Wednesday, May 8, 2013

How to add "show desktop" button to Tint2 panel ?

As openbox user , who uses tint2 and likes it very much , i tend to miss my show desktop button I enjoyed in other panels (xfce4,etc) ...
here is brief how-to guide to add "show desktop" button to Tint2 panel..
1-you need to have tint2-svn version of tint2 which includes applications launcher
2- make sure you have wmctrl app installed ..
3- cd to /usr/bin

cd usr/bin
 and create show_desktop.sh script with the following code
 #!/bin/sh  
 if wmctrl -m | grep "mode: ON"; then  
 exec wmctrl -k off  
 else  
 exec wmctrl -k on  
 fi  
save the file and change its permission to a+x

chmod a+x show_desktop.sh

now we need to create .desktop entry for our script 

cd usr/share/applications

sudo mousepad show_desktop.desktop s

add the following

[Desktop Entry]

Version=1.0

Exec=/usr/bin/show_desktop.sh

Icon=/usr/share/applications/Desktop-32.png

Terminal=false

Type=Application

Icon line is optional , but if you want to use customized icon ,
move the icon to /usr/share/applications ,
 identify the icon
identify Desktop-32.png
 and modify the line accordingly
modify your tint2rc configuration file and add the following
#------------------------------------------
#LAUNCHER
#------------------------------------------
launcher_icon_theme = areao43
launcher_padding = 4 4
launcher_background_id = 1
launcher_icon_size = 40 
launcher_item_app = /usr/share/applications/showdesktop.desktop

here is screenshot of my desktop =)
 

 sources used in this how-to with some personal modifications

 https://wiki.archlinux.org/index.php/Tint2#Application_Launchers_in_tint2-svn_.28AUR.29
http://crunchbang.org/forums/viewtopic.php?id=6455
 http://code.google.com/p/tint2/wiki/FAQ#Adding_a_%27show_desktop%27_button

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hello, you can show the desktop only with the .desktop file, using:

    [Desktop Entry]
    Version=1.0
    Exec=wmctrl -m | grep "mode: OFF" && exec wmctrl -k on || exec wmctrl -k off
    Icon=/usr/share/applications/Desktop-32.png
    Terminal=false
    Type=Application

    Basically, the shell script is reduced to only one line:
    wmctrl -m | grep "mode: OFF" && exec wmctrl -k on || exec wmctrl -k off

    Thanks for the publication, I'm using now in my Openbox + Debian 10 + Tint2 computer :D

    ReplyDelete