Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:howto:panel_plugins [2018/07/25 01:24] – [Library] Update example version of libxfce4panel andreldmdev:howto:panel_plugins [2024/03/26 18:11] (current) – [Testing and Releasing the plugin] gael
Line 1: Line 1:
 ====== Xfce Panel Plugins How To ====== ====== Xfce Panel Plugins How To ======
-<note tip>You can get the sample plugin from [[https://git.xfce.org/panel-plugins/xfce4-sample-plugin/|git]].</note>+<note tip>You can find the sample plugin [[https://gitlab.xfce.org/panel-plugins/xfce4-sample-plugin|on GitLab]]. There is also a [[https://gitlab.xfce.org/itsManjeet/xfce4-python-sample-plugin|Python version]].</note>
  
 ===== Introduction ===== ===== Introduction =====
Line 14: Line 14:
 of the panel framework. This file describes the way plugin writers should interact with this system. of the panel framework. This file describes the way plugin writers should interact with this system.
  
-The API documentation is installed with the panel and also available from +The [[:api_documentation|API documentation]] is installed with the panel and also available from 
 http://www.xfce.org/documentation/api/ http://www.xfce.org/documentation/api/
 +
  
  
Line 63: Line 64:
 required headers (''gtk'' and ''libxfce4util''): required headers (''gtk'' and ''libxfce4util''):
  
-  #include <libxfce4panel/xfce-panel-plugin.h>+  #include <libxfce4panel/libxfce4panel.h>
  
 ===== Plugin Registration ===== ===== Plugin Registration =====
  
-To register a plugin with the plugin system there are two macros available that should be used,  +To register a plugin with the plugin system there is one macro available that should be used, instead of using the library functions directly
-instead of using the library functions directly; one for internal plugins and one for external plugins.+  XFCE_PANEL_PLUGIN_REGISTER(construct); 
 +   
 +Older versions use the following two deprecated macros, one for internal plugins and one for external plugins.
  
   XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(construct);   XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(construct);
Line 275: Line 278:
 For creating a release you need to run ''./autogen.sh && make distcheck''. Fix all warnings and errors in make distcheck before distributing the package. For creating a release you need to run ''./autogen.sh && make distcheck''. Fix all warnings and errors in make distcheck before distributing the package.
  
-To help development, you can also test plugins without installing them on panel's prefix (e.g. /usr), you can also directly run plugins from the source so you don't need to to overwrite a plugin version from your distribution. To accomplish this, build the plugin with make and then follow these steps:+To help development, you can also test plugins without installing them on panel's prefix (e.g. /usr). As for 4.19.4, you can install the plugin in a directory of XDG_DATA_DIRS or in XDG_HOME_DIR, and the panel should find it. In particular, a default plugin installation in /usr/local with a panel in /usr should work on its own (or a plugin installation in ~/.local without root permissions). 
 + 
 +You can also directly run plugins from the source so you don't need to overwrite a plugin version from your distribution. To accomplish this, build the plugin with make and then follow these steps:
  
   * Create a symbolic link from your plugin binary to the panel's prefix installation, e.g. ''ln -s /home/johndoe/where/your/src/is/panel-plugin/.libs/libyourplugin.so /usr/lib/xfce4/panel-plugins/libyourplugin-git.so''   * Create a symbolic link from your plugin binary to the panel's prefix installation, e.g. ''ln -s /home/johndoe/where/your/src/is/panel-plugin/.libs/libyourplugin.so /usr/lib/xfce4/panel-plugins/libyourplugin-git.so''
   * Copy ''/usr/share/xfce4/panel/plugins/yourplugin.desktop'' to ''/usr/share/xfce4/panel/plugins/yourplugin-git.desktop''   * Copy ''/usr/share/xfce4/panel/plugins/yourplugin.desktop'' to ''/usr/share/xfce4/panel/plugins/yourplugin-git.desktop''
-  * Edit the latter to point at 'yourplugin-git' instead of 'yourplugin'modify the ''Name'' entry to distinguish your instance and ''X-XFCE-Module'' to match the symbolic link, i.e. ''libyourplugin-git''.+  * Edit the latter to point at 'yourplugin-git' instead of 'yourplugin'modify the ''Name'' entry to distinguish your instance and ''X-XFCE-Module'' to match the symbolic link, i.e. ''yourplugin-git''.
   * If you're porting a plugin to GTK+ 3, make sure to add ''X-XFCE-API=2.0'' to the desktop-git file.   * If you're porting a plugin to GTK+ 3, make sure to add ''X-XFCE-API=2.0'' to the desktop-git file.
 +
 +An example:
 +
 +<code>
 +$cat /usr/share/xfce4/panel/plugins/diskperf-git.desktop
 +[Xfce Panel]
 +Type=X-XFCE-PanelPlugin
 +Encoding=UTF-8
 +Name=Disk Performance Monitor (git)
 +Comment=Show disk performance
 +Icon=drive-harddisk
 +X-XFCE-Internal=FALSE
 +X-XFCE-Module=diskperf-git
 +X-XFCE-API=2.0
 +</code>
  
 Now the 'git' version of the panel plugin should be available in the 'add plugin' panel dialog. Whenever you make changes and compile the plugin, all you need to do is to add the plugin to panel again or simply refresh the panel ''xfce4-panel -r''. Now the 'git' version of the panel plugin should be available in the 'add plugin' panel dialog. Whenever you make changes and compile the plugin, all you need to do is to add the plugin to panel again or simply refresh the panel ''xfce4-panel -r''.