From c47a6b1ea6a34c9ee8b387ad6ea9466461223524 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Tue, 23 Jan 2024 22:58:11 -0500 Subject: Add support for typing tool on Wayland --- dpw | 13 ++++++++++--- readme.md | 13 ++++++++----- 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 -- cgit v1.2.3