I think i am getting close to finding some good methods. I just have one question for now: are you on Mint
Cinnamon, Mate, or Xfce? It looks like you are on Mate but i just want to make sure...
I am on Cinnamon... Things could be a bit different from one flavour to another.
I should wait, I'm here in the middle of the night. I will complete this work later, more neatly. But here's a quick summary of my adventures so far...
I created this one line script and saved it in /usr/local/bin/switch-icon:
Code: Select all
#!/bin/bash
aplay /usr/share/sounds/linuxmint-login.wav
Then i went into right-click on Menu > Configure > Menu tab >
Open the menu editor.
Using this Menu editor, i clicked on
New Item and added my /usr/local/bin/switch-icon command named Switch-icon in the Accessories sub-menu.
Then, i did a right-click from the Menu > Accessories >
Switch-icon to add my new launcher to the Panel.
So now, i have a launcher in the Panel, and when i click on it, it plays a test script, just a login sound for now.
Next, i go back to the
Menu editor, select my Switch-icon, click on
Properties, click on the icon, and change it to "network-vpn-symbolic" icon. And while being in this search and select window, i looked at all the other network icons, and i saw there was also a "network-wired-symbolic", among many others. So, for this little experiment, i want to find a way to switch instantly from "network-wired-symbolic" icon to "network-vpn-symbolic" icon. Back and forth.
Still in the Menu editor with Switch-icon selected, i clicked on
Edit Desktop File. It opened this:
Code: Select all
[Desktop Entry]
Name=Switch-icon
Exec=/usr/local/bin/switch-icon
Comment=Switch icon and play sound (test)
Terminal=false
Icon=network-vpn-symbolic
Type=Application
So that’s where the Icon is set. Each time i change the launcher icon from the Properties in the Menu editor, this file gets updated. This file is located there: ~/.local/share/applications/alacarte-made-df13e28a-89fb-11eb-a96c-8ba96b586f54.desktop
But i wonder if there is another copy of this file somewhere else, for the panel? When i right-click the launcher in the Menu Accessories to Add to desktop, it does create a duplicate of this launcher-filename.desktop on the ~/Desktop. But the only thing i could find relevant for the panel is this ~/.cinnamon/configs/
grouped-window-list@cinnamon.org/*.json The launcher-filename.desktop is listed in there when pinned from the Menu. Anyway, whether in the Menu, on the Desktop or pinned in the panel's Grouped window list, the true filename for this launcher always starts with "alacarte-made". So i just did a quick "Search for Files" in Nemo and only found 2 copies: one in ~/.local/share/applications/ and the other in ~/Desktop.
More frustrating, when i update the
Icon=iconname
by a direct edit in this launcher-filename.desktop, the Menu icon gets updated instantly, as well as the Desktop icon, but not the Panel icon. But, as soon as i close the Menu editor, then the Panel gets updated. So i wonder what is happening under the hood when i close this Menu editor.
Searching the web, i found someone had to rename twice /home/user/.cinnamon/configs/
panel-launchers@cinnamon.org/*.json to refresh the panel. So, I came up with a better solution:
Code: Select all
touch ~/.cinnamon/configs/grouped-window-list@cinnamon.org/*.json
does the job. So this way, i can edit the ~/.local/share/applications/launcher-filename.desktop, then do this
touch
, and the Panel icon gets changed!
This little experiment is not done yet, still to come:
- I should try these things on Mate, maybe, on my little Netbook...
- I want this launcher-filename.desktop to be changed from the script, using some
sed
command. So, you click on the small icon in the Panel, you hear a login sound and the icon is changed to network-vpn-symbolic. Click again, and you hear a logout and the icon gets changed to network-wired-symbolic. Creating some sort of toggle switch. I guess all i need is a combination of sed
, if
/ else
, and touch
commands...