-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathbookmarks.ini
More file actions
57 lines (54 loc) · 1.37 KB
/
Copy pathbookmarks.ini
File metadata and controls
57 lines (54 loc) · 1.37 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
55
56
57
[Commands]
1\Command="
const prefix = 'mark:';
global.setMark = function(name) {
if (!name) {
name = dialog('.title', 'Assign to register', 'Name', '');
}
const tag = prefix + name;
// Filter to only items that have a mark tag
const sel = ItemSelection().select(/mark:/, plugins.itemtags.mimeTags);
plugins.itemtags.untag(tag, ...sel.rows());
// TODO: allow selecting multiple items?
plugins.itemtags.tag(tag, currentItem());
};
global.listMarks = function() {
const s = new Set();
// Support multiple items?
for (let i = 0; i < size(); i++) {
for (const tag of plugins.itemtags.tags(i)) {
if (tag.startsWith(prefix)) {
s.add(tag.slice(prefix.length));
}
}
}
return Array.from(s);
};
global.copyMark = function(name) {
if (!name) {
name = menuItems.apply(global, listMarks());
}
const tag = prefix + name;
const len = size();
for (let i = 0; i < len; i++) {
if (plugins.itemtags.hasTag(tag, i)) {
select(i);
return;
}
}
}"
1\Icon=\xe0bb
1\IsScript=true
1\Name=Bookmarks
2\Command="
copyq setMark"
2\Icon=\xf15b
2\InMenu=true
2\Name=set mark
3\Command="
copyq copyMark"
3\Icon=\xf15b
3\InMenu=true
3\IsGlobalShortcut=true
3\Name=Restore mark
size=3