aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2024-01-23 22:58:11 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2024-01-23 23:02:08 -0500
commitc47a6b1ea6a34c9ee8b387ad6ea9466461223524 (patch)
treeea3f248e2c9b160e96f8a30964750699a3524892
parentd286aa4e07c7ad7b4ce6546cabf418ad56c6e6f6 (diff)
downloaddpw-c47a6b1ea6a34c9ee8b387ad6ea9466461223524.tar.gz
dpw-c47a6b1ea6a34c9ee8b387ad6ea9466461223524.tar.xz
Add support for typing tool on Wayland
-rwxr-xr-xdpw13
-rw-r--r--readme.md13
2 files changed, 18 insertions, 8 deletions
diff --git a/dpw b/dpw
index 67ee242..d66fff1 100755
--- a/dpw
+++ b/dpw
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright 2022 Mitchell Riedstra
+# Copyright 2024 Mitchell Riedstra
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
@@ -166,12 +166,19 @@ pth="$1"; shift
_clip_clear
}
+__type() {
+case $XDG_SESSION_TYPE in
+wayland) wtype -s 2 - ;;
+*) xdotool type --delay 2ms --clearmodifiers --file - ;;
+esac
+}
+
_type() {
pth="$1"; shift
"${DPW_BACKEND}" show "$pth" \
| sed 1q \
| tr -d '\n' \
- | xdotool type --delay 2ms --clearmodifiers --file -
+ | __type
}
list() {
@@ -262,7 +269,7 @@ case $a in
type)
$OTP "$authstring" \
| tr -d '\n' \
- | xdotool type --delay 2ms --clearmodifiers --file -
+ | __type
;;
esac
}
diff --git a/readme.md b/readme.md
index 5974ffb..721cd87 100644
--- a/readme.md
+++ b/readme.md
@@ -22,18 +22,21 @@ even exposed to your computer, only the utilization of it is.
## Usage under Wayland
-It should "just work" out of the box, if it doesn't check that you have
-`wl-clipboard` installed. If it still doesn't work, try setting:
+Requires `wl-clipboard` package for copying, and `wtype` for the type
+functionality.
-```
-export XDG_SESSION_TYPE=wayland
-```
+If for some reason it doesn't detect wayland try setting
+`XDG_SESSION_TYPE=wayland`.
## dmenu script
There's also a small dmenu script included that makes copying or typing
out passwords and OTP tokens very quick and easy
+If you wish to use something other than `dmenu` it's best to drop a compatible
+wrapper somewhere earlier in your path. ( This is actually how I use `bemenu` in
+Wayland whenever a script calls dmenu )
+
## Backends
The `dpw-gpg` shell script should be short enough to read to give you an