diff options
Diffstat (limited to 'herbstluftwm/.local')
| -rwxr-xr-x | herbstluftwm/.local/bin/dmenu_run_hlwm | 45 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/hlwm_goto_tag | 7 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/hlwm_moveto_tag | 7 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/hlwm_run.sh | 12 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/hlwm_select_tag | 10 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/restartpanels.sh | 27 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/run_list.sh | 20 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/scratchpad.sh | 26 | ||||
| -rwxr-xr-x | herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh | 102 | ||||
| l--------- | herbstluftwm/.local/share/config-files/herbstluftwm | 1 | ||||
| l--------- | herbstluftwm/.local/share/config-files/herbstluftwm-panel | 1 |
11 files changed, 247 insertions, 11 deletions
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 |
