[hackers] [wmii] Add stripped down version of 9menu, and right-click menus to clients. Includes 'Delete' item. Runs from rc.wmii only.

From: Kris Maglione <jg_AT_suckless.org>
Date: Mon Feb 26 10:32:00 2007

changeset: 1960:6b1217fd1152
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Feb 26 04:27:03 2007 -0500
summary: Add stripped down version of 9menu, and right-click menus to clients. Includes 'Delete' item. Runs from rc.wmii only.

diff -r 8593ba0b74d9 -r 6b1217fd1152 Makefile
--- a/Makefile Sun Feb 25 23:29:16 2007 -0500
+++ b/Makefile Mon Feb 26 04:27:03 2007 -0500
@@ -8,8 +8,9 @@ OBJ = ${SRC:.c=.o}
 OBJ = ${SRC:.c=.o}
 MAN1 = wmii wmiir wmiiwm wmiiloop
 SCRIPTS = wmii wmiir wmiiloop
+BIN = wmiiwm wmii9menu
 
-all: options wmiiwm
+all: options wmiiwm wmii9menu
 
 options:
         @echo wmii build options:
@@ -34,11 +35,15 @@ wmiiwm: ${OBJ}
 wmiiwm: ${OBJ}
         @echo LD $@
         @${CC} -o $@ ${OBJ} ${LDFLAGS}
-# @strip $@
+
+# XXX: This doesn't need libixp
+wmii9menu: 9menu.c
+ @echo LD $@
+ @${CC} -o $@ ${OBJ} ${LDFLAGS}
 
 clean:
         @echo cleaning
- @rm -f wmiiwm ${OBJ} wmii-${VERSION}.tar.gz
+ @rm -f ${BIN} ${OBJ} wmii-${VERSION}.tar.gz
 
 dist: clean
         @echo creating dist tarball
@@ -56,14 +61,16 @@ install: all
                 sed 's|CONFPREFIX|${CONFPREFIX}|g; s|CONFVERSION|${CONFVERSION}|g' < $$i >${DESTDIR}${PREFIX}/bin/$$i; \
                 chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
          done
- @cp -f wmiiwm ${DESTDIR}${PREFIX}/bin
- @chmod 755 ${DESTDIR}${PREFIX}/bin/wmiiwm
+ @for i in ${BIN}; do\
+ cp -f $$i ${DESTDIR}${PREFIX}/bin; \
+ chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
+ done
         @echo installing scripts to ${DESTDIR}${CONFPREFIX}/wmii-${CONFVERSION}
         @mkdir -p -m 0755 ${DESTDIR}${CONFPREFIX}/wmii-${CONFVERSION}
         @cd rc; for i in *; do \
                 sed 's|CONFPREFIX|${CONFPREFIX}|g' <$$i >${DESTDIR}${CONFPREFIX}/wmii-${CONFVERSION}/$$i; \
                 chmod 755 ${DESTDIR}${CONFPREFIX}/wmii-${CONFVERSION}/$$i; \
- done
+ done
         @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
         @mkdir -p -m 0755 ${DESTDIR}${MANPREFIX}/man1
         @for i in ${MAN1:=.1}; do \
diff -r 8593ba0b74d9 -r 6b1217fd1152 event.c
--- a/event.c Sun Feb 25 23:29:16 2007 -0500
+++ b/event.c Mon Feb 26 04:27:03 2007 -0500
@@ -80,8 +80,11 @@ buttonpress(XEvent *e) {
                         }
                         if(ev->subwindow)
                                 XAllowEvents(blz.dpy, ReplayPointer, ev->time);
- else
- XAllowEvents(blz.dpy, AsyncPointer, ev->time);
+ else {
+ XUngrabPointer(blz.dpy, ev->time);
+ XSync(blz.dpy, False);
+ write_event("ClientMouseDown 0x%x %d\n", f->client->win, ev->button);
+ }
                 }
         }else
                 XAllowEvents(blz.dpy, ReplayPointer, ev->time);
diff -r 8593ba0b74d9 -r 6b1217fd1152 rc/rc.wmii
--- a/rc/rc.wmii Sun Feb 25 23:29:16 2007 -0500
+++ b/rc/rc.wmii Mon Feb 26 04:27:03 2007 -0500
@@ -21,6 +21,13 @@ fn wmiimenu {
         dmenu -b -fn $WMII_FONT \
                 -nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
                 -sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2)
+}
+
+fn 9menu {
+ ./9menu -teleport -font $WMII_FONT \
+ -nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
+ -sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2) \
+ -br $WMII_FOCUSCOLORS(3) $*
 }
 
 fn config_whatis {
@@ -71,6 +78,15 @@ fn Event-NotUrgentTag { shift; wmiir xwr
 fn Event-NotUrgentTag { shift; wmiir xwrite /lbar/$"* $"* }
 
 fn Event-LeftBarClick { shift; wmiir xwrite /ctl view $* }
+fn Event-ClientMouseDown {
+ client = $1; button = $2
+ echo ClientMouseDown $*
+ if(~ $button 3)
+ switch(`{9menu Delete Nop}) {
+ case Delete
+ wmiir xwrite /client/$client/ctl kill
+ }
+}
 
 # Actions
 fn Action {
Received on Mon Feb 26 2007 - 10:32:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:56 UTC