diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-02-12 16:20:13 -0600 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-02-12 16:20:13 -0600 |
commit | 32c604ff257ae34e9d011add23d0b2af321dc8bb (patch) | |
tree | b7d40d3e0a1aa92ca0616719ccd60011be3b6a3c | |
parent | 7af2ab7dac6a72743beb13e436273e0e47527144 (diff) |
feat(tofi): migrate to tofi for dmenu
-rw-r--r-- | cliphist/.config/sway/config.d/70-cliphist.conf | 2 | ||||
-rw-r--r-- | pass/.config/sway/config.d/50-pass.conf | 2 | ||||
-rw-r--r-- | sway/.config/sway/config | 12 | ||||
-rw-r--r-- | tofi/.config/tofi/config | 19 | ||||
-rwxr-xr-x | tofi/.local/bin/dmenu-wl | 63 |
5 files changed, 90 insertions, 8 deletions
diff --git a/cliphist/.config/sway/config.d/70-cliphist.conf b/cliphist/.config/sway/config.d/70-cliphist.conf deleted file mode 100644 index 309181e..0000000 --- a/cliphist/.config/sway/config.d/70-cliphist.conf +++ /dev/null @@ -1,2 +0,0 @@ -bindsym $mod+v exec cliphist list | $menu | cliphist decode | wl-copy -bindsym $mod+Shift+v exec cliphist list | $menu | cliphist delete diff --git a/pass/.config/sway/config.d/50-pass.conf b/pass/.config/sway/config.d/50-pass.conf deleted file mode 100644 index a0bc1e2..0000000 --- a/pass/.config/sway/config.d/50-pass.conf +++ /dev/null @@ -1,2 +0,0 @@ -bindsym $mod+p exec passmenu -bindsym $mod+Shift+p exec passmenu --type diff --git a/sway/.config/sway/config b/sway/.config/sway/config index cbd7163..964cd16 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -1,5 +1,5 @@ set $mod Mod4 -set $menu bemenu +set $menu dmenu-wl set $left h set $down j @@ -66,13 +66,17 @@ bindsym $mod+q kill bindsym $mod+Shift+c reload bindsym $mod+Shift+Escape exec swaynag -t warning -m 'Exit sway?' -B 'Yes' 'swaymsg exit' bindsym $mod+ctrl+q exec loginctl lock-session -bindsym $mod+Escape exec powermenu list | $menu | powermenu +bindsym $mod+Escape exec powermenu list | $menu -l 6 | powermenu bindsym $mod+return exec $TERMINAL bindsym $mod+w exec $BROWSER bindsym Print exec slurp | grim -g - - | wl-copy --type image/png bindsym $mod+Print exec /usr/share/sway/scripts/grimshot --notify save area -bindsym $mod+space exec j4-dmenu-desktop --no-generic --dmenu='$menu' --term="$TERMINAL" -bindsym $mod+shift+space exec bemenu-run +bindsym $mod+space exec tofi-drun | xargs swaymsg exec -- +bindsym $mod+shift+space exec tofi-run | xargs swaymsg exec -- +bindsym $mod+v exec cliphist list | $menu -l 10 | cliphist decode | wl-copy +bindsym $mod+Shift+v exec cliphist list | $menu -l 10 | cliphist delete +bindsym $mod+p exec passmenu +bindsym $mod+Shift+p exec passmenu --type bindsym $mod+y exec yubikey-oath-dmenu --notify --clipboard bindsym $mod+Shift+y exec yubikey-oath-dmenu --notify --type diff --git a/tofi/.config/tofi/config b/tofi/.config/tofi/config new file mode 100644 index 0000000..a7f0488 --- /dev/null +++ b/tofi/.config/tofi/config @@ -0,0 +1,19 @@ +anchor = top +horizontal = true +width = 100% +height = 30 +result-spacing = 15 +font-size = 14 +prompt-text = "> " +font = monospace +outline-width = 0 +border-width = 0 +background-color = #282828 +text-color = #ebdbb2 +alternate-result-color = #bdae93 +selection-color = #fe8019 +min-input-width = 120 +padding-top = 4 +padding-bottom = 0 +padding-left = 0 +padding-right = 0 diff --git a/tofi/.local/bin/dmenu-wl b/tofi/.local/bin/dmenu-wl new file mode 100755 index 0000000..5270570 --- /dev/null +++ b/tofi/.local/bin/dmenu-wl @@ -0,0 +1,63 @@ +#!/bin/sh + +help() { + tofi --help + cat <<-EOF + + Extra options: + -b alias for '--anchor=bottom' + -i ignored, exists for compatibility + -l <lines> alias for '--horizontal=false --height=<estimation>'. Note: height is a rough + approximation, the actual number of lines shown may slightly differ. + -m <monitor> alias for '--output=<monitor>' + -p <prompt> alias for '--prompt-text=<prompt>' + -h, --help Show this help + EOF +} + +if ! opts="$(getopt -o bil:m:p:h -l help -n "$SCRIPT" -- "$@")"; then + help + exit 1 +fi + +eval set -- "$opts" + +args="" +while true; do + case "$1" in + -h | --help) + help + exit 0 + ;; + -b) + args="$args --anchor=bottom" + shift + ;; + -l) + args="$args --result-spacing=0 --horizontal=false --height=$((30 + 23 * $2))" + shift 2 + ;; + -m) + args="$args --output=$2" + shift 2 + ;; + -p) + args="$args --prompt-text=$2" + shift 2 + ;; + -i) shift ;; + --) + shift + break + ;; + *) + args="$args $1" + shift + ;; + esac +done + +set -- "$args" "$@" + +# shellcheck disable=2068 +command tofi $@ |