lxpanel taskbar middle click to close applications

Forums for the LXDE Edition
Forum rules
Before you post please read this

lxpanel taskbar middle click to close applications

Postby tiliqua on Sat Apr 21, 2012 8:28 am

Hi, 1st post :)

I'm running Mint 12 LXDE on a 9" netbook. To save a bit of vertical space I remove window decorations from maximised windows. I got a bit tired of right-clicking and selecting "close" on the LXPanel task bar/window list icons to exit an application (or Alt-F4) and really like the middle-click to close functionality of the Cinnamon panel I run on another computer. So I decided to mess around in the LXPanel source and I got middle-click to close working in the LXPanel taskbar plugin! (note I'm not a C coder, I just know how to G----- err I mean Duck Duck Go).

Save the following as 'taskbar-middleclicktoclose.patch'
Code: Select all
diff --git a/src/plugins/taskbar.c b/src/plugins/taskbar.c
index ea822d9..f8313ea 100644
--- a/src/plugins/taskbar.c
+++ b/src/plugins/taskbar.c
@@ -1112,11 +1112,8 @@ static gboolean taskbar_task_control_event(GtkWidget * widget, GdkEventButton *
         }
         else if (event->button == 2)
         {
-            /* Middle button.  Toggle the shaded state of the window. */
-            Xclimsg(tk->win, a_NET_WM_STATE,
-                2,      /* a_NET_WM_STATE_TOGGLE */
-                a_NET_WM_STATE_SHADED,
-                0, 0, 0);
+            /* Middle button.  Close the application. */
+            Xclimsgwm(tk->win, a_WM_PROTOCOLS, a_WM_DELETE_WINDOW);
         }
         else if (event->button == 3)
         {


Then cd to the directory you saved the patch to, download lxpanel, apply the patch and build.

Code: Select all
#install dependencies
sudo apt-get install automake build-essential libltdl-dev libtool libasound2-dev libwnck-dev intltool libmenu-cache1 libmenu-cache1-dev libgtk2.0-dev git

#Get LXPanel
git clone git://lxde.git.sourceforge.net/gitroot/lxde/lxpanel

#Apply the patch
git apply ../taskbar-middleclicktoclose.patch

#Build and install
./autogen.sh
./configure --enable-man #ignore enable-man error...
make
sudo make install

#log out and in again.


Note: this will install the entire lxpanel manually to /usr/local and won't be managed by the package manager. I don't know anything about building deb packages so didn't try to install it "properly". To uninstall: sudo rm -rf `locate lxpanel|grep /usr/local`

Thanks to vlad2005's post on compiling lxpanel which got me started.
tiliqua
Level 1
Level 1
 
Posts: 5
Joined: Sat Apr 21, 2012 8:00 am

Linux Mint is funded by ads and donations.
 

Re: lxpanel taskbar middle click to close applications

Postby tiliqua on Sat Apr 21, 2012 9:37 am

After all that, I just found someone has also done exactly the same... Oh well, guess I'm not as good at Duck Duck Going as I thought...
http://sashoalm.blogspot.com.au/2010/01 ... -when.html
tiliqua
Level 1
Level 1
 
Posts: 5
Joined: Sat Apr 21, 2012 8:00 am

Re: lxpanel taskbar middle click to close applications

Postby tiliqua on Sat Aug 18, 2012 4:41 am

Since there's no Mint 13 LXDE I'm using lubuntu 12.04 now, but I thought I'd update this post anyway as I've figured out how to make and install as a deb. Save as a shell script, make it executable and run as root.
Code: Select all
cd /tmp
rm -rf lxpanel*
apt-get source lxpanel
apt-get build-dep lxpanel
cd lxpanel*
cat > ../lxpanel-middleclick-to-close.patch <<EOF
--- a/src/plugins/taskbar.c
+++ b/src/plugins/taskbar.c
@@ -1112,11 +1112,8 @@
         }
         else if (event->button == 2)
         {
-            /* Middle button.  Toggle the shaded state of the window. */
-            Xclimsg(tk->win, a_NET_WM_STATE,
-                2,      /* a_NET_WM_STATE_TOGGLE */
-                a_NET_WM_STATE_SHADED,
-                0, 0, 0);
+            /* Middle button.  Close the application. */
+            Xclimsgwm(tk->win, a_WM_PROTOCOLS, a_WM_DELETE_WINDOW);
         }
         else if (event->button == 3)
         {
EOF
patch -p1 < ../lxpanel-middleclick-to-close.patch
dpkg-buildpackage -us -uc -b
cd ..
rm lxpanel*dbg*.deb
dpkg -i lxpanel*.deb
rm -rf lxpanel*
tiliqua
Level 1
Level 1
 
Posts: 5
Joined: Sat Apr 21, 2012 8:00 am


Return to LXDE

Who is online

Users browsing this forum: No registered users and 5 guests