aboutsummaryrefslogtreecommitdiffstats
path: root/herbstluftwm/.config
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2021-02-28 17:58:30 +0800
committerPeter Son Struschka <me@peter-struschka.com>2021-02-28 17:58:30 +0800
commit83d7b9c7ce20f16681afacf99ed3ab47427f1ded (patch)
tree5f607e348dadf13e5d6061217b7a317a48527d83 /herbstluftwm/.config
parente5209aad576fe44d3965fcb94d6709348b0a93bf (diff)
downloaddotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.tar.gz
dotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.tar.bz2
dotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.tar.lz
dotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.tar.xz
dotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.tar.zst
dotfiles-83d7b9c7ce20f16681afacf99ed3ab47427f1ded.zip
all: fixes and new modules
Diffstat (limited to 'herbstluftwm/.config')
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/autostart47
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/cycle_main_monitors.sh16
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/float.sh9
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/floating.sh52
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/floatmon.sh68
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/hiddentag.sh29
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/lasttag.sh9
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/panel.sh5
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/polybar.sh5
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/reindex.sh15
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/rules10
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/swap_monitor_tag.sh20
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/toggle_floatmon.sh33
13 files changed, 295 insertions, 23 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart
index 052f191..5e5c942 100755
--- a/herbstluftwm/.config/herbstluftwm/autostart
+++ b/herbstluftwm/.config/herbstluftwm/autostart
@@ -16,8 +16,11 @@ if hc silent new_attr bool my_not_first_autostart; then
#[ ! "$(pidof -x xss-lock)" ] && xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
[ ! "$(pidof -x xss-lock)" ] && herbstclient spawn xss-lock -n /usr/lib/xsecurelock/dimmer -l -- slock
fi
+[ ! "$(pidof -x picom)" ] && herbstclient spawn nm-applet
-#xsetroot -solid '#5A8E3A'
+xwallpaper --zoom "$XDG_DATA_HOME/images/wallpaper.jpg"
+
+xsetroot -solid '#5A8E3A'
# remove all existing keybindings
hc keyunbind --all
@@ -82,12 +85,15 @@ hc keybind $Mod-Control-Right resize right +$resizestep
tag_names=( {1..9} 10 )
tag_keys=( {1..9} 0 )
+echo "start" > /tmp/herbst_autostart
hc rename default "${tag_names[0]}" || true
for i in "${!tag_names[@]}" ; do
+ echo "$i ${tag_names[$i]} ${tag_keys[$i]}" >> /tmp/herbst_autostart
hc add "${tag_names[$i]}"
+ hc set_attr "tags.by-name.${tag_names[$i]}.index" "$i"
key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then
- hc keybind "$Mod-$key" and . use_index "$i" . spawn "$dir/bring_sticky.sh"
+ hc keybind "$Mod-$key" and . use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
@@ -107,19 +113,17 @@ hc keybind $Mod-r remove
hc keybind $Mod-Shift-space floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
+hc keybind $Mod-Shift-m set_attr clients.focus.minimized true
hc keybind $Mod-p pseudotile toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod-space \
- or , and . emit_hook layout_changed \
- . compare tags.focus.curframe_wcount = 2 \
+ or , and . compare tags.focus.curframe_wcount = 2 \
. cycle_layout +1 vertical horizontal max vertical grid \
, cycle_layout +1
-sticky_attr="my_sticky_client"
-hc keybind $Mod-s or , set_attr clients.focus."$sticky_attr" toggle \
- , new_attr bool clients.focus."$sticky_attr" true
+hc watch tags.focus.tiling.focused_frame.algorithm
hc keybind $ModAlt-Tab spawn rofi -show window
@@ -168,15 +172,17 @@ hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
-hc keybind $Mod-BackSpace cycle_monitor
+hc keybind $Mod-BackSpace spawn "$dir/cycle_main_monitors.sh"
# Swap tag with next monitor
hc keybind $Mod-Shift-BackSpace chain \
, new_attr string my_prev_monitor_tag \
, substitute T monitors.focus.tag \
set_attr my_prev_monitor_tag T \
- , cycle_monitor \
- , substitute T my_prev_monitor_tag \
- use T
+ , spawn bash -c \
+ "'$dir/cycle_main_monitors.sh' \
+ && herbstclient substitute T my_prev_monitor_tag \
+ use T"
+
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-c cycle
@@ -185,6 +191,14 @@ hc keybind $Mod-i jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
+
+# title theme
+hc attr theme.title_color '#000000'
+hc attr theme.title_height 15
+hc attr theme.title_font 'Dejavu Sans:pixelsize=12'
+
+#hc attr theme.padding_top 2
+
hc attr theme.active.color '#9fbc00'
hc attr theme.normal.color '#454545'
hc attr theme.urgent.color orange
@@ -217,22 +231,31 @@ hc set hide_covered_windows off
hc set focus_crosses_monitor_boundaries on
hc set swap_monitors_to_get_tag on
hc set focus_stealing_prevention off
-hc set focus_follows_mouse true
+hc set focus_follows_mouse false
+
+hc set raise_on_focus on
hc set tree_style '╾│ ├└╼─┐'
# rules
rules="$XDG_CONFIG_HOME/herbstluftwm/rules"
[ -x "$rules" ] && source "$rules"
+hc apply_rules --all
# unlock, just to be sure
hc unlock
+hc remove_monitor floatmon
+
# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
hc detect_monitors
+# Setup floating monitor
+hc spawn "$dir/floatmon.sh"
+hc keybind $Mod-Shift-s spawn "$dir/toggle_floatmon.sh"
+
# restartpanels
"$dir/polybar.sh" hlwm
#restartpanels.sh
diff --git a/herbstluftwm/.config/herbstluftwm/cycle_main_monitors.sh b/herbstluftwm/.config/herbstluftwm/cycle_main_monitors.sh
new file mode 100755
index 0000000..fbac0e3
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/cycle_main_monitors.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+hc() {
+ herbstclient "$@"
+}
+
+hc lock
+
+hc cycle_monitor
+while $(hc compare monitors.focus.name "!=" "")
+do
+ hc cycle_monitor
+done
+
+hc unlock
+
diff --git a/herbstluftwm/.config/herbstluftwm/float.sh b/herbstluftwm/.config/herbstluftwm/float.sh
new file mode 100755
index 0000000..d190c5c
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/float.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+PADDING=$(herbstclient list_padding)
+
+#re-add monitor called 'float' with same padding and dimensions as the monitor under focus in tag 9
+herbstclient remove_monitor float
+herbstclient add_monitor $(herbstclient list_monitors | grep \\\[FOCUS\\\] | grep -oe '[0-9]\+x[0-9]\++[0-9]\++[0-9]\+') 9 float
+herbstclient lock_tag float
+#add same padding:
+herbstclient pad float $PADDING
diff --git a/herbstluftwm/.config/herbstluftwm/floating.sh b/herbstluftwm/.config/herbstluftwm/floating.sh
new file mode 100755
index 0000000..403259d
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/floating.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+monitor=floatmon
+tag=fl
+Mod=${Mod:-Mod1}
+Floatkey=${Floatkey:-Shift-f}
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+size=$(herbstclient list_monitors | grep '\[FOCUS\]' | grep -oe '[0-9]\+x[0-9]\++[0-9]\++[0-9]\+')
+echo "size is: $size"
+
+hc chain , add "$tag" , floating "$tag" on
+hc or , add_monitor "$size" "$tag" "$monitor" \
+ , move_monitor "$monitor" "$size"
+hc raise_monitor "$monitor"
+hc lock_tag "$monitor"
+
+cmd=(
+or case: and
+ # if not on floating monitor
+ . compare monitors.focus.name != "$monitor"
+ # and if a client is focused
+ . get_attr clients.focus.winid
+ # then remember the last monitor of the client
+ . chain try new_attr string clients.focus.my_lastmon
+ try true
+ . substitute M monitors.focus.index
+ set_attr clients.focus.my_lastmon M
+ # and then move the client to the floating tag
+ . shift_to_monitor "$monitor"
+ . focus_monitor "$monitor"
+ . true
+ case: and
+ # if on the floating monitor
+ . compare monitors.focus.name = "$monitor"
+ # and if a client is focused
+ . get_attr clients.focus.winid
+ # then send it back to the original monitor
+ . substitute M clients.focus.my_lastmon chain
+ , shift_to_monitor M
+ , focus_monitor M
+ . true
+ case: and
+ # if the previous things fail,
+ # just move to the first monitor
+ . shift_to_monitor 0
+ . focus_monitor 0
+)
+
+hc keybind $Mod-$Floatkey "${cmd[@]}"
+
diff --git a/herbstluftwm/.config/herbstluftwm/floatmon.sh b/herbstluftwm/.config/herbstluftwm/floatmon.sh
new file mode 100755
index 0000000..9f55149
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/floatmon.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+monitor=floatmon
+tag=fl
+Mod=${Mod:-Mod4}
+Floatkey=${Floatkey:-s}
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+if which xwininfo &> /dev/null; then
+ size=$(xwininfo -root |
+ sed -n -e '/^ Width: / {
+ s/.*: //;
+ h
+ }
+ /^ Height: / {
+ s/.*: //g;
+ H;
+ x;
+ s/\n/x/p
+ }')
+else
+ echo "This script requires the xwininfo binary."
+ exit 1
+fi
+
+hc chain , add "$tag" , floating "$tag" on
+hc or , add_monitor "$size"+0+0 "$tag" "$monitor" \
+ , move_monitor "$monitor" "$size"+0+0
+hc pad "$monitor" 32 32 32 32
+hc raise_monitor "$monitor"
+hc lock_tag "$monitor"
+
+cmd=(
+or case: and
+ # if not on floating monitor
+ . compare monitors.focus.name != "$monitor"
+ # and if a client is focused
+ . get_attr clients.focus.winid
+ # then remember the last monitor of the client
+ . chain try new_attr string clients.focus.my_lastmon
+ try true
+ . substitute M monitors.focus.index
+ set_attr clients.focus.my_lastmon M
+ # and then move the client to the floating tag
+ . or , chain - shift_to_monitor "$monitor"
+ - focus_monitor "$monitor"
+ , move "$tag"
+ . true
+ case: and
+ # if on the floating monitor
+ . compare monitors.focus.name = "$monitor"
+ # and if a client is focused
+ . get_attr clients.focus.winid
+ # then send it back to the original monitor
+ . substitute M clients.focus.my_lastmon chain
+ , shift_to_monitor M
+ , focus_monitor M
+ . true
+ case: and
+ # if the previous things fail,
+ # just move to the first monitor
+ . shift_to_monitor 0
+ . focus_monitor 0
+)
+
+hc keybind $Mod-$Floatkey "${cmd[@]}"
+
diff --git a/herbstluftwm/.config/herbstluftwm/hiddentag.sh b/herbstluftwm/.config/herbstluftwm/hiddentag.sh
new file mode 100755
index 0000000..8c41d33
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/hiddentag.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+tag=hidden
+Mod=${Mod:-Mod4}
+HideKey=${Floatkey:-t}
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+hc add "$tag"
+
+cmd=(
+ and . chain try new_attr string clients.focus.my_original_tag
+ try true
+ . substitute T tags.focus.index
+ set_attr clients.focus.my_original_tag T
+ . move "$tag"
+ )
+unhide_cmd=(
+ foreach T clients.
+ sprintf S "%c.tag" T
+ and . compare S "=" "$tag"
+ . sprintf IDATTR "%c.winid" T
+ sprintf ID "%s" IDATTR
+ q
+ )
+
+hc keybind $Mod-$HideKey "${cmd[@]}"
+hc keybind $Mod-Shift-$HideKey
+
diff --git a/herbstluftwm/.config/herbstluftwm/lasttag.sh b/herbstluftwm/.config/herbstluftwm/lasttag.sh
index d4c328c..170643b 100755
--- a/herbstluftwm/.config/herbstluftwm/lasttag.sh
+++ b/herbstluftwm/.config/herbstluftwm/lasttag.sh
@@ -15,7 +15,7 @@ tag="$(hc attr tags.focus.name)"
lasttag="$tag"
hc --idle '(tag_changed|goto_last_tag|reload)' \
- | while read line ; do
+ | while read -r line ; do
IFS=$'\t' read -ra args <<< "$line"
case ${args[0]} in
tag_changed)
@@ -23,13 +23,16 @@ hc --idle '(tag_changed|goto_last_tag|reload)' \
tag=${args[1]}
;;
goto_last_tag)
- [ "$lasttag" ] && hc and . use "$lasttag" . spawn "$dir/bring_sticky.sh"
+ [ "$lasttag" ] && hc use "$lasttag"
;;
moveto_last_tag)
- [ "$lasttag" ] && hc and . move "$lasttag" . spawn "$dir/bring_sticky.sh"
+ [ "$lasttag" ] && hc move "$lasttag"
;;
reload)
exit
;;
esac
+ read -r -d '' -a visible_tags <<< "$(hc list_monitors | cut -d\" -f2)"
+ echo "new last_tag: ${lasttag}" >> /tmp/lasttag.log
+ echo "new tag: ${tag}" >> /tmp/lasttag.log
done
diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh
index 229e31e..41086c1 100755
--- a/herbstluftwm/.config/herbstluftwm/panel.sh
+++ b/herbstluftwm/.config/herbstluftwm/panel.sh
@@ -238,9 +238,8 @@ hc pad $monitor $panel_height
windowtitle="${cmd[@]:2}"
;&
layout_changed)
- currenttag=$(hc tag_status | tr '\t' '\n' | sed -n 's/#//p')
- focusedtaglayout=$(hc layout "$currenttag" @ | awk '{print $2}' | sed 's/://')
- case "$focusedtaglayout" in
+ current_layout=$(hc get_attr tags.focus.tiling.focused_frame.algorithm)
+ case "$curent_layout" in
vertical)
layout="V" ;;
horizontal)
diff --git a/herbstluftwm/.config/herbstluftwm/polybar.sh b/herbstluftwm/.config/herbstluftwm/polybar.sh
index 01d3d91..1c6d9a9 100755
--- a/herbstluftwm/.config/herbstluftwm/polybar.sh
+++ b/herbstluftwm/.config/herbstluftwm/polybar.sh
@@ -40,19 +40,22 @@ MONITOR=$(name "$primary_mon_name") polybar "topbar${wm}" &
primary_height_var="${primary_mon_name}_height"
declare "${primary_mon_name}_height=$((${!primary_height_var}+16))"
+hc set auto_detect_panels true
+
while read -r mon; do
echo "launching bar on $(name "$mon")"
height_var="$(name "$mon")_height"
echo "${height_var}"
echo "${!height_var}"
OFFSET_Y="$((${!height_var}-16))" MONITOR="$(name "$mon")" polybar "topbar2${wm}" &
+ echo "$(name "$mon") OFFSET Y $((${!height_var}-16))"
#sleep 2
echo -n "name: "
name "$mon"
echo
echo -n "id hlwm: "
hlwm_id "$mon"
- hc pad "$(hlwm_id "$mon")" "${!height_var}"
+ #hc pad "$(hlwm_id "$mon")" "${!height_var}"
done <<< "$(polybar -m)"
echo "Bars launched"
diff --git a/herbstluftwm/.config/herbstluftwm/reindex.sh b/herbstluftwm/.config/herbstluftwm/reindex.sh
new file mode 100755
index 0000000..b07c555
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/reindex.sh
@@ -0,0 +1,15 @@
+#!/bin/env bash
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+num_tags=$(hc attr tags.count)
+
+hidden_tags="scratchpad hidden fl"
+
+i=1
+
+for tag in $hidden_tags; do
+ hc set_attr "tags.by-name.$tag.index" $((num_tags-i))
+ echo "$tag to $((num_tags-i))"
+ i=$((i+1))
+done
diff --git a/herbstluftwm/.config/herbstluftwm/rules b/herbstluftwm/.config/herbstluftwm/rules
index 9fedcae..4157ae1 100755
--- a/herbstluftwm/.config/herbstluftwm/rules
+++ b/herbstluftwm/.config/herbstluftwm/rules
@@ -29,13 +29,13 @@ hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' \
# _NET_WM_WINDOW_TYPE_(ATOM) = <windowtype>
# WM_WINDOW_ROLE(STRING) = "<windowrole>"
hc rule class='jetbrains-toolbox' \
- floating=on floatplacement=none focus=off
-hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' title='win0' \
floating=on floatplacement=center focus=off
-hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' \
+hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' title='win0' \
+ floating=on floatplacement=center focus=off
+hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' \
title='Cannot execute command' \
floating=on floatplacement=center focus=off
-hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' \
+hc rule instance~'jetbrains-[a-z]*' class~'jetbrains-[a-z]*' \
title~'(Welcome.*)|(Java)' \
floating=on floatplacement=center focus=off
hc rule instance='gcr-prompter' class='Gcr-prompter' title='Unlock Keyring' \
@@ -46,4 +46,6 @@ hc rule instance=Steam class=Steam title~'(.*)List(.*)' \
focus=off
hc rule instance=scratchpad \
tag=scratchpad
+hc rule title='Discord Updater' \
+ floating=on
diff --git a/herbstluftwm/.config/herbstluftwm/swap_monitor_tag.sh b/herbstluftwm/.config/herbstluftwm/swap_monitor_tag.sh
new file mode 100755
index 0000000..8018c6d
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/swap_monitor_tag.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+dir="$XDG_CONFIG_HOME/herbstluftwm"
+
+hc() {
+ herbstclient "$@"
+}
+
+
+hc chain . \
+ . lock \
+ . new_attr string my_prev_monitor_tag \
+ . substitute T monitors.focus.tag \
+ set_attr my_prev_monitor_tag T \
+ . spawn bash -c \
+ "'$dir/cycle_main_monitors.sh' \
+ && herbstclient substitute T my_prev_monitor_tag \
+ use T"
+
+hc unlock
diff --git a/herbstluftwm/.config/herbstluftwm/toggle_floatmon.sh b/herbstluftwm/.config/herbstluftwm/toggle_floatmon.sh
new file mode 100755
index 0000000..f0b13b9
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/toggle_floatmon.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# Toggle floating monitor
+
+monitor=floatmon
+tag=fl
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+if which xwininfo &> /dev/null; then
+ size=$(xwininfo -root |
+ sed -n -e '/^ Width: / {
+ s/.*: //;
+ h
+ }
+ /^ Height: / {
+ s/.*: //g;
+ H;
+ x;
+ s/\n/x/p
+ }')
+else
+ echo "This script requires the xwininfo binary."
+ exit 1
+fi
+
+hc chain , add "$tag" , floating "$tag" on
+hc or , and . add_monitor "$size"+0+0 "$tag" "$monitor" \
+ . raise_monitor "$monitor" \
+ . pad "$monitor" 32 32 32 32 \
+ . lock_tag "$monitor" \
+ , remove_monitor "$monitor" "$size"+0+0
+