diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2024-01-23 23:13:58 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2024-01-23 23:13:58 -0500 |
| commit | f212711df305fc4bbd421fbc625d8408845a7ee1 (patch) | |
| tree | f38e938a727a82f70a5482bb50111d9d166750ab | |
| parent | 3dd2853189824cf4fce3be784f71310f6b2a05d2 (diff) | |
| download | pm-f212711df305fc4bbd421fbc625d8408845a7ee1.tar.gz pm-f212711df305fc4bbd421fbc625d8408845a7ee1.tar.xz | |
Add Wayland support
| -rwxr-xr-x | pm | 22 | ||||
| -rw-r--r-- | readme.md | 6 |
2 files changed, 24 insertions, 4 deletions
@@ -20,6 +20,10 @@ PASTE_MANAGER_X_SELECTION="${PASTE_MANAGER_X_SELECTION:-clipboard}" # Pretty much anything that implements a demu like interface should work here, # the only option called elsewhere is `-p` _menu="dmenu -l $PASTE_MANAGER_LINES -i" +if [ "$XDG_SESSION_TYPE" = "wayland" ] ; then + _menu="bemenu -l $PASTE_MANAGER_LINES -i" +fi + case $(uname) in Darwin) _menu="choose -m -s 16 -f Monaco -n $PASTE_MANAGER_LINES -w 85" ;; @@ -41,7 +45,12 @@ Darwin) pbcopy ;; *) - xclip -selection "$PASTE_MANAGER_X_SELECTION" + case $XDG_SESSION_TYPE in + wayland) + wl-copy ;; + *) + xclip -selection "$PASTE_MANAGER_X_SELECTION" ;; + esac :; esac } @@ -101,14 +110,21 @@ copyName() { selectName "$(sel "Will copy entry name")" | _clip } +__type() { +case $XDG_SESSION_TYPE in +wayland) wtype -s 2 - ;; +*) xdotool type --delay 2ms --clearmodifiers --file - ;; +esac +} + _type() { selectContent "$(sel "Will type content")" \ - | xdotool type --delay 1ms --clearmodifiers --file - + | __type } typeName() { selectName "$(sel "Will type entry name")" \ - | xdotool type --delay 1ms --clearmodifiers --file - + | __type } rename() { @@ -46,10 +46,14 @@ You'll need `dmenu` installed. You may also wish to bind a hotkey to run the new Environment variables: +`XDG_SESSION_TYPE` if set to `wayland` will utilize `wl-copy` from the +`wl-clipboard` package and `wtype` instead of `xclipboard` and `xdotool` +respectively. `bemenu` is used in place of `dmenu` on Wayland as well. + `PASTE_MANAGER_FILE` can override the file location `PASTE_MANAGER_LINES` overrides the number of lines displayed by `dmenu` `PASTE_MANAGER_X_SELECTION` sets the clipboard selection, you probably want to -leave it set to clipboard, the default. +leave it set to clipboard, the default. ( xorg only ) Edit the source code for further tweaks. The one people may have the most |
