sway-specific folder

This commit is contained in:
tavo-wasd 2024-02-05 05:59:09 -06:00
parent 861ee63c92
commit f53eaf80c0
5 changed files with 56 additions and 77 deletions

View file

@ -1,41 +1,33 @@
#!/bin/sh #!/bin/sh
# Script for using either bemenu or dmenu PROMPT="$1" MODE="$2"
# with preconfigured options if [ "$PROMPT" = "" -o "$PROMPT" = "-h" ] ; then printf "Usage: menu [prompt] [run/pass]\n" ; return 0 ; fi
PROMPT="$1" ; MODE="$2" [ "$MODE" = "pass" ] && BPASS="-x" DPASS="-P"
BRUN="-run" DRUN="_run" TRUN="-run" FRUN=""
[ "$MODE" != "run" ] && BRUN="" DRUN="" TRUN="" FRUN=""
# Configuration # Configuration
MENU="tofi" # Default to fzf menu="menu_bemenu"
font="JetbrainsMono"
font_size="10"
col_white="#ffffff" # White
col_nb="#121212" # Normal background col_nb="#121212" # Normal background
col_nf="#665c54" # Normal foreground col_nf="#665c54" # Normal foreground
col_sb="#121212" # Selected background col_sb="#121212" # Selected background
col_sf="#2e9ef4" # Selected foreground col_sf="#2e9ef4" # Selected foreground
font="JetbrainsMono"
font_size="10"
[ -e "$HOME/.config/menu-config" ] && MENU="$(cat "$HOME/.config/menu-config")" menu_bemenu() {
bemenu$BRUN \
# Print help --no-exec \
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 \
-i \ -i \
-c \
-l 10 \ -l 10 \
-W 0.3 \ -W 0.4 \
-B 1 \ -B 1 \
--cw 1 \ --cw 1 \
--tb $col_sb \ --tb $col_sb \
--tf $col_nf \ --tf $col_nf \
--fb $col_nb \ --fb $col_nb \
--ff $col_nf \ --ff $col_white \
--cb $col_nb \ --cb $col_nb \
--cf $col_nf \ --cf $col_nf \
--nb $col_nb \ --nb $col_nb \
@ -45,13 +37,13 @@ BEMENU_OPTS=$(printf " \
--ab $col_nb \ --ab $col_nb \
--af $col_nf \ --af $col_nf \
--bdr $col_sf \ --bdr $col_sf \
--fn "$font" \ --fn "$font $font_size" \
-p "$PROMPT" \ -p "$PROMPT" \
$BPASS \ $BPASS
") }
# dmenu opts menu_dmenu() {
DMENU_OPTS=" \ dmenu$DRUN \
-i \ -i \
-l 10 \ -l 10 \
-nb $col_nb \ -nb $col_nb \
@ -60,41 +52,18 @@ DMENU_OPTS=" \
-sf $col_sf \ -sf $col_sf \
-fn "$font:size=$font_size" \ -fn "$font:size=$font_size" \
-p "$PROMPT" \ -p "$PROMPT" \
$DPASS \ $DPASS
" }
# tofi opts menu_tofi() {
TOFI_OPTS=" \ tofi$TRUN \
--prompt-text "$PROMPT " \ --prompt-text "$PROMPT"
" }
# fzf opts menu_fzf() {
FZF_OPTS=" \ fzf \
--cycle \ --cycle \
--reverse \ --reverse
" }
# If chosen bemenu, use this args $menu
[ "$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

5
scripts/sway/swayotp Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
password="$(~/.config/scripts/menu/menu-pass)"
[ -z "$password" ] && exit
ydotool type $(pass otp "$password")

5
scripts/sway/swaypass Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
password="$(~/.config/scripts/menu/menu-pass)"
[ -z "$password" ] && exit
ydotool type $(pass "$password" | head -n 1)

View file

@ -26,8 +26,8 @@ set $up k
set $right l set $right l
set $term foot set $term foot
set $menu ~/.config/scripts/menu/menu "Run:" run | xargs swaymsg exec -- 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 $passmgr ~/.config/scripts/sway/swaypass
set $passotp ydotool type $(pass otp $(~/.config/scripts/menu/menu-pass)) set $passotp ~/.config/scripts/sway/swayotp
set $volup ~/.config/scripts/volup set $volup ~/.config/scripts/volup
set $voldown ~/.config/scripts/voldown set $voldown ~/.config/scripts/voldown
set $mute ~/.config/scripts/mute set $mute ~/.config/scripts/mute
@ -101,7 +101,7 @@ gaps inner 5
bar { bar {
position bottom position bottom
font pango:JetBrainsMono Bold 9 font pango:JetBrainsMono Bold 9
status_command ~/.config/scripts/status/sway status_command ~/.config/scripts/sway/swaystatus
height 20 height 20
colors { colors {