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/.config') 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