zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.87k stars 1.17k forks source link

Install as application #2816

Open KronosTheLate opened 1 year ago

KronosTheLate commented 1 year ago

It would be sweet it micro would install itself as an application to allow directly opening micro from the start menu, and to make it selectable as the default application to edit text files. This happened automatically with neovim.

I can be done manually by creating /usr/share/applications/Micro.desktop, and placing the following text (where I used vim as template) in it:

# The vim.desktop file is generated by src/po/Makefile, do NOT edit.
# Edit the src/po/vim.desktop.in file instead.

[Desktop Entry]
# Translators: This is the Application Name used in the Vim desktop file
Name=Micro
# Translators: This is the Generic Application Name used in the Vim desktop file
GenericName=Text Editor
# Translators: This is the comment used in the Vim desktop file
Comment=A modern and intuitive terminal-based text editor
# The translations should come from the po file. Leave them here for now, they will
# be overwritten by the po file when generating the desktop.file.
TryExec=micro
Exec=micro %F
Terminal=true
Type=Application
# Translators: Search terms to find this application. Do NOT change the semicolons! The list MUST also end with a semicolon!
Keywords=Text;editor;
# Translators: This is the Icon file name. Do NOT translate
Icon=/home/my_username/MyPrograms/micro-logo-mark.svg   # Where I downloaded the logo 
Categories=Utility;TextEditor;
StartupNotify=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Name[en_US]=Micro

The result is as follows: image

I can now make Micro the default app for opening the file-types I wish.

JohnVeness commented 1 year ago

Note there's already a micro.desktop file included in the source assets/packaging directory. I guess it's up to whoever makes packages to install this file (and the man file found in the same directory).