diff options
author | ZachIR <zachir@librem.one> | 2025-07-16 22:29:35 -0500 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-07-16 22:29:35 -0500 |
commit | ccbd3d97c0eeb1865d76ef634047147a8c1bbcf3 (patch) | |
tree | 47a6e3146268c5e091db9be3f75e2a04b2de89a6 | |
parent | a88e2fad0048f2d4fe8cab568864a5781d78341c (diff) |
Add script to automagically choose tofi or dmenu
-rwxr-xr-x | dmenu | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#!/bin/sh + +TOFI_CONF="$XDG_CONFIG_HOME/tofi/themes/dmenu" +while getopts "bPrl:p:" o; do case "${o}" in + "b") + ARGS="$ARGS --anchor=bottom" + ;; + "P") + ARGS="$ARGS --hide-input=true" + ;; + "r") + ARGS="$ARGS --require-match=true" + ;; + "l") + TOFI_CONF="$XDG_CONFIG_HOME/tofi/themes/dmenu_vertical" + ;; + "p") + ARGS="$ARGS --prompt-text=$OPTARG" + ;; + "*") + notify-send "Unsupported tofi args!" "Unsupported tofi args!" + ;; +esac done + +if [ -n "$WAYLAND_DISPLAY" ]; then + # Wayland + tofi -c "$TOFI_CONF" $ARGS 2>/dev/null + unset ARGS +elif [ -n "$DISPLAY" ]; then + # X11 + dmenu $@ +fi +unset TOFI_CONF |