From bb52c255508f9f8f3ca822f6f2ba0b76509896f6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 23 Feb 2012 18:18:51 +0100 Subject: [PATCH] .xbindkeysrc.scm --- .xbindkeysrc.scm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm index 93510ff..e068182 100644 --- a/.xbindkeysrc.scm +++ b/.xbindkeysrc.scm @@ -66,19 +66,33 @@ (close-port file) tag)) -(define (switch-tags) - "Switch to another tag" - (let* ((tags (get-tags)) - (tag (choose-tag "Switch to tag" tags))) +(define (switch-to-tag tag) + (let ((tags (get-tags))) (if (string? tag) (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)))) + (run-command (string-append "herbstclient use " tag)))))) + +(define (switch-tags) + "Switch to another tag" + (let* ((tags (get-tags)) + (tag (choose-tag "Switch to tag" tags))) + (switch-to-tag tag) (reset-main-binding))) +(define (switch-and-run) + "Ask for a command to run, switch to a tag with that name and run +the command." + (let* ((file (open-input-pipe + (string-append "dmenu_pick -p 'Run:' " dmenu-args))) + (prog (read-line file))) + (close-port file) + (switch-to-tag prog) + (run-command prog))) + (define (kill-tag) "Kill a selected tag" (let* ((tags (get-tags))