diff --git a/scripts/menu/menu b/scripts/menu/menu index d6852f9..83f6deb 100755 --- a/scripts/menu/menu +++ b/scripts/menu/menu @@ -1,57 +1,49 @@ #!/bin/sh -# Script for using either bemenu or dmenu -# with preconfigured options -PROMPT="$1" ; MODE="$2" +PROMPT="$1" MODE="$2" +if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then printf "Usage: menu [prompt] [run/pass]\n" ; return 0 ; fi +[ "$MODE" = "pass" ] && BPASS="-x" DPASS="-P" +BRUN="-run" DRUN="_run" TRUN="-run" FRUN="" +[ "$MODE" != "run" ] && BRUN="" DRUN="" TRUN="" FRUN="" # Configuration -MENU="tofi" # Default to fzf -col_nb="#121212" # Normal background -col_nf="#665c54" # Normal foreground -col_sb="#121212" # Selected background -col_sf="#2e9ef4" # Selected foreground +menu="menu_bemenu" font="JetbrainsMono" font_size="10" +col_white="#ffffff" # White +col_nb="#121212" # Normal background +col_nf="#665c54" # Normal foreground +col_sb="#121212" # Selected background +col_sf="#2e9ef4" # Selected foreground -[ -e "$HOME/.config/menu-config" ] && MENU="$(cat "$HOME/.config/menu-config")" - -# Print help -if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then - printf "Usage: menu [prompt] [run/pass/empty]" - return 0 -fi - -# Check for 'pass' arg -[ "$MODE" = "pass" ] && - BPASS="-x" && DPASS="-P" - -# bemenu opts -BEMENU_OPTS=$(printf " \ - -c \ +menu_bemenu() { +bemenu$BRUN \ + --no-exec \ -i \ + -c \ -l 10 \ - -W 0.3 \ + -W 0.4 \ -B 1 \ --cw 1 \ --tb $col_sb \ - --tf $col_nf \ - --fb $col_nb \ - --ff $col_nf \ - --cb $col_nb \ + --tf $col_nf \ + --fb $col_nb \ + --ff $col_white \ + --cb $col_nb \ --cf $col_nf \ - --nb $col_nb \ - --nf $col_nf \ - --hb $col_sb \ - --hf $col_sf \ - --ab $col_nb \ - --af $col_nf \ - --bdr $col_sf \ - --fn "$font" \ + --nb $col_nb \ + --nf $col_nf \ + --hb $col_sb \ + --hf $col_sf \ + --ab $col_nb \ + --af $col_nf \ + --bdr $col_sf \ + --fn "$font $font_size" \ -p "$PROMPT" \ - $BPASS \ -") + $BPASS +} -# dmenu opts -DMENU_OPTS=" \ +menu_dmenu() { +dmenu$DRUN \ -i \ -l 10 \ -nb $col_nb \ @@ -60,41 +52,18 @@ DMENU_OPTS=" \ -sf $col_sf \ -fn "$font:size=$font_size" \ -p "$PROMPT" \ - $DPASS \ -" + $DPASS +} -# tofi opts -TOFI_OPTS=" \ - --prompt-text "$PROMPT " \ -" +menu_tofi() { +tofi$TRUN \ + --prompt-text "$PROMPT" +} -# fzf opts -FZF_OPTS=" \ +menu_fzf() { +fzf \ --cycle \ - --reverse \ -" + --reverse +} -# If chosen bemenu, use this args -[ "$MENU" = "bemenu" ] && - OPTS="$BEMENU_OPTS" && - RUN="-run" - -# If chosen dmenu, use this args -[ "$MENU" = "dmenu" ] && - OPTS="$DMENU_OPTS" && - RUN="_run" - -# If chosen tofi, use this args -[ "$MENU" = "tofi" ] && - OPTS="$TOFI_OPTS" && - RUN="-run" - -# If chosen fzf, use this args -[ "$MENU" = "fzf" ] && - OPTS="$FZF_OPTS" && - RUN="" - -[ "$MODE" = "run" ] && $MENU$RUN $OPTS -[ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS -[ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS -[ -z "$MODE" ] && $MENU $OPTS +$menu diff --git a/scripts/sway/swayotp b/scripts/sway/swayotp new file mode 100755 index 0000000..7ebb742 --- /dev/null +++ b/scripts/sway/swayotp @@ -0,0 +1,5 @@ +#!/bin/sh + +password="$(~/.config/scripts/menu/menu-pass)" +[ -z "$password" ] && exit +ydotool type $(pass otp "$password") diff --git a/scripts/sway/swaypass b/scripts/sway/swaypass new file mode 100755 index 0000000..6dbce54 --- /dev/null +++ b/scripts/sway/swaypass @@ -0,0 +1,5 @@ +#!/bin/sh + +password="$(~/.config/scripts/menu/menu-pass)" +[ -z "$password" ] && exit +ydotool type $(pass "$password" | head -n 1) diff --git a/scripts/status/sway b/scripts/sway/swaystatus similarity index 100% rename from scripts/status/sway rename to scripts/sway/swaystatus diff --git a/sway/config b/sway/config index f8c72f9..6136cd2 100644 --- a/sway/config +++ b/sway/config @@ -26,8 +26,8 @@ set $up k set $right l set $term foot set $menu ~/.config/scripts/menu/menu "Run:" run | xargs swaymsg exec -- -set $passmgr ydotool type $(pass $(~/.config/scripts/menu/menu-pass) | head -n 1) -set $passotp ydotool type $(pass otp $(~/.config/scripts/menu/menu-pass)) +set $passmgr ~/.config/scripts/sway/swaypass +set $passotp ~/.config/scripts/sway/swayotp set $volup ~/.config/scripts/volup set $voldown ~/.config/scripts/voldown set $mute ~/.config/scripts/mute @@ -101,7 +101,7 @@ gaps inner 5 bar { position bottom font pango:JetBrainsMono Bold 9 - status_command ~/.config/scripts/status/sway + status_command ~/.config/scripts/sway/swaystatus height 20 colors {