Both sides previous revisionPrevious revisionNext revision | Previous revision |
panel-plugins:xfce4-genmon-plugin:start [2019/11/11 11:47] – re-organized section layout added TOC kevinbowen | panel-plugins:xfce4-genmon-plugin:start [2025/01/03 04:17] (current) – update screenshot kevinbowen |
---|
====== Genmon ====== | ~~NOTOC~~ |
| ====== xfce4-genmon-plugin - Generic Monitor Plugin ====== |
This plugin cyclically spawns the indicated script/program, captures its output (stdout) and displays the resulting string into the panel. | 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. |
| |
The string can also contain markup to displayed an image, a bar, a button and a personalized tooltip. | * **[[#Screenshots|Screenshots]]** |
| * **[[#Usage|Usage]]** |
| * XML Tags |
| * Example Script |
| * **[[#Advanced Features|Advanced Features]]** |
| * Pango Text Markup Support |
| * Refreshing the plugin |
| * Enhanced Gtk3 CSS Styling Capabilities |
| * **[[#Latest Release|Latest Release]]** |
| * **[[#Source Code Repository|Source Code Repository]]** |
| * **[[#Reporting Bugs|Reporting Bugs]]** |
| |
* **[[start#Screenshots|Screenshots]]** | |
* **[[start#Latest Release|Latest Release]]** | |
* **[[start#Reporting Bugs|Reporting Bugs]]** | |
| |
| |
===== Usage ===== | ===== Important Note about version 4.2.0 ===== |
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. | |
| |
**XML Tags** | <note important>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. </note> |
| |
If you want the plugin to display a personalized ''Image'' or ''Tooltip'' or ''Bar'' or ''Button'', 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: | ===== Screenshots ===== |
* ''<txt>Text to display</txt>'' | |
* ''<img>Path to the image to display</img>'' | |
* ''<tool>Tooltip text</tool>'' | |
* ''<bar>Pourcentage to display in the bar</bar>'' | |
* ''<click>The command to be executed when clicking on the image</click>'' | |
* ''<txtclick>The command to be executed when clicking on the text</txtclick>'' | |
| |
If None of the tags are detected in the result of the command, the plugin returns to its original behaviour (displaying the result of the command). | <figure "Genmon Configuration/Properties Dialog Window"> |
| {{:panel-plugins:xfce4-genmon-plugin-properties.png|Genmon Configuration/Properties Dialog Window}} |
| </figure> |
| |
**Example Script** | [[|Back To Top]] |
| ---- |
| |
Here's a simple example of a plugin displaying the Temp of the CPU in the panel | ===== Usage ===== |
(with an icon) and the Freq in a Tooltip: | |
| |
#!/bin/bash | |
echo "<img>/usr/share/icons/Bluecurve/16x16/apps/gnome-monitor.png</img>" | |
declare -i cpuFreq | |
cpuFreq=$(cat /proc/cpuinfo | grep "cpu MHz" | sed 's/\ \ */ /g' | cut -f3 -d" " | cut -f1 -d".") | |
if [ $cpuFreq -ge 1000 ] | |
then | |
cpu=$(echo $cpuFreq | cut -c1).$(echo $cpuFreq | cut -c2)GHz | |
else | |
cpu=${cpuFreq}MHz | |
fi | |
echo "<txt>"$(cat /proc/acpi/thermal_zone/THM/temperature | sed 's/\ \ */ /g' | cut -f2 -d" ")" C</txt>" | |
echo "<tool>Freq: "$cpu"</tool>" | |
| |
PS: Depending on your configuration, you should change the image path. | - [[:xfce:xfce4-panel:add-new-items|Add the plugin to the panel]]. |
| - Right-click on the added plugin, select **Properties** to open the settings window. |
| |
More scripts are available at: [[http://git.xfce.org/panel-plugins/xfce4-genmon-plugin/tree/scripts]]. | 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. |
| |
**Pango Markups in the <txt> tag** | **XML Tags** |
| |
Both the <txt> and <tool> tags support Pango Markups. See: [[https://developer.gnome.org/pango/stable/PangoMarkupFormat.html]]. With Pango markups, you can change text attributes like font colour, weight, size, etc, in your output string. To do so, use the <span></span> tag within the <txt></txt> or <tool></tool> tags. For example, to display the output in bold red, you could use something like: | 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. |
| |
echo "<txt><span weight='Bold' fgcolor='Red'>Test</span></txt>" | The XML tags which can be used: |
| * **<txt>Text to display</txt>** |
| * Displays the "Text to display" directly on the plugin. |
| * eg. ''echo "<txt>Hello World!</txt>"'' |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:txt.png?100|Genmon Display Text Example}} |
| * **<txtclick>The command to be executed when clicking on the text</txtclick>** |
| * If displaying text, this tag will allow for a program/script to be run when the text is clicked. |
| * eg. ''echo "<txt>File Manager</txt><txtclick>thunar</txtclick>"'' |
| * **<img>Path to the image to display</img>** |
| * Display an image on the plugin using the complete path and name to the image file. |
| * eg. ''echo "<img>/usr/share/pixmaps/xfce4_xicon.png</img>"'' |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:img.png?50|Genmon Display Image with Full Path Example}} |
| * **<click>The command to be executed when clicking on the image</click>** |
| * If using an image, this tag will allow for a program/script to be run when the image is clicked. |
| * eg. ''echo "<img>/usr/share/pixmaps/xfce4_xicon.png</img><click>xfce4-about</click>"'' |
| * **<icon>Themed icon to be displayed</icon>** |
| * Display an icon from the current icon theme using only the icon name. |
| * eg. ''echo "<icon>org.xfce.mousepad</icon>"'' |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:icon.png?50|Genmon Display Themed Icon Example}} |
| * Note: the <icon> 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 |
| * **<iconclick>The command to be executed when clicking on the icon</click>** |
| * If using an icon, this tag will allow for a program/script to run when the icon is clicked. |
| * eg. ''echo "<icon>org.xfce.mousepad</icon><iconclick>mousepad</iconclick>"'' |
| * **<tool>Tooltip text</tool>** |
| * Display specific content in a tooltip. |
| * eg. ''echo "<tool>My custom tooltip text</tool>"'' |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:tool.png?150|Genmon Tooltip Text Display Example}} |
| * Note: |
| * To hide the tooltip bubble, use an empty tool tag, eg: ''echo "<tool></tool>"'' |
| * The tooltip will not display with a cycle of less than 0.5 (see: [[https://gitlab.gnome.org/GNOME/gtk/-/issues/826]]) |
| * **<bar>Percentage to display in the bar</bar>** |
| * Display a value-based progress bar on the plugin. |
| * eg. ''echo "<bar>42</bar>"'' (this will show a progress bar at 42%) |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:bar.png?50|Genmon Percentage Bar Display Example}} |
| * **<css>embedded CSS tweaks</css>** |
| * This tag will allow the embedding of css tweaks directly into the plugin. |
| * eg. ''echo "<css>.genmon_valuebutton { background-color:green; color: yellow; padding: 5px;}</css>"'' |
| * Result: \\ {{:panel-plugins:xfce4-genmon-plugin:css.png?50|Genmon Embedded CSS Example}} |
| * More information on css and css tweaking of the plugin in the **Advanced Features** section below. |
| |
Refer to the previous link for information on all of the properties that can be set. | 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). |
| |
**Refreshing the plugin** | **Example Script (system stats)** |
| |
The xfce4-genmon-plugin now supports xfce4-panel plugin-event functionality. Currently it only supports the "refresh" action which resets the timer and causes the associated command to execute again. You can use this command remotely or at the end of a script to force the panel plugin to refresh. | Here is an example of a genmon plugin displaying basic system stats (cpu, memory, harddrive usage) using the <icon>, <txt>, <txtclick> and <tool> xml tags: |
| <file sh systemstats.sh> |
| #!/bin/sh |
| |
To refresh the plugin, issue the command: | ICON=utilities-system-monitor |
| PARTITION=sda2 |
| |
xfce4-panel --plugin-event=genmon-X:refresh:bool:true | # get CPU info |
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. | 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) |
| |
**Enhanced Gtk3 CSS Styling Capabilities** | # 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) |
| |
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://git.xfce.org/panel-plugins/xfce4-genmon-plugin/tree/CSS%20Styling.txt]]. | # do the genmon |
| echo "<icon>$ICON</icon><iconclick>xfce4-taskmanager</iconclick>" |
| echo "<txt> $CPU | $MEMUSAGE | $HD </txt><txtclick>xfce4-taskmanager</txtclick>" |
| echo "<tool>-=CPU $CPULOAD=- |
| $TOPCPU |
| |
//**(*dev-only)**// functionality is currently only available in the git tree and has not yet been officially released | -=MEM: $MEMUSED of $MEMUSAGE2=- |
| $TOPMEM |
| |
[[|Back To Top]] | -=HD usage: $HDUSED of $HDSIZE GB in use=- |
---- | $TOPHD</tool>" |
| |
===== Screenshots ===== | exit 0 |
{{:panel-plugins:xfce4-genmon-plugin.png|:panel-plugins:xfce4-genmon-plugin.png}} | </file> |
| |
In this example, the plugin is used to (from left to right): | <figure "Genmon syststats.sh Script Example"> |
- display the date | {{:panel-plugins:xfce4-genmon-plugin:syststats.png?300|Genmon syststats.sh Script Example}} |
- mount/unmount an USB disk with 1 click | </figure> |
- display the CPU temperature (and the frequency in the tooltip) | |
- display the HD temperature | |
- display the state of the 2 batteries of my laptop | |
- display the WIFI quality | |
| |
| <note>More scripts are available at: [[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/tree/master/scripts]].</note> |
| |
| 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]] |
| |
{{:panel-plugins:gmail.png|:panel-plugins:gmail.png}} | |
| |
In this example, we see the gmail checker script in action: | [[|Back To Top]] |
- plugin display shows icon indicating state of new emails available | ---- |
- tooltip shows number of new messages, sender/subject of new messages, and timestamp of last check | |
- clicking on the icon launches your email program | |
| |
| ===== Advanced Features ===== |
| **Pango Text Markup Support** |
| |
| Both the <txt> and <tool> 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 <span></span> (or any convenience) tag within the <txt></txt> or <tool></tool> tags. For example, to display the output in bold red and italic, you could use something like: |
| |
{{:panel-plugins:sysstat.png|:panel-plugins:sysstat.png}} | echo "<txt><span weight='Bold' fgcolor='Red'><i>Test</i></span></txt>" |
| |
| Result: |
| |
In this example, we see the sysstat script in action: | <figure "Genmon Pango Markup Support Example"> |
- plugin display shows optional icon and 3 readings (cpu, memory, hard drive usage) | {{:panel-plugins:xfce4-genmon-plugin:pango.png?50|Genmon Pango Markup Support Example}} |
- tooltip shows top 5 cpu and memory uses and hard drive space usage | </figure> |
- clicking on the text output launches xfce4-taskmanager (//ver. 3.99 or greater//) | |
| |
| Refer to the previous link for information on all of the properties that can be set. |
| |
| **Refreshing the plugin** |
| |
{{:panel-plugins:googcal.png|:panel-plugins:googcal.png}} | 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: |
| |
In this example, we see the google calendar checker script in action: | xfce4-panel --plugin-event=genmon-X:refresh:bool:true |
- plugin display shows icon indicating state of new upcoming appointments | 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. |
- tooltip shows a listing of upcoming appointments | |
- clicking on the icon opens google calendar in your browser | |
| |
| 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): |
| |
| <figure "Genmon 'Update Now' Menu Item"> |
| {{:panel-plugins:xfce4-genmon-plugin:updatenowmenu.png|Genmon 'Update Now' Menu Item}} |
| </figure> |
| |
{{:panel-plugins:twit0.png|:panel-plugins:twit0.png}} | **Enhanced Gtk3 CSS Styling Capabilities** |
{{:panel-plugins:twit1.png|:panel-plugins:twit1.png}} | |
| 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 <css></css> tags. For example: |
| <file genmonTest.sh> |
| #!/bin/bash |
| # set Label = Hello |
| echo "<txt>There</txt>" |
| echo "<txtclick>mousepad</txtclick>" |
| echo "<css>.genmon_valuebutton {background-color:red; color:yellow} .genmon_label {color:green}</css>" |
| echo "<tool>Hello there</tool>" |
| </file> |
| |
In this example, we see the twit (Twitter Timeline Notifier) script in action: | Result: \\ {{:panel-plugins:xfce4-genmon-plugin:hellothere.png?90|Genmon Enhanced Gtk3 CSS Styling Capabilities Example}} |
- plugin display shows icon indicating state of new tweets in your timeline | |
- libnotify notifications will be sent with new tweets | |
- tool tip will show new and optionally recent tweets | |
- clicking on the plugin icon can either execute a program, display a yad dialog with all recent tweets (above image), or compose and send a tweet. | |
| |
Most of the scripts are available in the plugin archive. | |
| |
[[|Back To Top]] | [[|Back To Top]] |
| |
===== Latest Release ===== | ===== Latest Release ===== |
==== 4.0.2 (2019/08/11) ==== | |
[[http://archive.xfce.org/src/panel-plugins/xfce4-genmon-plugin/4.0/xfce4-genmon-plugin-4.0.2.tar.bz2|xfce4-genmon-plugin-4.0.2.tar.bz2]] | |
| |
**SHA-256 Hash**: 256c22526f61aabf43b91b903b976c13e56198657667df443cdb06b31fbf23aa \\ | {{rss>https://archive.xfce.org/feeds/project/xfce4-genmon-plugin 1 date 2h}} |
**SHA-1 Hash**: cffc57ae3bce3ac0b3d5a6a055ef533907bb398c \\ | |
**MD5 Hash**: d808fe77a438c95b97ec6feda6162d22 | |
| |
---- | [[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin/-/blob/master/NEWS|Read the CHANGELOG]] |
===== Release History ===== | |
==== 4.0.1 (2017/10/29) ==== | |
* Allow pango markup in tooltip as well | |
* Added some extra sample scripts (twit, google calendar, sysstat) | |
* Enhanced CSS styling capabilites (see 'CSS Styling.txt' doc) | |
* Fix progressbar wrong direction | |
| |
==== 4.0.0 (2017/02/25) ==== | * **[[https://archive.xfce.org/src/panel-plugins/xfce4-genmon-plugin/|Download current release]]** (older versions of this component are also available here) |
* Fix PangoFontDescription not being able to display initial default string | |
| |
==== 3.99 (2016/11/02) ==== | [[|Back to Top]] |
* Port to Gtk3 | |
* Fix font styling to work with Gtk 3.22 | |
* Add support for "genmon" in 'xfce4-panel --plugin-event' (Bug #10734) | |
* Fix default tooltip does not work (bug #11284) | |
* Add <txtclick> functionality (Bug #3437) | |
| |
==== 3.4 (2012/05/12) ==== | ---- |
* Port from libxfcegui4 to libxfce4ui | |
* Install as a shared library rather than an executable | |
* No longer uses troublesome fixed-length text buffers | |
* Bug fixes | |
| |
===== Recent Changes ===== | ===== Source code repository ===== |
{{rss>http://git.xfce.org/panel-plugins/xfce4-genmon-plugin/atom/ 5 date}} | |
| |
===== Getting it ===== | |
The normal (and best) way to get this plugin is to use the package manager or port system of your operating system. | |
| |
If it isn't available there, or if you want a different version, you can download it in source form from [[http://archive.xfce.org/src/panel-plugins/xfce4-genmon-plugin/]]. | [[https://gitlab.xfce.org/panel-plugins/xfce4-genmon-plugin]] |
| |
---- | ---- |
===== Source code repository ===== | |
[[http://git.xfce.org/panel-plugins/xfce4-genmon-plugin/]] | |
---- | |
===== Reporting Bugs ===== | ===== Reporting Bugs ===== |
Bugs should be reported to the [[http://bugzilla.xfce.org/enter_bug.cgi?product=xfce4-genmon-plugin|Xfce bug tracking system]]. | |
| |
| * **[[:panel-plugins:xfce4-genmon-plugin:bugs|Reporting Bugs]]** -- List of currently open bugs and instructions on how to submit new bug reports |
| |
==== Open Bugs ==== | [[|Back To Top]] |
{{rss>http://bugzilla.xfce.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&chfieldto=Now&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&product=Xfce4-genmon-plugin&query_format=advanced&title=Bug%20List:%20genmon&ctype=atom}} | |
---- | ---- |
[[|Back To Top]] | [[:xfce:xfce4-panel:start:|Return to xfce4-panel Main Documentation Page]] |