summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTslil Clingman <hiato1@gmail.com>2015-02-18 11:11:36 +0200
committerTslil Clingman <hiato1@gmail.com>2015-02-18 11:11:36 +0200
commitf56c05fb1d874ebf02fe20bfe3e51e084f5a8ba3 (patch)
tree28b3f1a7db40773ef6e623d9e44fa76c5ec08f36
parentd683f90aacdd77f9736a85bb1c508c826fba092c (diff)
Reworked dmenu interaction for uniform interface in ratpoison and surf
-rwxr-xr-xratdm11
-rwxr-xr-xratws18
2 files changed, 17 insertions, 12 deletions
diff --git a/ratdm b/ratdm
new file mode 100755
index 0000000..19ea8f2
--- /dev/null
+++ b/ratdm
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
+screen=$(ratpoison -c sdump | tr ',' '\n' | grep '1$')
+width=$(echo $screen | cut -d ' ' -f 4)
+height=$(echo $screen | cut -d ' ' -f 5)
+s=$(echo $screen | cut -d ' ' -f 1)
+w=$(($width/3))
+h=$(($height/5*2))
+
+dmenu -p "Select >" -l 16 -s $s -x $w -y $h -w $w -sb '#0B0' -sf black -nb '#000' -fn $font -i -p foo "$@"
diff --git a/ratws b/ratws
index f276b7c..2e43904 100755
--- a/ratws
+++ b/ratws
@@ -1,14 +1,8 @@
#!/usr/bin/env sh
-font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
-screen=$(ratpoison -c sdump | tr ',' '\n' | grep '1$')
-width=$(echo $screen | cut -d ' ' -f 4)
-height=$(echo $screen | cut -d ' ' -f 5)
-s=$(echo $screen | cut -d ' ' -f 1)
-w=$(($width/3))
-h=$(($height/3))
-
-alias dm="dmenu -l 16 -s $s -x $w -y $h -w $w -p \"Select >\" -sb '#0B0' -sf black -nb '#000' -fn $font -i"
-
-sel=$(ratpoison -c windows | dm | cut -d ' ' -f 1)
-[ ! "$sel" = "" ] && ratpoison -c "select $sel" || true
+w=$(ratpoison -c windows)
+[ "$1" == "-s" ] && p="Tab" && w=$(echo "$w" | grep '(surf)')
+[ "$1" == "-w" ] && p="Windows" && w=$(echo "$w" | grep -v '(surf)')
+[ -z $w ] && exit
+sel=$(echo "$w" | ratdm -p ${p:-All}' >' | cut -d ' ' -f 1)
+[ -n $sel ] && ratpoison -c "select $sel" || true