From f1ce4ffda9abef8d8fcace19bff395d215a698c7 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 4 May 2017 08:57:37 +0200 Subject: Improved HLWM config --- herbstluftwm/.config/herbstluftwm/autostart | 5 +++- herbstluftwm/.config/herbstluftwm/dependencylist | 1 + herbstluftwm/.config/herbstluftwm/hlwm-keybindings | 9 ++++++ herbstluftwm/.config/herbstluftwm/hlwm-rules | 8 +++--- .../.config/herbstluftwm/panel_indicators.sh | 17 ++++++++++- .../.config/herbstluftwm/populate_panel.sh | 25 ++++++++++++---- herbstluftwm/.config/herbstluftwm/popup.sh | 2 +- .../.config/herbstluftwm/system_utils/backlight.sh | 7 +++++ .../.config/herbstluftwm/system_utils/music.sh | 1 - .../.config/herbstluftwm/system_utils/volume.sh | 9 ++++-- herbstluftwm/.config/herbstluftwm/themes/yosemite | 32 +++++++++++++++++++++ .../.config/herbstluftwm/wallpapers/yosemite.jpg | Bin 0 -> 3190338 bytes 12 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 herbstluftwm/.config/herbstluftwm/system_utils/backlight.sh create mode 100644 herbstluftwm/.config/herbstluftwm/themes/yosemite create mode 100644 herbstluftwm/.config/herbstluftwm/wallpapers/yosemite.jpg (limited to 'herbstluftwm/.config') diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index ebef530..450c7bb 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -6,6 +6,9 @@ hc() { } export -f hc +# Set resolution if arandr layout exists +[ -f "$HOME/.screenlayout/arandr.sh" ] && $HOME/.screenlayout/arandr.sh + # The current directory export HLWM_CONF_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) @@ -18,7 +21,7 @@ tag_names=() tag_keys=({1..9} 0) for key in ${tag_keys[@]}; do if [ $key -eq 0 ]; then - key=10 + key=9 else key=$(echo "$key - 1" | bc) fi diff --git a/herbstluftwm/.config/herbstluftwm/dependencylist b/herbstluftwm/.config/herbstluftwm/dependencylist index beed0dd..ae88741 100644 --- a/herbstluftwm/.config/herbstluftwm/dependencylist +++ b/herbstluftwm/.config/herbstluftwm/dependencylist @@ -16,3 +16,4 @@ ttf-dejavu ttf-font-awesome wireless_tools xautolock +xbacklight diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-keybindings b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings index 63325f5..4afc4a5 100644 --- a/herbstluftwm/.config/herbstluftwm/hlwm-keybindings +++ b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings @@ -6,17 +6,26 @@ 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 chain , spawn echo "!! HLWM reload config !!" , reload hc keybind $Mod-Shift-c close hc keybind $Mod-Return spawn xterm +hc keybind $Mod-Alt-l spawn xautolock -locknow hc keybind $Mod-Escape spawn rofi -color-enabled -modi "run,ssh" -show run +hc keybind $Mod-a spawn rofi -color-enabled -modi "drun" -show drun hc keybind $Mod-t spawn env HLWM_CONF_DIR=$HLWM_CONF_DIR $HLWM_CONF_DIR/rofi_theme.sh -color-enabled +hc keybind XF86AudioMute spawn amixer set Master toggle hc keybind XF86AudioLowerVolume spawn amixer set Master 1%- hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+ +hc keybind XF86MonBrightnessUp spawn xbacklight -inc 5 +hc keybind XF86MonBrightnessDown spawn xbacklight -dec 5 + +hc keybind XF86AudioPlay spawn playerctl play-pause + # Basic movement # Focusing clients hc keybind $Mod-h focus left diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-rules b/herbstluftwm/.config/herbstluftwm/hlwm-rules index df4df45..9601d7c 100644 --- a/herbstluftwm/.config/herbstluftwm/hlwm-rules +++ b/herbstluftwm/.config/herbstluftwm/hlwm-rules @@ -7,7 +7,7 @@ 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 +hc rule --class~'(.*[Ss]team.*)' --tag=1000 --focus=off +hc rule --class~'(.*[Hh]exchat.*)' --tag=1001 --focus=off +hc rule --class~'(.*[Ss]potify.*)' --tag=1001 --focus=off +hc rule --class~'(.*[Ss]kype.*)' --tag=0111 --focus=off diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index a65be74..d4d7077 100755 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -8,6 +8,7 @@ battery_icon=("\uf244" "\uf243" "\uf242" "\uf241" "\uf240" "\uf1e6") network_icon=("\uf1eb" "\uf109") music_icon="\uf001" volume_icon=("\uf026" "\uf027" "\uf028") +backlight_icon="\uf185" hlwm_indicator_music() { @@ -34,8 +35,10 @@ hlwm_indicator_volume() # Volume if pgrep pulseaudio >> /dev/null ; then volume=$(hlwm_utils_volume) - if [ -z "$volume" ] ; then + if [ -z "$volume" ]; then volume_status="off" + elif [ "$volume" == "mute" ]; then + volume_status="%{F$HLWM_FG_ACOLOR}${volume_icon[0]} Mute%{F-}" elif [ "$volume" -eq 0 ]; then volume_status="%{F$HLWM_FG_ACOLOR}${volume_icon[0]} $volume%%{F-}" elif [ "$volume" -lt 33 ]; then @@ -82,6 +85,8 @@ hlwm_indicator_battery() if [ "$battery_status" = "Charging" ] ; then battery_status="${battery_icon[5]}" + elif [ "$battery_level" -lt 5 ]; then + systemctl suspend; elif [ "$battery_level" -lt 10 ] ; then battery_status="%{F$HLWM_ACCENT_ACOLOR}${battery_icon[0]}%{F-}" elif [ "$battery_level" -lt 25 ] ; then @@ -115,4 +120,14 @@ hlwm_indicator_clock() echo -e "date\t%{F$HLWM_FG_ACOLOR}$time %{F$HLWM_FG_ACOLOR}($date)%{F-}" } +hlwm_indicator_backlight() { + local level=$(hlwm_utils_backlight) + + if [ -z "$level" ]; then + echo -e "backlight\toff" + else + echo -e "backlight\t$backlight_icon $level%" + fi +} + # 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 15a40c4..3ebda1c 100755 --- a/herbstluftwm/.config/herbstluftwm/populate_panel.sh +++ b/herbstluftwm/.config/herbstluftwm/populate_panel.sh @@ -29,6 +29,7 @@ fi hlwm_indicator_network & hlwm_indicator_battery & hlwm_indicator_clock & + hlwm_indicator_backlight & sleep 1 || break done > >(uniq_linebuffered) & @@ -47,6 +48,7 @@ fi battery="" net="" windowtitle="" + backlight="" separator="%{F$HLWM_ACCENT_ACOLOR}|%{F-}" @@ -70,15 +72,14 @@ fi echo -n "%{F$HLWM_FG_ACOLOR}" ;; esac - echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" + echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U$HLWM_BG_ACOLOR+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" + right="$music$volume$backlight$net$battery$date " + echo -n "%{r}%{U$HLWM_BG_ACOLOR+u}$right" #DO NOT REMOVE THIS ECHO echo @@ -106,6 +107,14 @@ fi volume="$volume $separator%{B-} " fi ;; + backlight) + backlight="${cmd[@]:1}" + if [ "$backlight" == "off" ]; then + backlight="" + else + backlight="$backlight $separator%{B-} " + fi + ;; net) net="${cmd[@]:1}" if [ $net = "off" ] ; then @@ -128,8 +137,12 @@ fi ;; focus_changed|window_title_changed) windowtitle="${cmd[@]:2}" - if [ ${#windowtitle} -gt 60 ]; then - windowtitle="${windowtitle:0:57}..." + if [ -n "$windowtitle" ]; then + if [ ${#windowtitle} -gt 60 ]; then + windowtitle="${windowtitle:0:57}..." + fi + + windowtitle="$separator%{F-}%{B-} $windowtitle" fi ;; esac diff --git a/herbstluftwm/.config/herbstluftwm/popup.sh b/herbstluftwm/.config/herbstluftwm/popup.sh index b9980e2..969695d 100755 --- a/herbstluftwm/.config/herbstluftwm/popup.sh +++ b/herbstluftwm/.config/herbstluftwm/popup.sh @@ -42,5 +42,5 @@ else { echo "%{F$HLWM_ACCENT_ACOLOR} $prefix %{F$HLWM_FG_ACOLOR}$message %{F$HLWM_FG_ACOLOR}($t)%{F-}" sleep $timeout - } | bar $bar_opts + } | lemonbar $bar_opts fi diff --git a/herbstluftwm/.config/herbstluftwm/system_utils/backlight.sh b/herbstluftwm/.config/herbstluftwm/system_utils/backlight.sh new file mode 100644 index 0000000..e2f7b13 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/system_utils/backlight.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +hlwm_utils_backlight() { + printf "%.0f" $(xbacklight -get) +} + +# vim: set ts=8 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/system_utils/music.sh b/herbstluftwm/.config/herbstluftwm/system_utils/music.sh index da7b74d..4f6856e 100644 --- a/herbstluftwm/.config/herbstluftwm/system_utils/music.sh +++ b/herbstluftwm/.config/herbstluftwm/system_utils/music.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash hlwm_utils_music_playing() { - playing="" mpd_status=$(mpc | sed -nr "s/^\[(.*)\].*$/\1/p") diff --git a/herbstluftwm/.config/herbstluftwm/system_utils/volume.sh b/herbstluftwm/.config/herbstluftwm/system_utils/volume.sh index fcd4b88..4c3e21e 100644 --- a/herbstluftwm/.config/herbstluftwm/system_utils/volume.sh +++ b/herbstluftwm/.config/herbstluftwm/system_utils/volume.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash hlwm_utils_volume() { - amixer get Master | - grep "Front Right: Playback" | - sed "s/.*\[\([0-9]*\)%\].*/\1/" + local status=($(amixer get Master | sed -rn 's/\s*Front Right.*\[([0-9]+)%\]\s+\[(on|off)\]/\1 \2/p')) + if [ "${status[1]}" == "off" ]; then + echo "mute" + else + echo "${status[0]}" + fi } # vim: set ts=8 sw=4 tw=0 et : diff --git a/herbstluftwm/.config/herbstluftwm/themes/yosemite b/herbstluftwm/.config/herbstluftwm/themes/yosemite new file mode 100644 index 0000000..b081063 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/themes/yosemite @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +declare -A colors +colors=(["background"]="#262626" ["foreground"]="#f9f9f9" # Fore- and Background TODO + ["color0"]="#2e3436" ["color8"]="#555753" # Blacks TODO + ["color1"]="#a31604" ["color9"]="#c60001" # Reds + ["color2"]="#447241" ["color10"]="#27a343" # Greens + ["color3"]="#c1951a" ["color11"]="#d5a30e" # Yellows TODO + ["color4"]="#425387" ["color12"]="#4a5a8d" # Blues TODO + ["color5"]="#965d98" ["color13"]="#893c8c" # Magentas TODO + ["color6"]="#06989a" ["color14"]="#12bccb" # Cyanes TODO + ["color7"]="#d3d7cf" ["color15"]="#eeeeec") # Whites TODO + +# Wallpaper +export HLWM_WALLPAPER="$HLWM_CONF_DIR/wallpapers/yosemite.jpg" + +# Shadow +export HLWM_COMPOSITING=true + +# Padding +export HLWM_WINDOW_PADDING=20 + +# Panel +export HLWM_PANEL_HEIGHT=25 +export HLWM_PANEL_FONT="DejaVu Sans Mono-10" +export HLWM_PANEL_BOTTOM=false +export HLWM_PANEL_MARGIN="-1 -1" # Up/Down Left/Right (-1 is respects $HLWM_WINDOW_PADDING) + +# Colors +export HLWM_FG_COLOR=${colors["foreground"]} +export HLWM_ACCENT_COLOR=${colors["color2"]} +export HLWM_BG_COLOR=${colors["background"]} diff --git a/herbstluftwm/.config/herbstluftwm/wallpapers/yosemite.jpg b/herbstluftwm/.config/herbstluftwm/wallpapers/yosemite.jpg new file mode 100644 index 0000000..f852194 Binary files /dev/null and b/herbstluftwm/.config/herbstluftwm/wallpapers/yosemite.jpg differ -- cgit v1.2.3