aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION4
-rw-r--r--rofi/bin/rofi_pass.sh32
-rw-r--r--sxhkd/sxhkdrc3
-rw-r--r--vim/after/ftplugin/python.vim10
-rw-r--r--vim/filetype.vim9
5 files changed, 47 insertions, 11 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
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.
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
diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim
index b5071e3b..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')
@@ -20,7 +28,7 @@ let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c'
" Mappings to choose 'equalprg'
nnoremap <buffer> <LocalLeader>t
- \ :<C-U>setlocal equalprg=equalprg=autopep8\ -aaa\ --\ -<CR>
+ \ :<C-U>setlocal equalprg=autopep8\ -aaa\ --\ -<CR>
nnoremap <buffer> <LocalLeader>i
\ :<C-U>setlocal equalprg<<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>t'
diff --git a/vim/filetype.vim b/vim/filetype.vim
index 4b0a5702..eea7f1f5 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
@@ -94,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
@@ -363,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