summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.xbindkeysrc.scm42
-rwxr-xr-xbin/kill_tag10
-rwxr-xr-xbin/move_to_tag9
-rwxr-xr-xbin/switch_tags10
4 files changed, 35 insertions, 36 deletions
diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm
index 7e1e556..bf5a77d 100644
--- a/.xbindkeysrc.scm
+++ b/.xbindkeysrc.scm
@@ -4,6 +4,7 @@
;;; Modkey
(define modkey 'mod4)
+(define dmenu-cmd "dmenu -b -nb '#000000' -nf '#15abc3' -sb '#e0c625' -sf '#000000'")
;;; Macros
(define-macro (cmd command)
@@ -29,16 +30,44 @@
(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")))
+(define (choose-tag prompt tags)
+ (let* ((file (open-input-pipe
+ (string-append "echo '" (string-join tags "\n")
+ "' | " dmenu-cmd " -p '" prompt ":'")))
(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))
+ (let* ((tags (get-tags))
+ (tag (choose-tag "Switch to tag" tags)))
+ (if (string? tag)
+ (begin
+ (if (not (member tag tags))
+ (run-command (string-append "herbstclient add " tag)))
+ (run-command (string-append "herbstclient use " tag))))
+ (reset-main-binding)))
+
+(define (kill-tag)
+ "Kill a selected tag"
+ (let* ((tags (get-tags))
+ (tag (choose-tag "Kill tag" tags)))
+ (if (string? tag)
+ (begin
+ (if (member tag tags)
+ (run-command (string-append "herbstclient merge_tag " tag)))))
+ (reset-main-binding)))
+
+(define (move-to-tag)
+ "Move selected window to another tag"
+ (let* ((tags (get-tags))
+ (tag (choose-tag "Move to tag" tags)))
+ (if (string? tag)
+ (begin
+ (if (not (member tag tags))
+ (run-command (string-append "herbstclient add " tag)))
+ (run-command (string-append "herbstclient move " tag))))
(reset-main-binding)))
;;; Maps
@@ -66,11 +95,10 @@
"Second binding"
(ungrab-all-keys)
(remove-all-keys)
- ;;(xbindkey-function '(b) (cmd "~/bin/switch_tags"))
(xbindkey-function '(b) switch-tags)
(xbindkey-function `(,modkey c) (cmd "herbstclient quit"))
(xbindkey-function `(,modkey r) (cmd "herbstclient reload"))
- (xbindkey-function '(k) (cmd "~/bin/kill_tag"))
+ (xbindkey-function '(k) kill-tag)
(xbindkey-function '("0") (cmd "herbstclient remove"))
(xbindkey-function '("3") (cmd "herbstclient split horizontal 0.5"))
(xbindkey-function '("2") (cmd "herbstclient split vertical 0.5"))
@@ -79,7 +107,7 @@
(xbindkey-function '(shift f) (cmd "herbstclient fullscreen toggle"))
(xbindkey-function '(p) (cmd "herbstclient pseudotile toggle"))
(xbindkey-function '(r) resize-map)
- (xbindkey-function '(m) (cmd "~/bin/move_to_tag"))
+ (xbindkey-function '(m) move-to-tag)
(xbindkey-function `(,modkey g) reset-main-binding)
(grab-all-keys))
diff --git a/bin/kill_tag b/bin/kill_tag
deleted file mode 100755
index 79bbf5a..0000000
--- a/bin/kill_tag
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/zsh
-
-TAGS=( $(herbstclient tag_status 0 | tr ":\!.+#" " ") )
-FOO=$(for i in "${TAGS[@]}"; do echo $i; done | dmenu)
-
-if [[ "${TAGS[@]}" == *"$FOO"* ]]; then
- herbstclient merge_tag $FOO
-else
- notify-send "Unknown tag: $FOO"
-fi
diff --git a/bin/move_to_tag b/bin/move_to_tag
deleted file mode 100755
index 3cf1806..0000000
--- a/bin/move_to_tag
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/zsh
-
-. $HOME/bin/hlwm_source
-
-if [[ "${TAGS[@]}" != *" $FOO "* ]]; then
- herbstclient add $FOO
-fi
-
-herbstclient move $FOO
diff --git a/bin/switch_tags b/bin/switch_tags
deleted file mode 100755
index 55eda0a..0000000
--- a/bin/switch_tags
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/zsh
-
-TAGS=( $(herbstclient tag_status 0 | tr ":\!.+#" " ") )
-FOO=$(for i in "${TAGS[@]}"; do echo $i; done | dmenu)
-
-if [[ "${TAGS[@]}" != *"$FOO"* ]]; then
- herbstclient add $FOO
-fi
-
-herbstclient use $FOO