I use wl-copy with Sway and xclip with i3 under Arch Linux. I generally prefer using Sway, but I can't use it all the time because certain applications only work properly on i3.
Under Sway, when mpv is run as a native Wayland application, pressing the key combination defined in mp.add_key_binding at the end of the script doesn't actually copy the current time to the clipboard; it only shows the OSD message, 'Copied to Clipboard: [timecode]'
My knowledge in Lua is rather limited, but by looking at the script, I've been able to find that it only checks whether each supported clipboard manager exists in an if-else statement. In my case, xclip is available (the first part of the if statement) and so xclip -silent -in -selection clipboard is run, but it doesn't work under Wayland.
I wonder how to solve this. One idea is to check the current value of the environment variable $XDG_SESSION_TYPE. If it is wayland, use wl-copy, and if it is x11, use xclip.
I use wl-copy with Sway and xclip with i3 under Arch Linux. I generally prefer using Sway, but I can't use it all the time because certain applications only work properly on i3.
Under Sway, when mpv is run as a native Wayland application, pressing the key combination defined in
mp.add_key_binding
at the end of the script doesn't actually copy the current time to the clipboard; it only shows the OSD message, 'Copied to Clipboard: [timecode]'My knowledge in Lua is rather limited, but by looking at the script, I've been able to find that it only checks whether each supported clipboard manager exists in an if-else statement. In my case,
xclip
is available (the first part of the if statement) and soxclip -silent -in -selection clipboard
is run, but it doesn't work under Wayland.I wonder how to solve this. One idea is to check the current value of the environment variable
$XDG_SESSION_TYPE
. If it iswayland
, usewl-copy
, and if it isx11
, usexclip
.