.xbindkeysrc.scm
This commit is contained in:
parent
9fa57d0fce
commit
2f10eab467
1 changed files with 27 additions and 1 deletions
|
@ -1,4 +1,7 @@
|
||||||
;; -*- eval: (git-auto-commit-mode 1) -*-
|
;; -*- eval: (git-auto-commit-mode 1) -*-
|
||||||
|
(use-modules (ice-9 popen)
|
||||||
|
(ice-9 rdelim))
|
||||||
|
|
||||||
;;; Modkey
|
;;; Modkey
|
||||||
(define modkey 'mod4)
|
(define modkey 'mod4)
|
||||||
|
|
||||||
|
@ -16,6 +19,28 @@
|
||||||
(main-binding)
|
(main-binding)
|
||||||
(grab-all-keys))
|
(grab-all-keys))
|
||||||
|
|
||||||
|
(define (get-tags)
|
||||||
|
(let* ((file (open-input-pipe
|
||||||
|
"TAGS=( $(herbstclient tag_status 0 | tr \":\\!.+#\" \" \") ); echo ${TAGS[@]}"))
|
||||||
|
(tags (string-split (read-line file) #\ )))
|
||||||
|
(close-port file)
|
||||||
|
tags))
|
||||||
|
|
||||||
|
(define (get-tag tags pipe)
|
||||||
|
(read-line pipe))
|
||||||
|
|
||||||
|
(define (choose-tag tags)
|
||||||
|
(let* ((file (open-input-pipe (string-append "echo '" (string-join tags "\n") "' | dmenu")))
|
||||||
|
(tag (read-line file)))
|
||||||
|
(close-port file)
|
||||||
|
tag))
|
||||||
|
|
||||||
|
(define (switch-tags)
|
||||||
|
"Switch to another tag"
|
||||||
|
(let ((tag (choose-tag (get-tags))))
|
||||||
|
(run-command (string-append "herbtsclient use " tag))
|
||||||
|
(reset-main-binding)))
|
||||||
|
|
||||||
;;; Maps
|
;;; Maps
|
||||||
(define (main-binding)
|
(define (main-binding)
|
||||||
"First binding"
|
"First binding"
|
||||||
|
@ -41,7 +66,8 @@
|
||||||
"Second binding"
|
"Second binding"
|
||||||
(ungrab-all-keys)
|
(ungrab-all-keys)
|
||||||
(remove-all-keys)
|
(remove-all-keys)
|
||||||
(xbindkey-function '(b) (cmd "~/bin/switch_tags"))
|
;;(xbindkey-function '(b) (cmd "~/bin/switch_tags"))
|
||||||
|
(xbindkey-function '(b) switch-tags)
|
||||||
(xbindkey-function `(,modkey c) (cmd "herbstclient quit"))
|
(xbindkey-function `(,modkey c) (cmd "herbstclient quit"))
|
||||||
(xbindkey-function `(,modkey r) (cmd "herbstclient reload"))
|
(xbindkey-function `(,modkey r) (cmd "herbstclient reload"))
|
||||||
(xbindkey-function '(k) (cmd "~/bin/kill_tag"))
|
(xbindkey-function '(k) (cmd "~/bin/kill_tag"))
|
||||||
|
|
Loading…
Reference in a new issue