From c2942fa8cf20b7c7fbefdb18b2c4fc9e1934fde8 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 8 Feb 2012 00:55:02 +0100 Subject: XBINDKEYS: Place current tag last and last picked tag first. --- .xbindkeysrc.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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))) -- cgit v1.2.3-54-g00ecf