aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/herbstluftwm/autostart191
-rw-r--r--config/herbstluftwm/dependencylist15
-rwxr-xr-xconfig/herbstluftwm/lock.sh7
-rwxr-xr-xconfig/herbstluftwm/notify.sh19
-rwxr-xr-xconfig/herbstluftwm/panel.sh160
-rw-r--r--config/herbstluftwm/panel_indicators.sh127
-rwxr-xr-xconfig/herbstluftwm/popup.sh46
-rwxr-xr-xconfig/herbstluftwm/start.sh13
-rw-r--r--config/herbstluftwm/theme.sh33
l---------config/redshift.conf1
10 files changed, 612 insertions, 0 deletions
diff --git a/config/herbstluftwm/autostart b/config/herbstluftwm/autostart
new file mode 100755
index 0000000..78e9af8
--- /dev/null
+++ b/config/herbstluftwm/autostart
@@ -0,0 +1,191 @@
1#!/bin/bash
2
3# this is a simple config for herbstluftwm
4
5hc() {
6 herbstclient "$@"
7}
8
9#Include the theming script
10dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
11source "$dir/theme.sh"
12
13#Detect monitors
14hc set auto_detect_monitors 1
15hc detect_monitors
16
17#Panel and window_p
18monitor_w=($(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/'))
19panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc)
20dmenu_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"
21
22# remove all existing keybindings
23hc keyunbind --all
24
25# keybindings
26Mod=Mod4 # Use the super key as the main modifier
27
28hc keybind $Mod-Shift-q quit
29hc keybind $Mod-Shift-r reload
30hc keybind $Mod-Shift-c close
31hc keybind $Mod-Return spawn xterm
32hc keybind $Mod-grave spawn dmenu_run $dmenu_opts
33hc keybind XF86AudioLowerVolume spawn amixer set Master 1%-
34hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+
35
36# basic movement
37# focusing clients
38hc keybind $Mod-Left focus left
39hc keybind $Mod-Down focus down
40hc keybind $Mod-Up focus up
41hc keybind $Mod-Right focus right
42hc keybind $Mod-h focus left
43hc keybind $Mod-j focus down
44hc keybind $Mod-k focus up
45hc keybind $Mod-l focus right
46
47# moving clients
48hc keybind $Mod-Shift-Left shift left
49hc keybind $Mod-Shift-Down shift down
50hc keybind $Mod-Shift-Up shift up
51hc keybind $Mod-Shift-Right shift right
52hc keybind $Mod-Shift-h shift left
53hc keybind $Mod-Shift-j shift down
54hc keybind $Mod-Shift-k shift up
55hc keybind $Mod-Shift-l shift right
56
57# splitting frames
58# create an empty frame at the specified direction
59hc keybind $Mod-u split bottom 0.5
60hc keybind $Mod-o split right 0.5
61# let the current frame explode into subframes
62hc keybind $Mod-Control-space split explode
63
64# resizing frames
65resizestep=0.05
66hc keybind $Mod-Control-h resize left +$resizestep
67hc keybind $Mod-Control-j resize down +$resizestep
68hc keybind $Mod-Control-k resize up +$resizestep
69hc keybind $Mod-Control-l resize right +$resizestep
70hc keybind $Mod-Control-Left resize left +$resizestep
71hc keybind $Mod-Control-Down resize down +$resizestep
72hc keybind $Mod-Control-Up resize up +$resizestep
73hc keybind $Mod-Control-Right resize right +$resizestep
74
75# tags
76tag_names=( I II III IV V VI VII VIII IX X )
77tag_keys=( {1..9} 0 )
78
79# Selecting workspaces
80hc keybind Alt-Control-Left use_index -1
81hc keybind Alt-Control-Right use_index +1
82hc rename default "${tag_names[0]}" || true
83for i in ${!tag_names[@]} ; do
84 hc add "${tag_names[$i]}"
85 key="${tag_keys[$i]}"
86 if ! [ -z "$key" ] ; then
87 hc keybind "$Mod-$key" use_index "$i"
88 hc keybind "$Mod-Shift-$key" move_index "$i"
89 fi
90done
91
92# cycle through tags
93hc keybind $Mod-period use_index +1 --skip-visible
94hc keybind $Mod-comma use_index -1 --skip-visible
95
96# layouting
97hc keybind $Mod-r remove
98hc keybind $Mod-space cycle_layout 1
99hc keybind $Mod-s floating toggle
100hc keybind $Mod-f fullscreen toggle
101hc keybind $Mod-p pseudotile toggle
102
103# mouse
104hc mouseunbind --all
105hc mousebind $Mod-Button1 move
106hc mousebind $Mod-Button2 zoom
107hc mousebind $Mod-Button3 resize
108
109# focus
110hc keybind $Mod-BackSpace cycle_monitor
111hc keybind $Mod-Tab cycle_all +1
112hc keybind $Mod-Shift-Tab cycle_all -1
113hc keybind $Mod-c cycle
114hc keybind $Mod-i jumpto urgent
115hc set focus_follows_mouse 1
116
117# theme
118hc attr theme.tiling.reset 1
119hc attr theme.floating.reset 1
120hc set frame_border_width 0
121hc set always_show_frame 0
122hc set frame_bg_transparent 1
123hc set frame_normal_opacity 0
124hc set frame_active_opacity 0
125hc set frame_transparent_width 0
126hc set frame_gap 0
127
128hc attr theme.active.color $color_accent
129hc attr theme.normal.color $color_bg
130hc attr theme.urgent.color orange
131hc attr theme.inner_width 1
132hc attr theme.inner_color $color_bg
133hc attr theme.border_width 3
134hc attr theme.floating.border_width 4
135hc attr theme.floating.outer_width 1
136hc attr theme.floating.outer_color $color_bg
137hc attr theme.active.inner_color $color_bg
138hc attr theme.active.outer_color $color_bg
139hc attr theme.background_color $color_bg
140
141hc set window_gap $window_p
142hc set frame_padding 0
143hc set smart_window_surroundings 0
144hc set smart_frame_surroundings 1
145hc set mouse_recenter_gap 1
146
147# rules
148hc unrule -F
149hc rule focus=on # normally focus new clients
150
151#hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
152hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
153hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
154
155hc rule --class~'(.*[Ss]team.*)' --tag=IX --focus=off
156hc rule --class~'(.*[Hh]exchat.*)' --tag=X --focus=off
157hc rule --class~'(.*[Ss]potify.*)' --tag=X --focus=off
158hc rule --class~'(.*[Ss]kype.*)' --tag=VIII --focus=off
159
160# unlock, just to be sure
161hc unlock
162
163herbstclient set tree_style '╾│ ├└╼─┐'
164
165#Start panel in all monitors
166start_panel() {
167 for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
168 "$1" $monitor&
169 done
170}
171
172# find the panel
173panel=$dir/panel.sh
174[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
175if pgrep panel.sh >> /dev/null
176then
177 kill $(pgrep panel.sh)
178 start_panel $panel
179else
180 start_panel $panel
181fi
182
183pulseaudio --start
184
185$dir/start.sh "xautolock -time 5 -locker $dir/lock.sh"
186$dir/start.sh "feh --bg-fill $wallpaper"
187$dir/start.sh "compton --config $HOME/.compton"
188$dir/start.sh "xrdb -load $HOME/.Xresources"
189$dir/start.sh "xset +fp /usr/share/fonts/local"
190$dir/start.sh "xset fp rehash"
191#$dir/start.sh "$dir/notify.sh $dir/popup.sh"
diff --git a/config/herbstluftwm/dependencylist b/config/herbstluftwm/dependencylist
new file mode 100644
index 0000000..7d3babf
--- /dev/null
+++ b/config/herbstluftwm/dependencylist
@@ -0,0 +1,15 @@
1alsa-utils
2bar-aint-recursive
3bc
4compton
5dmenu2
6feh
7i3lock
8playerctl
9pulseaudio
10pulseaudio-alsa
11scrot
12sed
13stlarch_font
14wireless_tools
15xautolock
diff --git a/config/herbstluftwm/lock.sh b/config/herbstluftwm/lock.sh
new file mode 100755
index 0000000..04c4638
--- /dev/null
+++ b/config/herbstluftwm/lock.sh
@@ -0,0 +1,7 @@
1#!/bin/bash
2
3SCREENCAP="/tmp/lock.png"
4scrot $SCREENCAP
5convert -gaussian-blur "12x3" $SCREENCAP $SCREENCAP
6i3lock -i $SCREENCAP
7rm $SCREENCAP
diff --git a/config/herbstluftwm/notify.sh b/config/herbstluftwm/notify.sh
new file mode 100755
index 0000000..40c5330
--- /dev/null
+++ b/config/herbstluftwm/notify.sh
@@ -0,0 +1,19 @@
1#!/bin/bash
2
3while true; do
4
5 bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity)
6 bat_stat=$(cat /sys/class/power_supply/BAT1/status)
7
8 if [[ $bat_lvl -le 5 && $bat_stat == "Discharging" ]]; then
9 $1 -m "Battery level critical: $bat_lvl%%" -u "high"
10 elif [[ $bat_lvl -eq 10 && $bat_stat == "Discharging" ]]; then
11 $1 -m "Battery level low: $bat_lvl%%"
12 elif [[ $bat_lvl -eq 50 && $bat_stat == "Discharging" ]]; then
13 $1 -m "Battery level at $bat_lvl%%"
14 elif [[ $bat_lvl -eq 100 && $bat_stat == "Charging" ]]; then
15 $1 -m "Battery fully charged"
16 fi
17
18 sleep 60;
19done
diff --git a/config/herbstluftwm/panel.sh b/config/herbstluftwm/panel.sh
new file mode 100755
index 0000000..763c668
--- /dev/null
+++ b/config/herbstluftwm/panel.sh
@@ -0,0 +1,160 @@
1#!/bin/bash
2
3hc() {
4 "${herbstclient_command[@]:-herbstclient}" "$@" ;
5}
6
7dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
8source "$dir/theme.sh"
9source "$dir/panel_indicators.sh"
10
11monitor=${1:-0}
12
13geometry=( $(herbstclient monitor_rect "$monitor") )
14if [ -z "$geometry" ] ;then
15 echo "Invalid monitor $monitor"
16 exit 1
17fi
18# geometry has the format W H X Y
19x=$(echo "${geometry[0]} + $window_p" | bc)
20y=$(echo "${geometry[1]} + $window_p" | bc)
21panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc)
22bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font,$font_sec -u 2 -B $acolor_bg -F $acolor_fg"
23
24hc pad $monitor $(echo "$panel_h + $window_p" | bc)
25
26if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
27 # mawk needs "-W interactive" to line-buffer stdout correctly
28 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
29 uniq_linebuffered() {
30 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
31 }
32else
33 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
34 # we don't want to use it there.
35 uniq_linebuffered() {
36 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
37 }
38fi
39
40{
41 ### Event generator ###
42 # <eventname>\t<data> [...]
43 # e.g.
44 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
45 while true ; do
46 music
47 volume
48 network
49 battery
50 clock
51 sleep 1 || break
52 done > >(uniq_linebuffered) &
53 childpid=$!
54 hc --idle
55 kill $childpid
56} 2> /dev/null | {
57
58 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
59 visible=true
60 date=""
61 volume=""
62 battery=""
63 net=""
64 windowtitle=""
65 while true ; do
66 separator="%{F$acolor_accent}|%{F-}"
67 # draw tags
68 for i in "${tags[@]}" ; do
69 case ${i:0:1} in
70 '#')
71 echo -n "%{U$acolor_accent+u}%{F$acolor_fg}"
72 ;;
73 '+')
74 echo -n "%{U$acolor_fg+u}%{F$acolor_fg}"
75 ;;
76 ':')
77 echo -n "%{F$acolor_fg}"
78 ;;
79 '!')
80 echo -n "%{B$acolor_accent}%{U$acolor_accent+u}%{F$acolor_bg}"
81 ;;
82 *)
83 echo -n "%{F$acolor_fg}"
84 ;;
85 esac
86 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}"
87 done
88 echo -n "$separator%{F-}%{B-} "
89 echo -n "${windowtitle//^/^^}"
90
91 #Right part of panel
92 right="$music$volume$net$battery$date "
93 echo -n "%{r}$right"
94
95 #DO NOT REMOVE THIS ECHO
96 echo
97
98 # wait for next event
99 IFS=$'\t' read -ra cmd || break
100 case "${cmd[0]}" in
101 tag*)
102 #echo "resetting tags" >&2
103 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
104 ;;
105 music)
106 music="${cmd[@]:1}"
107 if [ $music == "off" ] ; then
108 music=""
109 else
110 music="$music $separator%{B-} "
111 fi
112 ;;
113 volume)
114 volume="${cmd[@]:1}"
115 if [ $volume == "off" ] ; then
116 volume=""
117 else
118 volume="$volume $separator%{B-} "
119 fi
120 ;;
121 net)
122 net="${cmd[@]:1}"
123 if [ $net = "off" ] ; then
124 net=""
125 else
126 net="$net $separator%{B-} "
127 fi
128 ;;
129 battery)
130 battery="${cmd[@]:1}"
131 if [ $battery == "off" ] ; then
132 battery=""
133 else
134 battery="$battery $separator%{B-} "
135 fi
136 ;;
137 date)
138 #echo "resetting date" >&2
139 date="${cmd[@]:1}"
140 ;;
141 focus_changed|window_title_changed)
142 windowtitle="${cmd[@]:2}"
143 ;;
144 esac
145 done
146} 2> /dev/null | bar $bar_opts | {
147 #Handle clickable areas
148 while read line; do
149 IFS=',' read -a c <<< $(echo $line)
150 case "${c[0]}" in
151 tag)
152 herbstclient use "${c[1]}"
153 echo "herbstclient use \"${c[1]}\""
154 ;;
155 *)
156 echo "${c[0]}: not valid command"
157 ;;
158 esac
159 done
160}
diff --git a/config/herbstluftwm/panel_indicators.sh b/config/herbstluftwm/panel_indicators.sh
new file mode 100644
index 0000000..e450337
--- /dev/null
+++ b/config/herbstluftwm/panel_indicators.sh
@@ -0,0 +1,127 @@
1#!/bin/bash
2battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042")
3network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af")
4music_icon="\ue05c"
5
6music()
7{
8 # Music
9 player_status=$(playerctl status)
10 if [ $player_status = "Playing" ]; then
11 player_artist=$(playerctl metadata artist)
12 player_title=$(playerctl metadata title)
13 playing="$player_title - $player_artist"
14
15 if [ "$current" != "$playing" ] ; then
16 current=$playing
17 scrolling=$current
18 elif [ ${#scrolling} -gt "24" ] ; then
19 scrolling=${scrolling:1}
20 else
21 scrolling=$current
22 fi
23
24 echo -e "music\t$music_icon ${scrolling:0:24}"
25 else
26 echo -e "music\toff"
27 fi
28}
29
30volume()
31{
32 # Volume
33 if pgrep pulseaudio >> /dev/null ; then
34 volumes=$(\
35 amixer get Master | \
36 grep "Front Right: Playback"\
37 )
38 vol=$(\
39 echo $volumes | \
40 sed "s/.*\[\([0-9]*\)%\].*/\1/"\
41 )
42 if [ -z $vol ] ; then
43 echo -e "volume\toff"
44 else
45 echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%%{F-}"
46 fi
47 else
48 echo -e "volume\toff"
49 fi
50}
51
52network()
53{
54 # Network
55 read lo int1 int2 <<< `ip link | sed -n 's/^[0-9]: \(.*\):.*$/\1/p'`
56 if iwconfig $int1 >/dev/null 2>&1; then
57 wifi=$int1
58 eth=$int2
59 else
60 wifi=$int2
61 eth=$int1
62 fi
63
64 ip link show $eth | grep 'state UP' >/dev/null && int=$eth || int=$wifi
65
66 if [ $int == $wifi ] ; then
67 iwconfig=$(iwconfig $int)
68 ssid=$(
69 echo $iwconfig | \
70 sed "s/.*ESSID:\(\".*\"\).*/\1/" | \
71 sed "s/.*\(off\/any\).*/\"\1\"/" | \
72 sed "s/.*\"\(.*\)\".*/\1/"
73 )
74
75 quality=$( \
76 echo $iwconfig | \
77 sed "s/^.*Link Quality=\([0-9]*\)\/\([0-9]*\) .*$/(\1*100)\/\2/" | \
78 bc
79 )
80
81 if [ $ssid == "off/any" ] ; then
82 echo -e "net\toff"
83 elif [ $quality -lt 33 ] ; then
84 echo -e "net\t${network_icon[0]} $ssid"
85 elif [ $quality -lt 66 ] ; then
86 echo -e "net\t${network_icon[1]} $ssid"
87 else
88 echo -e "net\t${network_icon[2]} $ssid"
89 fi
90
91 elif [ $int == $eth ] ; then
92 echo -e "net\t${network_icon[3]} ethernet"
93 else
94 echo -e "net\toff"
95 fi
96}
97
98battery()
99{
100 # Battery
101 if $(test -e /sys/class/power_supply/BAT1) ; then
102
103 bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity)
104 bat_state=$(cat /sys/class/power_supply/BAT1/status)
105
106 if [ $bat_state == "Charging" ] ; then
107 bat_status="${battery_icon[4]}"
108 elif [ $bat_lvl -lt 10 ] ; then
109 bat_status="${F$acolor_accent}${battery_icon[0]}${F-}"
110 elif [ $bat_ -lt 33 ] ; then
111 bat_status="${battery_icon[1]}"
112 elif [ $bat_lvl -lt 66 ] ; then
113 bat_status="${battery_icon[2]}"
114 else
115 bat_status="${battery_icon[3]}"
116 fi
117
118 echo -e "battery\t$bat_status $bat_lvl%%%{F-}"
119 else
120 echo -e "battery\toff"
121 fi
122}
123
124clock()
125{
126 echo -e $(date +$"date\t%{F$acolor_fg}%H:%M:%S %{F$acolor_fg}(%d-%m-%Y)%{F-}")
127}
diff --git a/config/herbstluftwm/popup.sh b/config/herbstluftwm/popup.sh
new file mode 100755
index 0000000..eda37f5
--- /dev/null
+++ b/config/herbstluftwm/popup.sh
@@ -0,0 +1,46 @@
1#!/bin/bash
2
3help () {
4 echo -e "Usage: popup.sh [OPTIONS]"
5 echo -e "Spawns a popup for a certain amount of time"
6 echo -e ""
7 echo -e "Options:"
8 echo -e " -m MESSAGE\t\tSpecifies message to be displayed"
9 echo -e " -t TIMEOUT\t\tAmount of time in seconds the popup is displayed"
10 echo -e " -u LEVEL\t\tUrgency level (info or high)"
11}
12
13dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
14source "$dir/theme.sh"
15
16timeout=10
17message=""
18urgency="info"
19
20while getopts ":m:t:x:y:w:h:u:" opt; do
21 case $opt in
22 m) message=$OPTARG ;;
23 t) timeout=$OPTARG ;;
24 u) urgency=$OPTARG ;;
25 esac
26done
27
28if test ! $message; then
29 help
30else
31
32 bar_opts="-f $font,$font_sec -B $acolor_bg -F $acolor_fg -g ${popup_width}x${height}+${popup_x}+${popup_y} -u 2"
33
34 t=$(date +%T)
35
36 if [ $urgency == "info" ]; then
37 prefix="Info:"
38 elif [ $urgency == "high" ]; then
39 prefix="!!WARNING:"
40 fi
41
42 {
43 echo "%{F$acolor_accent} $prefix %{F$acolor_fg}$message %{F$acolor_fg}($t)%{F-}"
44 sleep $timeout
45 } | bar $bar_opts
46fi
diff --git a/config/herbstluftwm/start.sh b/config/herbstluftwm/start.sh
new file mode 100755
index 0000000..f10fca6
--- /dev/null
+++ b/config/herbstluftwm/start.sh
@@ -0,0 +1,13 @@
1#!/bin/bash
2
3opts=($@)
4
5program=$(echo ${opts[0]} | sed 's/^.*\/\(.*\)/\1/')
6
7if pgrep $program >> /dev/null
8then
9 killall $program
10 ${opts[@]} &
11else
12 ${opts[@]} &
13fi
diff --git a/config/herbstluftwm/theme.sh b/config/herbstluftwm/theme.sh
new file mode 100644
index 0000000..c40f94a
--- /dev/null
+++ b/config/herbstluftwm/theme.sh
@@ -0,0 +1,33 @@
1# Get color from ~/.Xresources
2get_x_color() {
3 xresources=$(cat ~/.Xresources)
4 color=$(echo $xresources | sed "s/.*\*color$1: \(#[0-9A-Fa-f]*\).*/\1/")
5 echo $color
6}
7
8# Add alpha channel to a hexadecimal color
9add_alpha_channel(){
10 echo "$1" | \
11 sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/"
12}
13
14# Wallpaper
15wallpaper="/home/tom/Pictures/Wallpapers/snake.jpg"
16
17# Padding
18window_p=20
19
20# Panel
21panel_h=24
22font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*"
23font_sec="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*"
24
25# Colors
26color_fg=$(get_x_color 15)
27color_accent=$(get_x_color 10)
28color_bg=$(get_x_color 0)
29
30# Alpha Colors for use with bar
31acolor_fg=$(add_alpha_channel $color_fg)
32acolor_accent=$(add_alpha_channel $color_accent)
33acolor_bg=$(add_alpha_channel $color_bg)
diff --git a/config/redshift.conf b/config/redshift.conf
new file mode 120000
index 0000000..89e8120
--- /dev/null
+++ b/config/redshift.conf
@@ -0,0 +1 @@
/home/tom/dotfiles/redshift.conf \ No newline at end of file