[SOLVED] - Create and place icon in Gnome Applications menu
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
[SOLVED] - Create and place icon in Gnome Applications menu
I would like to create a .desktop file for a custom application, and I have figured out how to do that.
The way I did it was duplicate the icon for firewall-config.desktop; rename it, tweak the syntax internally and etcetera.
Once I have completed that process my icons are dropped into Applications > Other menu. I would like to control the placement of the icon.
How do I create another menu folder, and then place my custom icon in it?
I don't know what to google search, and I am not sure I am using the proper terms on this forum for that matter.
The way I did it was duplicate the icon for firewall-config.desktop; rename it, tweak the syntax internally and etcetera.
Once I have completed that process my icons are dropped into Applications > Other menu. I would like to control the placement of the icon.
How do I create another menu folder, and then place my custom icon in it?
I don't know what to google search, and I am not sure I am using the proper terms on this forum for that matter.
Last edited by warron.french on 2019/05/15 23:56:40, edited 3 times in total.
Thanks,
War
War
Re: Create and place icon in Gnome Applications menu
If I understand you correctly...
jamalm wrote:There are 3 locations you should be concerned with:
/usr/share/desktop-directories
/etc/xdg/menus/applications-merged
/usr/share/applications
Bear in mind the last location is system-wide specific, if you want it just for your user, use: ~/.local/share/applications
Firstly we:
Create a file called APPNAME.menu (substitute APPNAME for whatever you want to call it) in the folder location /etc/xdg/menus/applications-merged
Input these contents:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/me ... nu-1.0.dtd">
<Menu>
<Name>Applications</Name> <!-- This is necessary for your directory to appear in the applications drop down -->
<Menu> <!--app -->
<Name>app</Name>
<Directory>APPNAME.directory</Directory>
<Include>
<Category>APPNAME</Category>
</Include>
</Menu> <!-- End app -->
</Menu> <!-- End Applications -->
Save the file and create another file called APPNAME.directory in the folder location ( it should be the same name specified in the .menu file) /usr/share/desktop-directories with these contents:
[Desktop Entry]
Type=Directory
Name=AppName
Icon=/path/to/icon
Note the .directory filename should be exactly the same as the .directory name you entered in the .menu file above.
Create a standard .desktop file in ~/.local/share/applications or /usr/share/applications with these contents (substituting for your own program of course and the Categories=line MUST BE the same as the name you gave the .directory file eariler)
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/path/to/executable.sh
Name=ApplicationToRun
Icon=/path/to/icon
Categories=APPNAME
Comment=Comment for users
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
Re: Create and place icon in Gnome Applications menu
Jamalm, thanks for the info.
Can you please explain why this is three parts?
I can see why it would be two parts (icon, and where to place it), but I am confused on why the .desktop, .directory and .menu parts... even with this link - https://access.redhat.com/documentation ... plications
Your instructions made the process easier to understand.
Thank you,
Can you please explain why this is three parts?
I can see why it would be two parts (icon, and where to place it), but I am confused on why the .desktop, .directory and .menu parts... even with this link - https://access.redhat.com/documentation ... plications
Your instructions made the process easier to understand.
Thank you,
Thanks,
War
War
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
Re: Create and place icon in Gnome Applications menu
This worked for me:
/etc/xdg/menus/applications-merged/warron.menu
/usr/share/desktop-directories/warron.directory
/usr/share/applications/warron.desktop
This was enough for me to complete the test/modeling of what I wanted to do.
Thanks,
/etc/xdg/menus/applications-merged/warron.menu
Code: Select all
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/me ... nu-1.0.dtd">
<Menu>
<Name>Applications</Name> <!-- This is necessary for your directory to appear in the applications drop down -->
<Menu> <!--app -->
<Name>app</Name>
<Directory>warron.directory</Directory>
<Include>
<Category>warron</Category>
</Include>
</Menu> <!-- End app -->
</Menu> <!-- End Applications -->
Code: Select all
[Desktop Entry]
Name=warron
Comment=Warron Desktop programs
Icon=im-local-xmpp
Type=Directory
Code: Select all
[Desktop Entry]
Name=Warron Prog1
Comment=Firewall Configuration
Icon=im-local-xmpp
Categories=warron
# Translators: These are searchable keywords for the firewall configuration tool
Keywords=firewall;network;security;iptables;netfilter;
Exec=/usr/bin/firewall-config
Type=Application
StartupNotify=true
Terminal=false
X-Desktop-File-Install-Version=0.23
Thanks,
Thanks,
War
War
Re: Create and place icon in Gnome Applications menu
I did not particularly study this question, but somehow I searched for this information and added it to my bookmarks. But nevertheless, as I understand it .menu is a kind of link being created for the menu of the graphical shell that should be displayed. .directory is essentially a virtual menu folder where all application launch shortcuts will be placed when added, and .desktop itself is essentially a command to start a program. That is, the three links are obtained. Desktop refers to the menu directory ".directory", and in turn .directory refers to a new menu item in the .menu system. Although this is only my personal judgment, I can be mistaken.
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
Re: Create and place icon in Gnome Applications menu
Mikhail29,
I seem to be having a problem with reproducing the success of this process on RHEL7.
Is it supposed to be different on RHEL7? The process worked for me at home on CentOS-7.
Sorry, I need a little more help,
I seem to be having a problem with reproducing the success of this process on RHEL7.
Is it supposed to be different on RHEL7? The process worked for me at home on CentOS-7.
Sorry, I need a little more help,
Thanks,
War
War
Re: Create and place icon in Gnome Applications menu
AFAIK Gnome confirms to XDG:
https://specifications.freedesktop.org/ ... atest.html
(although what version of gnome and what version of xdg is respected may come into play).
https://specifications.freedesktop.org/ ... atest.html
(although what version of gnome and what version of xdg is respected may come into play).
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
Re: Create and place icon in Gnome Applications menu
All, thank you for the support. I made some minor mistake apparently, but got it fixed.
I don't remember precisely what it was, but it had something to do with capitalization matching, not just for the filename within the <Directory> tag.
I am all set, thanks!
My RPM work, and the delivery of these Gnome menu and icons has been completed.
Thank you for "teaching me to fish" instead of "feeding me."
I don't remember precisely what it was, but it had something to do with capitalization matching, not just for the filename within the <Directory> tag.
I am all set, thanks!
My RPM work, and the delivery of these Gnome menu and icons has been completed.
Thank you for "teaching me to fish" instead of "feeding me."
Thanks,
War
War
Re: [SOLVED] - Create and place icon in Gnome Applications menu
I like fishing .....
- warron.french
- Posts: 616
- Joined: 2014/03/27 20:21:58
Re: [SOLVED] - Create and place icon in Gnome Applications menu
Me, too, I have not done it in a long time though.
The reference to fishing was: "Feed a man, he eats for a day. Teach him to fish and he eats for life." That's where I was going with the fishing reference.
I don't know how well dispersed the expression is though.
The reference to fishing was: "Feed a man, he eats for a day. Teach him to fish and he eats for life." That's where I was going with the fishing reference.
I don't know how well dispersed the expression is though.
Thanks,
War
War