From 65d35ade50a86fc3ab146057213755cc74310885 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Wed, 19 Aug 2015 13:43:24 +0200 Subject: Start refactoring hlwm --- herbstluftwm/.config/herbstluftwm/autostart | 149 ++------------------- herbstluftwm/.config/herbstluftwm/hlwm-keybindings | 80 +++++++++++ herbstluftwm/.config/herbstluftwm/hlwm-rules | 13 ++ herbstluftwm/.config/herbstluftwm/hlwm-theming | 31 +++++ herbstluftwm/.config/herbstluftwm/theme.sh | 4 +- 5 files changed, 136 insertions(+), 141 deletions(-) create mode 100644 herbstluftwm/.config/herbstluftwm/hlwm-keybindings create mode 100644 herbstluftwm/.config/herbstluftwm/hlwm-rules create mode 100644 herbstluftwm/.config/herbstluftwm/hlwm-theming (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index 683fbf1..416c38a 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # this is a simple config for herbstluftwm @@ -19,159 +19,28 @@ monitor_w=($(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/')) panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc) dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $color_bg -nf $color_fg -sb $color_accent -sf $color_bg" -# remove all existing keybindings -hc keyunbind --all - -# keybindings -Mod=Mod4 # Use the super key as the main modifier - -hc keybind $Mod-Shift-q quit -hc keybind $Mod-Shift-r reload -hc keybind $Mod-Shift-c close -hc keybind $Mod-Return spawn xterm -hc keybind $Mod-grave spawn dmenu_run $dmenu_opts -hc keybind XF86AudioLowerVolume spawn amixer set Master 1%- -hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+ - -# basic movement -# focusing clients -#hc keybind $Mod-Left focus left -#hc keybind $Mod-Down focus down -#hc keybind $Mod-Up focus up -#hc keybind $Mod-Right focus right -hc keybind $Mod-h focus left -hc keybind $Mod-j focus down -hc keybind $Mod-k focus up -hc keybind $Mod-l focus right - -# moving clients -#hc keybind $Mod-Shift-Left shift left -#hc keybind $Mod-Shift-Down shift down -#hc keybind $Mod-Shift-Up shift up -#hc keybind $Mod-Shift-Right shift right -hc keybind $Mod-Shift-h shift left -hc keybind $Mod-Shift-j shift down -hc keybind $Mod-Shift-k shift up -hc keybind $Mod-Shift-l shift right - -# splitting frames -# create an empty frame at the specified direction -hc keybind $Mod-u split bottom 0.5 -hc keybind $Mod-o split right 0.5 -# let the current frame explode into subframes -hc keybind $Mod-Control-space split explode - -# resizing frames -resizestep=0.05 -hc keybind $Mod-Control-h resize left +$resizestep -hc keybind $Mod-Control-j resize down +$resizestep -hc keybind $Mod-Control-k resize up +$resizestep -hc keybind $Mod-Control-l resize 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 -#hc keybind $Mod-Control-Right resize right +$resizestep - -# tags +# Tags tag_names=( I II III IV V VI VII VIII IX X ) tag_keys=( {1..9} 0 ) -# Selecting workspaces -#hc keybind Alt-Control-Left use_index -1 -#hc keybind Alt-Control-Right use_index +1 -hc keybind Alt-Control-h use_index -1 -hc keybind Alt-Control-l use_index +1 -hc rename default "${tag_names[0]}" || true -for i in ${!tag_names[@]} ; do - hc add "${tag_names[$i]}" - key="${tag_keys[$i]}" - if ! [ -z "$key" ] ; then - hc keybind "$Mod-$key" use_index "$i" - hc keybind "$Mod-Shift-$key" move_index "$i" - fi -done - -# cycle through tags -hc keybind $Mod-period use_index +1 --skip-visible -hc keybind $Mod-comma use_index -1 --skip-visible - -# layouting -hc keybind $Mod-r remove -hc keybind $Mod-space cycle_layout 1 -hc keybind $Mod-s floating toggle -hc keybind $Mod-f fullscreen toggle -hc keybind $Mod-p pseudotile toggle - -# mouse -hc mouseunbind --all -hc mousebind $Mod-Button1 move -hc mousebind $Mod-Button2 zoom -hc mousebind $Mod-Button3 resize - -# focus -hc keybind $Mod-BackSpace cycle_monitor -hc keybind $Mod-Tab cycle_all +1 -hc keybind $Mod-Shift-Tab cycle_all -1 -hc keybind $Mod-c cycle -hc keybind $Mod-i jumpto urgent -hc set focus_follows_mouse 1 - -# theme -hc attr theme.tiling.reset 1 -hc attr theme.floating.reset 1 -hc set frame_border_width 0 -hc set always_show_frame 0 -hc set frame_bg_transparent 1 -hc set frame_normal_opacity 0 -hc set frame_active_opacity 0 -hc set frame_transparent_width 0 -hc set frame_gap 0 - -hc attr theme.active.color $color_accent -hc attr theme.normal.color $color_bg -hc attr theme.urgent.color orange -hc attr theme.inner_width 1 -hc attr theme.inner_color $color_bg -hc attr theme.border_width 3 -hc attr theme.floating.border_width 4 -hc attr theme.floating.outer_width 1 -hc attr theme.floating.outer_color $color_bg -hc attr theme.active.inner_color $color_bg -hc attr theme.active.outer_color $color_bg -hc attr theme.background_color $color_bg - -hc set window_gap $window_p -hc set frame_padding 0 -hc set smart_window_surroundings 0 -hc set smart_frame_surroundings 1 -hc set mouse_recenter_gap 1 - -# rules -hc unrule -F -hc rule focus=on # normally focus new clients - -#hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on -hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on -hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off - -hc rule --class~'(.*[Ss]team.*)' --tag=IX --focus=off -hc rule --class~'(.*[Hh]exchat.*)' --tag=X --focus=off -hc rule --class~'(.*[Ss]potify.*)' --tag=X --focus=off -hc rule --class~'(.*[Ss]kype.*)' --tag=VIII --focus=off +# Source hlwm-config-files +source "$dir/hlwm-keybindings" +source "$dir/hlwm-theming" +source "$dir/hlwm-rules" -# unlock, just to be sure +# Unlock, just to be sure hc unlock herbstclient set tree_style '╾│ ├└╼─┐' -#Start panel in all monitors +# Start panel in all monitors start_panel() { for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do "$1" $monitor& done } -# find the panel +# Find the panel panel=$dir/panel.sh [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh if pgrep panel.sh >> /dev/null diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-keybindings b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings new file mode 100644 index 0000000..4a6a614 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Remove all existing keybindings +hc keyunbind --all + +# Keybindings +Mod=Mod4 # Use the super key as the main modifier + +hc keybind $Mod-Shift-q quit +hc keybind $Mod-Shift-r reload +hc keybind $Mod-Shift-c close +hc keybind $Mod-Return spawn xterm +hc keybind $Mod-grave spawn dmenu_run $dmenu_opts +hc keybind XF86AudioLowerVolume spawn amixer set Master 1%- +hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+ + +# Basic movement +# Focusing clients +hc keybind $Mod-h focus left +hc keybind $Mod-j focus down +hc keybind $Mod-k focus up +hc keybind $Mod-l focus right + +# Moving clients +hc keybind $Mod-Shift-h shift left +hc keybind $Mod-Shift-j shift down +hc keybind $Mod-Shift-k shift up +hc keybind $Mod-Shift-l shift right + +# Splitting frames +# Create an empty frame at the specified direction +hc keybind $Mod-u split bottom 0.5 +hc keybind $Mod-o split right 0.5 +# Let the current frame explode into subframes +hc keybind $Mod-Control-space split explode + +# Resizing frames +resizestep=0.05 +hc keybind $Mod-Control-h resize left +$resizestep +hc keybind $Mod-Control-j resize down +$resizestep +hc keybind $Mod-Control-k resize up +$resizestep +hc keybind $Mod-Control-l resize right +$resizestep + +# Selecting workspaces +hc keybind Alt-Control-h use_index -1 +hc keybind Alt-Control-l use_index +1 +hc rename default "${tag_names[0]}" || true +for i in ${!tag_names[@]} ; do + hc add "${tag_names[$i]}" + key="${tag_keys[$i]}" + if ! [ -z "$key" ] ; then + hc keybind "$Mod-$key" use_index "$i" + hc keybind "$Mod-Shift-$key" move_index "$i" + fi +done + +# Cycle through tags +hc keybind $Mod-period use_index +1 --skip-visible +hc keybind $Mod-comma use_index -1 --skip-visible + +# Layouting +hc keybind $Mod-r remove +hc keybind $Mod-space cycle_layout 1 +hc keybind $Mod-s floating toggle +hc keybind $Mod-f fullscreen toggle +hc keybind $Mod-p pseudotile toggle + +# Mouse +hc mouseunbind --all +hc mousebind $Mod-Button1 move +hc mousebind $Mod-Button2 zoom +hc mousebind $Mod-Button3 resize + +# Focus +hc keybind $Mod-BackSpace cycle_monitor +hc keybind $Mod-Tab cycle_all +1 +hc keybind $Mod-Shift-Tab cycle_all -1 +hc keybind $Mod-c cycle +hc keybind $Mod-i jumpto urgent +hc set focus_follows_mouse 1 diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-rules b/herbstluftwm/.config/herbstluftwm/hlwm-rules new file mode 100644 index 0000000..df4df45 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/hlwm-rules @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Rules +hc unrule -F +hc rule focus=on # normally focus new clients + +hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on +hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off + +hc rule --class~'(.*[Ss]team.*)' --tag=IX --focus=off +hc rule --class~'(.*[Hh]exchat.*)' --tag=X --focus=off +hc rule --class~'(.*[Ss]potify.*)' --tag=X --focus=off +hc rule --class~'(.*[Ss]kype.*)' --tag=VIII --focus=off diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-theming b/herbstluftwm/.config/herbstluftwm/hlwm-theming new file mode 100644 index 0000000..0ffd366 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/hlwm-theming @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Theme +hc attr theme.tiling.reset 1 +hc attr theme.floating.reset 1 +hc set frame_border_width 0 +hc set always_show_frame 0 +hc set frame_bg_transparent 1 +hc set frame_normal_opacity 0 +hc set frame_active_opacity 0 +hc set frame_transparent_width 0 +hc set frame_gap 0 + +hc attr theme.active.color $color_accent +hc attr theme.normal.color $color_bg +hc attr theme.urgent.color orange +hc attr theme.inner_width 1 +hc attr theme.inner_color $color_bg +hc attr theme.border_width 3 +hc attr theme.floating.border_width 4 +hc attr theme.floating.outer_width 1 +hc attr theme.floating.outer_color $color_bg +hc attr theme.active.inner_color $color_bg +hc attr theme.active.outer_color $color_bg +hc attr theme.background_color $color_bg + +hc set window_gap $window_p +hc set frame_padding 0 +hc set smart_window_surroundings 0 +hc set smart_frame_surroundings 1 +hc set mouse_recenter_gap 1 diff --git a/herbstluftwm/.config/herbstluftwm/theme.sh b/herbstluftwm/.config/herbstluftwm/theme.sh index 34e22a7..3192abb 100644 --- a/herbstluftwm/.config/herbstluftwm/theme.sh +++ b/herbstluftwm/.config/herbstluftwm/theme.sh @@ -1,7 +1,9 @@ +#!/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/") + color=$(echo $xresources | sed "s/.*\*color$1: \(\#[0-9A-Fa-f]*\).*/\1/") echo $color } -- cgit v1.2.3 From 7b2dae6bbe96dcad354fe8cd88bdf736e84aa19c Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Tue, 25 Aug 2015 21:40:38 +0200 Subject: Added more geeky tag names --- herbstluftwm/.config/herbstluftwm/autostart | 18 +++++++++++---- herbstluftwm/.config/herbstluftwm/panel.sh | 5 +++-- herbstluftwm/.config/herbstluftwm/theme | 35 +++++++++++++++++++++++++++++ herbstluftwm/.config/herbstluftwm/theme.sh | 35 ----------------------------- 4 files changed, 52 insertions(+), 41 deletions(-) create mode 100644 herbstluftwm/.config/herbstluftwm/theme delete mode 100644 herbstluftwm/.config/herbstluftwm/theme.sh (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index 416c38a..7a80b1c 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -2,13 +2,16 @@ # this is a simple config for herbstluftwm +# The current directory +dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +# Herbstclient shortcut hc() { herbstclient "$@" } #Include the theming script -dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$dir/theme.sh" +source "$dir/theme" #Detect monitors hc set auto_detect_monitors 1 @@ -20,8 +23,15 @@ panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc) dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $color_bg -nf $color_fg -sb $color_accent -sf $color_bg" # Tags -tag_names=( I II III IV V VI VII VIII IX X ) -tag_keys=( {1..9} 0 ) +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) +done; # Source hlwm-config-files source "$dir/hlwm-keybindings" diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh index 41952a6..b1ecebe 100755 --- a/herbstluftwm/.config/herbstluftwm/panel.sh +++ b/herbstluftwm/.config/herbstluftwm/panel.sh @@ -1,11 +1,12 @@ #!/bin/bash +dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ; } -dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$dir/theme.sh" +source "$dir/theme" source "$dir/panel_indicators.sh" monitor=${1:-0} diff --git a/herbstluftwm/.config/herbstluftwm/theme b/herbstluftwm/.config/herbstluftwm/theme new file mode 100644 index 0000000..3192abb --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/theme @@ -0,0 +1,35 @@ +#!/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-*-*-*-*-*-*-*" +font_sec="-*-stlarch-medium-*-*-*-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) diff --git a/herbstluftwm/.config/herbstluftwm/theme.sh b/herbstluftwm/.config/herbstluftwm/theme.sh deleted file mode 100644 index 3192abb..0000000 --- a/herbstluftwm/.config/herbstluftwm/theme.sh +++ /dev/null @@ -1,35 +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-*-*-*-*-*-*-*" -font_sec="-*-stlarch-medium-*-*-*-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 From ffac7062a84028277558fb0110b31b825e42dfa2 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 27 Aug 2015 12:37:05 +0200 Subject: Fixed indentation of hlwm code --- herbstluftwm/.config/herbstluftwm/panel.sh | 145 ++++++++++++--------- .../.config/herbstluftwm/panel_indicators.sh | 3 +- herbstluftwm/.config/herbstluftwm/theme | 1 - 3 files changed, 82 insertions(+), 67 deletions(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh index b1ecebe..70e8154 100755 --- a/herbstluftwm/.config/herbstluftwm/panel.sh +++ b/herbstluftwm/.config/herbstluftwm/panel.sh @@ -1,9 +1,9 @@ #!/bin/bash -dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) hc() { - "${herbstclient_command[@]:-herbstclient}" "$@" ; + "${herbstclient_command[@]:-herbstclient}" "$@" } source "$dir/theme" @@ -11,16 +11,18 @@ source "$dir/panel_indicators.sh" monitor=${1:-0} -geometry=( $(herbstclient monitor_rect "$monitor") ) +geometry=($(herbstclient monitor_rect "$monitor")) if [ -z "$geometry" ] ;then echo "Invalid monitor $monitor" exit 1 fi -# geometry has the format W H X Y + +# 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,$font_sec -u 2 -B $acolor_bg -F $acolor_fg" +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) @@ -28,13 +30,13 @@ 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(); }' "$@" + 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(); }' "$@" + awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" } fi @@ -43,29 +45,36 @@ fi # \t [...] # e.g. # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 + while true ; do - music - volume - network - battery - clock + 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="" + volume="" + battery="" + net="" windowtitle="" + + separator="%{F$acolor_accent}|%{F-}" + while true ; do - separator="%{F$acolor_accent}|%{F-}" - # draw tags + for i in "${tags[@]}" ; do case ${i:0:1} in '#') @@ -86,15 +95,16 @@ fi 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 part of panel right="$music$volume$net$battery$date " echo -n "%{r}$right" - #DO NOT REMOVE THIS ECHO - echo + #DO NOT REMOVE THIS ECHO + echo # wait for next event IFS=$'\t' read -ra cmd || break @@ -103,38 +113,38 @@ fi #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 - ;; + 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}" @@ -144,18 +154,23 @@ fi ;; 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 + + #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_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index e450337..a433e3a 100644 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -1,6 +1,7 @@ #!/bin/bash +icon_font="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*" battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") -network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") +network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "%{T2}\ue0af%{T-}") music_icon="\ue05c" music() diff --git a/herbstluftwm/.config/herbstluftwm/theme b/herbstluftwm/.config/herbstluftwm/theme index 3192abb..d0e48da 100644 --- a/herbstluftwm/.config/herbstluftwm/theme +++ b/herbstluftwm/.config/herbstluftwm/theme @@ -22,7 +22,6 @@ window_p=20 # Panel panel_h=24 font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" -font_sec="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*" # Colors color_fg=$(get_x_color 15) -- cgit v1.2.3 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 From 519560b1278111d1d2acce0357920c7819cc53ea Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 19:29:08 +0200 Subject: Fixed panel icons --- .../.config/herbstluftwm/panel_indicators.sh | 62 +++++++++++++--------- .../.config/herbstluftwm/populate_panel.sh | 2 +- herbstluftwm/.config/herbstluftwm/start_panel.sh | 1 + 3 files changed, 38 insertions(+), 27 deletions(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index ad45d75..14dfdad 100755 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash + icon_font="FontAwesome-10" -battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") -network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") -music_icon="\ue05c" + +battery_icon=("\uf244" "\uf243" "\uf242" "\uf241" "\uf240" "\uf1e6") +network_icon=("\uf1eb" "\uf109") +music_icon="\uf001" +volume_icon=("\uf026" "\uf027" "\uf028") music() { @@ -35,16 +38,21 @@ volume() volumes=$(\ amixer get Master | \ grep "Front Right: Playback"\ - ) + ) vol=$(\ echo $volumes | \ sed "s/.*\[\([0-9]*\)%\].*/\1/"\ - ) + ) if [ -z $vol ] ; then - echo -e "volume\toff" + vol_status="off" + elif [ $vol -eq 0 ]; then + vol_status="%{F$acolor_fg}${volume_icon[0]} $vol%%{F-}" + elif [$vol -lt 33]; then + vol_status="%{F$acolor_fg}${volume_icon[1]} $vol%%{F-}" else - echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%{F-}" + vol_status="%{F$acolor_fg}${volume_icon[2]} $vol%%{F-}" fi + echo -e "volume\t$vol_status" else echo -e "volume\toff" fi @@ -67,7 +75,7 @@ network() if [ $int == $wifi ] ; then iwconfig=$(iwconfig $int) ssid=$( - echo $iwconfig | \ + echo $iwconfig | \ sed "s/.*ESSID:\(\".*\"\).*/\1/" | \ sed "s/.*\(off\/any\).*/\"\1\"/" | \ sed "s/.*\"\(.*\)\".*/\1/" @@ -81,16 +89,12 @@ network() if [ $ssid == "off/any" ] ; then echo -e "net\toff" - elif [ $quality -lt 33 ] ; then - echo -e "net\t${network_icon[0]} $ssid" - elif [ $quality -lt 66 ] ; then - echo -e "net\t${network_icon[1]} $ssid" else - echo -e "net\t${network_icon[2]} $ssid" + echo -e "net\t${network_icon[0]} $ssid $quality%" fi elif [ $int == $eth ] ; then - echo -e "net\t${network_icon[3]} ethernet" + echo -e "net\t${network_icon[1]} Ethernet" else echo -e "net\toff" fi @@ -98,31 +102,37 @@ network() battery() { - # Battery - if $(test -e /sys/class/power_supply/BAT1) ; then + # Batteries + bat_info="off" + for bat in $(find /sys/class/power_supply | grep BAT); do + nr="${bat: -1}" + bat_info="" - bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) - bat_state=$(cat /sys/class/power_supply/BAT1/status) + bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity) + bat_state=$(cat /sys/class/power_supply/BAT0/status) if [ $bat_state == "Charging" ] ; then - bat_status="${battery_icon[4]}" + bat_status="${battery_icon[5]}" elif [ $bat_lvl -lt 10 ] ; then bat_status="${F$acolor_accent}${battery_icon[0]}${F-}" - elif [ $bat_ -lt 33 ] ; then + elif [ $bat_ -lt 25 ] ; then bat_status="${battery_icon[1]}" - elif [ $bat_lvl -lt 66 ] ; then + elif [ $bat_ -lt 50 ] ; then bat_status="${battery_icon[2]}" - else + elif [ $bat_lvl -lt 75 ] ; then bat_status="${battery_icon[3]}" + else + bat_status="${battery_icon[4]}" fi - echo -e "battery\t$bat_status $bat_lvl%%%{F-}" - else - echo -e "battery\toff" - fi + bat_info+="$nr: $bat_status $bat_lvl%%{F-}" + done + echo -e "battery\t$bat_info" } clock() { echo -e $(date +$"date\t%{F$acolor_fg}%H:%M:%S %{F$acolor_fg}(%d-%m-%Y)%{F-}") } + +# vim: set ts=4 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/populate_panel.sh b/herbstluftwm/.config/herbstluftwm/populate_panel.sh index 07ecafd..f7ada8a 100755 --- a/herbstluftwm/.config/herbstluftwm/populate_panel.sh +++ b/herbstluftwm/.config/herbstluftwm/populate_panel.sh @@ -24,7 +24,7 @@ fi # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 while true ; do - music & + music volume & network & battery & diff --git a/herbstluftwm/.config/herbstluftwm/start_panel.sh b/herbstluftwm/.config/herbstluftwm/start_panel.sh index 6894d79..9f637da 100755 --- a/herbstluftwm/.config/herbstluftwm/start_panel.sh +++ b/herbstluftwm/.config/herbstluftwm/start_panel.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash source "$HLWM_CONF_DIR/themes/current" +source "$HLWM_CONF_DIR/panel_indicators.sh" # Check for valid monitors monitor=${1:-0} -- cgit v1.2.3 From e6e4e7dc8351baed4efeed91ed3bf78f3f92d6d7 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 19:30:36 +0200 Subject: Updated dependencylist --- herbstluftwm/.config/herbstluftwm/dependencylist | 1 + 1 file changed, 1 insertion(+) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/dependencylist b/herbstluftwm/.config/herbstluftwm/dependencylist index 34c9bf9..84c61d7 100644 --- a/herbstluftwm/.config/herbstluftwm/dependencylist +++ b/herbstluftwm/.config/herbstluftwm/dependencylist @@ -10,6 +10,7 @@ pulseaudio pulseaudio-alsa scrot sed +ttf-dejavu ttf-font-awesome wireless_tools xautolock -- cgit v1.2.3 From 8560ce29a58ce21e27f8688c7f7dbf79013afd3e Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 20:22:04 +0200 Subject: Fixed volume icon < 33% --- herbstluftwm/.config/herbstluftwm/panel_indicators.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index 14dfdad..6f4bf15 100755 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -47,7 +47,7 @@ volume() vol_status="off" elif [ $vol -eq 0 ]; then vol_status="%{F$acolor_fg}${volume_icon[0]} $vol%%{F-}" - elif [$vol -lt 33]; then + elif [ $vol -lt 33 ]; then vol_status="%{F$acolor_fg}${volume_icon[1]} $vol%%{F-}" else vol_status="%{F$acolor_fg}${volume_icon[2]} $vol%%{F-}" -- cgit v1.2.3 From 453b0acde1e8c4c7a1786ed5740d05f0330b5176 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 21:33:48 +0200 Subject: Fixed duplicate panel --- herbstluftwm/.config/herbstluftwm/populate_panel.sh | 2 ++ herbstluftwm/.config/herbstluftwm/start_panel.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/populate_panel.sh b/herbstluftwm/.config/herbstluftwm/populate_panel.sh index f7ada8a..7afa0c3 100755 --- a/herbstluftwm/.config/herbstluftwm/populate_panel.sh +++ b/herbstluftwm/.config/herbstluftwm/populate_panel.sh @@ -3,6 +3,8 @@ source "$HLWM_CONF_DIR/themes/current" source "$HLWM_CONF_DIR/panel_indicators.sh" +monitor=$1 + 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 diff --git a/herbstluftwm/.config/herbstluftwm/start_panel.sh b/herbstluftwm/.config/herbstluftwm/start_panel.sh index 9f637da..e573a53 100755 --- a/herbstluftwm/.config/herbstluftwm/start_panel.sh +++ b/herbstluftwm/.config/herbstluftwm/start_panel.sh @@ -27,7 +27,7 @@ panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc) hc pad $monitor $(echo "$panel_h + $window_p" | bc) # Start the panel -$HLWM_CONF_DIR/populate_panel.sh | +$HLWM_CONF_DIR/populate_panel.sh $monitor | 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 -- cgit v1.2.3 From 3d1e91b881d292f840d459c4911022f30807b4ff Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Mon, 31 Aug 2015 21:52:51 +0200 Subject: Some code improvements to network function --- herbstluftwm/.config/herbstluftwm/panel_indicators.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'herbstluftwm') diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index 6f4bf15..5797781 100755 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -88,16 +88,18 @@ network() ) if [ $ssid == "off/any" ] ; then - echo -e "net\toff" + net_status="off" else - echo -e "net\t${network_icon[0]} $ssid $quality%" + net_status="${network_icon[0]} $ssid $quality%" fi elif [ $int == $eth ] ; then - echo -e "net\t${network_icon[1]} Ethernet" + net_status="${network_icon[1]} Ethernet" else - echo -e "net\toff" + net_status="off" fi + + echo -e "net\t$net_status" } battery() -- cgit v1.2.3