aboutsummaryrefslogtreecommitdiffstats
path: root/herbstluftwm
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2020-10-11 12:15:08 +0800
committerPeter Son Struschka <me@peter-struschka.com>2020-10-11 20:22:03 +0800
commite5209aad576fe44d3965fcb94d6709348b0a93bf (patch)
tree3f8c4388d5b2511d78debf5e2d9b1357c3187b38 /herbstluftwm
parent37dd411698bd6eae8365260dde39b8ae9c7cbd36 (diff)
downloaddotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.gz
dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.bz2
dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.lz
dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.xz
dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.zst
dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.zip
all: overhaul
all: Remove old symlinks herbstluftwm: use polybar instead of dzen2 polybar: update config doom-emacs: update repository
Diffstat (limited to 'herbstluftwm')
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/autostart112
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/bring_sticky.sh29
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/herbstcommander.sh88
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/lasttag.sh35
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/panel.sh4
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/polybar.sh58
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/rules49
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/windowmenu.sh50
-rwxr-xr-xherbstluftwm/.local/bin/dmenu_run_hlwm45
-rwxr-xr-xherbstluftwm/.local/bin/hlwm_goto_tag7
-rwxr-xr-xherbstluftwm/.local/bin/hlwm_moveto_tag7
-rwxr-xr-xherbstluftwm/.local/bin/hlwm_run.sh12
-rwxr-xr-xherbstluftwm/.local/bin/hlwm_select_tag10
-rwxr-xr-xherbstluftwm/.local/bin/restartpanels.sh27
-rwxr-xr-xherbstluftwm/.local/bin/run_list.sh20
-rwxr-xr-xherbstluftwm/.local/bin/scratchpad.sh26
-rwxr-xr-xherbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh102
l---------herbstluftwm/.local/share/config-files/herbstluftwm1
l---------herbstluftwm/.local/share/config-files/herbstluftwm-panel1
19 files changed, 621 insertions, 62 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart
index 7605dd2..052f191 100755
--- a/herbstluftwm/.config/herbstluftwm/autostart
+++ b/herbstluftwm/.config/herbstluftwm/autostart
@@ -2,6 +2,8 @@
# this is a simple config for herbstluftwm
+dir="$XDG_CONFIG_HOME/herbstluftwm"
+
hc() {
herbstclient "$@"
}
@@ -9,9 +11,10 @@ hc() {
hc emit_hook reload
if hc silent new_attr bool my_not_first_autostart; then
- [ ! "$(pidof -x picom)" ] && picom &
+ [ ! "$(pidof -x picom)" ] && herbstclient spawn picom
xset s 600 5
- [ ! "$(pidof -x xss-lock)" ] && xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
+ #[ ! "$(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
#xsetroot -solid '#5A8E3A'
@@ -31,8 +34,8 @@ hc keybind $Mod-Shift-q close
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn "${TERMINAL:-xterm}" # use your $TERMINAL with xterm as fallback
-hc keybind $Mod-x spawn dmenu_run
-hc keybind $Mod-d spawn /etc/xdg/herbstluftwm/dmenu_run_hlwm
+hc keybind $Mod-x spawn dmenu_run_hlwm
+hc keybind $Mod-d spawn rofi -show drun
hc keybind $Mod-backslash rotate
@@ -84,7 +87,7 @@ 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-$key" and . use_index "$i" . spawn "$dir/bring_sticky.sh"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
@@ -93,11 +96,15 @@ done
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma use_index -1 --skip-visible
-hc keybind $Mod-b use_previous
+# Previous tag
+hc spawn "$dir/lasttag.sh"
+hc keybind $Mod-b emit_hook goto_last_tag
+hc keybind $Mod-Shift-b emit_hook moveto_last_tag
+#hc keybind $Mod-b use_previous
# layouting
hc keybind $Mod-r remove
-hc keybind $Mod-s floating toggle
+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-p pseudotile toggle
@@ -109,13 +116,36 @@ hc keybind $Mod-space
. 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 keybind $ModAlt-Tab spawn rofi -show window
# scratchpad
hc keybind $Mod-grave spawn ~/.local/bin/scratchpad.sh
-# media
+# hidden
+hidden_tag="hidden"
+hc add "$hidden_tag"
+# hide window
+hc keybind $Mod-t move "$hidden_tag"
+# bring all hidden windows to current tag
+hc keybind $Mod-Shift-t \
+ foreach T clients. \
+ sprintf S "%c.tag" T \
+ and . compare S "=" "$hidden_tag" \
+ . sprintf IDATTR "%c.winid" T \
+ sprintf ID "%s" IDATTR \
+ bring ID
+
+hc keybind $Mod-m spawn "$dir/windowmenu.sh"
+hc keybind $Mod-n spawn hlwm_goto_tag
+
+hc keybind $Mod-w spawn "$dir/herbstcommander.sh"
+
+# XF86 keys
hc keybind XF86AudioLowerVolume spawn change-vol -
hc keybind XF86AudioRaiseVolume spawn change-vol +
hc keybind XF86AudioMute spawn pactl set-sink-mute 0 toggle
@@ -128,6 +158,7 @@ hc keybind XF86AudioPrev spawn playerctl previous
hc keybind XF86MonBrightnessDown spawn brightnessctl s "5%-"
hc keybind XF86MonBrightnessUp spawn brightnessctl s "+5%"
+# lock
hc keybind $Mod-Shift-Delete spawn xset s activate
# mouse
@@ -154,16 +185,6 @@ hc keybind $Mod-i jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
-hc set frame_border_active_color '#222222'
-hc set frame_border_normal_color '#101010'
-hc set frame_bg_normal_color '#565656'
-hc set frame_bg_active_color '#345F0C'
-hc set frame_border_width 1
-hc set always_show_frame on
-hc set frame_bg_transparent on
-hc set frame_transparent_width 5
-hc set frame_gap 4
-
hc attr theme.active.color '#9fbc00'
hc attr theme.normal.color '#454545'
hc attr theme.urgent.color orange
@@ -177,33 +198,33 @@ hc attr theme.active.inner_color '#3E4A00'
hc attr theme.active.outer_color '#3E4A00'
hc attr theme.background_color '#141414'
-hc set window_gap 2
+hc set frame_border_active_color '#222222'
+hc set frame_border_normal_color '#101010'
+hc set frame_bg_normal_color '#565656'
+hc set frame_bg_active_color '#345F0C'
+hc set frame_border_width 1
+hc set always_show_frame off
+hc set frame_bg_transparent on
+hc set frame_transparent_width 5
+hc set frame_gap 4
+hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings off
hc set smart_frame_surroundings on
hc set mouse_recenter_gap 0
-hc set focus_crosses_monitor_boundaries off
-
-# rules
-hc unrule -F
-#hc rule class=XTerm tag=3 # move all xterms to tag 3
-hc rule focus=on # normally focus new clients
-#hc rule focus=off # normally do not focus new clients
-# give focus to most common terminals
-#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
-hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=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='jetbrains-toolbox' floating=on
-hc rule class='jetbrains-idea' instance='jetbrains-idea' title='win0' floating=on
-hc rule class=Steam instance=Steam title~'Steam( .*)'
-hc rule class=Steam instance=Steam title~'(.*)List(.*)'
-hc rule instance=scratchpad tag=scratchpad
+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 tree_style '╾│ ├└╼─┐'
+# rules
+rules="$XDG_CONFIG_HOME/herbstluftwm/rules"
+[ -x "$rules" ] && source "$rules"
+
# unlock, just to be sure
hc unlock
@@ -212,16 +233,7 @@ hc unlock
# or simply:
hc detect_monitors
-# find the panel
-panel=~/.config/herbstluftwm/panel.sh
-[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
-for monitor in $(hc list_monitors | cut -d: -f1) ; do
- # start it on each monitor
- hc spawn "$panel" "$monitor"
-done
-killall -q stalonetray
-while pgrep -u "$UID" -x stalonetray >/dev/null; do
- sleep 1
-done
-sleep 5
-hc spawn stalonetray --geometry 1x1+1250+0 --window-layer top -c "$XDG_CONFIG_HOME/stalonetray/stalonetrayrc"
+# restartpanels
+"$dir/polybar.sh" hlwm
+#restartpanels.sh
+
diff --git a/herbstluftwm/.config/herbstluftwm/bring_sticky.sh b/herbstluftwm/.config/herbstluftwm/bring_sticky.sh
new file mode 100755
index 0000000..d0f1250
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/bring_sticky.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Script to bring non visible sticky windows over
+# to the current tag
+
+hc() {
+ herbstclient "$@"
+}
+
+hc lock
+
+read -ra other_monitor <<< "$(hc tag_status | tr '\t' '\n' | sed -n 's/-//p')"
+declare -A other_monitor_map
+for key in "${!other_monitor[@]}"; do other_monitor_map[${other_monitor[$key]}]="$key"; done
+
+win_ids=$(hc foreach T clients. \
+ sprintf S "%c.my_sticky_client" T \
+ and . silent compare S "=" "true" \
+ . sprintf WINIDATTR "%c.winid" T \
+ attr WINIDATTR 2>&1)
+win_array=($win_ids)
+
+for sticky_winid in "${win_array[@]}"; do
+ tag=$(hc attr "clients.$sticky_winid.tag")
+ if [ ! ${other_monitor_map[$tag]+_} ]; then hc bring "$sticky_winid"; fi
+done
+
+hc unlock
+
diff --git a/herbstluftwm/.config/herbstluftwm/herbstcommander.sh b/herbstluftwm/.config/herbstluftwm/herbstcommander.sh
new file mode 100755
index 0000000..efe5f20
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/herbstcommander.sh
@@ -0,0 +1,88 @@
+#!/usr/bin/env bash
+
+# herbstcommander.sh - launch herbstluftwm-commands via dmenu
+# Written by Florian Bruhin <me@the-compiler.org>
+
+# To customize dmenu-colors, create a file named "herbstcommander" in your
+# herbstluftwm config-directory, with something like this in it:
+#
+# dmenu_command=(dmenu -i -b -nb '#313131' -nf '#686868' -sb '#454545' -sf '#898989')
+#
+# You can also directly pass dmenu-arguments to this script instead, as long
+# as dmenu_command is undefined.
+
+config_1="$XDG_CONFIG_HOME/herbstluftwm/herbstcommander"
+config_2="$HOME/.config/herbstluftwm/herbstcommander"
+[[ -f "$config_1" ]] && source "$config_1"
+[[ -f "$config_2" ]] && source "$config_2"
+
+dm() {
+ if [[ "${dmenu_command[@]}" ]]; then
+ "${dmenu_command[@]}" "$@"
+ else
+ dmenu -i "$@"
+ fi
+}
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+prompt=${prompt:-herbstluft: }
+display_reply=${display_reply:-true}
+
+cmd=( "$@" )
+forceexec=0
+
+while :; do
+ dmenu_args=""
+ if [[ "$forceexec" != 1 ]]; then
+ completion=$(hc complete "${#cmd[@]}" "${cmd[@]}")
+ if [[ "$?" = 7 ]] ; then
+ forceexec=1
+ fi
+ fi
+ if [[ "$forceexec" == 1 ]]; then
+ echo "Executing ${cmd[@]}"
+ reply=$(hc "${cmd[@]}")
+ status=$?
+ if [[ "$display_reply" && "$reply" ]]; then
+ dm -p "${cmd[*]}" <<< "$reply" >/dev/null
+ fi
+ exit $status
+ else
+ case "${cmd[*]}" in
+ raise|jumpto|bring)
+ IFS=$'\t' read -ra tags <<< "$(hc tag_status)"
+ i=1
+ completion=$(
+ wmctrl -l | while read line; do
+ IFS=' ' read -ra fields <<< "$line"
+ id=${fields[0]}
+ tag=${tags[ ${fields[1]} ]}
+ class=$(xprop -notype -id $id WM_CLASS |
+ sed 's/.*\?= *//; s/"\(.*\?\)", *"\(.*\?\)".*/\1,\2/')
+ title=${fields[@]:3}
+ printf "%-3s %s %-3s [%s] %s\n" "$i)" "$id" "$tag" "$class" "$title"
+ i=$((i+1))
+ done
+ )
+
+ dmenu_args="-l 10"
+ ;;
+ esac
+ next=$(dm $dmenu_args -p "${prompt}${cmd[*]}" <<< "$completion")
+ (( $? != 0 )) && exit 125 # dmenu was killed
+ if [[ -z "$next" ]]; then
+ forceexec=1 # empty reply instead of completion
+ else
+ case "${cmd[*]}" in
+ raise|jumpto|bring)
+ # add the WINID only (second field)
+ IFS=' ' read -ra fields <<< "$next"
+ cmd+=( ${fields[1]} )
+ ;;
+ *)
+ cmd+=( $next )
+ ;;
+ esac
+ fi
+ fi
+done
diff --git a/herbstluftwm/.config/herbstluftwm/lasttag.sh b/herbstluftwm/.config/herbstluftwm/lasttag.sh
new file mode 100755
index 0000000..d4c328c
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/lasttag.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+# usage: start this script in anywhere your autostart (but *after* the
+# emit_hook reload line)
+
+# to switch to the last tag, call: herbstclient emit_hook goto_last_tag
+# or bind it: herbstclient keybind Mod1-Escape emit_hook goto_last_tag
+
+
+dir="$XDG_CONFIG_HOME/herbstluftwm"
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+tag="$(hc attr tags.focus.name)"
+lasttag="$tag"
+
+hc --idle '(tag_changed|goto_last_tag|reload)' \
+ | while read line ; do
+ IFS=$'\t' read -ra args <<< "$line"
+ case ${args[0]} in
+ tag_changed)
+ lasttag="$tag"
+ tag=${args[1]}
+ ;;
+ goto_last_tag)
+ [ "$lasttag" ] && hc and . use "$lasttag" . spawn "$dir/bring_sticky.sh"
+ ;;
+ moveto_last_tag)
+ [ "$lasttag" ] && hc and . move "$lasttag" . spawn "$dir/bring_sticky.sh"
+ ;;
+ reload)
+ exit
+ ;;
+ esac
+ done
diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh
index ebdd59a..229e31e 100755
--- a/herbstluftwm/.config/herbstluftwm/panel.sh
+++ b/herbstluftwm/.config/herbstluftwm/panel.sh
@@ -128,6 +128,8 @@ hc pad $monitor $panel_height
for i in "${tags[@]}" ; do
# don't render these hidden tags
case ${i:1} in
+ 'hidden')
+ ;&
'scratchpad')
continue ;;
esac
@@ -185,7 +187,7 @@ hc pad $monitor $panel_height
IFS=$'\t' read -ra cmd || break
# log events for debugging
- echo "${cmd[@]}" >> /tmp/panel_${monitor}.log
+ #echo "${cmd[@]}" >> /tmp/panel_${monitor}.log
# find out event origin
case "${cmd[0]}" in
diff --git a/herbstluftwm/.config/herbstluftwm/polybar.sh b/herbstluftwm/.config/herbstluftwm/polybar.sh
new file mode 100755
index 0000000..01d3d91
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/polybar.sh
@@ -0,0 +1,58 @@
+#!/bin/env bash
+
+killall -q polybar
+
+while pgrep -u $UID -x polybar >/dev/null; do
+ sleep 0.5
+done
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+# manually set padding
+hc set auto_detect_panels false
+
+monitor_bound() {
+ echo "$1" | cut -d' ' -f2
+}
+
+name() {
+ echo "$1" | sed -e 's/:.*$//g'
+}
+
+hlwm_id() {
+ while read -r bound; do
+ hc list_monitors | grep "$bound" | sed -e 's/:.*$//g'
+ done <<< "$(monitor_bound "$1")"
+}
+
+primary_mon=$(polybar -m | grep '(primary)')
+primary_mon_name=$(name "$primary_mon")
+all_monitors=$(polybar -m |
+ sed -e 's/:.*$//g')
+for name in $all_monitors; do
+ declare "${name}_height=16"
+done
+
+wm=${1:+"-$1"}
+
+#
+MONITOR=$(name "$primary_mon_name") polybar "topbar${wm}" &
+primary_height_var="${primary_mon_name}_height"
+declare "${primary_mon_name}_height=$((${!primary_height_var}+16))"
+
+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}" &
+ #sleep 2
+ echo -n "name: "
+ name "$mon"
+ echo
+ echo -n "id hlwm: "
+ hlwm_id "$mon"
+ hc pad "$(hlwm_id "$mon")" "${!height_var}"
+done <<< "$(polybar -m)"
+
+echo "Bars launched"
diff --git a/herbstluftwm/.config/herbstluftwm/rules b/herbstluftwm/.config/herbstluftwm/rules
new file mode 100755
index 0000000..9fedcae
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/rules
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+hc() {
+ herbstclient "$@"
+}
+
+# rules
+hc unrule -F
+#hc rule class=XTerm tag=3 # move all xterms to tag 3
+hc rule focus=on # normally focus new clients
+#hc rule focus=off # normally do not focus new clients
+
+# give focus to most common terminals
+#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
+hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' \
+ floating=on
+hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' \
+ focus=on
+hc rule windowrole='pop-up' \
+ floating=on
+hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' \
+ manage=off
+
+# use xprop with mouse or
+# DISPLAY=:0 xprop -name "..."
+# xprop to rule conditions
+# WM_CLASS(STRING) = "<instance>", "<class>"
+# WM_NAME(STRING) = "<title>"
+# _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]*' \
+ title='Cannot execute command' \
+ floating=on floatplacement=center focus=off
+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' \
+ floating=on floatplacement=center focus=off
+hc rule instance=Steam class=Steam title~'Steam( .*)' \
+ focus=off
+hc rule instance=Steam class=Steam title~'(.*)List(.*)' \
+ focus=off
+hc rule instance=scratchpad \
+ tag=scratchpad
+
diff --git a/herbstluftwm/.config/herbstluftwm/windowmenu.sh b/herbstluftwm/.config/herbstluftwm/windowmenu.sh
new file mode 100755
index 0000000..9de0f46
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/windowmenu.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+set -e
+#
+# dependencies:
+#
+# - rofi
+
+# offer a window menu offering possible actions on that window like
+# moving to a different tag or toggling its fullscreen state
+
+action_list() {
+ local a="$1"
+ "$a" "Close" herbstclient close
+ "$a" "Toggle fullscreen" herbstclient fullscreen toggle
+ "$a" "Toggle pseudotile" herbstclient pseudotile toggle
+ for tag in $(herbstclient complete 1 move) ; do
+ "$a" "Move to tag $tag" herbstclient move "$tag"
+ done
+}
+
+print_menu() {
+ echo "$1"
+}
+
+title=$(herbstclient attr clients.focus.title)
+title=${title//&/&amp;}
+rofiflags=(
+ -p "herbstclient:"
+ -mesg "<i>$title</i>"
+ -columns 3
+ -location 2
+ -width 100
+ #-no-custom
+)
+result=$(action_list print_menu | rofi -i -dmenu -m -2 "${rofiflags[@]}")
+[ $? -ne 0 ] && exit 0
+
+exec_entry() {
+ if [ "$1" = "$result" ] ; then
+ shift
+ "$@"
+ exit 0
+ else
+ herbstclient add "$result"
+ herbstclient move "$result"
+ fi
+}
+
+action_list exec_entry
+
diff --git a/herbstluftwm/.local/bin/dmenu_run_hlwm b/herbstluftwm/.local/bin/dmenu_run_hlwm
new file mode 100755
index 0000000..612ee48
--- /dev/null
+++ b/herbstluftwm/.local/bin/dmenu_run_hlwm
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+if ! command -v dmenu > /dev/null 2>/dev/null ; then
+ echo "Error: Requirement dmenu not found in your PATH." >&2
+ exit 1
+fi
+
+# Get the currently active tag
+tag=$(herbstclient attr tags.focus.name)
+
+# Redirect to dmenu_path if available
+if command -v dmenu_path > /dev/null 2>/dev/null ; then
+ selectedPath=$(dmenu_path | dmenu "$@")
+
+# If at least stest is present use the code from latest dmenu_path directly
+elif command -v stest > /dev/null 2>/dev/null ; then
+ cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
+ if [ -d "$cachedir" ]; then
+ cache=$cachedir/dmenu_run
+ else
+ cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
+ fi
+ IFS=:
+ if stest -dqr -n "$cache" $PATH; then
+ selectedPath=$(stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@")
+ else
+ selectedPath=$(dmenu "$@" < "$cache")
+ fi
+
+# Both not found -> unable to continue
+else
+ echo "Error: Requirements dmenu_path or stest not found in your PATH." >&2
+ exit 2
+fi
+
+# Stop here if the user aborted
+[ -z $selectedPath ] && exit 0
+
+# Move next window from this process to this tag. Prepend the rule so
+# that it may be overwritten by existing custom rules e.g. in the
+# autostart. Also set a maximum age for this rule of 120 seconds and
+# mark it as one-time-only rule.
+herbstclient rule prepend maxage="120" pid="$$" tag="$tag" once
+
+exec $selectedPath
diff --git a/herbstluftwm/.local/bin/hlwm_goto_tag b/herbstluftwm/.local/bin/hlwm_goto_tag
new file mode 100755
index 0000000..12c93c0
--- /dev/null
+++ b/herbstluftwm/.local/bin/hlwm_goto_tag
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+tag=$(hlwm_select_tag)
+
+hc use "$tag"
diff --git a/herbstluftwm/.local/bin/hlwm_moveto_tag b/herbstluftwm/.local/bin/hlwm_moveto_tag
new file mode 100755
index 0000000..17be186
--- /dev/null
+++ b/herbstluftwm/.local/bin/hlwm_moveto_tag
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+
+tag=$(hlwm_select_tag)
+
+hc move "$tag"
diff --git a/herbstluftwm/.local/bin/hlwm_run.sh b/herbstluftwm/.local/bin/hlwm_run.sh
new file mode 100755
index 0000000..49fdc28
--- /dev/null
+++ b/herbstluftwm/.local/bin/hlwm_run.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+tag=$(herbstclient attr tags.focus.name)
+
+selectedPath=$(run_list.sh | rofi -dmenu)
+
+[ -z $selectedPath ] && exit 0
+
+herbstclient rule prepend maxage="120" pid="$$" tag="$tag" once
+
+exec $selectedPath
diff --git a/herbstluftwm/.local/bin/hlwm_select_tag b/herbstluftwm/.local/bin/hlwm_select_tag
new file mode 100755
index 0000000..3b23188
--- /dev/null
+++ b/herbstluftwm/.local/bin/hlwm_select_tag
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
+#IFS=$'\t' read -ra tags <<< "$(hc tag_status "")"
+tags="$(hc tag_status "" | tr '\t' '\n')"
+tags_list=$(echo "$tags" | sed 's/^.//g')
+
+selected_tag=$(echo "$tags_list" | rofi -dmenu)
+hc add "$selected_tag"
+echo "$selected_tag"
diff --git a/herbstluftwm/.local/bin/restartpanels.sh b/herbstluftwm/.local/bin/restartpanels.sh
new file mode 100755
index 0000000..20d779e
--- /dev/null
+++ b/herbstluftwm/.local/bin/restartpanels.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+installdir=/
+
+XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
+defaultpanel="$XDG_CONFIG_HOME/herbstluftwm/panel.sh"
+
+[ -x "$defaultpanel" ] || defaultpanel="$installdir/etc/xdg/herbstluftwm/panel.sh"
+
+panelcmd="${1:-$defaultpanel}"
+
+herbstclient emit_hook quit_panel
+
+monitors=$(herbstclient list_monitors)
+
+for i in $(echo "$monitors" | cut -d':' -f1) ; do
+ "$panelcmd" "$i" &
+done
+
+# wait and restart stalonetray
+sleep 1
+killall -q stalonetray
+while pgrep -u "$UID" -x stalonetray >/dev/null; do
+ sleep 1
+done
+herbstclient spawn stalonetray --geometry 1x1+1250+0 --window-layer top -c "$XDG_CONFIG_HOME/stalonetray/stalonetrayrc"
+
diff --git a/herbstluftwm/.local/bin/run_list.sh b/herbstluftwm/.local/bin/run_list.sh
new file mode 100755
index 0000000..463bbaf
--- /dev/null
+++ b/herbstluftwm/.local/bin/run_list.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+set -eu #o pipefail
+
+cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
+if [ -d "$cachedir" ]; then
+ cache=$cachedir/run_list
+else
+ cache=$HOME/.run_list
+fi
+
+#if [ ! -f "$cache" ] || [ $(find "$cache" -mmin +180) = "$cache" ]; then
+IFS=':'
+if [ ! -f "$cache" ] || [ $(find $PATH -prune -cnewer "$cache" 2>/dev/null |\
+ head -c1 | wc -c) -eq 1 ]; then
+
+ find -L $PATH -maxdepth 1 -type f -executable -printf "%f\n" 2>/dev/null |\
+ sort -u | tee "$cache"
+else
+ cat "$cache"
+fi
diff --git a/herbstluftwm/.local/bin/scratchpad.sh b/herbstluftwm/.local/bin/scratchpad.sh
index d168ad7..3e550e4 100755
--- a/herbstluftwm/.local/bin/scratchpad.sh
+++ b/herbstluftwm/.local/bin/scratchpad.sh
@@ -18,17 +18,25 @@ hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
scratchpad=(urxvt -title "$tag" -name "scratchpad")
#scratchpad=(xterm -title "$tag" -name "scratchpad")
-#mrect=( $(hc monitor_rect "") )
read -r -a mrect < <(hc monitor_rect "")
-width=${mrect[2]}
-height=${mrect[3]}
+monitor_w=${mrect[2]}
+monitor_h=${mrect[3]}
+monitor_w_offset=${mrect[0]}
+monitor_h_offset=${mrect[1]}
+
+scratchpad_scale_factor=0.75
+
+scratch_w=$(printf "%d" "$(bc -l <<< "$monitor_w * $scratchpad_scale_factor")")
+scratch_h=$(printf "%d" "$(bc -l <<< "$monitor_h * $scratchpad_scale_factor")")
+scratch_w_offset=$(((monitor_w-scratch_w)/2))
+scratch_h_offset=$(((monitor_h-scratch_h)/2))
rect=(
- $((width/2))
- $((height/2))
- $((mrect[0]+(width/4)))
- $((mrect[1]+(height/4)))
+ "$scratch_w"
+ "$scratch_h"
+ $((monitor_w_offset+scratch_w_offset))
+ $((monitor_h_offset+scratch_h_offset))
)
hc add "$tag"
@@ -36,8 +44,8 @@ hc add "$tag"
monitor=scratchpad
exists=false
-if ! hc add_monitor $(printf "%dx%d%+d%+d" "${rect[@]}") \
- "$tag" $monitor 2> /dev/null ; then
+if ! hc add_monitor "$(printf "%dx%d%+d%+d" "${rect[@]}")" \
+ "$tag" "$monitor" 2> /dev/null ; then
exists=true
else
# remember which monitor was focused previously
diff --git a/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh b/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh
new file mode 100755
index 0000000..b7cf5e6
--- /dev/null
+++ b/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh
@@ -0,0 +1,102 @@
+#!/usr/bin/env bash
+
+hc() {
+ "${herbstclient_command[@]:-herbstclient}" "$@"
+}
+
+monitor_bound() {
+ echo "$1" | cut -d' ' -f2
+}
+
+hlwm_id() {
+ while read -r bound; do
+ hc list_monitors | grep "$bound" | sed -e 's/:.*$//g'
+ done <<< "$(monitor_bound "$1")"
+}
+
+this_monitor=$(polybar -m | grep "$MONITOR")
+
+
+monitor=$(hlwm_id "$this_monitor")
+
+get_layout() {
+ currenttag=$(hc tag_status | tr '\t' '\n' | sed -n 's/#//p')
+ focusedtaglayout=$(hc layout "$currenttag" @ | awk '{print $2}' | sed 's/://')
+ case "$focusedtaglayout" in
+ vertical)
+ echo "V" ;;
+ horizontal)
+ echo "H" ;;
+ max)
+ echo "M" ;;
+ grid)
+ echo "G" ;;
+ esac
+}
+
+layout=$(get_layout)
+
+herbstclient --idle "(tag_*|focus_changed|window_title_changed)" 2>/dev/null | {
+
+ while true; do
+ # Read tags into $tags array
+ IFS=$'\t' read -ra tags <<< "$(hc tag_status "$monitor")"
+ {
+ # Read the prefix from each tag
+ for i in "${tags[@]}" ; do
+ case ${i:1} in
+ 'hidden')
+ ;&
+ 'scratchpad')
+ continue
+ ;;
+ esac
+ case ${i:0:1} in
+ '#')
+ echo -n "%{B#9fbc00}%{F#101010}"
+ # Tag in focus on this monitor
+ ;;
+ '%')
+ echo -n "%{B#9ca668}%{F#141414}"
+ # Tag in focus on other monitor
+ ;;
+ '+')
+ echo -n "%{B#9ca668}%{F#141414}"
+ # tag viewed on this monitor
+ ;;
+ '-')
+ echo -n "%{B#9ca668}%{F#141414}"
+ # Tag viewed on other monitor
+ ;;
+ ':')
+ echo -n "%{B#222}%{F#ffffff}"
+ # Tag is not empty
+ ;;
+ '!')
+ echo -n "%{B#ff0675}%{F#141414}"
+ # Tag contains urgent window
+ ;;
+ *)
+ echo -n "%{B#222}%{F#7a7a7a}"
+ ;;
+ esac
+
+ echo "%{A1:herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
+ done
+
+ echo "%{F-}%{B-}"
+
+ echo "| [$layout]"
+
+ } | tr -d "\n"
+ echo
+ IFS=$'\t' read -ra cmd || break
+
+ case "${cmd[0]}" in
+ focus_changed|window_title_changed|layout_changed)
+ layout=$(get_layout)
+ esac
+ # wait for next event from herbstclient --idle
+ # read -r || break
+ done
+} 2>/dev/null
diff --git a/herbstluftwm/.local/share/config-files/herbstluftwm b/herbstluftwm/.local/share/config-files/herbstluftwm
deleted file mode 120000
index 9e20763..0000000
--- a/herbstluftwm/.local/share/config-files/herbstluftwm
+++ /dev/null
@@ -1 +0,0 @@
-../../../.config/herbstluftwm/autostart \ No newline at end of file
diff --git a/herbstluftwm/.local/share/config-files/herbstluftwm-panel b/herbstluftwm/.local/share/config-files/herbstluftwm-panel
deleted file mode 120000
index 439ccbe..0000000
--- a/herbstluftwm/.local/share/config-files/herbstluftwm-panel
+++ /dev/null
@@ -1 +0,0 @@
-../../../.config/herbstluftwm/panel.sh \ No newline at end of file