diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2015-11-03 00:17:53 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2015-11-03 00:17:53 -0300 |
commit | f852bfd75bec7e53febeb3e753fce5752b423d97 (patch) | |
tree | 8a6d843950435eb4ef756938863ed326b2faeec3 /herbstluftwm | |
parent | 50787494e9dcbed9fa3caa96cba46a0c40d321d8 (diff) | |
download | dotfiles-f852bfd75bec7e53febeb3e753fce5752b423d97.tar.gz |
Update herbstluftwm
Diffstat (limited to 'herbstluftwm')
-rwxr-xr-x | herbstluftwm/autostart | 21 | ||||
-rwxr-xr-x | herbstluftwm/bin/dmenu_wrapper | 11 | ||||
-rwxr-xr-x | herbstluftwm/bin/mvrs.sh (renamed from herbstluftwm/mvrs.sh) | 7 | ||||
-rw-r--r-- | herbstluftwm/fn.sh | 6 | ||||
-rwxr-xr-x | herbstluftwm/panel.bar.sh | 157 | ||||
-rwxr-xr-x | herbstluftwm/panel.sh | 10 | ||||
-rwxr-xr-x | herbstluftwm/popups.sh | 11 |
7 files changed, 45 insertions, 178 deletions
diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 444d17a..89842c6 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -10,15 +10,13 @@ hc() { cmd+=(, $@) } -mvrs() { - ~/.config/herbstluftwm/mvrs.sh $1 $2 -} +source ${HOME}/.config/herbstluftwm/fn.sh hc emit_hook reload # Some autostart configuration nitrogen --restore & -#compton -b +mpd # remove all existing keybindings hc keyunbind --all @@ -33,8 +31,9 @@ hc keybind $Mod-Shift-r reload hc keybind $Mod-Shift-c close #hc keybind $Mod-Return spawn st hc keybind $Mod-Return spawn xterm -#hc keybind $Mod-p spawn dmenu_run -b -p $(hostname) -nb "#010101" -hc keybind $Mod-p spawn rofi -show run +hc keybind $Mod-p spawn ${HOME}/.config/herbstluftwm/bin/dmenu_wrapper +# Have better unicode support +hc keybind $Mod-n spawn gvim ~/.notes # basic movement # focusing clients @@ -58,10 +57,10 @@ hc keybind $Mod-Control-space split explode # resizing frames resizestep=0.02 -hc keybind $Mod-Control-h spawn ~/.config/herbstluftwm/mvrs.sh left +$resizestep -hc keybind $Mod-Control-j spawn ~/.config/herbstluftwm/mvrs.sh down +$resizestep -hc keybind $Mod-Control-k spawn ~/.config/herbstluftwm/mvrs.sh up +$resizestep -hc keybind $Mod-Control-l spawn ~/.config/herbstluftwm/mvrs.sh right +$resizestep +hc keybind $Mod-Control-h spawn ~/.config/herbstluftwm/bin/mvrs.sh left +$resizestep +hc keybind $Mod-Control-j spawn ~/.config/herbstluftwm/bin/mvrs.sh down +$resizestep +hc keybind $Mod-Control-k spawn ~/.config/herbstluftwm/bin/mvrs.sh up +$resizestep +hc keybind $Mod-Control-l spawn ~/.config/herbstluftwm/bin/mvrs.sh right +$resizestep hc keybind $Mod-Control-Left resize left +$resizestep hc keybind $Mod-Control-Down resize down +$resizestep hc keybind $Mod-Control-Up resize up +$resizestep @@ -133,7 +132,7 @@ hc set frame_bg_active_color '#151515' hc set frame_border_width 0 hc set window_border_width 2 hc set window_border_normal_color '#3a3a3a' -hc set window_border_active_color '#cc342b' +hc set window_border_active_color "$(xrdb -q | grep color4 | awk '{ print $2; }')" #hc attr theme.active.color '#9E003A' #hc attr theme.normal.color '#252525' diff --git a/herbstluftwm/bin/dmenu_wrapper b/herbstluftwm/bin/dmenu_wrapper new file mode 100755 index 0000000..7d9dccf --- /dev/null +++ b/herbstluftwm/bin/dmenu_wrapper @@ -0,0 +1,11 @@ +#!/bin/bash + +# Wrapper around dmenu for some problems with the loading of the font. + +get_xresources() { + arr=( $(xrdb -q | grep $1 | head -1) ) + echo -n "${arr[@]:1}" +} + +dmenu_run -b -p $(hostname) -nb $(get_xresources background) -sb $(get_xresources color4) -sf $(get_xresources foreground) -fn "$(get_xresources face | sed 's/ /\\ /g')" + diff --git a/herbstluftwm/mvrs.sh b/herbstluftwm/bin/mvrs.sh index f7b3c14..65b5733 100755 --- a/herbstluftwm/mvrs.sh +++ b/herbstluftwm/bin/mvrs.sh @@ -17,20 +17,25 @@ else case $1 in left) + echo match left width=$(($width - ${resizestep})) ;; right) + echo match right width=$(($width + ${resizestep})) ;; up) + echo match up height=$(($height - ${resizestep})) ;; down) + # Dunno, this is weird + resizestep=20 height=$(($height + ${resizestep})) ;; esac + echo resizing to ${winid} $width $height ~/.config/herbstluftwm/bin/mvrs ${winid} $width $height fi - diff --git a/herbstluftwm/fn.sh b/herbstluftwm/fn.sh new file mode 100644 index 0000000..dd7b4ce --- /dev/null +++ b/herbstluftwm/fn.sh @@ -0,0 +1,6 @@ + +get_xresources() { + arr=( $(xrdb -q | grep $1 | head -1) ) + echo -n "${arr[@]:1}" +} + diff --git a/herbstluftwm/panel.bar.sh b/herbstluftwm/panel.bar.sh deleted file mode 100755 index 88f7ab1..0000000 --- a/herbstluftwm/panel.bar.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash - -# todo: fontello icons - -# disable path name expansion or * will be expanded in the line -# cmd=( $line ) -set -f - -function uniq_linebuffered() { - awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" -} -function get_mpd_song() { - # use mpc to get currently playing song, uppercase it - song=$(mpc current -f %title%) - # let's skip ft. parts, etc. to get some more space - echo $song -} - -monitor=${1:-0} - -separator="\f3 | \fr" -song=$(get_mpd_song) -windowtitle="" - -herbstclient pad $monitor 18 -{ - # events: - # mpc events - mpc idleloop player & - mpc_pid=$! - - # date - while true ; do - date +'date_day %A %e. ' - date +'date_min %H:%M ' - sleep 1 || break - done > >(uniq_linebuffered) & - date_pid=$! - - while true - do - $HOME/scripts/battery-parse - sleep 2m || break - done & - battery_pid=$! - - while true - do - $HOME/scripts/nm-connected-device - sleep 3m || break - done & - nm_status_pid=$! - - # hlwm events - herbstclient --idle - - # exiting; kill stray event-emitting processes - kill $date_pid $mpd_pid $battery_pid $nm_status_pid -} 2> /dev/null | { - TAGS=( $(herbstclient tag_status $monitor) ) - #unset TAGS[${#TAGS[@]}-1] - date_day="" - date_min="" - Battery="" - network_status="" - visible=true - - while true ; do - # align left - echo -n "\l" - if [[ $windowtitle ]] - then - if [ ${#windowtitle} -gt 55 ] - then - windowtitle="$(echo -n $windowtitle | cut -c1-55)..." - fi - echo -n "\ur\fr$windowtitle$separator" - fi - - # Align center - echo -n "\c" - for i in "${TAGS[@]}" ; do - case ${i:0:1} in - '#') # current tag - echo -n "\u4\b4\fr" - ;; - '+') # active on other monitor - echo -n "\u7\b7\f8" - ;; - ':') - # Tag with windows - echo -n "\ur\br\f4" - ;; - '!') # urgent tag - echo -n "\u1\br\f1" - ;; - *) - echo -n "\ur\br\fr" - ;; - esac - echo -n " ${i:1} " # | tr '[:lower:]' '[:upper:]' - done - - # align right - echo -n "\r\ur\fr\br" - # display song and separator only if something's playing - if [[ $song ]]; then - if [ ${#song} -gt 30 ] - then - song="$(echo -n $song | cut -c1-30)..." - fi - echo -n "\ur\fr$song$separator" - fi - echo -n "$network_status" - echo -n "$separator" - echo -n "$Battery" - echo -n "$separator" - echo -n "$date_day" | tr '[:lower:]' '[:upper:]' - echo -n " \f2" - echo -n "$date_min " | tr '[:lower:]' '[:upper:]' - echo - # wait for next event - read line || break - cmd=( $line ) - # find out event origin - case "${cmd[0]}" in - tag*) - TAGS=( $(herbstclient tag_status $monitor) ) - #unset TAGS[${#TAGS[@]}-1] - ;; - date_day) - date_day="${cmd[@]:1}" - ;; - date_min) - date_min="${cmd[@]:1}" - ;; - player) - song=$(get_mpd_song) - ;; - focus_changed|window_title_changed) - windowtitle="${cmd[@]:2}" - ;; - Battery) - Battery="${cmd[1]} ${cmd[2]}" - ;; - network) - network_status="${cmd[1]} ${cmd[2]}" - ;; - quit_panel) - exit - ;; - reload) - exit - ;; - esac - done -} 2> /dev/null | bar $1 diff --git a/herbstluftwm/panel.sh b/herbstluftwm/panel.sh index 035bcf5..b17eb6d 100755 --- a/herbstluftwm/panel.sh +++ b/herbstluftwm/panel.sh @@ -12,12 +12,12 @@ x=${geometry[0]} y=${geometry[1]} panel_width=${geometry[2]} panel_height=16 -font="-Misc-Termsyn.Icons-Medium-R-Normal--11-79-100-100-C-60-ISO8859-1" +#font="-Misc-Termsyn.Icons-Medium-R-Normal--11-79-100-100-C-60-ISO8859-1" #font="-*-envy code r-*-*-*-*-11-*-*-*-*-*-*-*" -# font="DejaVu Sans Mono" +font="-*-fira mono-*-*-*-*-10-*-*-*-*-*-*-*" bgcolor=$(hc get frame_border_normal_color) selbg=$(hc get window_border_active_color) -selfg='#101010' +selfg='#efefef' popups="/home/matias/.config/herbstluftwm/popups.sh" #### @@ -154,7 +154,7 @@ hc pad $monitor $panel_height # get width of right aligned text.. and add some space.. width=$($textwidth "$font" "$right_text_only ") - echo -n "^pa($(($panel_width - $width + 22)))$(printf "$right")" + echo -n "^pa($(($panel_width - $width + 4)))$(printf "$right")" echo ### Data handling ### @@ -206,7 +206,7 @@ hc pad $monitor $panel_height player) if [[ x"${cmd[@]:1}" != "x" ]] then - song="^ca(1, ${popups} music) \uEA ^ca()" + song="^ca(1, ${popups} music) music^ca()" else song="wep" fi diff --git a/herbstluftwm/popups.sh b/herbstluftwm/popups.sh index 0ba7d86..db75c0b 100755 --- a/herbstluftwm/popups.sh +++ b/herbstluftwm/popups.sh @@ -1,17 +1,20 @@ #!/bin/bash -dzen_bg="#444040" +source ${HOME}/.config/herbstluftwm/fn.sh + +dzen_bg="$(get_xresources foreground)" +dzen_fg="$(get_xresources background)" calendary() { ( cal - ) | dzen2 -p -bg "${dzen_bg}" -x "1195" -y "25" -w "165" -h "20" -l "5" -sa "c" -ta "c" \ + ) | dzen2 -p -bg "${dzen_bg}" -fg "${dzen_fg}" -x "1195" -y "27" -w "165" -h "20" -l "5" -sa "c" -ta "c" \ -title-name "popup_sysinfo" -e 'onstart=uncollapse;button1=exit;button3=exit' } position(){ pos=$(mpc | awk 'NR==2' | awk '{print $4}' | sed 's/(//' | sed 's/%)//') - bar=$(echo $pos | gdbar -w $1 -h 1.5 -fg "#FF3D00" -bg "#821D00") + bar=$(echo $pos | gdbar -w $1 -h 3.5 -fg "$(get_xresources color4)" -bg "$(get_xresources color8)") echo -n "$bar" return } @@ -31,7 +34,7 @@ music() { ^p($padding)^ca(1,mpc prev)Prev^ca() ^ca(1,mpc toggle)Play/Pause^ca() ^ca(1,mpc stop)Stop^ca() ^ca(1,mpc next)Next^ca() ^p($padding)$(position $(($popup_width - $padding)) )" 2> /dev/null sleep 1 - done | dzen2 -p -bg "${dzen_bg}" -y 25 -x 967 -l 5 -u -w $(($popup_width + $padding)) -ta l -title-name "popup_mpd" -e 'onstart=uncollapse;button3=exit' + done | dzen2 -p -bg "${dzen_bg}" -fg "${dzen_fg}" -y 27 -x 1087 -l 5 -u -w $(($popup_width + $padding)) -ta l -title-name "popup_mpd" -e 'onstart=uncollapse;button3=exit' } case $1 in |