@@ 59,6 59,11 @@ menu() {
| sed 's/ .*// ; q'
}
+use_Xwayland() {
+ query='recurse(.nodes[]?, .floating_nodes[]?) | select(.focused).shell'
+ [[ "$(swaymsg -t get_tree | jq -r "${query}")" = 'xwayland' ]]
+}
+
# Parse arguments, check dependancies
parse_args() {
@@ 84,6 89,10 @@ parse_args() {
[[ "${cmd}" = 'wl-copy' ]] && [[ "${asset}" = 'both' ]] \
&& die 'Cannot copy both username and password.'
+ # Use xdotool for Xwayland windows
+ [[ "${cmd}" = 'wtype' ]] && use_Xwayland \
+ && cmd=xdotool
+
check_dep "${cmd}"
}
@@ 155,6 164,12 @@ type_or_copy() {
# Add a short delay before typing
set -- -s 150 "${@}"
+
+ elif [[ "${cmd}" = 'xdotool' ]]; then
+ [[ "${asset}" = 'both' ]] \
+ && set -- "${credentials[user]}"$'\t'"${credentials[pass]}"
+
+ set -- sleep 0.15 type "${@}"
fi
exec "${cmd}" "${@}"