Skip to content

Commit

Permalink
Fix getting default browser on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 27, 2023
1 parent 8a3e108 commit af9a62f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ export default async function defaultBrowser() {

if (process.platform === 'linux') {
const {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);
const name = titleize(stdout.trim().replace(/.desktop$/, '').replace('-', ' '));

return {
name,
id: stdout,
};
const id = stdout.trim();
const name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));
return {name, id};
}

if (process.platform === 'win32') {
Expand Down

0 comments on commit af9a62f

Please sign in to comment.