Execute multiple shell commands periodically with separate intervals and display the output in gnome top bar.
-
Download the file
[email protected]
from the latest release and extract the content to~/.local/share/gnome-shell/extensions/[email protected]
. -
OR checkout the repo to
~/.local/share/gnome-shell/extensions/[email protected]
.git clone https://github.com/raujonas/executor.git ~/.local/share/gnome-shell/extensions/[email protected]/
With both options you have to restart gnome shell afterwards (Alt + F2
and then enter r
).
The commands and the interval for each command can be set for each location (left, center, right) separately in the settings view.
It is possible to use custom css to style the output of your commands dynamically. There are two ways to do this:
-
Preferred option: Create the file
~/.config/[email protected]/custom.css
and add your custom css there. This file will be imported into the extension. This way your custom css will NOT be overwritten by extension updates. You can use the following commands to create the file:mkdir /home/$USER/.config/[email protected] touch /home/$USER/.config/[email protected]/custom.css
-
Non durable option: You can add your custom css in
~/.local/share/gnome-shell/extensions/[email protected]/custom.css
. Your custom css will be overwritten by extension updates in this case. Make sure to save it somewhere before updating.
Example custom.css
file:
.red {
color: red;
}
.yellow {
color: yellow
}
.green {
color: rgb(107, 179, 0);
}
.huge-font {
font: 20px "Comic Sans";
}
.italic {
font: 17px "Arial";
font-style: italic;
}
Note: After making changes in your css you have to restart your shell (Alt + F2
and then enter r
).
Usage: To use the css classes dynamically in your commands, you can add it with the following syntax to your output: <executor.css.red>
. This will add the specified css class to your output, in this case red
.
Example: The following command queries the current timestamp. If the output is a round number it should have the color red, if not then green.
date +%s | awk '{if ($1 % 2 == 0) {print $1"<executor.css.red>"} else { print $1"<executor.css.green>"} }'
The output is either one of the following depending on the timestamp:
You can also combine multiple css classes:
Usage: To use markup there's another setting <executor.markup.true>
which has to be included somewhere in the output to activate markup.
Example: The following command is an example for using markup with different colors and some italic text, all inside one command. You can find other attributes like font_family
or size
here.
echo "<executor.markup.true> <span foreground='blue'>Blue text</span> is <i>cool</i>! <span foreground='red'>Red text</span> is cool too"
This produces the following output:
Note: Due to a bug in ClutterText there is an empty space in front of the first <span>
tag required
Combination of css and markup is also possible. In this case the setting for markup <executor.markup.true>
must be located after all css settings. Here is an example:
echo " <span font_family='monospace' foreground='blue'>Blue text</span> is <i>cool</i>! <span foreground='red'>Red text</span><executor.css.green><executor.markup.true> is cool too"
This produces the following output:
If you want to execute more complex scripts it might be helpful to store them outside of the extension and create the final output there.
Here is a very good example of how you can achieve this. With this solution it is also possible to create a rotating output of multiple different commands.
If you want to export and import all settings at once you can use dconf.
Export: dconf dump /org/gnome/shell/extensions/executor/ > executor-settings.dconf
Import: dconf load /org/gnome/shell/extensions/executor/ < executor-settings.dconf
Let me know what your use cases are and I will add them here.
I for example use this extension for hardware monitoring:
If you have no output or other issues you can have a look into the log:
journalctl /usr/bin/gnome-shell -f
Please feel free to contribute and suggest ideas or report bugs!
You can add translation for the language of your choice by editing the example.pot with a program like Poedit. Then you can submit your *.po and *.mo file inside the po/ folder.