From 626d49c4729690c27b26b4f14196695bad29533b Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 16:58:07 +0200 Subject: Switched to lemonbar-xft-git --- herbstluftwm/.config/herbstluftwm/autostart | 61 +++---- herbstluftwm/.config/herbstluftwm/dependencylist | 4 +- herbstluftwm/.config/herbstluftwm/panel.sh | 176 --------------------- herbstluftwm/.config/herbstluftwm/panel_handler.sh | 17 ++ .../.config/herbstluftwm/panel_indicators.sh | 8 +- .../.config/herbstluftwm/populate_panel.sh | 137 ++++++++++++++++ herbstluftwm/.config/herbstluftwm/start.sh | 2 +- herbstluftwm/.config/herbstluftwm/start_panel.sh | 33 ++++ herbstluftwm/.config/herbstluftwm/theme | 34 ---- herbstluftwm/.config/herbstluftwm/themes/current | 1 + herbstluftwm/.config/herbstluftwm/themes/purpur | 34 ++++ 11 files changed, 254 insertions(+), 253 deletions(-) delete mode 100755 herbstluftwm/.config/herbstluftwm/panel.sh create mode 100755 herbstluftwm/.config/herbstluftwm/panel_handler.sh mode change 100644 => 100755 herbstluftwm/.config/herbstluftwm/panel_indicators.sh create mode 100755 herbstluftwm/.config/herbstluftwm/populate_panel.sh create mode 100755 herbstluftwm/.config/herbstluftwm/start_panel.sh delete mode 100644 herbstluftwm/.config/herbstluftwm/theme create mode 120000 herbstluftwm/.config/herbstluftwm/themes/current create mode 100644 herbstluftwm/.config/herbstluftwm/themes/purpur (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index 7a80b1c..78a81b4 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -1,17 +1,16 @@ #!/usr/bin/env bash -# this is a simple config for herbstluftwm - -# The current directory -dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - # Herbstclient shortcut hc() { herbstclient "$@" } +export -f hc + +# The current directory +export HLWM_CONF_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) #Include the theming script -source "$dir/theme" +source "$HLWM_CONF_DIR/themes/current" #Detect monitors hc set auto_detect_monitors 1 @@ -26,17 +25,16 @@ dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $color tag_names=() tag_keys=({1..9} 0) for key in ${tag_keys[@]}; do - if [ $key -eq 0 ]; then key=10; fi - key=$(echo "$key - 1" | bc) - echo $key - name=$(echo "obase=2;$key" | bc | awk '{ printf "%04d", $0 }') - tag_names+=($name) + if [ $key -eq 0 ]; then key=10; fi + key=$(echo "$key - 1" | bc) + name=$(echo "obase=2;$key" | bc | awk '{ printf "%04d", $0 }') + tag_names+=($name) done; # Source hlwm-config-files -source "$dir/hlwm-keybindings" -source "$dir/hlwm-theming" -source "$dir/hlwm-rules" +source "$HLWM_CONF_DIR/hlwm-keybindings" +source "$HLWM_CONF_DIR/hlwm-theming" +source "$HLWM_CONF_DIR/hlwm-rules" # Unlock, just to be sure hc unlock @@ -44,29 +42,20 @@ hc unlock herbstclient set tree_style '╾│ ├└╼─┐' # Start panel in all monitors -start_panel() { - for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do - "$1" $monitor& - done -} - -# Find the panel -panel=$dir/panel.sh +panel=$HLWM_CONF_DIR/start_panel.sh [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh -if pgrep panel.sh >> /dev/null -then - kill $(pgrep panel.sh) - start_panel $panel -else - start_panel $panel -fi +for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do + $panel $monitor& +done pulseaudio --start -$dir/start.sh "xautolock -time 5 -locker $dir/lock.sh" -$dir/start.sh "feh --bg-fill $wallpaper" -$dir/start.sh "compton --config $HOME/.compton" -$dir/start.sh "xrdb -load $HOME/.Xresources" -$dir/start.sh "xset +fp /usr/share/fonts/local" -$dir/start.sh "xset fp rehash" -#$dir/start.sh "$dir/notify.sh $dir/popup.sh" +$HLWM_CONF_DIR/start.sh "xautolock -time 5 -locker $HLWM_CONF_DIR/lock.sh" +$HLWM_CONF_DIR/start.sh "feh --bg-fill $wallpaper" +$HLWM_CONF_DIR/start.sh "compton --config $HOME/.compton" +$HLWM_CONF_DIR/start.sh "xrdb -load $HOME/.Xresources" +$HLWM_CONF_DIR/start.sh "xset +fp /usr/share/fonts/local" +$HLWM_CONF_DIR/start.sh "xset fp rehash" +#$HLWM_CONF_DIR/start.sh "$HLWM_CONF_DIR/notify.sh $HLWM_CONF_DIR/popup.sh" + +# vim: set ts=4 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/dependencylist b/herbstluftwm/.config/herbstluftwm/dependencylist index e62c3af..34c9bf9 100644 --- a/herbstluftwm/.config/herbstluftwm/dependencylist +++ b/herbstluftwm/.config/herbstluftwm/dependencylist @@ -4,12 +4,12 @@ compton dmenu2 feh i3lock -lemonbar-git +lemonbar-xft-git playerctl pulseaudio pulseaudio-alsa scrot sed -stlarch_font +ttf-font-awesome wireless_tools xautolock diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh deleted file mode 100755 index 70e8154..0000000 --- a/herbstluftwm/.config/herbstluftwm/panel.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash - -dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) - -hc() { - "${herbstclient_command[@]:-herbstclient}" "$@" -} - -source "$dir/theme" -source "$dir/panel_indicators.sh" - -monitor=${1:-0} - -geometry=($(herbstclient monitor_rect "$monitor")) -if [ -z "$geometry" ] ;then - echo "Invalid monitor $monitor" - exit 1 -fi - -# Geometry has the format W H X Y -x=$(echo "${geometry[0]} + $window_p" | bc) -y=$(echo "${geometry[1]} + $window_p" | bc) - -panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc) -bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font -f $icon_font -u 2 -B $acolor_bg -F $acolor_fg" - -hc pad $monitor $(echo "$panel_h + $window_p" | bc) - -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 - -{ - ### Event generator ### - # \t [...] - # e.g. - # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 - - while true ; do - music & - volume & - network & - battery & - clock & - 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="" - volume="" - battery="" - net="" - windowtitle="" - - separator="%{F$acolor_accent}|%{F-}" - - while true ; do - - for i in "${tags[@]}" ; do - case ${i:0:1} in - '#') - echo -n "%{U$acolor_accent+u}%{F$acolor_fg}" - ;; - '+') - echo -n "%{U$acolor_fg+u}%{F$acolor_fg}" - ;; - ':') - echo -n "%{F$acolor_fg}" - ;; - '!') - echo -n "%{B$acolor_accent}%{U$acolor_accent+u}%{F$acolor_bg}" - ;; - *) - echo -n "%{F$acolor_fg}" - ;; - esac - echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" - done - - echo -n "$separator%{F-}%{B-} " - echo -n "${windowtitle//^/^^}" - - # Right part of panel - right="$music$volume$net$battery$date " - echo -n "%{r}$right" - - #DO NOT REMOVE THIS ECHO - echo - - # wait for next event - IFS=$'\t' read -ra cmd || break - case "${cmd[0]}" in - tag*) - #echo "resetting tags" >&2 - IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" - ;; - music) - music="${cmd[@]:1}" - if [ $music == "off" ] ; then - music="" - else - music="$music $separator%{B-} " - fi - ;; - volume) - volume="${cmd[@]:1}" - if [ $volume == "off" ] ; then - volume="" - else - volume="$volume $separator%{B-} " - fi - ;; - net) - net="${cmd[@]:1}" - if [ $net = "off" ] ; then - net="" - else - net="$net $separator%{B-} " - fi - ;; - battery) - battery="${cmd[@]:1}" - if [ $battery == "off" ] ; then - battery="" - else - battery="$battery $separator%{B-} " - fi - ;; - date) - #echo "resetting date" >&2 - date="${cmd[@]:1}" - ;; - focus_changed|window_title_changed) - windowtitle="${cmd[@]:2}" - ;; - esac - done - -} 2> /dev/null | lemonbar $bar_opts | { - - #Handle clickable areas - while read line; do - IFS=',' read -a c <<< $(echo $line) - case "${c[0]}" in - tag) - herbstclient use "${c[1]}" - echo "herbstclient use \"${c[1]}\"" - ;; - *) - echo "${c[0]}: not valid command" - ;; - esac - done - -} - -# vim: set ts=4 sw=4 tw=80 et : diff --git a/herbstluftwm/.config/herbstluftwm/panel_handler.sh b/herbstluftwm/.config/herbstluftwm/panel_handler.sh new file mode 100755 index 0000000..6bff693 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/panel_handler.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +#Handle clickable areas +while read line; do + IFS=',' read -a c <<< $(echo $line) + case "${c[0]}" in + tag) + herbstclient use "${c[1]}" + echo "herbstclient use \"${c[1]}\"" + ;; + *) + echo "${c[0]}: not valid command" + ;; + esac +done + +# vim: set ts=4 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh old mode 100644 new mode 100755 index a433e3a..ad45d75 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -1,7 +1,7 @@ -#!/bin/bash -icon_font="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*" +#!/usr/bin/env bash +icon_font="FontAwesome-10" battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") -network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "%{T2}\ue0af%{T-}") +network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") music_icon="\ue05c" music() @@ -43,7 +43,7 @@ volume() if [ -z $vol ] ; then echo -e "volume\toff" else - echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%%{F-}" + echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%{F-}" fi else echo -e "volume\toff" diff --git a/herbstluftwm/.config/herbstluftwm/populate_panel.sh b/herbstluftwm/.config/herbstluftwm/populate_panel.sh new file mode 100755 index 0000000..07ecafd --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/populate_panel.sh @@ -0,0 +1,137 @@ +#!/usr/bin/env bash + +source "$HLWM_CONF_DIR/themes/current" +source "$HLWM_CONF_DIR/panel_indicators.sh" + +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 + +{ + ### Event generator ### + # \t [...] + # e.g. + # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 + + while true ; do + music & + volume & + network & + battery & + clock & + 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="" + volume="" + battery="" + net="" + windowtitle="" + + separator="%{F$acolor_accent}|%{F-}" + + while true ; do + + for i in "${tags[@]}" ; do + case ${i:0:1} in + '#') + echo -n "%{U$acolor_accent+u}%{F$acolor_fg}" + ;; + '+') + echo -n "%{U$acolor_fg+u}%{F$acolor_fg}" + ;; + ':') + echo -n "%{F$acolor_fg}" + ;; + '!') + echo -n "%{B$acolor_accent}%{U$acolor_accent+u}%{F$acolor_bg}" + ;; + *) + echo -n "%{F$acolor_fg}" + ;; + esac + echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" + done + + echo -n "$separator%{F-}%{B-} " + echo -n "${windowtitle//^/^^}" + + # Right part of panel + right="$music$volume$net$battery$date " + echo -n "%{r}$right" + + #DO NOT REMOVE THIS ECHO + echo + + # wait for next event + IFS=$'\t' read -ra cmd || break + case "${cmd[0]}" in + tag*) + #echo "resetting tags" >&2 + IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" + ;; + music) + music="${cmd[@]:1}" + if [ $music == "off" ] ; then + music="" + else + music="$music $separator%{B-} " + fi + ;; + volume) + volume="${cmd[@]:1}" + if [ $volume == "off" ] ; then + volume="" + else + volume="$volume $separator%{B-} " + fi + ;; + net) + net="${cmd[@]:1}" + if [ $net = "off" ] ; then + net="" + else + net="$net $separator%{B-} " + fi + ;; + battery) + battery="${cmd[@]:1}" + if [ $battery == "off" ] ; then + battery="" + else + battery="$battery $separator%{B-} " + fi + ;; + date) + #echo "resetting date" >&2 + date="${cmd[@]:1}" + ;; + focus_changed|window_title_changed) + windowtitle="${cmd[@]:2}" + ;; + esac + done + +} 2> /dev/null + +# vim: set ts=4 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/start.sh b/herbstluftwm/.config/herbstluftwm/start.sh index f10fca6..53b9e45 100755 --- a/herbstluftwm/.config/herbstluftwm/start.sh +++ b/herbstluftwm/.config/herbstluftwm/start.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash opts=($@) diff --git a/herbstluftwm/.config/herbstluftwm/start_panel.sh b/herbstluftwm/.config/herbstluftwm/start_panel.sh new file mode 100755 index 0000000..6894d79 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/start_panel.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +source "$HLWM_CONF_DIR/themes/current" + +# Check for valid monitors +monitor=${1:-0} +geometry=($(herbstclient monitor_rect "$monitor")) +if [ -z "$geometry" ] ;then + echo "Invalid monitor $monitor" + exit 1 +fi + +# Make sure only one instanve per monitor is running +lockfile="/tmp/start_panel-$monitor.lck" +if [ -e "$lockfile" ] && kill -0 $(cat $lockfile); then + pkill -P $(cat $lockfile) +fi +trap "rm -f $lockfile; exit" INT TERM EXIT +echo "$$" > "$lockfile" + +# Geometry has the format W H X Y +x=$(echo "${geometry[0]} + $window_p" | bc) +y=$(echo "${geometry[1]} + $window_p" | bc) +panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc) + +# Apply padding to make room for the panel +hc pad $monitor $(echo "$panel_h + $window_p" | bc) + +# Start the panel +$HLWM_CONF_DIR/populate_panel.sh | +lemonbar -g ${panel_width}x${panel_h}+${x}+${y} -f "$font" -f "$icon_font" -u2 -B$acolor_bg -F$acolor_fg | +$HLWM_CONF_DIR/panel_handler.sh + +# vim: set ts=4 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/theme b/herbstluftwm/.config/herbstluftwm/theme deleted file mode 100644 index d0e48da..0000000 --- a/herbstluftwm/.config/herbstluftwm/theme +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -# Get color from ~/.Xresources -get_x_color() { - xresources=$(cat ~/.Xresources) - color=$(echo $xresources | sed "s/.*\*color$1: \(\#[0-9A-Fa-f]*\).*/\1/") - echo $color -} - -# Add alpha channel to a hexadecimal color -add_alpha_channel(){ - echo "$1" | \ - sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/" -} - -# Wallpaper -wallpaper="$HOME/.config/herbstluftwm/poligons.png" - -# Padding -window_p=20 - -# Panel -panel_h=24 -font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" - -# Colors -color_fg=$(get_x_color 15) -color_accent=$(get_x_color 5) -color_bg=$(get_x_color 0) - -# Alpha Colors for use with bar -acolor_fg=$(add_alpha_channel $color_fg) -acolor_accent=$(add_alpha_channel $color_accent) -acolor_bg=$(add_alpha_channel $color_bg) diff --git a/herbstluftwm/.config/herbstluftwm/themes/current b/herbstluftwm/.config/herbstluftwm/themes/current new file mode 120000 index 0000000..8a80c5f --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/themes/current @@ -0,0 +1 @@ +purpur \ No newline at end of file diff --git a/herbstluftwm/.config/herbstluftwm/themes/purpur b/herbstluftwm/.config/herbstluftwm/themes/purpur new file mode 100644 index 0000000..5fedc6d --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/themes/purpur @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Get color from ~/.Xresources +get_x_color() { + xresources=$(cat ~/.Xresources) + color=$(echo $xresources | sed "s/.*\*color$1: \(\#[0-9A-Fa-f]*\).*/\1/") + echo $color +} + +# Add alpha channel to a hexadecimal color +add_alpha_channel(){ + echo "$1" | \ + sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/" +} + +# Wallpaper +wallpaper="$HOME/.config/herbstluftwm/poligons.png" + +# Padding +window_p=20 + +# Panel +panel_h=25 +font="DejaVu Sans Mono-10" + +# Colors +color_fg=$(get_x_color 15) +color_accent=$(get_x_color 5) +color_bg=$(get_x_color 0) + +# Alpha Colors for use with bar +acolor_fg=$(add_alpha_channel $color_fg) +acolor_accent=$(add_alpha_channel $color_accent) +acolor_bg=$(add_alpha_channel $color_bg) -- cgit v1.2.3