Skip to content

fix: :config_edit open editor not video player#269

Draft
suveshmoza wants to merge 3 commits intoglide-browser:mainfrom
suveshmoza:fix/config-edit-opening-video-player
Draft

fix: :config_edit open editor not video player#269
suveshmoza wants to merge 3 commits intoglide-browser:mainfrom
suveshmoza:fix/config-edit-opening-video-player

Conversation

@suveshmoza
Copy link
Copy Markdown
Contributor

Closes #228
Test on

  • macOS
  • Linux
  • Windows

const mime_info = mime_service.getFromTypeAndExtension("text/plain", "");
mime_info.preferredAction = Ci.nsIHandlerInfo.useSystemDefault;
mime_info.launchWithFile(file);
} catch {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: did you run into any errors while testing this or is this just defensive?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being defensive here. I didn’t run into any errors during testing, but added in case it throws.

function launch_as_text(file: nsIFile): void {
try {
const mime_service = Cc["@mozilla.org/mime;1"]!.getService(Ci.nsIMIMEService);
const mime_info = mime_service.getFromTypeAndExtension("text/plain", "");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know at least on macOS you can register different editors for different kinds of text files... so I suspect we'll have to try a more specific mime type first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found the full list of MIME types https://www.iana.org/assignments/media-types/media-types.xhtml
. I think the javascript/ecmascript mime type should do the work

@RobertCraigie
Copy link
Copy Markdown
Member

Okay I think we don't need to worry about windows really. It seems like they only support setting default applications per file extension, and if one isn't explicitly set then it prompts you to choose an application.

The only failure case then is if someone has already set a media player as the default for .ts files, but that seems unavoidable?

@suveshmoza suveshmoza force-pushed the fix/config-edit-opening-video-player branch from 7209d74 to d03974f Compare March 8, 2026 13:56
@suveshmoza
Copy link
Copy Markdown
Contributor Author

Okay I think we don't need to worry about windows really. It seems like they only support setting default applications per file extension, and if one isn't explicitly set then it prompts you to choose an application.

The only failure case then is if someone has already set a media player as the default for .ts files, but that seems unavoidable?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix :config_edit opening video players

2 participants