mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 2b6150c6510fc4bf1f55a70748bf2997e8218fe6
Parent: ecee8e592622edb73a3bd5cde3d331a66e1c1b10
Author: Ren Tatsumoto
Date:   Wed,  8 Sep 2021 16:01:15 +0000

Merge pull request #50 from adem/clipboard-wayland-support

add Wayland support for "copy to clipboard"
Diffstat:
Msubs2srs.lua | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -18,7 +18,8 @@ Requirements: * mpv >= 0.32.0 * AnkiConnect * curl -* xclip +* xclip (when running X11) +* wl-copy (when running Wayland) Usage: 1. Change `config` according to your needs @@ -166,6 +167,10 @@ local function is_running_macOS() return mp.get_property('options/cocoa-force-dedicated-gpu') ~= nil end +local function is_running_wayland() + return os.getenv('WAYLAND_DISPLAY') ~= nil +end + local function contains_non_latin_letters(str) return str:match("[^%c%p%s%w]") end @@ -885,7 +890,7 @@ end local function init_platform_nix() local self = {} - local clip = is_running_macOS() and 'LANG=en_US.UTF-8 pbcopy' or 'xclip -i -selection clipboard' + local clip = is_running_macOS() and 'LANG=en_US.UTF-8 pbcopy' or is_running_wayland() and 'wl-copy' or 'xclip -i -selection clipboard' self.tmp_dir = function() return '/tmp'