From b30acd13148b4b5174331580678bb5b0ce26e027 Mon Sep 17 00:00:00 2001 From: shmibs Date: Thu, 3 Jul 2014 11:26:07 -0700 Subject: complete theme revamp switched to bar, changed term colours, and added a config_vars file to make sourcing theme colours / fonts / etc easier --- .Xresources | 67 ++++-- .config/dunst/dunstrc | 8 +- .config/herbstluftwm/autostart | 9 +- .config/herbstluftwm/calc.sh | 6 +- .config/herbstluftwm/config_vars | 15 ++ .config/herbstluftwm/panel.sh | 405 +++++++++++++++++++-------------- .config/herbstluftwm/panel/conky_stats | 9 + .config/herbstluftwm/switcher.sh | 7 +- .config/herbstluftwm/tray.sh | 7 +- .config/nitrogen/bg-saved.cfg | 2 +- .xinitrc | 4 + README.md | 9 +- 12 files changed, 334 insertions(+), 214 deletions(-) create mode 100755 .config/herbstluftwm/config_vars create mode 100644 .config/herbstluftwm/panel/conky_stats diff --git a/.Xresources b/.Xresources index bf458e8..3371173 100644 --- a/.Xresources +++ b/.Xresources @@ -10,44 +10,75 @@ URxvt*buffered: on ! URxvt*geometry: geom ! Use the specified colour as the windows background colour [default White]; option -bg. -URxvt*background: #171717 +URxvt*background: #252525 ! Use the specified colour as the windows foreground colour [default Black]; option -fg. URxvt*foreground: #FEFEFE ! Use the specified colour for the colour value n, where 0-7 corresponds to low-intensity (normal) colours and 8-15 corresponds to high-intensity (bold = bright -! black -URxvt*color0: #2E3436 +!! black +!URxvt*color0: #2E3436 +!! light black +!URxvt*color8: #555753 +!! red +!URxvt*color1: #E6562E +!! light red +!URxvt*color9: #FA7955 +!! green +!URxvt*color2: #59992F +!! light green +!URxvt*color10: #8AE234 +!! yellow +!URxvt*color3: #D4A831 +!! light yellow +!URxvt*color11: #FCE381 +!! blue +!URxvt*color4: #5D8CB0 +!! light blue +!URxvt*color12: #9BBBCF +!! magenta +!URxvt*color5: #9F79B8 +!! light magenta +!URxvt*color13: #D9A1E3 +!! cyan +!URxvt*color6: #06989A +!! light cyan +!URxvt*color14: #61E2E2 +!! white +!URxvt*color7: #E0E0E0 +!! light white +!URxvt*color15: #FEFEFE +URxvt*color0: #4e4e4e ! light black -URxvt*color8: #555753 +URxvt*color8: #7d7d7d ! red -URxvt*color1: #E6562E +URxvt*color1: #ff4070 ! light red -URxvt*color9: #FA7955 +URxvt*color9: #ff6699 ! green -URxvt*color2: #59992F +URxvt*color2: #d5f85f ! light green -URxvt*color10: #8AE234 +URxvt*color10: #99ff66 ! yellow -URxvt*color3: #D4A831 +URxvt*color3: #ffa466 ! light yellow -URxvt*color11: #FCE381 +URxvt*color11: #faff66 ! blue -URxvt*color4: #5D8CB0 +URxvt*color4: #00a1e4 ! light blue -URxvt*color12: #9BBBCF +URxvt*color12: #00b4ff ! magenta -URxvt*color5: #9F79B8 +URxvt*color5: #7d66ff ! light magenta -URxvt*color13: #D9A1E3 +URxvt*color13: #a982ff ! cyan -URxvt*color6: #06989A +URxvt*color6: #00ccff ! light cyan -URxvt*color14: #61E2E2 +URxvt*color14: #26ded2 ! white -URxvt*color7: #E0E0E0 +URxvt*color7: #d6d6d6 ! light white -URxvt*color15: #FEFEFE +URxvt*color15: #f0f0f0 ! ! URxvt*colorBD: colour diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 3ac60ec..c3af307 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -42,7 +42,7 @@ show_age_threshold = 60 # split notifications into multiple lines if they don't fit into geometry - word_wrap = yes + word_wrap = no # ignore newlines '\n' in notifications ignore_newline = no @@ -59,7 +59,7 @@ # right side of the screen. Y is measured from the top and down respectevly. # The width can be negative. In this case the actual width is the # screen width minus the width defined in within the geometry option. - geometry = "300x5-3+21" + geometry = "0x5-3+21" # The transparency of the window. range: [0; 100] # This option will only work if a compositing windowmanager is present (e.g. xcompmgr, compiz, etc..) @@ -125,7 +125,7 @@ [frame] width = 1 - color = "#a25136" + color = "#00aad4" [shortcuts] # shortcuts are specified as [modifier+][modifier+]...key @@ -152,7 +152,7 @@ timeout = 10 [urgency_critical] - background = "#a25136" + background = "#00aad4" foreground = "#fcfcfc" timeout = 0 diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart index 1b714e6..968338c 100755 --- a/.config/herbstluftwm/autostart +++ b/.config/herbstluftwm/autostart @@ -1,6 +1,6 @@ #!/bin/bash -source ~/.config/herbstluftwm/colours.sh +source ~/.config/herbstluftwm/config_vars hc() { herbstclient "$@" @@ -138,9 +138,10 @@ hc keybind Mod4-Right spawn banshee --next hc keybind Mod4-Down spawn banshee --toggle-playing # dmenu -hc keybind Mod4-0 spawn dmenu_run -p "Run:" -h 18 -nb $bg_normal -nf $fg_normal -sb $bg_focus -sf $fg_focus -hc keybind Mod4-9 spawn ~/.config/herbstluftwm/switcher.sh $bg_normal $fg_normal $bg_focus $fg_focus -hc keybind Mod4-8 spawn ~/.config/herbstluftwm/calc.sh $bg_normal $fg_normal $bg_focus $fg_focus +hc keybind Mod4-0 spawn dmenu_run -fn $dfont -p "Run:" -h 18 -nb $bg_normal -nf $fg_normal \ + -sb $bg_focus -sf $fg_focus +hc keybind Mod4-9 spawn ~/.config/herbstluftwm/switcher.sh +hc keybind Mod4-8 spawn ~/.config/herbstluftwm/calc.sh ############## end launchers ############## diff --git a/.config/herbstluftwm/calc.sh b/.config/herbstluftwm/calc.sh index 142065e..88d31df 100755 --- a/.config/herbstluftwm/calc.sh +++ b/.config/herbstluftwm/calc.sh @@ -1,5 +1,7 @@ #!/bin/bash +source ~/.config/herbstluftwm/config_vars + acc=0 in="first" prompt="calc:" @@ -25,7 +27,9 @@ command_check() { } while [ "$in" != "" ]; do - in=$(echo "" | dmenu -q -h 18 -nb $1 -nf $2 -sb $3 -sf $4 -p "$prompt") + in=$(echo "" | dmenu -fn $efont -q -h $bheight \ + -nb $bg_normal -nf $fg_normal \ + -sb $bg_focus -sf $fg_focus -p "$prompt") if [[ $(command_check "$in" "$acc") -eq 1 ]]; then break fi diff --git a/.config/herbstluftwm/config_vars b/.config/herbstluftwm/config_vars new file mode 100755 index 0000000..d5d7dff --- /dev/null +++ b/.config/herbstluftwm/config_vars @@ -0,0 +1,15 @@ +#!/bin/bash + +bg_normal='#333333' +fg_normal='#efefef' +bg_focus='#00aad4' +fg_focus='#efefef' +bg_urgent='#ff4070' +fg_urgent='#efefef' + +fg_grey='#ababab' + +bheight=18 + +dfont='-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*' +efont='-*-tamsyn-medium-*-*-*-14-*-*-*-*-*-*-*' diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index e77cf87..8e1211f 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh @@ -1,5 +1,9 @@ #!/bin/bash +########### +# SETUP # +########### + hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;} monitor=${1:-0} geometry=( $(herbstclient monitor_rect "$monitor") ) @@ -8,189 +12,238 @@ if [ -z "$geometry" ] ;then exit 1 fi # geometry has the format W H X Y -x=${geometry[0]} -y=${geometry[1]} -panel_width=${geometry[2]} -panel_height=18 -font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*" -bgcolor=$(hc get frame_border_normal_color) -selbg=$(hc get window_border_active_color) -selfg='#fefefe' - -#### -# Try to find textwidth binary. -# In e.g. Ubuntu, this is named dzen2-textwidth. -if which textwidth &> /dev/null ; then - textwidth="textwidth"; -elif which dzen2-textwidth &> /dev/null ; then - textwidth="dzen2-textwidth"; -else - echo "This script requires the textwidth tool of the dzen2 project." - exit 1 -fi -#### -# true if we are using the svn version of dzen2 -# depending on version/distribution, this seems to have version strings like -# "dzen-" or "dzen-x.x.x-svn" -if dzen2 -v 2>&1 | head -n 1 | grep -q '^dzen-\([^,]*-svn\|\),'; then - dzen2_svn="true" -else - dzen2_svn="" -fi +xpos=${geometry[0]} +ypos=${geometry[1]} +width=${geometry[2]} -if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then - # mawk needs "-W interactive" to line-buffer stdout correctly - # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 - uniq_linebuffered() { - awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" - } -else - # other awk versions (e.g. gawk) issue a warning with "-W interactive", so - # we don't want to use it there. - uniq_linebuffered() { - awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" - } -fi +# grab standardised colours +source ~/.config/herbstluftwm/config_vars -hc pad $monitor $panel_height +# set alpha for background colours +alpha='#ff' +bg_normal=$(echo -n $alpha; echo "$bg_normal" | tr -d '#') +fg_normal=$(echo -n '#ff'; echo "$fg_normal" | tr -d '#') +bg_focus=$(echo -n $alpha; echo "$bg_focus" | tr -d '#') +fg_focus=$(echo -n '#ff'; echo "$fg_focus" | tr -d '#') +bg_urgent=$(echo -n '#ff'; echo "$bg_urgent" | tr -d '#') +fg_urgent=$(echo -n '#ff'; echo "$fg_urgent" | tr -d '#') -{ - ### Event generator ### - # based on different input data (mpc, date, hlwm hooks, ...) this generates events, formed like this: - # \t [...] - # e.g. - # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 - - #mpc idleloop player & - - while true ; do - # "date" output is checked once a second, but an event is only - # generated if the output changed compared to the previous run. - date +$'date\t^fg(#efefef)%a, %b %d, %H:%M' - sleep 1 || break - done > >(uniq_linebuffered) & - childpid=$! - hc --idle - kill $childpid -} 2> /dev/null | { - IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" - visible=true - date="" - clients="" - focus_index="" - while true ; do - - ### Output ### - # This part prints dzen data based on the _previous_ data handling run, - # and then waits for the next event to happen. - - bordercolor="#26221C" - separator="^bg()^fg($selbg)|" - # draw tags - for i in "${tags[@]}" ; do - case ${i:0:1} in - '#') - echo -n "^bg($selbg)^fg($selfg)" - ;; - '+') - echo -n "^bg(#9CA668)^fg(#141414)" - ;; - ':') - echo -n "^bg()^fg(#ffffff)" - ;; - '!') - echo -n "^bg(#FF0675)^fg(#141414)" - ;; - *) - echo -n "^bg()^fg(#ababab)" - ;; - esac - # non-clickable tags, because i don't care - echo -n " ${i:1} " - done - echo -n "$separator^fg()" - - for i in "${!clients[@]}"; do - if [ $i -eq $focus_index ]; then - echo -n "^bg($selbg)^fg($selfg) ${clients[i]} ^bg()^fg()" - else - echo -n " ${clients[i]} " - fi +fg_grey=$(echo -n '#ff'; echo "$fg_grey" | tr -d '#') + +hc pad $monitor $bheight + +# global content variables +winlist="" + + + +################# +# SUBROUTINES # +################# + +# functions for retrieving and processing data +# upon events + +update_taglist() { + echo -n "%{l}%{B${bg_normal} F${fg_normal} U${fg_normal}}" + hc tag_status | tr '\t' '\n' | sed \ + -e '1d' \ + -e '$d' \ + -e 's/\(.*\)/\1 /' \ + -e 's/:/ /' \ + -e "s/[#+\-%]\(.*\)/%{B${bg_focus} F${fg_focus}} \1%{B${bg_normal} F${fg_normal}}/" \ + -e "s/!\(.*\)/%{B${bg_urgent} F${fg_urgent}} \1%{B${bg_normal} F${fg_normal}}/" \ + -e "s/\.\(.*\)/%{B${bg_normal} F${fg_grey}} \1%{B${bg_normal} F${fg_normal}}/" \ + | tr -d '\n' + echo "%{F${bg_focus}}|%{F${fg_normal}}" +} + +update_winlist() { + focus_id=$(hc get_attr clients.focus.winid) + + if [[ "$focus_id" == "" ]]; then + return + fi + + # grab current window list, limit to current desktop, + # clean up output, cut to length,add focused window + # formatting, and finally delete win ids and merge + # lines + + for c in $(herbstclient layout | grep -Eo '0x[0-9a-f]*'); do + xwininfo -id $c | sed -n 2p | sed -e 's/"//' -e 's/"$//' -e 's/$/\t/' | cut -c -70 | sed \ + -e 's/xwininfo: Window id: //' \ + -e 's/$/.../' -e 's/\t\.\.\.$//' \ + -e "s/${focus_id} \(.*\)/%{B${bg_focus} F${fg_focus}} \1 %{B${bg_normal} F${fg_normal}}/" \ + -e 's/0x[a-f0-9]* \(.*\)/ \1 /' | tr -d '\n' done +} + + + +####################### +# OUTPUT CONTAINERS # +####################### + +# all fields are put in separate elements + +# tag list +fields[1]=$(update_taglist) +# window list +fields[2]=$(update_winlist) +# align right +fields[3]="%{r}" +# when +fields[4]="" +# banshee np +fields[5]="" +# conky stats +fields[6]="" +# date +fields[7]="" +# vertical separator and gap for tray +fields[8]="%{F${bg_focus}}| %{F${fg_normal}}" - # small adjustments - right="$separator^bg() $date $separator" - right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') - # get width of right aligned text.. and add some space.. - width=$($textwidth "$font" "$right_text_only ") - echo -n "^pa($(($panel_width - $width)))$right" - echo - - ### Data handling ### - # This part handles the events generated in the event loop, and sets - # internal variables based on them. The event and its arguments are - # read into the array cmd, then action is taken depending on the event - # name. - # "Special" events (quit_panel/togglehidepanel/reload) are also handled - # here. - - # wait for next event - IFS=$'\t' read -ra cmd || break - # find out event origin - case "${cmd[0]}" in - tag*) - #echo "resetting tags" >&2 - IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" - ;; - date) - #echo "resetting date" >&2 - date="${cmd[@]:1}" - ;; - quit_panel) - exit - ;; - togglehidepanel) - currentmonidx=$(hc list_monitors | sed -n '/\[FOCUS\]$/s/:.*//p') - if [ "${cmd[1]}" -ne "$monitor" ] ; then - continue - fi - if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ] ; then - continue - fi - echo "^togglehide()" - if $visible ; then - visible=false - hc pad $monitor 0 - else - visible=true - hc pad $monitor $panel_height - fi - ;; - reload) - exit - ;; - focus_changed|window_title_changed) - clients=($(herbstclient layout | grep -Eo '0x[0-9a-f]*')) focus_client=$(herbstclient get_attr clients.focus.winid) - focus_index="" - hc_args="herbstclient chain" - for i in "${!clients[@]}"; do - if [ "${clients[i]}" == "$focus_client" ]; then - focus_index=$i + +###################### +# EVENT GENERATORS # +###################### + +# loops for generating a line of information, +# with the first element in the line as a +# unique identifier for the event type + +get_stat() { + { + conky -c ~/.config/herbstluftwm/panel/conky_stats + # suppress lines that do not differ from + # previous lines + } | awk '$0 != l { print ; l=$0 ; fflush(); }' +} + +get_date() { + { + while true; do + date +$'date\t%a, %b %d, %H:%M:%S' + sleep 1 + done + } | awk '$0 != l { print ; l=$0 ; fflush(); }' +} + +get_when() { + { + while true; do + if [[ "$(when --future=1 | sed '1,2d')" == "" ]]; then + echo -e 'when\t0' + else + echo -e 'when\t1' fi - hc_args="$hc_args"" .-. get_attr clients.""${clients[i]}"".instance .-. echo" + sleep 10 done + } | awk '$0 != l { print ; l=$0 ; fflush(); }' +} + + + +####################### +# EVENT MULTIPLEXER # +####################### + +# the loops defined above are launched and +# their outputs multiplexed + +{ + get_stat & + child[1]=$! + get_date & + child[2]=$! + get_when & + child[3]=$! + + hc --idle + + for id in ${child[@]}; do + kill $id + done +} 2> /dev/null | { + + + +################## +# EVENT PARSER # +################## - clients=($($hc_args)) - ;; - #player) - # ;; - esac - done +# those lines are then read, one by one, +# and the information contained used to +# generate the required fields - ### dzen2 ### - # After the data is gathered and processed, the output of the previous block - # gets piped to dzen2. + while true; do + + # split our read lines into an array + # for easy parsing + IFS=$'\t' read -ra event || break + + # determine event type and act + # accordingly + case "${event[0]}" in + date) + fields[7]="%{F${bg_focus}}|%{F${fg_normal} A:date:} ${event[@]:1} %{A}" + ;; + stats) + fields[6]="%{F${bg_focus}}|%{F${fg_normal} A:stats:} ${event[@]:1} %{A}" + ;; + when) + if [[ "${events[1]}" -eq 1 ]]; then + fields[4]="%{F${bg_focus}}|%{F${fg_normal} A:when:} * %{A}" + else + fields[4]="" + fi + ;; -} 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \ - -e 'button3=;button4=exec:herbstclient use_index -1;button5=exec:herbstclient use_index +1' \ - -ta l -bg "$bgcolor" -fg '#efefef' + # hc events + focus_changed|window_title_changed) + fields[2]=$(update_winlist) + ;; + tag_changed|tag_flags) + fields[1]=$(update_taglist) + fields[2]=$(update_winlist) + ;; + + *) + ;; + esac + + # i wish i could just print the entire array + # this easily, but that inserts spaces + #echo "${fields[@]}" + echo -n "${fields[1]}${fields[2]}${fields[3]}${fields[4]}" + echo "${fields[5]}${fields[6]}${fields[7]}${fields[8]}" + + done + + # pass the events into bar +} 2> /dev/null | bar -f $dfont -g${width}x${bheight}+${xpos}+${ypos} \ + -B ${bg_normal} -F ${fg_normal} | \ +{ + +##################### +# COMMAND HANDLER # +##################### + +# finally, take the output from bar and execute commands + while read command; do + case "$command" in + date) + notify-send "$(cal)" + ;; + stats) + urxvt -e htop + ;; + when) + notify-send "$(when)" + ;; + *) + ;; + esac + done +} diff --git a/.config/herbstluftwm/panel/conky_stats b/.config/herbstluftwm/panel/conky_stats new file mode 100644 index 0000000..a425958 --- /dev/null +++ b/.config/herbstluftwm/panel/conky_stats @@ -0,0 +1,9 @@ +background no +out_to_console yes +out_to_x no +update_interval 2.0 +total_run_times 0 +use_spacer none + +TEXT +stats mem: %%${memperc} cpu: %%${cpu cpu0} diff --git a/.config/herbstluftwm/switcher.sh b/.config/herbstluftwm/switcher.sh index 4d570c2..a19fe6e 100755 --- a/.config/herbstluftwm/switcher.sh +++ b/.config/herbstluftwm/switcher.sh @@ -1,7 +1,12 @@ #!/bin/zsh +source ~/.config/herbstluftwm/config_vars + IFS=$'\r\n' clients=($(wmctrl -l | cut -c -10)) -number=$(wmctrl -l | cut -c 20- | nl -w 2 -s ") " | dmenu -i -h 18 -nb $1 -nf $2 -sb $3 -sf $4 -p "Select:" -l 40 | grep -oE '[0-9]' | head -1) +number=$(wmctrl -l | cut -c 20- | nl -w 2 -s ") " | \ + dmenu -fn $efont -i -h $bheight -nb $bg_normal -nf $fg_normal \ + -sb $bg_focus -sf $fg_focus -p "Select:" -l 40 | \ + grep -oE '[0-9]' | head -1) if [ $number ]; then herbstclient jumpto ${clients[$(expr $number - 1)]} fi diff --git a/.config/herbstluftwm/tray.sh b/.config/herbstluftwm/tray.sh index cef5fb5..61e6310 100755 --- a/.config/herbstluftwm/tray.sh +++ b/.config/herbstluftwm/tray.sh @@ -1,12 +1,13 @@ #!/bin/bash hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;} -bgcolor=$(hc get frame_border_normal_color) + +source ~/.config/herbstluftwm/config_vars run="" while [ -z "$run" ]; do sleep .5 - run=$(ps -e | grep dzen2) + run=$(ps -e | grep bar) echo "$run" done -trayer --edge top --align right --heighttype pixel --height 18 --widthtype pixel --width 18 --distancefrom right --distance 4 +trayer --edge top --align right --heighttype pixel --height $bheight --widthtype pixel --width $bheight --distancefrom right --distance 4 diff --git a/.config/nitrogen/bg-saved.cfg b/.config/nitrogen/bg-saved.cfg index 7d0eb17..15c602b 100644 --- a/.config/nitrogen/bg-saved.cfg +++ b/.config/nitrogen/bg-saved.cfg @@ -1,4 +1,4 @@ [:0.0] -file=/home/shmibs/backdrops/burn-orange.png +file=/home/shmibs/backdrops/arch-sloppity.png mode=5 bgcolor=#000000 diff --git a/.xinitrc b/.xinitrc index 62aba2b..3012257 100644 --- a/.xinitrc +++ b/.xinitrc @@ -22,6 +22,10 @@ fcitx & sxiv -c export XDG_CACHE_HOME=/home/shmibs/.cache +#load local fonts +xset +fp /usr/share/fonts/local +xset fp rehash + #disable power saving xset -dpms xset s off diff --git a/README.md b/README.md index 00cc01c..92a3d0d 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,6 @@ suddenly a browser is no longer a thing that necessarily breaks your workflow when you have to refer to it for information. oh, and try [setting your hint keys](http://5digits.org/pentadactyl/faq#faq-hintkeys). -###dunst/dmenu/stalonetray/compton/dzen2/nitrogen -useful things all around. i haven't bothered with -any fancy-pants dmenu configs just yet. maybe after -finishing up with dzen2 and (maybe) switching to -zsh (now that i have an ssd and completions don't -take forever to load). +###dunst/dmenu/trayer/compton/bar/nitrogen +useful things all around. i'm still trying to figure out +alternative mouse buttons with bar. -- cgit v1.2.3