Main index > Off the wall > alt + right clicking instead?

By Dj_FoodStamp (User), on Sat May 7 07:18:03 2005: alt + right clicking instead?.

I am a blackbox wm user and I have to say that adesklets has greatly improved my desktop visually. There are so many useful desklets available and I am currently taking advantage of all of them. However, I find that adesklet's way of configuring desklets while running sometimes interferes with the way blackbox/fluxbox users access their system menu.

I seem to have around 4 desklets running at any given time. Sometimes I would accidently delete an applet or screw it up by right clicking the desklet instead of the desktop to access my blackbox menu. How would one go about fixing this without changing the window manager's default way of operation?

I think it would better if configuring desklets required an additional key to access the desklet menu. i.e. alt + right clicking a desklet. This way, adesklets can intergrate into a *box windowmanager smoother. What do you think of this? I am a non coder so I'd have no idea where to start.

By syfou (Core Developer & Desklet Author), on Sat May 7 14:23:07 2005, last edited on Sun May 8 01:49:39 2005.

Hi Dj_FoodStamp,

glad adesklets suits your need.

Code:


--- adesklets.c.old     2005-05-07 14:20:04.000000000 -0400
+++ adesklets.c 2005-05-07 14:19:28.000000000 -0400
@@ -2891,7 +2891,8 @@
       case ButtonPress:
        /* Fire default menu on left button click */
        if(ev.xbutton.button==3) {
-         if (adesklets_menu_fire(0,&menu_str) &&
+         if ((ev.xbutton.state & ControlMask) &&
+             (adesklets_menu_fire(0,&menu_str)) &&
              (adesklets.user_event_mask&MenuFireMask))
            event("menufire 0 %s\n",menu_str);
        } else



If you save this as keymod.diff, then go to the src/ directory of adesklets 0.4.8 package, you can apply it with:

Code:


patch </path/to/keymod.diff adesklets.c



It adds the additionnal need to have the control key pressed at the same time to have the contextual menu fired... I didn't use the alt key because many window managers already make special use of this build in (it is just a matter of changing ControlMask for Mod1Mask, though)... I still to not know if I will integrate this in next adesklets version, since I find it quite counter-intuitive, and make it a runtime-configurable option would need more work, and I am currently quite busy elsewhere...

But let's see what people think of that!

By cs-cam (Desklet Author), on Sun May 8 00:39:32 2005.

I'm a big fan of that idea personally. I would've implemented it myself except I don't know any C :) At any rate, if you leave it patchable in any future versions and create a runtime option in your other upcoming project, that might be a good way to do it, but whatever suits you :)

By syfou (Core Developer & Desklet Author), on Sun May 8 01:48:28 2005.

Universal patches are quite resilient to minor code changes, so this one should continue working with many upcoming releases of adesklets... Maybe will I make this a configuration-time option for the next one (turned off by default) tough: I will let you know.

By cs-cam (Desklet Author), on Wed Jun 1 00:06:58 2005.

Hmmmm, I can't get your patch to apply, here's the output:

Code:


.patching file src/adesklets.c
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 2891.
1 out of 1 hunk FAILED -- saving rejects to file src/adesklets.c.rej


and the contents of the .rej file if it helps.

Code:


***************
*** 2891,2897 ****
        case ButtonPress:
         /* Fire default menu on left button click */
         if(ev.xbutton.button==3) {
-          if (adesklets_menu_fire(0,&menu_str) &&
               (adesklets.user_event_mask&MenuFireMask))
             event("menufire 0 %s\n",menu_str);
  
--- 2891,2898 ----
        case ButtonPress:
         /* Fire default menu on left button click */
         if(ev.xbutton.button==3) {
+          if ((ev.xbutton.state & ControlMask) &&
+              (adesklets_menu_fire(0,&menu_str)) &&
               (adesklets.user_event_mask&MenuFireMask))
             event("menufire 0 %s\n",menu_str);
  

Freshly extracted archive, I don't know how patch files work to maybe try a solution. I noticed in Scite, the patch file looks like it uses spaces while adesklets.c seems to be using tabs for indention, I don't know if this makes a different or not. I tried replacing the spaces with tabs and had no luck.

By syfou (Core Developer & Desklet Author), on Wed Jun 1 00:45:35 2005.

Quote:


patch unexpectedly ends in middle of line

I bet you did not put and end of line ('\n') character at the end of the last line when you pasted from the code snipset above...

cs-cam wrote:


I noticed in Scite, the patch file looks like it uses spaces while adesklets.c seems to be using tabs for indention, I don't know if this makes a different or not. I tried replacing the spaces with tabs and had no luck.

GNU diff/patch are incredibly resilient to a lot of abuses, including tab/space mixing (see -l/--ignore-whitespace) in GNU patch manual. This said, I verified the above patch to perfectly match the code and to still work.

cs-cam wrote:


I don't know how patch files work to maybe try a solution.

Unified format is really simple and easy to read (given human-readable description is about one paragraph long). In this specific case, you should have no problem either to figure things out manually.


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.