-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathdiff-latest-items.ini
More file actions
54 lines (46 loc) · 1.57 KB
/
Copy pathdiff-latest-items.ini
File metadata and controls
54 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
[Command]
Command="
copyq:
var selectedItem1 = selectedItemData(0)[mimeText]
var selectedItem2 = selectedItemData(1)[mimeText]
var item1 = null
var item2 = null
if (selectedItem2 == undefined) {
// the selected item either doesn't contain text
// or the command is run as global shortcut.
// select the last two clipboard in this case.
item1 = read(1)
item2 = read(0)
} else {
item1 = selectedItem1
item2 = selectedItem2
}
function tempFile(content) {
var file = new TemporaryFile()
file.openWriteOnly()
file.write(content)
file.close()
return file
}
var f1 = tempFile(item1)
var f2 = tempFile(item2)
var name1 = f1.fileName()
var name2 = f2.fileName()
// Choose your favorite diff tool (leave just one execute(...) uncommented):
// === Beyond Compare ===
// reference: https://www.scootersoftware.com/v4help/command_line_reference.html
// If it doesn't work, try using the full path, eg:
// execute('/usr/local/bin/compare', name1, name2)
execute('bcompare', name1, name2)
// === WinMerge ===
// reference: https://manual.winmerge.org/en/Command_line.html
// execute('winmergeu', '/e', '/x', '/u', '/fl', '/dl', 'item1', '/dr', 'item2', name1, name2)
// Wait few seconds before exiting script and deleting temporary files,
// because the command may be executed in background.
sleep(5000)"
GlobalShortcut=meta+alt+d
Icon=\xf0db
InMenu=true
IsGlobalShortcut=true
Name=Diff Latest Items
Shortcut=ctrl+d