Skip to content

Commit d8a7c65

Browse files
committed
break!: remove censor display and supercharged files since too niche
1 parent 09569c0 commit d8a7c65

File tree

5 files changed

+81
-250
lines changed

5 files changed

+81
-250
lines changed

README.md

Lines changed: 32 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,42 @@ Gallery.](https://alfred.app/workflows/chrisgrieser/shimmering-obsidian/)
1717

1818
- [Installation](#installation)
1919
- [Alfred-based quick switcher](#alfred-based-quick-switcher)
20-
* [How the search works](#how-the-search-works)
21-
* [Main search](#main-search)
22-
+ [Search for notes](#search-for-notes)
23-
+ [Smart queries](#smart-queries)
24-
+ [Search for aliases](#search-for-aliases)
25-
+ [Search for folders](#search-for-folders)
26-
+ [Search for headings](#search-for-headings)
27-
+ [Browse links of a note](#browse-links-of-a-note)
28-
* [Search notes by their tags](#search-notes-by-their-tags)
29-
* [Search bookmarked files](#search-bookmarked-files)
30-
* [Search recent files](#search-recent-files)
31-
* [Search for attachments](#search-for-attachments)
32-
* [Search all external links in the entire vault](#search-all-external-links-in-the-entire-vault)
33-
* [Extra features](#extra-features)
34-
+ [Supercharged icons](#supercharged-icons)
35-
+ [Privacy mode](#privacy-mode)
36-
+ [Vault search as Alfred fallback](#vault-search-as-alfred-fallback)
37-
+ [Previewing notes via QuickLook](#previewing-notes-via-quicklook)
20+
* [How the search works](#how-the-search-works)
21+
* [Main search](#main-search)
22+
+ [Search for notes](#search-for-notes)
23+
+ [Smart queries](#smart-queries)
24+
+ [Search for aliases](#search-for-aliases)
25+
+ [Search for folders](#search-for-folders)
26+
+ [Search for headings](#search-for-headings)
27+
+ [Browse links of a note](#browse-links-of-a-note)
28+
* [Search notes by their tags](#search-notes-by-their-tags)
29+
* [Search bookmarked files](#search-bookmarked-files)
30+
* [Search recent files](#search-recent-files)
31+
* [Search for attachments](#search-for-attachments)
32+
* [Search all external links in the entire vault](#search-all-external-links-in-the-entire-vault)
33+
* [Extra features](#extra-features)
34+
+ [Vault search as Alfred fallback](#vault-search-as-alfred-fallback)
35+
+ [Previewing notes via QuickLook](#previewing-notes-via-quicklook)
3836
- [Note-related features](#note-related-features)
39-
* [Create a new note](#create-a-new-note)
40-
* [Scratchpad](#scratchpad)
37+
* [Create a new note](#create-a-new-note)
38+
* [Scratchpad](#scratchpad)
4139
- [Screenshot features](#screenshot-features)
42-
* [OCR screenshots](#ocr-screenshots)
43-
* [Image screenshot](#image-screenshot)
40+
* [OCR screenshots](#ocr-screenshots)
41+
* [Image screenshot](#image-screenshot)
4442
- [Utility features](#utility-features)
45-
* [Workspace switcher](#workspace-switcher)
46-
* [Vault switcher](#vault-switcher)
47-
* [Back up your vault](#back-up-your-vault)
48-
* [CSS files](#css-files)
49-
* [Open various folders](#open-various-folders)
50-
* [Update plugins & metadata](#update-plugins--metadata)
43+
* [Workspace switcher](#workspace-switcher)
44+
* [Vault switcher](#vault-switcher)
45+
* [Back up your vault](#back-up-your-vault)
46+
* [CSS files](#css-files)
47+
* [Open various folders](#open-various-folders)
48+
* [Update plugins & metadata](#update-plugins--metadata)
5149
- [Plugins, themes, and settings](#plugins-themes-and-settings)
52-
* [Plugins](#plugins)
53-
* [Themes](#themes)
54-
* [Settings & local plugins](#settings--local-plugins)
50+
* [Plugins](#plugins)
51+
* [Themes](#themes)
52+
* [Settings & local plugins](#settings--local-plugins)
5553
- [Documentation searches](#documentation-searches)
56-
* [Official documentation](#official-documentation)
57-
* [Plugin developer documentation](#plugin-developer-documentation)
54+
* [Official documentation](#official-documentation)
55+
* [Plugin developer documentation](#plugin-developer-documentation)
5856
- [Cheatsheet](#cheatsheet)
5957
- [Credits](#credits)
6058
- [About the developer](#about-the-developer)
@@ -271,39 +269,6 @@ the file simply is opened in your default app.)
271269

272270
### Extra features
273271

274-
#### Supercharged icons
275-
You can prepend or append icons to the results of any search based on the notes'
276-
tags, similar to the [Supercharged Links
277-
Plugin](https://obsidian.md/plugins?id=supercharged-links-obsidian).
278-
- To do so, you have to add a file containing your emojis to the workflow
279-
configuration `Supercharged Icons`.
280-
- Every line of the file should represent a pair of tag and emoji to be
281-
assigned, separated by `,`. Use `,,` so that the emoji gets appended instead
282-
of prepended.
283-
284-
**Example**
285-
286-
```csv
287-
coding,💻
288-
person,👤
289-
seedling,,🌱
290-
pkm,🧠,💡
291-
```
292-
293-
…results in:
294-
295-
```text
296-
💻 Filename1
297-
👤 Filename2
298-
Filename3 🌱
299-
🧠 Filename4 💡
300-
```
301-
302-
#### Privacy mode
303-
When the "Privacy Mode" checkbox is enabled, all notes with the `cssclass`
304-
`private` are censored when performing a search. This setting is meant to be
305-
enabled temporarily, for example during screen-sharing.
306-
307272
#### Vault search as Alfred fallback
308273
The main search (`o`) can also be used as [Fallback Search for
309274
Alfred](https://www.alfredapp.com/help/features/default-results/fallback-searches/),
@@ -312,7 +277,7 @@ basically a search that shows up when any Alfred search has no result.
312277
#### Previewing notes via QuickLook
313278
To avoid accidentally triggering the Quick Look feature, it is suggested you
314279
turn off activating QuickLook via shift and use `⌘ + Y` instead. You can do so
315-
with in the Alfred Settings under `Features → Previews`:
280+
in the Alfred Settings under `Features → Previews`:
316281

317282
[QLmarkdown](https://github.com/sbarex/QLMarkdown) and
318283
[Peek](https://apps.apple.com/app/peek-quick-look-extension/id1554235898) both

info.plist

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7702,25 +7702,6 @@ DOUBLE CLICK THIS to set Hotkey. Suggested Hotkey: cmd + shift + 1</string>
77027702
<key>variable</key>
77037703
<string>main_search_subtitle</string>
77047704
</dict>
7705-
<dict>
7706-
<key>config</key>
7707-
<dict>
7708-
<key>default</key>
7709-
<false/>
7710-
<key>required</key>
7711-
<false/>
7712-
<key>text</key>
7713-
<string>Privacy mode</string>
7714-
</dict>
7715-
<key>description</key>
7716-
<string>While enabled, all notes with the cssclass "private" will be censored. This setting is meant to be enabled temporarily when sharing the screen.</string>
7717-
<key>label</key>
7718-
<string></string>
7719-
<key>type</key>
7720-
<string>checkbox</string>
7721-
<key>variable</key>
7722-
<string>privacy_mode</string>
7723-
</dict>
77247705
<dict>
77257706
<key>config</key>
77267707
<dict>
@@ -7944,27 +7925,6 @@ DOUBLE CLICK THIS to set Hotkey. Suggested Hotkey: cmd + shift + 1</string>
79447925
<key>variable</key>
79457926
<string>template_note_path</string>
79467927
</dict>
7947-
<dict>
7948-
<key>config</key>
7949-
<dict>
7950-
<key>default</key>
7951-
<string></string>
7952-
<key>filtermode</key>
7953-
<integer>2</integer>
7954-
<key>placeholder</key>
7955-
<string></string>
7956-
<key>required</key>
7957-
<false/>
7958-
</dict>
7959-
<key>description</key>
7960-
<string>To append/prepend icons to your search results, similar to the Supercharged Links Plugin. Consult the documentation for further information.</string>
7961-
<key>label</key>
7962-
<string>Supercharged icons</string>
7963-
<key>type</key>
7964-
<string>filepicker</string>
7965-
<key>variable</key>
7966-
<string>supercharged_icon_file</string>
7967-
</dict>
79687928
<dict>
79697929
<key>config</key>
79707930
<dict>
@@ -8153,11 +8113,6 @@ DOUBLE CLICK THIS to set Hotkey. Suggested Hotkey: cmd + shift + 1</string>
81538113
<string>max_number_of_bkps</string>
81548114
</dict>
81558115
</array>
8156-
<key>variables</key>
8157-
<dict>
8158-
<key>censor_char</key>
8159-
<string></string>
8160-
</dict>
81618116
<key>version</key>
81628117
<string>4.10.3</string>
81638118
<key>webaddress</key>

scripts/bookmark-or-recent-files.js

Lines changed: 40 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env osascript -l JavaScript
2-
32
ObjC.import("stdlib");
43
const app = Application.currentApplication();
54
app.includeStandardAdditions = true;
5+
//──────────────────────────────────────────────────────────────────────────────
66

77
/** @param {string} filePath */
88
function parentFolder(filePath) {
@@ -28,14 +28,10 @@ function run(argv) {
2828
const vaultPath = $.getenv("vault_path");
2929
const configFolder = $.getenv("config_folder");
3030

31-
const externalLinkRegex = /\[[^\]]*\]\([^)]+\)/;
3231
const metadataJSON = vaultPath + `/${configFolder}/plugins/metadata-extractor/metadata.json`;
3332
const starredJSON = vaultPath + `/${configFolder}/starred.json`;
3433
const bookmarkJSON = vaultPath + `/${configFolder}/bookmarks.json`;
35-
const superIconFile = $.getenv("supercharged_icon_file").replace(
36-
/^~/,
37-
app.pathTo("home folder"),
38-
);
34+
const subtitleType = $.getenv("main_search_subtitle");
3935

4036
let recentJSON = vaultPath + `/${configFolder}/workspace.json`;
4137
if (!fileExists(recentJSON)) recentJSON = recentJSON.slice(0, -5); // Obsidian 1.0 uses workspace.json → https://discord.com/channels/686053708261228577/716028884885307432/1013906018578743478
@@ -84,14 +80,6 @@ function run(argv) {
8480
}
8581
const starsAndBookmarks = [...new Set([...stars, ...bookmarks])];
8682

87-
// icons
88-
let superIconList = [];
89-
if (superIconFile && fileExists(superIconFile)) {
90-
superIconList = readFile(superIconFile)
91-
.split("\n")
92-
.filter((line) => line.length !== 0);
93-
}
94-
9583
//───────────────────────────────────────────────────────────────────────────
9684

9785
// filter the metadataJSON for the items:
@@ -101,65 +89,44 @@ function run(argv) {
10189
if (mode === "recents") return recentFiles.includes(item.relativePath);
10290
if (mode === "bookmarks") return starsAndBookmarks.includes(item.relativePath);
10391
})
104-
.map(
105-
(
106-
/** @type {{ fileName: any; relativePath: any; tags: string | any[]; links: any[]; backlinks: any; frontmatter: { cssclass: string | string[]; }; }} */ file,
107-
) => {
108-
const filename = file.fileName;
109-
const relativePath = file.relativePath;
110-
const absolutePath = vaultPath + "/" + relativePath;
111-
112-
// icon & type dependent actions
113-
let iconpath = "icons/note.png";
114-
let emoji = "";
115-
let additionalMatcher = "";
116-
// append only indicators for the other mode, since the recent file
117-
// icons for recent file search and bookmark icons for bookmark
118-
// search are obvious
119-
if (mode === "recents" && starsAndBookmarks.includes(relativePath)) {
120-
emoji += "🔖 ";
121-
additionalMatcher += "starred bookmark ";
122-
} else if (mode === "bookmarks" && recentFiles.includes(relativePath)) {
123-
emoji += "🕑 ";
124-
additionalMatcher += "recent ";
125-
}
126-
if ($.getenv("remove_emojis") === "1") emoji = "";
127-
if (filename.toLowerCase().includes("kanban")) iconpath = "icons/kanban.png";
128-
129-
// icons
130-
let superchargedIcon = "";
131-
let superchargedIcon2 = "";
132-
if (superIconList.length > 0 && file.tags) {
133-
superIconList.forEach((pair) => {
134-
const tag = pair.split(",")[0].toLowerCase().replaceAll("#", "");
135-
const icon = pair.split(",")[1];
136-
const icon2 = pair.split(",")[2];
137-
if (file.tags.includes(tag) && icon) superchargedIcon = icon + " ";
138-
else if (file.tags.includes(tag) && icon2) superchargedIcon2 = " " + icon2;
139-
});
140-
}
141-
142-
// exclude cssclass: private
143-
let displayName = filename;
144-
const censorChar = $.getenv("censor_char");
145-
const isPrivateNote = file.frontmatter?.cssclass?.includes("private");
146-
const privacyModeOn = $.getenv("privacy_mode") === "1";
147-
const applyCensoring = isPrivateNote && privacyModeOn;
148-
if (applyCensoring) displayName = filename.replace(/./g, censorChar);
149-
150-
// push result
151-
return {
152-
title: emoji + superchargedIcon + displayName + superchargedIcon2,
153-
match: additionalMatcher + alfredMatcher(filename),
154-
subtitle: "▸ " + parentFolder(relativePath),
155-
arg: relativePath,
156-
quicklookurl: vaultPath + "/" + relativePath,
157-
type: "file:skipcheck",
158-
uid: relativePath,
159-
icon: { path: iconpath },
160-
};
161-
},
162-
);
92+
.map((file) => {
93+
const filename = file.fileName;
94+
const relativePath = file.relativePath;
95+
96+
// icon & type dependent actions
97+
let iconpath = "icons/note.png";
98+
let emoji = "";
99+
let additionalMatcher = "";
100+
// append only indicators for the other mode, since the recent file
101+
// icons for recent file search and bookmark icons for bookmark
102+
// search are obvious
103+
if (mode === "recents" && starsAndBookmarks.includes(relativePath)) {
104+
emoji += "🔖 ";
105+
additionalMatcher += "starred bookmark ";
106+
} else if (mode === "bookmarks" && recentFiles.includes(relativePath)) {
107+
emoji += "🕑 ";
108+
additionalMatcher += "recent ";
109+
}
110+
if ($.getenv("remove_emojis") === "1") emoji = "";
111+
if (filename.toLowerCase().includes("kanban")) iconpath = "icons/kanban.png";
112+
113+
const subtitle =
114+
subtitleType === "parent"
115+
? parentFolder(relativePath)
116+
: (file.tags || []).map((/** @type {string} */ t) => "#" + t).join(" ");
117+
118+
// push result
119+
return {
120+
title: emoji + filename,
121+
match: additionalMatcher + alfredMatcher(filename),
122+
subtitle: subtitle,
123+
arg: relativePath,
124+
quicklookurl: vaultPath + "/" + relativePath,
125+
type: "file:skipcheck",
126+
uid: relativePath,
127+
icon: { path: iconpath },
128+
};
129+
});
163130

164131
return JSON.stringify({
165132
items: fileArray,

0 commit comments

Comments
 (0)