diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2020-10-11 12:15:08 +0800 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2020-10-11 20:22:03 +0800 |
| commit | e5209aad576fe44d3965fcb94d6709348b0a93bf (patch) | |
| tree | 3f8c4388d5b2511d78debf5e2d9b1357c3187b38 /herbstluftwm/.local/bin/dmenu_run_hlwm | |
| parent | 37dd411698bd6eae8365260dde39b8ae9c7cbd36 (diff) | |
| download | dotfiles-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/.local/bin/dmenu_run_hlwm')
| -rwxr-xr-x | herbstluftwm/.local/bin/dmenu_run_hlwm | 45 |
1 files changed, 45 insertions, 0 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 |
