Friday, January 1, 2010

Patch for LXPanel to close windows on middle click.

I like using middle-click to close tabs in Firefox, and I would like to be able to close windows by middle-clicking their icon-entry on the taskbar in LXDE. Unfortunately, it can only be done by editing the source of lxpanel, which is the LXDE taskbar.

For Debian, you need to get the source code:
 apt-get source lxpanel  
 sudo apt-get build-dep lxpanel  
Then you need to apply this patch:
 commit ec2772ddbbf0f02e9175f195e9f234c2c305e8ee  
 Author: sashoalm <sashoalm@aspire>  
 Date:  Sat Feb 22 16:33:29 2014 +0200  
   Close window on wheel-click.  
 diff --git a/src/plugins/taskbar.c b/src/plugins/taskbar.c  
 index baf6281..95143b9 100644  
 --- a/src/plugins/taskbar.c  
 +++ b/src/plugins/taskbar.c  
 @@ -1111,11 +1111,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 window. */  
 +      Xclimsgwm(tk->win, a_WM_PROTOCOLS, a_WM_DELETE_WINDOW);  
      }  
      else if (event->button == 3)  
      {  
And install it:
 ./configure  
 make  
 sudo make install  
Now you can close windows with middle click on taskbar.