summaryrefslogtreecommitdiffstats
path: root/.xbindkeysrc.scm
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-02-24 00:22:49 +0100
committerGravatar Tom Willemsen2012-02-24 00:22:49 +0100
commitf1532bd57803c201ec0ca23f169c74d9234c1bd7 (patch)
tree78196393b47724c6f5726c60e1154c15e57140d8 /.xbindkeysrc.scm
parent4857418dbde4c11f34a66774c5fb047119a96fe2 (diff)
parent136e988c22fdd0e846b785b9f229e7d6263ec1da (diff)
downloaddotfiles-f1532bd57803c201ec0ca23f169c74d9234c1bd7.tar.gz
dotfiles-f1532bd57803c201ec0ca23f169c74d9234c1bd7.zip
Merge remote-tracking branch 'gitorious/master' into phoenix
Diffstat (limited to '.xbindkeysrc.scm')
-rw-r--r--.xbindkeysrc.scm49
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: