3These scripts are all for doing stuff on macOS.
4They rely on Mac-specific stuff and are unlikely to be useful on non-Mac systems.
6## The individual scripts
10# This adds the root of the repo to the PATH, which has cog_helpers.py
11from os.path import abspath, dirname
12import sys; sys.path.append(abspath(dirname(dirname("."))))
21 "description": "alias for <code>pmset -g batt</code>; reports the current battery level",
25 "description": "close ephemeral tabs in Safari – basically, anything that can be easily recreated/reopened later."
28 "usage": "close_specific_tabs [example.org fragment.net]",
29 "description": "close tabs in Safari based on their URL – useful for closing tabs which I can see have high activity/CPU in Activity Monitor."
33 "description": "count the number of tabs I have open in Safari."
37 "description": "print the path to the frontmost selected item in Finder"
41 "description": "get the URL of the frontmost Safari window"
44 "name": "find_processes_using_secure_input",
45 "description": "lists any processes using Secure Input, which can block apps like TextExpander"
48 "usage": "get_all_live_text [directory]",
49 "description": "get OCR'd text for all the images in a directory using Live Text"
52 "name": "get_focus_mode",
53 "description": "prints the current Focus mode"
56 "name": "get_photo_sizes",
57 "description": "print the size of every item in my Photos Library."
60 "name": "list_safari_tabs",
61 "description": "print the URL of every tab I have open in Safari"
65 "description": "print the path to the note I currently have open in [
Obsidian](
https://obsidian.md/), if any."
68 "usage": "set_accent_colour (red|orange|yellow|green|blue|purple|pink|graphite)",
69 "description": "set the accent colour, as configured in the Appearance settings",
72 "usage": "set_finder_comment PATH COMMENT",
73 "description": "Set the Finder comment of a file, which will be indexed by Spotlight for searching"
76 "usage": "set_iterm_tab_title.py TITLE",
77 "description": "Set the title of a tab in iTerm 2"
80 "usage": "sterilise [PATH]",
81 "description": "alias for <code>xattr -d com.apple.quarantine</code>"
84 "usage": "trash [PATH]",
85 "description": "move a file to the Trash"
88 "name": "unlock_keychain",
90 alias for <code>security unlock-keychain ~/Library/Keychains/login.keychain</code>; unlocks the login keychain
92 The login keychain normally gets unlocked by the OS when you log into your account; this is for when I'm accessing a Mac over SSH.
98cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
103 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/battery">
108 alias for <code>pmset -g batt</code>; reports the current battery level
112 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/close_tabs">
113 <code>close_tabs</code>
117 close ephemeral tabs in Safari – basically, anything that can be easily recreated/reopened later.
121 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/close_specific_tabs">
122 <code>close_specific_tabs [example.org fragment.net]</code>
126 close tabs in Safari based on their URL – useful for closing tabs which I can see have high activity/CPU in Activity Monitor.
130 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/count_tabs">
131 <code>count_tabs</code>
135 count the number of tabs I have open in Safari.
139 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/ffile">
144 print the path to the frontmost selected item in Finder
148 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/furl">
153 get the URL of the frontmost Safari window
157 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/find_processes_using_secure_input">
158 <code>find_processes_using_secure_input</code>
162 lists any processes using Secure Input, which can block apps like TextExpander
166 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_all_live_text">
167 <code>get_all_live_text [directory]</code>
171 get OCR'd text for all the images in a directory using Live Text
175 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_focus_mode">
176 <code>get_focus_mode</code>
180 prints the current Focus mode
184 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/get_photo_sizes">
185 <code>get_photo_sizes</code>
189 print the size of every item in my Photos Library.
193 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/list_safari_tabs">
194 <code>list_safari_tabs</code>
198 print the URL of every tab I have open in Safari
202 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/obnote">
207 print the path to the note I currently have open in [
Obsidian](
https://obsidian.md/), if any.
211 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/set_accent_colour">
212 <code>set_accent_colour (red|orange|yellow|green|blue|purple|pink|graphite)</code>
216 set the accent colour, as configured in the Appearance settings
220 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/set_finder_comment">
221 <code>set_finder_comment PATH COMMENT</code>
225 Set the Finder comment of a file, which will be indexed by Spotlight for searching
229 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/set_iterm_tab_title.py">
230 <code>set_iterm_tab_title.py TITLE</code>
234 Set the title of a tab in iTerm 2
238 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/sterilise">
239 <code>sterilise [PATH]</code>
243 alias for <code>xattr -d com.apple.quarantine</code>
247 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/trash">
248 <code>trash [PATH]</code>
252 move a file to the Trash
256 <a href="https://github.com/alexwlchan/scripts/blob/main/macos/unlock_keychain">
257 <code>unlock_keychain</code>
261 alias for <code>security unlock-keychain ~/Library/Keychains/login.keychain</code>; unlocks the login keychain
263 The login keychain normally gets unlocked by the OS when you log into your account; this is for when I'm accessing a Mac over SSH.
267<!-- [[[end]]] (sum: uJMF1iuiOs) -->