From 21e36eef243fcd42932ea1d65ccec1d34b56b931 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Jul 2023 23:18:48 +1200 Subject: Add username-typing to rofi password-store script --- rofi/bin/rofi_pass.sh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/rofi/bin/rofi_pass.sh b/rofi/bin/rofi_pass.sh index 99b5e3e4..fb31a454 100644 --- a/rofi/bin/rofi_pass.sh +++ b/rofi/bin/rofi_pass.sh @@ -1,5 +1,7 @@ # Pick password from local or remote password-store with rofi's dmenu emulation -# mode, and write it to the active X11 window. +# mode, and write it to the active X11 window. Optionally, prefix it with the +# username, being the last part of the slash-delimited password's name, and +# a TAB press to move to the next field in a form. # self=rofi_pass @@ -50,24 +52,38 @@ get_password() { head -n 1 } +# Check for --login/-l option to paste a username-password combo, not just the +# password (defaults to the latter). +# +login=0 +case $1 in + --login|-l) login=1 ;; +esac + # Apply rofi -dmenu to pick a password name. Use case-insensitive matching, # and don't accept arbitrary input. # name=$(get_names | rofi -dmenu -i -no-lazy-grab -only_match -p pass) || exit [ -n "$name" ] || exit -# Retrieve the chosen password by name; check that we actually got something -# back. +# Retrieve the username for the chosen password, and then the secret itself; +# check that we actually got more than an empty string back in both cases. # +username=${name##*/} +[ -n "$username" ] || exit password=$(get_password "$name") || exit [ -n "$password" ] || exit -# Have xdotool type the password, receiving it on its standard input rather -# than its arguments, for security. +# Have xdotool type either the username-TAB-password, or just the password; +# receiving it on its standard input rather than its arguments, for security. # -printf %s "$password" | - xdotool type --clearmodifiers --delay=0 --file - \ - || exit +if [ "$login" -eq 1 ] ; then + printf '%s\t%s' \ + "$username" "$password" +else + printf '%s' \ + "$password" +fi | xdotool type --clearmodifiers --delay=0 --file - || exit # Tell the user we wrote the password out, in case they're typing a password # into a field with echo turned off. -- cgit v1.2.3 From a8e106b3aea029dafcaa05e7b00e6bba521a11db Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Jul 2023 23:19:19 +1200 Subject: Add keybinding for rofi password-store login --- sxhkd/sxhkdrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc index 0e54d4fb..b4f823b6 100644 --- a/sxhkd/sxhkdrc +++ b/sxhkd/sxhkdrc @@ -22,6 +22,9 @@ super + m super + p exec rofi_pass +super + shift + p + exec rofi_pass --login + super + t exec thunar -- cgit v1.2.3 From dadf79c8b6a6718a45f305c0296d2beafa925281 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 4 Jul 2023 17:09:14 +1200 Subject: Correct double-up in Vim python 'equalprg' --- vim/after/ftplugin/python.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim index b5071e3b..cf7b00b7 100644 --- a/vim/after/ftplugin/python.vim +++ b/vim/after/ftplugin/python.vim @@ -20,7 +20,7 @@ let b:undo_ftplugin .= '|nunmap c' " Mappings to choose 'equalprg' nnoremap t - \ :setlocal equalprg=equalprg=autopep8\ -aaa\ --\ - + \ :setlocal equalprg=autopep8\ -aaa\ --\ - nnoremap i \ :setlocal equalprg< let b:undo_ftplugin .= '|nunmap t' -- cgit v1.2.3 From b8125109fa305a6941b6fdff55c66876a700ea27 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 20 Jul 2023 14:49:27 +1200 Subject: Add missing comment to filetype.vim --- vim/filetype.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/filetype.vim b/vim/filetype.vim index 4b0a5702..d1b2d1ef 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -73,6 +73,7 @@ augroup filetypedetect \ sources.list \,*/etc/apt/sources.list.d/*.list \ setfiletype debsources + " Desktop files autocmd BufNewFile,BufRead \ ?*.desktop \,?*.directory -- cgit v1.2.3 From 28d8473a4b0f03dc6d209f5b0303f0359247fa7a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 20 Jul 2023 14:49:43 +1200 Subject: Set exports filetype in Vim --- vim/filetype.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/filetype.vim b/vim/filetype.vim index d1b2d1ef..fa2a290b 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -95,6 +95,10 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ ?*.dot \ setfiletype dot + " NFS exports + autocmd BufNewFile,BufRead + \ exports + \ setfiletype exports " Forth autocmd BufNewFile,BufRead \ ?*.fs,?*.ft -- cgit v1.2.3 From 2e64ed304546e17953a6a1f5d07cd39b34fb198a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 20 Jul 2023 15:28:53 +1200 Subject: Add Vim filetype detection for Rust --- vim/filetype.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/filetype.vim b/vim/filetype.vim index fa2a290b..eea7f1f5 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -368,6 +368,10 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ ?*.rb \ setfiletype ruby + " Rust + autocmd BufNewFile,BufRead + \ ?*.rs + \ setfiletype rust " Samba config autocmd BufNewFile,BufRead \ smb.conf -- cgit v1.2.3 From 3deb986d9743cc570160a391f02abfd233d5e9e4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 2 Aug 2023 19:46:52 +1200 Subject: Handle unset b:undo_ftplugin in Python Vim --- vim/after/ftplugin/python.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim index cf7b00b7..2ca1ae89 100644 --- a/vim/after/ftplugin/python.vim +++ b/vim/after/ftplugin/python.vim @@ -1,3 +1,11 @@ +" The Python runtime files didn't define b:undo_ftplugin until Vim v8.1.1048; +" if it's not set yet, set it here (to something innoccuous) so that the +" appending :let commands in the rest of this file don't break. +" +if !exists('b:undo_ftplugin') + let b:undo_ftplugin = 'setlocal tabstop<' +endif + " Use pyflakes for syntax checking and autopep8 for tidying compiler pyflakes if executable('autopep8') -- cgit v1.2.3 From 24cece25d6bf942aeb62800484186f8ce96f289d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 3 Aug 2023 09:39:23 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d596a54f..f677da70 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v12.40.0 -Mon, 26 Jun 2023 00:48:24 +0000 +tejr dotfiles v12.41.0 +Wed, 02 Aug 2023 21:39:23 +0000 -- cgit v1.2.3