Page 2 of 2

Re: "Scripts" option with right click

Posted: Sat Jul 04, 2009 2:59 am
by PCMan
1. Run update-desktop-database ~/.local/share/applications after you did the edit.
2. Add NoDisplay=true, and it won't be shown in applications menu.

Re: "Scripts" option with right click

Posted: Tue Jan 18, 2011 8:44 am
by Roland
Sorry for raising old topic, but user scripts are still not implemented, so need to use this way.

I'm trying to create a context menu "Send email", using *.desktop file.
But have a trouble, what default Mimetype i have to use for all files (mean that associate desktop with every file)?

Re: "Scripts" option with right click

Posted: Fri May 25, 2012 10:29 am
by gymka
Roland wrote:Sorry for raising old topic, but user scripts are still not implemented, so need to use this way.

I'm trying to create a context menu "Send email", using *.desktop file.
But have a trouble, what default Mimetype i have to use for all files (mean that associate desktop with every file)?
in folder ~/.local/share/applications create your .desktop file, in my case i created two desktop files "test.desktop" and "test2.desktop". run

Code: Select all

cp ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeapps.list_backup
cat /etc/mime.types |sed 's/\(.*\)\t.*/\1/g'|sed 's/\t//g'| tr "\\n"";"|sed 's/;/=test.desktop;test2.desktop\n/g'>>~/.local/share/applications/mimeapps.list'
now in all files context menu there is buttons from test.desktop and from test2.desktop. simple:)

P.S. 1. afaik /etc/mime.types is created with tool "mime-types", maybe in other distros there is no such file, but in archlinux there is:)
2. my /etc/mime.types file had comments, so before executing script i manually removed these comments.
3. personally I needed context menu button for all files and only for images, so run script like above and then executed another:

Code: Select all

sed -i 's/\(image\/.*\)/\1test3_only_for_images.desktop;/g' ~/.local/share/applicatons/mimeapps.list
and it added context menu button only to images:)