I want to run the script temp-throttle (https://github.com/Sepero/temp-throttle) at startup and show a custom Plank icon.
The script will throttle CPU frequency at 79 celsius if run like so
sudo ./temp_throttle.sh 79
As it needs the temperature to be specified as above after cd
in the path of the script, a second script is needed.
#!/bin/bash
cd "path-to-the-folder//temp-throttle-stable"
terminator -e 'sudo ./temp_throttle.sh 79' --geometry=300x80 -p hold
I have called that temp-throttle
and put it in $HOME/bin
, as indicated here.
In order to have some info on the situation, I have integrated the command in a terminal command and added -p hold
that sets a terminal profile to keep terminal window open.
If I add that script to startup applications list, the icon used in Plank is that of the terminal.
I would like it to run at startup and show in Plank my custom "temp.png" icon
For that, I have created the file ~/.local/share/applications/temp-throttle.desktop
with the following lines:
[Desktop Entry]
Type=Application
Name=temp-throttle
Icon=temp
Categories=System;Monitor;
Exec=temp-throtle
Executing that directly (double-click) it shows the terminal icon in Plank.
I can make the dock use the custom "temp" icon by executing the .desktop
file from the applications search&launch tool (e.g. Slingshot) or with the command gtk-launch temp-throttle
(as suggested here).
After that, the custom Plank icon can of course be pinned to the dock (right-click, "Keep in Dock"). That creates the file /home/cipeos/.config/plank/dock1/launchers/temp-throttle.dockitem
with the lines
[PlankDockItemPreferences]
Launcher=file:///home/cipeos/.local/share/applications/temp-throttle.desktop
as suggested in the pauljohn32's answer. He also seems to suggest in a comment that the important thing here is to have the exact same names for all files involved: all my file are called temp-throttle
.
The problem is how to run a .desktop
file at startup: if I simply add the desktop file at startup it will not run at all. If I add the startup command gtk-launch temp-throttle.desktop
it will still use the terminator icon.
This question is close to this: Apply icons to bash scripts, but different, as the answers under that (use a .desktop
file) will not work if the command/script/desktop-file is run at startup.
It seems that at startup the final command/script is run without taking into account the Icon=
line in the .desktop
file, no matter the method used to run the .desktop
launcher.
I have tested many answers under this question (Running a .desktop file in the terminal) but they will not keep the icon specified in the .desktop
file if that is run at startup.
THIS answer provides a solution for Unity, but it doesn't work as such for Plank.
gnome-session-properties
. But will use any other method if it would amount to an answer. – Feb 13 '17 at 12:10showicon
script as it seems to be what I want, but it doesn't work for me at the moment. I still get the terminal icon . --- Is your answer under the other question Unity-specific? I need it to work with Plank. – Feb 13 '17 at 13:47.dockitem
method allows to pin.desktop
file to Plank, the custom icon will only be used when run from the dock. Terminal icon will always be used when run otherwise i.e. application menu, launcher and startup. – Feb 26 '17 at 08:26