Skip to content

Commit 342c256

Browse files
fix(clipshot): simplify command
1 parent 4853d93 commit 342c256

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

clipshot.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ local platform = mp.get_property_native('platform')
1717
if platform == 'windows' then
1818
file = os.getenv('TEMP')..'\\'..o.name
1919
cmd = {
20-
'powershell', '-NoProfile', '-Command', ([[& {
21-
Add-Type -Assembly System.Windows.Forms;
22-
Add-Type -Assembly System.Drawing;
23-
$shot = [Drawing.Image]::FromFile(%q);
24-
[Windows.Forms.Clipboard]::SetImage($shot);
25-
}]]):format(file)
20+
'cmd', '/c', string.format(
21+
'powershell -NoProfile -Command %q',
22+
"Add-Type -Assembly System.Windows.Forms, System.Drawing; "..
23+
"[Windows.Forms.Clipboard]::SetImage([Drawing.Image]::FromFile('"..file.."'))"
24+
)
2625
}
2726
elseif platform == 'darwin' then
2827
file = os.getenv('TMPDIR')..'/'..o.name
2928
-- png: «class PNGf»
3029
local type = o.type ~= '' and o.type or 'JPEG picture'
3130
cmd = {
32-
'osascript', '-e', ([[
33-
set the clipboard to ( ¬
34-
read (POSIX file %q) as %s)
35-
]]):format(file, type)
31+
'osascript', '-e', string.format(
32+
'set the clipboard to (read (POSIX file %q) as %s)',
33+
file, type
34+
)
3635
}
3736
else
3837
file = '/tmp/'..o.name

0 commit comments

Comments
 (0)