#!/bin/bash TOFI_CONF="$XDG_CONFIG_HOME/tofi/themes/dmenu" if [ -n "$WAYLAND_DISPLAY" ]; then if echo "$@" | grep -qE -- '-l [0-9]+'; then declare -a ARGS SKIP="0" for arg in "$@"; do echo "$arg" | grep -qE '^\s*-l\s*' && SKIP=2 if [ "$SKIP" -gt 0 ]; then DMENULINES="y" TOFI_CONF="$XDG_CONFIG_HOME/tofi/themes/dmenu_vertical" SKIP="$((SKIP - 1))" continue fi if echo "$arg" | grep -qE '.* .*'; then ARGS+=("$arg") else ARGS+=("$arg") fi done fi fi if [ -n "$WAYLAND_DISPLAY" ]; then # Wayland if [ -n "$DMENULINES" ]; then tofi -c "$TOFI_CONF" -d "${ARGS[@]}" else tofi -c "$TOFI_CONF" -d "$@" 2>/dev/null fi unset ARGS elif [ -n "$DISPLAY" ]; then # X11 dmenu $@ fi unset TOFI_CONF