diff options
Diffstat (limited to '.xbindkeysrc.scm')
-rw-r--r-- | .xbindkeysrc.scm | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm index 9e17422..d1c9479 100644 --- a/.xbindkeysrc.scm +++ b/.xbindkeysrc.scm @@ -1,8 +1,8 @@ -;; -*- eval: (git-auto-commit-mode 1) -*- +;;;_ Import (use-modules (ice-9 popen) (ice-9 rdelim)) -;;; Variables +;;;_ Variables (define modkey 'mod4) (define dmenu-font "-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*") @@ -22,7 +22,7 @@ (define previous-tag '()) (define current-tag "default") -;;; Macros +;;;_ Macros (define-macro (cmd command) `(lambda () (run-command ,command) @@ -36,7 +36,7 @@ (xbindkey-function `(,modkey g) reset-main-binding) (grab-all-keys))) -;;; Functions +;;;_ Functions (define (reset-main-binding) "reset first binding" (close-gui-window) @@ -66,19 +66,34 @@ (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)) + (reset-main-binding)) + (define (kill-tag) "Kill a selected tag" (let* ((tags (get-tags)) @@ -123,7 +138,7 @@ (close-pipe dzen-pipe) (set! dzen-pipe '()))) -;;; Maps +;;;_ Maps (define (main-binding) "First binding" (xbindkey `(,modkey shift "1") (string-append "dmenu_run -p 'Run:' " dmenu-args)) @@ -142,6 +157,10 @@ (xbindkey '(XF86AudioPrev) "mpc prev") (xbindkey '(XF86AudioNext) "mpc next") (xbindkey '(XF86Tools) "ncmpcpp") + (xbindkey `(,modkey b) "herbstclient focus left") + (xbindkey `(,modkey n) "herbstclient focus down") + (xbindkey `(,modkey p) "herbstclient focus up") + (xbindkey `(,modkey f) "herbstclient focus right") (xbindkey-function `(,modkey g) reset-main-binding)) (create-map X-function-map @@ -158,7 +177,8 @@ (xbindkey-function '(shift f) (cmd "herbstclient fullscreen toggle")) (xbindkey-function '(p) (cmd "herbstclient pseudotile toggle")) (xbindkey-function '(r) resize-map) - (xbindkey-function '(m) move-to-tag)) + (xbindkey-function '(m) move-to-tag) + (xbindkey-function `(,modkey f) switch-and-run)) (create-map W-function-map (gui-print "S-w") @@ -186,5 +206,10 @@ (xbindkey `(,modkey f) "herbstclient resize right +0.05") (xbindkey-function '(Return) reset-main-binding)) -;;; Main +;;;_ Main (main-binding) + +;;;_ Local Variables +;; Local Variables: +;; eval: (git-auto-commit-mode 1) +;; End: |