From 269565187a4fffb117ee2e02434be5f9b040da87 Mon Sep 17 00:00:00 2001 From: Gregory Trolliet Date: Tue, 17 Dec 2024 17:42:19 +0100 Subject: [PATCH] [sway] Switch launcher and pass to fuzzel --- .config/fuzzel/fuzzel.ini | 89 +++++++++++++++++++++++++++++++++++++++ .config/sway/config | 25 ++++------- .local/bin/fuzzel-menu | 35 +++++++++++++++ 3 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 .config/fuzzel/fuzzel.ini create mode 100755 .local/bin/fuzzel-menu diff --git a/.config/fuzzel/fuzzel.ini b/.config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..95d068c --- /dev/null +++ b/.config/fuzzel/fuzzel.ini @@ -0,0 +1,89 @@ +# output= +# font=monospace +# dpi-aware=auto +# prompt=> +# icon-theme=hicolor +# icons-enabled=yes +# fields=filename,name,generic +# password-character=* +# fuzzy=yes +# show-actions=no +# terminal=$TERMINAL -e # Note: you cannot actually use environment variables here +# launch-prefix= + +# lines=15 +# width=30 +# horizontal-pad=40 +# vertical-pad=8 +# inner-pad=0 + +# image-size-ratio=0.5 + +# line-height= +# letter-spacing=0 + +# layer = top +# exit-on-keyboard-focus-loss = yes + +[colors] +background=282a36dd +text=f8f8f2ff +match=8be9fdff +selection-match=8be9fdff +selection=44475add +selection-text=f8f8f2ff +border=bd93f9ff + +[border] +# width=1 +# radius=10 + +[dmenu] +# mode=text # text|index +# exit-immediately-if-empty=no + +[key-bindings] +# cancel=Escape Control+g +# execute=Return KP_Enter Control+y +# execute-or-next=Tab +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# delete-line=Control+k +# prev=Up Control+p +# prev-with-wrap=ISO_Left_Tab +# prev-page=PageUp KP_PageUp +# next=Down Control+n +# next-with-wrap=none +# next-page=Page_Down KP_Page_Down + +# custom-N: *dmenu mode only*. Like execute, but with a non-zero +# exit-code; custom-1 exits with code 10, custom-2 with 11, custom-3 +# with 12, and so on. + +# custom-1=Mod1+1 +# custom-2=Mod1+2 +# custom-3=Mod1+3 +# custom-4=Mod1+4 +# custom-5=Mod1+5 +# custom-6=Mod1+6 +# custom-7=Mod1+7 +# custom-8=Mod1+8 +# custom-9=Mod1+9 +# custom-10=Mod1+0 +# custom-11=Mod1+exclam +# custom-12=Mod1+at +# custom-13=Mod1+numbersign +# custom-14=Mod1+dollar +# custom-15=Mod1+percent +# custom-16=Mod1+dead_circumflex +# custom-17=Mod1+ampersand +# custom-18=Mod1+asterix +# custom-19=Mod1+parentleft diff --git a/.config/sway/config b/.config/sway/config index ba4b903..dc16484 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -72,13 +72,13 @@ set $mod Mod4 set $alt Mod1 # Set up a shortcut to reload this config file: -bindsym $mod+Shift+c reload +bindsym $mod+k reload # Quit your current session and return to the log-in manager/tty: -bindsym $mod+Shift+e exec $HOME/.config/sway/exit.sh +bindsym $mod+Shift+k exec $HOME/.config/sway/exit.sh # Open password menu -bindsym $mod+x exec $HOME/.local/bin/passmenu --type +bindsym $mod+x exec $HOME/.local/bin/fuzzel-menu --type # Screen locking (automatic, with a timeout) set $lock swaylock -c 550000 @@ -102,12 +102,6 @@ bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right -# Move focus to another window ("cult of vim" version): -bindsym $mod+j focus down -bindsym $mod+h focus left -bindsym $mod+l focus right -bindsym $mod+k focus up - # Move the window: bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down @@ -228,12 +222,12 @@ bindsym $mod+Ctrl+Down move workspace to output down # You can "split" the current object of your focus with # $mod+b or $mod+v, for horizontal and vertical splits # respectively. -bindsym $mod+b splith +bindsym $mod+b splih bindsym $mod+v splitv # Switch the current container between different layout styles bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed +bindsym $mod+t layout tabbed bindsym $mod+e layout toggle split # Make the current focus fullscreen @@ -280,7 +274,7 @@ bindsym XF86MonBrightnessUp exec light -A 10 # Keyboard Shortcuts (launching applications) # #=============================================# # Set up wofi to replace dmenu as the launcher of choice: -set $menu wofi --show drun -i | xargs swaymsg exec -- +set $menu fuzzel # Launch your browser: bindsym $mod+shift+b exec firefox @@ -290,8 +284,7 @@ bindsym ctrl+$mod+f exec pcmanfm # Open a terminal emulator: set $term alacritty -bindsym $mod+t exec $term -bindsym $mod+Shift+t exec $term -e tmuxinator start default +bindsym $mod+Shift+c exec $term # Kill focused window: bindsym $mod+F4 kill @@ -322,7 +315,7 @@ for_window [app_id="gnome-calendar"] floating enable # Startup app # #===============================# -exec nextcloud +exec sleep 5s && nextcloud --background #===============================# # Dropdown terminal # @@ -344,7 +337,7 @@ for_window [app_id="$ddterm-id"] { } # show existing or start new dropdown terminal -bindsym Ctrl+Escape exec swaymsg '[app_id="$ddterm-id"] scratchpad show' \ +bindsym $mod+c exec swaymsg '[app_id="$ddterm-id"] scratchpad show' \ || $ddterm -e tmuxinator start default \ && sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize' # ^-- resize again, case moving to different output diff --git a/.local/bin/fuzzel-menu b/.local/bin/fuzzel-menu new file mode 100755 index 0000000..d8a04d4 --- /dev/null +++ b/.local/bin/fuzzel-menu @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu="fuzzel --dmenu --prompt '🔐 Password :'" + xdotool="/usr/bin/wtype -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | fuzzel --dmenu --prompt "🔐 Password : " ) + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +fi