~~NOTOC~~
====== xfce4-genmon-plugin - Genmon ======
This plugin cyclically spawns the indicated script/program, captures its output (stdout) and displays the resulting string into the panel.
The string can also contain markup to displayed an formatted text, image/icon, a bar, a button, and a personalized tooltip.
* **[[#Usage|Usage]]**
* XML Tags
* Example Script
* **[[#Advanced Features|Advanced Features]]**
* Pango Text Markup Support
* Refreshing the plugin
* Enhanced Gtk3 CSS Styling Capabilities
* **[[#Screenshots|Screenshots]]**
* **[[#Latest Release|Latest Release]]**
* **[[#Source Code Repository|Source Code Repository]]**
* **[[#Reporting Bugs|Reporting Bugs]]**
===== Important Note about version 4.2.0 =====
In version 4.2.0, the backend settings have been migrated from rc files to xfconf. Individual plugin settings will not be automatically migrated to xfconf and each plugin will need to be manually re-configured. A script has been developed ([[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/blob/master/scripts/migrate_to_xfconf.sh]]) that can offer assistance for the migration.
===== Usage =====
If you want the plugin to display only text (original version), enter the command in the //Command// field of the //Properties// section of the plugin. Otherwise, xml tags are used to display content on the plugin.
**XML Tags**
If you want the plugin to display a personalized ''Text'', ''Image'', ''Icon'', ''Tooltip'' or ''Bar'', you should develop (or get) a script returning a XML string, and enter the path of this script in the //Command// field of the //Property// section of the plugin.
The XML tags which can be used:
* **Text to display**
* Displays the "Text to display" directly on the plugin.
* eg. ''echo "Hello World!"''
* Result: {{:panel-plugins:xfce4-genmon-plugin:txt.png?100|}}
* **The command to be executed when clicking on the text**
* If displaying text, this tag will allow for a program/script to be run when the text is clicked.
* eg. ''echo "File Managerthunar"''
* **Path to the image to display**
* Display an image on the plugin using the complete path and name to the image file.
* eg. ''echo "/usr/share/pixmaps/xfce4_xicon.png"''
* Result: {{:panel-plugins:xfce4-genmon-plugin:img.png?50|}}
* **The command to be executed when clicking on the image**
* If using an image, this tag will allow for a program/script to be run when the image is clicked.
* eg. ''echo "/usr/share/pixmaps/xfce4_xicon.pngxfce4-about"''
* **Themed icon to be displayed**
* Display an icon from the current icon theme using only the icon name.
* eg. ''echo "org.xfce.mousepad"''
* Result: {{:panel-plugins:xfce4-genmon-plugin:icon.png?50|}}
* Note: the tag allows the following functionality:
* image changes with the icon theme
* supports panel's 'Adjust Icon Size Automatically' functionality
* supports light/dark symbolic icon auto-colour changes
* **The command to be executed when clicking on the icon**
* If using an icon, this tag will allow for a program/script to run when the icon is clicked.
* eg. ''echo "org.xfce.mousepadmousepad"''
* **Tooltip text**
* Display specific content in a tooltip.
* eg. ''echo "My custom tooltip text"''
* Result: {{:panel-plugins:xfce4-genmon-plugin:tool.png?150|}}
* Note:
* To hide the tooltip bubble, use an empty tool tag, eg: ''echo ""''
* The tooltip will not display with a cycle of less than 0.5 (see: [[https://gitlab.gnome.org/GNOME/gtk/-/issues/826]])
* **Percentage to display in the bar**
* Display a value-based progress bar on the plugin.
* eg. ''echo "42"'' (this will show a progress bar at 42%)
* Result: {{:panel-plugins:xfce4-genmon-plugin:bar.png?50|}}
* **embedded CSS tweaks**
* This tag will allow the embedding of css tweaks directly into the plugin.
* eg. ''echo ".genmon_valuebutton { background-color:green; color: yellow; padding: 5px;}"''
* Result: {{:panel-plugins:xfce4-genmon-plugin:css.png?50|}}
* More information on css and css tweaking of the plugin in the **Advanced Features** section below.
If None of the tags are detected in the result of the command, the plugin reverts to its original behavior (displaying the result of the command).
**Example Script (system stats)**
Here is an example of a genmon plugin displaying basic system stats (cpu, memory, harddrive usage) using the , , and xml tags:
#!/bin/sh
ICON=utilities-system-monitor
PARTITION=sda2
# get CPU info
CPU=$(cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{printf("%02d", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5))}')
CPULOAD=$(uptime | tr -s " " | cut -d' ' -f9-)
TOPCPU=$(ps aux --no-headers | awk '{print $3 " " $11}' | sort -rn | head -n 5)
# get memory info
MEMTOT=$(cat /proc/meminfo | grep MemTotal | awk '{printf ("% 0.1f", $2/1024000)}')
MEMAVA=$(cat /proc/meminfo | grep MemAvailable | awk '{printf ("%0.1f", $2/1024000)}')
MEMUSAGE=$(free | grep Mem | awk '{printf("%02d", $3/$2 * 100.0)}')
MEMUSAGE2=$(echo "$MEMTOT GB in use")
MEMUSED=$(echo "scale=2;($MEMTOT - $MEMAVA)" | bc)
TOPMEM=$(ps aux --no-headers | awk '{print $4 " " $11}' | sort -rn | head -n 5)
# get hard drive usage info
HD=$(df -hl /dev/$PARTITION | grep $PARTITION | awk '{printf ("%02d", $5)}' | sed -e 's/%//')
HDUSED=$(df -hl /dev/$PARTITION | grep $PARTITION | awk '{print $3}' | sed -e 's/G//')
HDSIZE=$(df -hl /dev/$PARTITION | grep $PARTITION | awk '{print $2}' | sed -e 's/G//')
TOPHD=$(df -hl /dev/$PARTITION | tail -1)
# do the genmon
echo "$ICONxfce4-taskmanager"
echo " $CPU | $MEMUSAGE | $HD xfce4-taskmanager"
echo "-=CPU $CPULOAD=-
$TOPCPU
-=MEM: $MEMUSED of $MEMUSAGE2=-
$TOPMEM
-=HD usage: $HDUSED of $HDSIZE GB in use=-
$TOPHD"
exit 0
{{:panel-plugins:xfce4-genmon-plugin:syststats.png?300|}}
More scripts are available at: [[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/tree/master/scripts]].
Additional genmon scripts can be found in the following online repositories (special thanks to the individual developers for creating them):
* [[https://github.com/xtonousou/xfce4-genmon-scripts]]
* [[https://github.com/almaceleste/xfce4-genmon-scripts]]
* [[https://github.com/levimake/xfce4-genmon-panel-scripts]]
* [[https://codeberg.org/jn/genmon-scripts]]
[[|Back To Top]]
----
===== Advanced Features =====
**Pango Text Markup Support**
Both the and tags support Pango Markups. See: [[https://docs.gtk.org/Pango/pango_markup.html]]. With Pango markups, you can change text attributes like font colour, weight, size, etc, in your output string. To do so, use the (or any convenience) tag within the or tags. For example, to display the output in bold red and italic, you could use something like:
echo "Test"
Result: {{:panel-plugins:xfce4-genmon-plugin:pango.png?50|}}
Refer to the previous link for information on all of the properties that can be set.
**Refreshing the plugin**
As of version 3.99, the xfce4-genmon-plugin supports xfce4-panel plugin-event functionality to remotely force the plugin to refresh. To refresh the plugin, issue the command:
xfce4-panel --plugin-event=genmon-X:refresh:bool:true
where "genmon-X" is the widget name of the particular genmon instance. To get this name, go to the panel properties screen and on the Items tab, hover your mouse over the genmon plugin to get it's internal name.
As of version 4.2.0, an "Update Now" menu item was added to the plugin right-click menu to immediately update the plugin (this does not reset the timer):
{{:panel-plugins:xfce4-genmon-plugin:updatenowmenu.png?150|}}
**Enhanced Gtk3 CSS Styling Capabilities**
As of version 4.0.1, CSS styling capabilities have been enhanced by providing style classes for all elements of the plugin that can be styled via themes or individual overrides (~/.config/gtk-3.0/gtk.css). For more information, see: [[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/blob/master/CSS%20Styling.txt]].
And as of version 4.2.0, this plugin also supports CSS tags (special thanks to @stergem) that allow you to tweak the plugin css directly from within the command/script using tags. For example:
#!/bin/bash
# set Label = Hello
echo "There"
echo "mousepad"
echo ".genmon_valuebutton {background-color:red; color:yellow} .genmon_label {color:green}"
echo "Hello there"
Result: {{:panel-plugins:xfce4-genmon-plugin:hellothere.png?90|}}
[[|Back To Top]]
----
===== Screenshots =====
Configuration/Properties screen:
{{:panel-plugins:xfce4-genmon-plugin:genmon-config.png?300|}}
About screen:
{{:panel-plugins:xfce4-genmon-plugin:genmon-about.png?350|}}
[[|Back To Top]]
----
===== Latest Release =====
{{rss>https://archive.xfce.org/feeds/project/xfce4-genmon-plugin 1 date 2h}}
[[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/blob/master/NEWS|Read the CHANGELOG]]
* **[[https://archive.xfce.org/src/panel-plugins/xfce4-genmon-plugin/|Download current release]]** (link also contains older versions)
[[|Back to Top]]
----
===== Source code repository =====
[[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin]]
----
===== Reporting Bugs =====
* **[[:panel-plugins:xfce4-genmon-plugin:bugs|Reporting Bugs]]** -- Open bug reports and how to report new bugs
[[|Back To Top]]
----
[[ :xfce:xfce4-panel:start:|Return to Main Xfce4-panel page]]