ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] ratmenu improvement suggestion


From: Daniel Webb
Subject: [RP] ratmenu improvement suggestion
Date: Tue, 13 Jun 2006 21:39:54 -0600
User-agent: Mutt/1.5.11

Ratmenu items should be able to be selected using a single keypress
(1,2,3,etc).  Here's a patch, although it makes a big assumption that your
list items are 0,1,2,3,4,5,etc.  I always use the 0 slot for a title, so it
works out fine since I don't like to use 0 for an option and start the second
line with 1.  To do it right there would need to be a command-line option to
specify the offset.

>diff -u ratmenu-2.3.11.orig ratmenu-2.3.11.dmw
Common subdirectories: ratmenu-2.3.11.orig/debian and ratmenu-2.3.11.dmw/debian
Only in ratmenu-2.3.11.dmw: ratmenu
diff -u ratmenu-2.3.11.orig/ratmenu.c ratmenu-2.3.11.dmw/ratmenu.c
--- ratmenu-2.3.11.orig/ratmenu.c       2005-03-31 00:56:24.000000000 -0700
+++ ratmenu-2.3.11.dmw/ratmenu.c        2006-06-13 21:26:24.000000000 -0600
@@ -368,6 +368,12 @@
                                curitem-- <= 0        ? curitem = numitems - 1 
: 0 ;
                                redraw(curitem, high, wide, 0);
                                break;
+            default:
+                if (key >= XK_0 && key <= XK_9) {
+                   int quickitem = key - XK_0;
+                   if (quickitem >= numitems) break;
+                   spawn(commands[quickitem]);
+                }
                        }
                        break;
                case MapNotify: case Expose: redraw(curitem, high, wide, 1); 
break;

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]