dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

[FEATURE] Ability to Choose Default Text Editor

Open codeRSH opened this issue 1 month ago • 6 comments

Is your feature request related to a problem? Please describe.

I am not a fan of Gnome Editor. But it seems ML4W OS updater installs it as a dependency even if I removed it previous time.

Describe the solution you'd like

I would like an ability to choose the default editor (like the options given below).

Image

Also, if any default editor is already set (probably by checking mimetype) then another editor shouldn't be installed.

Describe alternatives you've considered

I have tried to update the default editor using config files but couldn't find an easy way to do it.

Additional context

No response

Support or Contribution

codeRSH avatar Oct 08 '26 06:10 codeRSH

@codeRSH - I raised #1870 to correct instances in the Sidebar and Welcome app where Gnome Editor were being called explicitly as opposed to using the preference stored in ~/.config/ml4w/settings/editor.sh. If/when this change gets committed, you could edit editor.sh to something like kitty $EDITOR "$@" to have the edit occur in your default terminal text editor.

What the PR does not address, though, is the following:

  • How migration.sh might be invoked on updates to overwrite editor.sh with gnome-text-editor (thereby erasing the setting)
  • How to handle creating an entry for text editor in the Default Apps section since it could get complex trying to handle nested preferences (e.g. using the value from Default Terminal to use for opening nano vs. typing the terminal command).

I'd like @mylinuxforwork if he has any ideas regarding what might make sense for a field like this.

hurlbutt avatar Oct 11 '26 21:10 hurlbutt

@hurlbutt Thanks for your effort. Having an option in the Default Apps section would be consistent and easier for a layman to configure. However if that's complex then having an editor.sh file to configure is also good enough provided it's not overwritten with every release.

Hope @mylinuxforwork will have a look into this.

codeRSH avatar Oct 16 '26 04:10 codeRSH

@codeRSH @hurlbutt Thanks for bringing this up.

The challenge is that I need to add an editor as a dependency because after a fresh installer, some settings, like keyboard, require a text editor. And visually, the gnome-text-editor fits best to the general look and feel.

I am currently thinking on a new way to configure ML4W OS. The idea is the introduction of a .config/ml4w-os/hyprland.json to configure default programs and other settings. The settings app can then overwrite values in this file.

What do you think?

mylinuxforwork avatar Oct 16 '26 17:10 mylinuxforwork

@hurlbutt Just merged your PR into the Rolling Release. Can you test?

mylinuxforwork avatar Oct 16 '26 17:10 mylinuxforwork

@mylinuxforwork - I tested the changes locally before submitting, and I can confirm that they work as intended.

Regarding using JSON to specify settings, it's less the where and more the how. For the other default apps, they a) are GUI apps and b) don't depend on other settings/configs. For the text editor, however, if I want to rely on a terminal app (e.g. emacs, vim), then the configuration can become tricky:

  • Ideally you wouldn't need to specify which terminal app should be used since that is already a setting
  • You may want to just rely on the $EDITOR environment variable rather than specify the terminal-based text editor (and you may not know if it's been set or not)

I can see a text field working fine for a GUI app, but it might become awkward for a user to try to configure a terminal command in the same text field. One potential solution could be to have a toggle/dropdown to specify whether to use a GUI app or a terminal app, and if terminal is selected then the user is informed that it will use the preferred terminal to open the app specified by $EDITOR. The GUI selection would reveal the text field with the name of the app to invoke. It might not be the cleanest UX solution, but it might be a fine compromise between making the interactions straightforward while still allowing for flexibility.

hurlbutt avatar Oct 18 '26 05:10 hurlbutt

Thanks for your feedback.

mylinuxforwork avatar Oct 19 '26 15:10 mylinuxforwork