diff --git a/bin/omakub-launch-walker b/bin/omakub-launch-walker index 1a6a779c1..be197359f 100755 --- a/bin/omakub-launch-walker +++ b/bin/omakub-launch-walker @@ -7,24 +7,44 @@ # See: https://github.com/abenz1267/walker/pull/708 DIMS_FILE="${XDG_STATE_HOME:-$HOME/.local/state}/omakub/walker-service-dims" +CONFIG_FILE="${HOME}/.config/walker/config.toml" # Ensure elephant (Walker data provider) is running pgrep -x elephant > /dev/null || elephant & +# gtk4-layer-shell renders Walker incorrectly on X11; use a normal window there instead. +want_as_window=false +if [[ ${XDG_SESSION_TYPE:-} == "x11" ]]; then + want_as_window=true +fi + +current_as_window=$(awk '/^as_window = / { print $3; exit }' "$CONFIG_FILE" 2>/dev/null) +if [[ $current_as_window != "$want_as_window" ]]; then + if [[ -n $current_as_window ]]; then + sed -i "s/^as_window = .*/as_window = $want_as_window/" "$CONFIG_FILE" + else + sed -i "1ias_window = $want_as_window" "$CONFIG_FILE" + fi + pkill -x walker 2>/dev/null + while pgrep -x walker > /dev/null; do sleep 0.05; done +fi + # Resolve effective dimensions: defaults, overridden by caller args -width=644; minheight=300; maxheight=300 +# --height is the overall window; min/maxheight only size the scrolled list inside it. +width=644; height=0; minheight=300; maxheight=300 args=("$@") for i in "${!args[@]}"; do case "${args[i]}" in - --width) width="${args[i+1]}" ;; - --minheight) minheight="${args[i+1]}" ;; - --maxheight) maxheight="${args[i+1]}" ;; + --width|-w) width="${args[i+1]}" ;; + --height) height="${args[i+1]}" ;; + --minheight) minheight="${args[i+1]}" ;; + --maxheight) maxheight="${args[i+1]}" ;; esac done # Kill ALL walker processes (client + service) when dimensions change. # Not killing on dim change causes the service to cap new windows to its initially-cached size. -dims_key="w${width}x${minheight}-${maxheight}" +dims_key="w${width}h${height}x${minheight}-${maxheight}" mkdir -p "$(dirname "$DIMS_FILE")" if [[ $(cat "$DIMS_FILE" 2>/dev/null) != $dims_key ]] && pgrep -x walker > /dev/null; then pkill -x walker @@ -35,6 +55,7 @@ echo "$dims_key" > "$DIMS_FILE" # Inject defaults only for dimensions not explicitly passed by the caller. defaults=() [[ $* != *--width* ]] && defaults+=(--width $width) +[[ $* != *--height* && $height -gt 0 ]] && defaults+=(--height $height) [[ $* != *--minheight* ]] && defaults+=(--minheight $minheight) [[ $* != *--maxheight* && $* != *--minheight* ]] && defaults+=(--maxheight $maxheight) diff --git a/bin/omakub-menu b/bin/omakub-menu index b3a088970..efc867752 100755 --- a/bin/omakub-menu +++ b/bin/omakub-menu @@ -42,7 +42,7 @@ menu() { fi fi - echo -e "$options" | omakub-launch-walker --dmenu --width 295 --minheight 1 --maxheight 630 -p "$prompt…" "${args[@]}" 2>/dev/null + echo -e "$options" | omakub-launch-walker --dmenu --width 295 --minheight 280 --maxheight 630 -p "$prompt…" "${args[@]}" 2>/dev/null } terminal() { diff --git a/default/walker/themes/omakub-default/layout.xml b/default/walker/themes/omakub-default/layout.xml index 3b7bda714..a6652f1c1 100644 --- a/default/walker/themes/omakub-default/layout.xml +++ b/default/walker/themes/omakub-default/layout.xml @@ -86,8 +86,8 @@ false true 600 - 300 - 0 + 560 + 280 true true automatic