From 24ed8402b1bfca5d832391232acea6056d665917 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 2 Feb 2012 09:28:24 +0100 Subject: [PATCH 1/8] .conkyrc --- .conkyrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.conkyrc b/.conkyrc index 297229e..8d5bfd8 100644 --- a/.conkyrc +++ b/.conkyrc @@ -29,7 +29,7 @@ lua_draw_hook_pre conky_main_box TEXT ${font Arial:bold:size=10}${color Tan1}TODO ${color RoyalBlue}${voffset -2}${hr 2} -$font${color SlateGray}${exec /home/slash/development/projects/ntd/src/ntd list short} +$font${shadecolor red}${color SlateGray}${exec /home/slash/development/projects/ntd/src/ntd list short}$shadecolor $if_mpd_playing${font Arial:bold:size=10}${color Tan1}MUSIC ${color RoyalBlue}${voffset -2}${hr 2} $font$alignc${color SlateGray}$mpd_title From 3ffd027aabb0f523e0b2c79468d958c223d546a6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 2 Feb 2012 09:29:17 +0100 Subject: [PATCH 2/8] .conkyrc --- .conkyrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.conkyrc b/.conkyrc index 8d5bfd8..297229e 100644 --- a/.conkyrc +++ b/.conkyrc @@ -29,7 +29,7 @@ lua_draw_hook_pre conky_main_box TEXT ${font Arial:bold:size=10}${color Tan1}TODO ${color RoyalBlue}${voffset -2}${hr 2} -$font${shadecolor red}${color SlateGray}${exec /home/slash/development/projects/ntd/src/ntd list short}$shadecolor +$font${color SlateGray}${exec /home/slash/development/projects/ntd/src/ntd list short} $if_mpd_playing${font Arial:bold:size=10}${color Tan1}MUSIC ${color RoyalBlue}${voffset -2}${hr 2} $font$alignc${color SlateGray}$mpd_title From 5272c47e00ff258ebf0d414007358c7ebfb87bc2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 2 Feb 2012 14:57:57 +0100 Subject: [PATCH 3/8] .ncmpcpp/config --- .ncmpcpp/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ncmpcpp/config b/.ncmpcpp/config index dff7507..20d1030 100644 --- a/.ncmpcpp/config +++ b/.ncmpcpp/config @@ -1,10 +1,11 @@ +# -*- eval: (git-auto-commit-mode 1) -*- # Playlist autocenter_mode = "yes" centered_cursor = "yes" now_playing_prefix = "$b" now_playing_suffix = "$/b" playlist_display_mode = "classic" # (classic/columns) -song_list_format = "{$8%d%n}|{ $8%n}$9 | {$3%a$9 - }{$4%t$9} {$R$5[%b]$9}" +song_list_format = "{$3%a$9 - }{$4%t$9} {$R$5[%b]$9}" # Bars display_bitrate = "no" From 9fa57d0fce47e363dfa218f7748545170b775800 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 5 Feb 2012 00:55:31 +0100 Subject: [PATCH 4/8] .xinitrc --- .xinitrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.xinitrc b/.xinitrc index 0d1c74e..a7956b8 100644 --- a/.xinitrc +++ b/.xinitrc @@ -1,4 +1,5 @@ -# -*- mode: shell-script; eval: (git-auto-commit-mode 1) -*- +case + # -*- mode: shell-script; eval: (git-auto-commit-mode 1) -*- # -----[ Set background ]--------------------------------------------- hsetroot -center ~/pictures/wallpapers/3600x1080/wallpaper-1460625.jpg From 2f10eab467b0f993b8f66bfeeffdf89f9949b406 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 6 Feb 2012 21:51:01 +0100 Subject: [PATCH 5/8] .xbindkeysrc.scm --- .xbindkeysrc.scm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm index e467941..7e1e556 100644 --- a/.xbindkeysrc.scm +++ b/.xbindkeysrc.scm @@ -1,4 +1,7 @@ ;; -*- eval: (git-auto-commit-mode 1) -*- +(use-modules (ice-9 popen) + (ice-9 rdelim)) + ;;; Modkey (define modkey 'mod4) @@ -16,6 +19,28 @@ (main-binding) (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 (define (main-binding) "First binding" @@ -41,7 +66,8 @@ "Second binding" (ungrab-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 r) (cmd "herbstclient reload")) (xbindkey-function '(k) (cmd "~/bin/kill_tag")) From 9f48c01515dbe6b88e6c847f62bbc7bbcc9b08b0 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 6 Feb 2012 22:25:18 +0100 Subject: [PATCH 6/8] XBINDKEYS: Remove external scripts for tag handling --- .xbindkeysrc.scm | 42 +++++++++++++++++++++++++++++++++++------- bin/kill_tag | 10 ---------- bin/move_to_tag | 9 --------- bin/switch_tags | 10 ---------- 4 files changed, 35 insertions(+), 36 deletions(-) delete mode 100755 bin/kill_tag delete mode 100755 bin/move_to_tag delete mode 100755 bin/switch_tags 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 From f2604da83588aad7af6d723ff4603d71d1982d9e Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 6 Feb 2012 22:28:14 +0100 Subject: [PATCH 7/8] PANEL: Change it all again --- .config/herbstluftwm/panel.sh | 138 +++++++++++++++++++++++----------- 1 file changed, 94 insertions(+), 44 deletions(-) diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 14080b9..38c365f 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh @@ -10,7 +10,7 @@ fi # geometry has the format: WxH+X+Y x=${geometry[0]} width=${geometry[2]} -height=1 +height=12 y=$(expr ${geometry[3]} - $height) tag_width=40 font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*" @@ -25,6 +25,96 @@ function uniq_linebuffered() { awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" } +function print_tags() { + # draw tags + echo -n "$separator" + for i in "${TAGS[@]}" ; do + if [[ "${TAGS2[@]}" == *"#${i:1}"* ]]; then + echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()" + elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then + echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()" + else + case ${i:0:1} in + '#') + echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()" + ;; + '+') + echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()" + ;; + ':') + echo -n "^bg($hicolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($hicolor)^ro(${tag_width}x$height)^fg()" + ;; + '!') + echo -n "^bg($urcolor)^fg(#000000) ${i:1} ^fg()^bg()" +# echo -n "^fg($urcolor)^ro(${tag_width}x$height)^fg()" + ;; + *) + echo -n "^bg($bgcolor)^fg(#ffffff) ${i:1} ^fg()^bg()" +# echo -n "^bg()^fg($bgcolor)^ro(${tag_width}x$height)^fg()" + ;; + esac + fi + echo -n "$separator" + done +} + +function print_mailboxes() { + mailboxes=(ninthfloor gmail arch aethon ryuslash.org) + mailtxt="" + for j in "${mailboxes[@]}"; do + mailfile="$HOME/documents/mail/$j/INBOX/new/" + mailcnt=$(ls $mailfile | wc -l) + + if [ $mailcnt -gt 0 ]; then + mailsha1=$(echo $j | sha1sum) + mailcolor="#${mailsha1:0:6}" + else + mailcolor=$bgcolor + fi + + mailtxt="$mailtxt${separator}^bg($mailcolor)^fg(#ffffff) $j ^fg()^bg()" +# echo -n "^fg($mailcolor)^ro(${tag_width}x$height)^fg()$separator" + done + mailtxt_only=$(echo -n "$mailtxt" | sed 's.\^[^(]*([^)]*)..g') + let mailtxt_width=$(textwidth "$font" "$mailtxt_only")+20 + echo -n "^p(_RIGHT)^p(-$mailtxt_width)$mailtxt" +} + +function print_services() { + services=(emacs httpd mysqld dunst xbindkeys mpdscribble sshd mpd) + servicetxt="" + for j in "${services[@]}"; do + servicetxt="$servicetxt$separator$(status $j)" + done + servicetxt_only=$(echo -n "$servicetxt" | sed 's.\^[^(]*([^)]*)..g') + let servicetxt_width=$(textwidth "$font" "$servicetxt_only")/2 + + echo -n "^p(_CENTER)^p(-$servicetxt_width)$servicetxt" +} + +function status() +{ + running=$(${1}_running 2>/dev/null || pidof $1) + + if [ -n "$running" ]; then + color="darkgreen" + else + color="darkred" + fi + + echo -n "^bg($color)^fg(#ffffff) $1 ^fg()^bg()" +} + +function emacs_running() +{ + ps ax | awk '{ print $5 " " $6 }' | grep -E "^emacs --daemon" +} + herbstclient pad $monitor -5 -5 $(expr -5 + $height) -5 herbstclient pad $monitor2 -5 -5 -5 -5 { @@ -36,50 +126,10 @@ herbstclient pad $monitor2 -5 -5 -5 -5 TAGS2=( $(herbstclient tag_status $monitor2) ) while true ; do separator="^fg($bgcolor)^ro(1x$height)^fg()" - # draw tags - echo -n "$separator" - for i in "${TAGS[@]}" ; do - if [[ "${TAGS2[@]}" == *"#${i:1}"* ]]; then - echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()" - elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then - echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()" - else - case ${i:0:1} in - '#') - echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()" - ;; - '+') - echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()" - ;; - ':') - echo -n "^fg($hicolor)^ro(${tag_width}x$height)^fg()" - ;; - '!') - echo -n "^fg($urcolor)^ro(${tag_width}x$height)^fg()" - ;; - *) - echo -n "^bg()^fg($bgcolor)^ro(${tag_width}x$height)^fg()" - ;; - esac - fi - echo -n "$separator" - done + print_tags + print_services + print_mailboxes - mailboxes=(ninthfloor gmail arch aethon ryuslash.org) - echo -n "^p(_RIGHT)^p(-$(expr $tag_width \* ${#mailboxes[@]} + 5))" - for j in "${mailboxes[@]}"; do - mailfile="$HOME/documents/mail/$j/INBOX/new/" - mailcnt=$(ls $mailfile | wc -l) - - if [ $mailcnt -gt 0 ]; then - mailsha1=$(echo $j | sha1sum) - mailcolor="#${mailsha1:0:6}" - else - mailcolor=$bgcolor - fi - - echo -n "^fg($mailcolor)^ro(${tag_width}x$height)^fg()$separator" - done echo # wait for next event read line || break From f9eeef0571c908489c55d73b39efe6e7faebbdc5 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 6 Feb 2012 22:29:49 +0100 Subject: [PATCH 8/8] OFFLINEIMAP: Don't check iActor account --- .offlineimaprc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.offlineimaprc b/.offlineimaprc index caabb9e..db46d5f 100644 --- a/.offlineimaprc +++ b/.offlineimaprc @@ -1,7 +1,7 @@ [general] # NOTE: cronjob calls the quiet UI with -u ui = TTYUI -accounts = ryuslash.org,gmail,arch,aethon,iactor,ninthfloor +accounts = ryuslash.org,gmail,arch,aethon,ninthfloor pythonfile = ~/.offlineimap.py [Account arch]