summaryrefslogtreecommitdiffstats
path: root/.xbindkeysrc.scm
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-02-08 00:55:02 +0100
committerGravatar Tom Willemsen2012-02-08 00:55:02 +0100
commitc2942fa8cf20b7c7fbefdb18b2c4fc9e1934fde8 (patch)
tree3b06bc4e217c95cb3da3ecc7d64461f4e0ee542a /.xbindkeysrc.scm
parent01a0c630672d869a7df0f4aae835433c7e68e939 (diff)
downloaddotfiles-c2942fa8cf20b7c7fbefdb18b2c4fc9e1934fde8.tar.gz
dotfiles-c2942fa8cf20b7c7fbefdb18b2c4fc9e1934fde8.zip
XBINDKEYS: Place current tag last and last picked tag first.
Diffstat (limited to '.xbindkeysrc.scm')
-rw-r--r--.xbindkeysrc.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm
index 9d87a2e..5e7efca 100644
--- a/.xbindkeysrc.scm
+++ b/.xbindkeysrc.scm
@@ -12,6 +12,9 @@
(define dzen-args (string-append " -fn '" font "' -x 5 -y 5 -bg '#000000' -fg '#15abc3'"))
(define dzen-pipe '())
+(define previous-tag '())
+(define current-tag "default")
+
;;; Macros
(define-macro (cmd command)
`(lambda ()
@@ -41,7 +44,11 @@
"TAGS=( $(herbstclient tag_status 0 | tr \":\\!.+#\" \" \") ); echo ${TAGS[@]}"))
(tags (string-split (read-line file) #\ )))
(close-port file)
- tags))
+ (set! tags (delete current-tag tags))
+ (set! tags (delete previous-tag tags))
+ (if (not (null? previous-tag))
+ (append `(,previous-tag) (append tags `(,current-tag)))
+ (append tags `(,current-tag)))))
(define (choose-tag prompt tags)
"Ask to choose a tag"
@@ -60,6 +67,8 @@
(begin
(if (not (member tag tags))
(system (string-append "herbstclient add " tag)))
+ (set! previous-tag current-tag)
+ (set! current-tag tag)
(run-command (string-append "herbstclient use " tag))))
(reset-main-binding)))