From 5c345b8a8c5bc6f813f4cba058cd077e392c7cba Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 4 Jun 2024 21:28:01 +0200 Subject: [PATCH] mpv: custom yanker no new line --- .config/mpv/scripts/custom_yanker.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/mpv/scripts/custom_yanker.lua b/.config/mpv/scripts/custom_yanker.lua index 5d0bd67..376de66 100644 --- a/.config/mpv/scripts/custom_yanker.lua +++ b/.config/mpv/scripts/custom_yanker.lua @@ -29,7 +29,7 @@ local function handle_n() local filename = mp.get_property("filename") -- Use a method to copy 'filename' to clipboard (platform-specific) -- For example, on Unix-like systems, you might use 'xclip' - os.execute("echo " .. filename .. " | xclip -selection clipboard") + os.execute("printf %s" .. filename .. " | xclip -selection clipboard") mp.osd_message("Copied filename " .. filename .. " to clipboard", 3) reset_y() -- Reset the 'y' keypress state end @@ -43,7 +43,7 @@ local function handle_d() if y_pressed then local filepath = mp.get_property("path") local directory = string.match(filepath, "(.*/)") - os.execute("echo " .. directory .. " | xclip -selection clipboard") + os.execute("printf %s" .. directory .. " | xclip -selection clipboard") mp.osd_message("Copied directory " .. directory .. " to clipboard", 3) reset_y() end @@ -53,7 +53,7 @@ end local function handle_p() if y_pressed then local full_path = mp.get_property("path") - os.execute("echo " .. full_path .. " | xclip -selection clipboard") + os.execute("printf %s " .. full_path .. " | xclip -selection clipboard") mp.osd_message("Copied full path " .. full_path .. " to clipboard", 3) reset_y() end