├── .DS_Store
├── .github
└── FUNDING.yml
├── Items
├── Bitcoin Price GBP (daily close).textbar
├── Bitcoin Price GBP (every 10 mins).textbar
├── Bitcoin Price GBP (recent - every 10 mins).textbar
├── Bitcoin Price USD (daily close).textbar
├── Bitcoin Price USD (every 10 mins).textbar
├── Bitcoin Price USD (recent - every 10 mins).textbar
├── Calendar.textbar
└── Weather.textbar
├── README.md
├── Resources
└── buymeacoffee.png
├── Screenshots
├── AdditionalImages.png
├── CPUBar.png
├── CPUSpeed.png
├── ConsoleApp.png
├── ControlPlaneContext.png
├── GitStatus.png
├── HTMLView.png
├── HotDonutsNow.png
├── LatestEmail.png
├── MouseKeyboardBattery.png
├── NightScoutCGM.png
├── QuickLauncher.png
├── SiteStatus.png
├── TextBarLive.png
├── TextBarLiveItems.png
├── URLView.png
├── UpdatedAt.png
├── Weather.png
├── WiFiOff.png
├── advanced.png
├── proxysettings.png
├── v3-dragdrop.png
├── v3-export.png
├── v3-textbar.png
├── webbar.png
└── webcharts.png
├── Scripts
├── CPUSpeed.sh
├── CheckOutlookMail.scpt
├── CrashPlan.sh
├── LatestEmail.scpt
├── NightScoutCGM.sh
├── OutlookNextMeeting.scpt
├── OutlookNextMeetingMini.scpt
├── SelectedFinderFile-ShowTags.scpt
├── SelectedFinderFile.scpt
├── ShowSpotify.scpt
├── SiteStatus.sh
├── SpaceNumber.sh
├── SpotifyControl.scpt
├── cpubar.sh
├── get_fanspeed.sh
├── git_status.sh
├── icloudtabs.py
├── icloudtabsaction.py
├── ip.sh
├── load.sh
├── membar.sh
├── mounts.sh
├── multitextbar.sh
├── pingTime.sh
├── ssid.sh
├── vbox.sh
└── vbox_runvm.sh
└── apple.html
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/.DS_Store
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [richie5um]
4 |
--------------------------------------------------------------------------------
/Items/Bitcoin Price GBP (daily close).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price GBP (daily close).textbar
--------------------------------------------------------------------------------
/Items/Bitcoin Price GBP (every 10 mins).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price GBP (every 10 mins).textbar
--------------------------------------------------------------------------------
/Items/Bitcoin Price GBP (recent - every 10 mins).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price GBP (recent - every 10 mins).textbar
--------------------------------------------------------------------------------
/Items/Bitcoin Price USD (daily close).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price USD (daily close).textbar
--------------------------------------------------------------------------------
/Items/Bitcoin Price USD (every 10 mins).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price USD (every 10 mins).textbar
--------------------------------------------------------------------------------
/Items/Bitcoin Price USD (recent - every 10 mins).textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Bitcoin Price USD (recent - every 10 mins).textbar
--------------------------------------------------------------------------------
/Items/Calendar.textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Calendar.textbar
--------------------------------------------------------------------------------
/Items/Weather.textbar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Items/Weather.textbar
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TextBar-Recipes
2 |
3 | ## What?
4 | Recipes for TextBar app [www.richsomerfield.com/apps](http://www.richsomerfield.com/apps).
5 |
6 | ## Contributions
7 | Please submit pull-requests so that I can add your ideas/scripts.
8 |
9 | ----
10 |
11 | ## TextBar License
12 |
13 | TextBar requires a license (after the 7 day trial period). But, TextBar Mac licenses work with all versions of TextBar; v1, v2 and v3 - there is **no** upgrade fee for v3.
14 |
15 | TextBar repesents a huge amount of work. If you would like to donate that would be very much appreciated.
16 |
17 |
18 |
19 | **Or via Paypal:** [paypal.me/richie5um](https://www.paypal.me/richie5um)
20 |
21 | ----
22 |
23 | ## Latest Major Features
24 |
25 | [Release Notes](http://www.richsomerfield.com/apps/textbar/releasenotes_textbar.html)
26 |
27 | ----
28 |
29 | ## New for TextBar v3.2.2
30 |
31 | TextBar v3.2 has **major** new features over v3.1. But, as I've only recently released v3 it seems simpler to keep the v3 prefix.
32 |
33 | ### Show Charts in MenuBar
34 |
35 | TextBar has an internal charting format to show charts in your MenuBar.
36 |
37 | 
38 |
39 | Example here: [Bitcoin Close Price - USD](https://github.com/richie5um/TextBar-Recipes/blob/master/Items/Bitcoin%20Price%20USD%20(daily%20close).textbar?raw=true)
40 |
41 | Example here: [Bitcoin Close Price - GBP](https://github.com/richie5um/TextBar-Recipes/blob/master/Items/Bitcoin%20Price%20GBP%20(daily%20close).textbar?raw=true)
42 | > Note: Requires accessing www.coinbase.com in your Safari web browser to approve access first.
43 |
44 | Open the script to see how it works.
45 |
46 | More examples here: [TextBar Items](Items)
47 | > Please submit them and I'll include them here :).
48 |
49 | ### Show HTML in MenuBar
50 |
51 | TextBar can show HTML in your menubar - to give you ultimate control / customizability [sic].
52 |
53 | 
54 |
55 | Example here: [Calendar](https://github.com/richie5um/TextBar-Recipes/blob/master/Items/Calendar.textbar?raw=true)
56 |
57 | > Note: This example uses HTML for MenuBar and HTML for Popover.
58 |
59 | ### Added native support for Proxy Configuration in Preferences > Network
60 |
61 | 
62 |
63 | ### Improvements to control in Preferences > Advanced
64 |
65 | 
66 |
67 | ----
68 |
69 | ## New for TextBar v3
70 |
71 | Here are the major new items for v3...
72 |
73 | ### New Preferences UI
74 |
75 | Complete re-written Preferences UI to make to easier to add and edit TextBar Items.
76 |
77 | 
78 |
79 | ### Share TextBar Items
80 |
81 | Use the new _Export_ button to save and share TextBar items with other TextBar users!
82 |
83 | 
84 |
85 | > I'm hoping to create a TextBar Items webpage at some point, for now email them to me or create a PullRequest and I'll add them to this page.
86 |
87 | Note: The Export mechanism tries to detect if the script is a file. If it is, it'll automatically include the contents of the file. Otherwise it'll require any used files to be available on the other system. If in doubt, use the new file picker to select a script file - this will work with the new export mechanism.
88 |
89 | The old Import/Export mechanism is still available for backups of your configured TextBar Items, but this does not include any file contents. It is intended for personal backups only.
90 |
91 | ### Shortcut to Refresh
92 |
93 | You can now assign a shortcut key to a TextBar Item so you can quick refresh it. You could use use this as a simple script runner :-).
94 |
95 | ### Drag and Drop Images
96 |
97 | Drag and Drop an image file onto the new preferences _image_ area to use your own image for your TextBar item.
98 |
99 | 
100 |
101 | ### And numerous other fixes and improvements
102 |
103 | ----
104 |
105 | ## New for TextBar v2
106 |
107 | Here are the major new items for v2...
108 |
109 | ### TextBar Live
110 |
111 | [https://app.textbar.co](https://app.textbar.co)
112 |
113 | > Do you have multiple Mac computers? Do you have remote or headless Mac servers? If so, then TextBar Live could be for you. TextBar Live allows you to see the status of all of your TextBar items, from all of your Macs, in a single place on the web.
114 |
115 | **Note:** TextBar Live requires a monthly subscription.
116 |
117 | * Register on [https://app.textbar.co](https://app.textbar.co)
118 | * Create a subscription - note: the first 100 users get a free 1 device subscription.
119 |
120 | * In TextBar Mac app > Preferences > Live:
121 | * Set your API Token - from [https://app.textbar.co/#/account](https://app.textbar.co/#/account)
122 | * And then enable
123 |
124 | 
125 |
126 | * View your TextBar items on the web:
127 |
128 | 
129 |
130 | ----
131 |
132 | ## Troubleshooting
133 |
134 | If you encounter problems with TextBar, you can enable logging. How to:
135 | * Run 'defaults write com.RichSomerfield.TextBar ScriptLogging -bool true'
136 | * Restart TextBar app
137 | * Open the macOS Console app, and use 'TextBar' filter
138 |
139 | 
140 |
141 | To disable the extended logging:
142 | * Run 'defaults delete com.RichSomerfield.TextBar ScriptLogging'
143 | * Restart TextBar app
144 |
145 | If TextBar is crashing on launch, you can try disabling the scripts:
146 | * Run 'defaults write com.RichSomerfield.TextBar DisableItemsOnStart -bool true'
147 | * Restart TextBar app
148 | * Run 'defaults delete com.RichSomerfield.TextBar DisableItemsOnStart'
149 |
150 | ----
151 |
152 | ### Dynamic Values
153 |
154 | Some of the TextBar values can be overriden from your script - so you can change them dynamically.
155 |
156 | The dynamic section is identified by returning `----TEXTBAR----` in your script.
157 |
158 | #### Dynamic Refresh
159 |
160 | This script will override the refresh configured for this item (in TextBar preferences) with 5 secs.
161 |
162 | #!/bin/bash
163 | date
164 | echo "----TEXTBAR----"
165 | echo "REFRESH=5"
166 |
167 |
168 | #### Dynamic Image
169 |
170 | This script will override the image configured for this item (in TextBar preferences).
171 |
172 | #!/bin/bash
173 | echo "Dynamic Image"
174 | echo "----TEXTBAR----"
175 | echo "IMAGE=_no_image-32"
176 |
177 | The bundled images are stored in `/Applications/TextBar.app/Contents/Resources` (use 'Show Package Contents' to navigate into the app in Finder).
178 |
179 | #!/bin/bash
180 | echo "Dynamic Image"
181 | echo "----TEXTBAR----"
182 | echo "IMAGE=coffee-32"
183 |
184 | Prefix the image name with a ':' to load an image from a location on your machine.
185 |
186 | #!/bin/bash
187 | echo "Dynamic Image"
188 | echo "----TEXTBAR----"
189 | echo "IMAGE=:$HOME/Pictures/RichS.jpeg"
190 |
191 | #### HTML View
192 |
193 | Show HTML in the TextBar view. For example (this is the output of the script):
194 |
195 | Display HTML
196 |
197 |
198 |
206 |
207 |
208 |
Hello from TextBar v2
209 |
210 |
211 | ----TEXTBAR----
212 | VIEWTYPE=HTML
213 |
214 | **Note:** You can also specify the ViewSize of the view.
215 |
216 |
217 | Display HTML
218 |
219 | ...
220 |
221 | ----TEXTBAR----
222 | REFRESH=10
223 | VIEWTYPE=HTML
224 | VIEWSIZE=600,400
225 |
226 | 
227 |
228 | #### URL View
229 |
230 | Show a webpage in the TextBar view.
231 |
232 | #!/bin/bash
233 | echo "Display URL"
234 | echo "https://www.apple.com"
235 | echo "----TEXTBAR----"
236 | echo "VIEWTYPE=URL"
237 | echo "VIEWSIZE=$(( ( RANDOM % 200 ) + 500 )),$(( ( RANDOM % 200 ) + 300 ))"
238 |
239 | **Note:** You can also specify the ViewSize of the view. This script creates a random sized view to demonstrate dynamic refresh too :-).
240 |
241 | 
242 |
243 | ### Last Update
244 | All TextBar items show the last updated time in the menu.
245 |
246 | 
247 |
248 | ----
249 |
250 | ## Recipes
251 |
252 | ### What is my Local IP address?
253 | ifconfig | grep inet | grep -v inet6 | cut -d" " -f2 | tail -n1
254 |
255 | ### What is my external IP address?
256 | curl -s http://ipinfo.io/ip
257 |
258 | ### What SSID is being used for en0
259 | $HOME/scripts/ssid.sh
260 |
261 | ###### [Download Script](Scripts/ssid.sh)
262 |
263 | 
264 | > Requires TextBar 2.0.362 or later.
265 | > This is much better than the SSID command that comes by default in TextBar.
266 |
267 | ### What is my (approximate) location?
268 | curl -s http://freegeoip.net/csv/ | awk -F',' '{print $6}'
269 |
270 | ### What is my latency to Google's DNS Servers?
271 | ping -c 1 8.8.8.8 | awk -F" |=" '/time/{print $10"ms"}'
272 |
273 | ### Display Ping Time to a Specified Server
274 | $HOME/scripts/pingTime.sh google.com
275 | > Download pingTime.sh to your machine (to ~/scripts), and then add this to TextBar.
276 |
277 | ### How much disk space am I using?
278 | df / | awk '{ print $5 }' | tail -n 1
279 |
280 | ### What is the time in a different country (e.g. UK)?
281 | UKDATE=\`TZ=GB date +"%H:%M %p"\` ; echo "UK: $UKDATE"
282 |
283 | ### Is my website running?
284 | ALIVE=\`curl -Is www.google.com | grep -q "200 OK"\` && echo "Google Alive" || echo "Google Dead"
285 |
286 | ### Site Status - determine if multiple websites are running
287 | $HOME/scripts/SiteStatus.sh
288 | > Download SiteStatus.sh to your machine (to ~/scripts), and then add this to TextBar. Read the script as you need to create a directory and file to list websites.
289 | > ###### [Download Script](Scripts/SiteStatus.sh)
290 |
291 | 
292 |
293 | ### Smiley
294 | echo '😀'
295 | > Easiest way to see other emoji is; Open TextEdit, then "Edit > Emoji & Symbols". Then just copy and paste into TextBar.
296 |
297 | ### Colored text
298 | if [ $((`date +"%S"`%2)) -eq 0 ]; then echo "\e[41mHot donuts now"; else echo "\e[42mHot donuts now"; fi
299 | > [MPU 321 - 58mins](https://www.relay.fm/mpu/321)
300 |
301 | > Set the refresh to 1 secs for flashing text.
302 |
303 | 
304 |
305 | ### What is my battery charge?
306 | ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}'
307 |
308 | ### Show CPU 'graph'
309 | $HOME/scripts/CPUSpeed.sh
310 |
311 | ###### [Download Script](Scripts/CPUSpeed.sh)
312 |
313 | > Download CPUSpeed.sh to your machine (to ~/scripts), and then add this to TextBar.
314 | > Note: This is fairly basic. It is very slow to use ```top``` to calculate the CPU, but, I've not come across a better way yet.
315 |
316 | 
317 |
318 | ### Show CPU 'graph' - version 2
319 | $HOME/scripts/cpubar.sh
320 |
321 | ###### [Download Script](Scripts/cpubar.sh)
322 |
323 | 
324 | > Download cpubar.sh to your machine (to ~/scripts), and then add this to TextBar.
325 | > Requires TextBar 1.5.174 or later.
326 |
327 | ### Show Mem 'graph'
328 | $HOME/scripts/membar.sh
329 |
330 | ###### [Download Script](Scripts/membar.sh)
331 |
332 | > Download membar.sh to your machine (to ~/scripts), and then add this to TextBar.
333 | > Requires TextBar 1.5.174 or later.
334 |
335 | ### What song (and artist) is playing in iTunes?
336 | osascript -e 'if application "iTunes" is running then' -e 'tell application "iTunes"' -e 'if player state = playing then' -e '(get name of current track) & " – " & (get artist of current track)' -e 'else' -e 'return ""' -e 'end if' -e 'end tell' -e 'else' -e 'return ""' -e 'end if'
337 | > If iTunes is running and a song is playing, this will display the current song name and artist name.
338 |
339 | ### What song (and artist) is playing in Spotify?
340 | osascript -e 'if application "Spotify" is running then' -e 'tell application "Spotify"' -e 'if player state is playing then' -e 'return "♫ " & (artist of current track as string) & " - " & (name of current track as string)' -e 'end if' -e 'end tell' -e 'end if'
341 | > If Spotify is running and a song is playing, this will display the current song name and artist name.
342 |
343 | ### Weather
344 | curl -s 'http://api.openweathermap.org/data/2.5/weather?q=Manchester,UK&units=metric' | python -c 'import sys, json; data=json.load(sys.stdin); print("{} : {:.1f}°C".format(data["weather"][0]["main"], data["main"]["temp"]))'
345 |
346 | 
347 | > Don't refresh too frequently as this service is rate limited.
348 | > You'll need to change "Manchester,UK" to your location, unless you actually live in Manchester :-).
349 | > Note: An API key is required.
350 |
351 | ### Unicode Weather
352 | curl weather.mar.cx/Manchester,_UK | grep "" | cut -d'>' -f2 | cut -d' ' -f1
353 | > This is likely to break as it isn't entirely robust. Edit the location to get your weather.
354 |
355 | ### Show (Local) Git Repo Status
356 | $HOME/scripts/git_status.sh TextBar "$HOME/Code/TextBar"
357 |
358 | 
359 | > Download git_status.sh to your machine (to ~/scripts), and then add this to TextBar.
360 | > Requires TextBar 1.5.174 or later
361 |
362 | ### Get Current ControlPlan context
363 | osascript -e 'tell application "ControlPlane" to get the current context' | sed -e 's: + ::g'
364 |
365 | 
366 | > I also remove the + between the contexts to save space (TextBar green, ControlPlane red).
367 |
368 | ### Unread Emails in AppleMail
369 | if [[ $(pgrep Mail) ]]; then osascript -e 'tell application "Mail" to get the unread count of inbox'; else echo "N/A"; fi
370 |
371 | ### Unread Emails in Outlook
372 | osascript $HOME/scripts/CheckOutlookMail.scpt
373 |
374 | ###### [Download Script](Scripts/CheckOutlookMail.scpt)
375 |
376 | > Download CheckOutlookMail.scpt to your machine (to ~/scripts), and then add this to TextBar.
377 |
378 | ### Date of Latest Email in AppleMail
379 | osascript $HOME/scripts/LatestEmail.scpt
380 |
381 | ###### [Download Script](Scripts/LatestEmail.scpt)
382 |
383 | > Download LatestEmail.scpt to your machine (to ~/scripts), and then add this to TextBar.
384 |
385 | 
386 |
387 | ### Next Meeting in Outlook
388 | osascript $HOME/scripts/OutlookNextMeeting.scpt
389 |
390 | ###### [Download Script](Scripts/OutlookNextMeeting.scpt)
391 |
392 | > Download OutlookNextMeeting.scpt to your machine (to ~/scripts), and then add this to TextBar.
393 | > Edit OutlookNextMeeting.scpt if you want the text formatted differently.
394 | > Note: This only looks 60 mins into the future. You can edit OutlookNextMeeting.scpt if you want longer.
395 |
396 | ### Show the clipboard (text)
397 | pbpaste | sed 's/^[[:space:]]*//;s/[[:space:]]$//' | sed -E 's/^(.{10}).+$/\1.../'
398 | > This looks more complex than you might imagine. It; strips leading and trailing whitespace, displays only 10 chars (and if it exceeds 10 characters, it'll display the ellipsis).
399 | > Obviously, if you 'Copy to Clipboard' on this, you'll get the truncated text - but, as it is already on the clipboard, you don't need to copy it :-).
400 |
401 | ### Character Count of current clipboard
402 | pbpaste | wc -c
403 |
404 | ### Mouse and Keyboard Battery Status
405 | echo "M: "`ioreg -c BNBMouseDevice | grep '"BatteryPercent" =' | sed 's/[^0-9]*//g'`"%"
406 | echo "B:" `ioreg -c AppleBluetoothHIDKeyboard | grep '"BatteryPercent" =' | sed 's/[^0-9]*//g'`"%"
407 |
408 | > Note: For Magic Mouse 2, you may need to use this instead (change 'Magic Mouse 2' if you've renamed your device):
409 |
410 | echo "M: "`ioreg -l | grep -A 10 "Magic Mouse 2" | grep '"BatteryPercent" =' | sed 's/[^0-9]*//g'`"%"
411 |
412 | 
413 | > Add these as two separate items.
414 |
415 | ### WhatPulse keys press
416 |
417 | [WhatPulse](http://whatpulse.org/) is a keyboard and mouse statistics generater.
418 |
419 | Keys pressed in the last hour:
420 |
421 | printf "%'.0f\n" $(echo '' | sqlite3 ~/Library/Application\ Support/whatpulse/whatpulse.db -cmd "select count from keypresses where day = DATE('now') and hour = strftime('%H',TIME('now','localtime'));" -batch)
422 |
423 | Key pressed today:
424 |
425 | printf "%'.0f\n" $(echo '' | sqlite3 ~/Library/Application\ Support/whatpulse/whatpulse.db -cmd "select sum("count") from keypresses where day = date();" -batch)
426 |
427 | ### Stackoverflow Reputation
428 | json=$(curl -s http://stackoverflow.com/users/flair/22656.json) && echo $json | sed 's/,//g;s/^.*reputation...\([0-9]*\).*$/\1/'
429 | > (replace 22656 by your SO account number)
430 |
431 | ### VirtualBox
432 | $HOME/scripts/vbox.sh
433 |
434 | ###### [Download Script](Scripts/vbox.sh)
435 |
436 | > Download vbox.sh to your machine (to ~/scripts), and then add this to TextBar.
437 | > Also, download vbox_run.sh to your machine (to ~/scripts) and add the action for this item to be $HOME/scripts/vbox_run.sh. Then, when you click on the machine, it'll start it.
438 | > Many thanks to SteffenK!
439 |
440 | ### Vagrant
441 | VBoxManage list runningvms | egrep -oh '[a-z]+_default' | awk -F'_' '{print $1}' | paste -s -d", " -
442 | > Show all currently running vagrant boxes (VirtualBox only)
443 |
444 | ### Show Selected File in Finder
445 | osascript $HOME/scripts/SelectedFinderFile.scpt
446 |
447 | ###### [Download Script](Scripts/SelectedFinderFile.scpt)
448 |
449 | > Download SelectedFinderFile.scpt to your machine (to ~/scripts), and then add this to TextBar.
450 |
451 | ### Show Outdated Formulae in Homebrew
452 | /usr/local/bin/brew update >/dev/null && /usr/local/bin/brew outdated | wc -l | awk '{print $1}' ; /usr/local/bin/brew outdated
453 | > This will show the number of outdated formulae in the menubar; clicking the item will show the list of items that are outdated. Update the path to `brew` to match your system.
454 |
455 | ### Remind me to sit/stand
456 | test -f $HOME/tmp/stand && { echo "Stand" && rm $HOME/tmp/stand } || { echo "Sit" && touch $HOME/tmp/stand }
457 | > Configure with whatever refresh frequency you want - in TextBar Preferences.
458 |
459 | ### Next Today Task from Things3
460 | osascript -e 'tell application "Things3"' -e 'get name of second to do in list "Today"' -e 'end tell'
461 |
462 | ## ANSI Escape Colors
463 | echo 'Normal \e[41m Other '
464 | > This is an example.
465 | > Requires TextBar 1.5.174 or later
466 |
467 | ## Multi-line Scripts
468 | echo 'Hello' ; echo 'World' ; echo '!'
469 | > Requires TextBar 1.5.174 or later
470 |
471 | ## HTML
472 | From v1.3.3, TextBar can render _basic_ HTML into your TextBar item. The text must begin with ``````, or end with `````` - must be in lowercase! - for it to be renderred as HTML.
473 |
474 | The HTML support is fairly limited, it supports text and images. The text can be styled using embedded CSS, the images can't. Images should be resized to about 14x14.
475 |
476 | ### Hello World
477 | echo 'Hello world'
478 |
479 | ### Display Image
480 | echo ''
481 | > You can't resize the image, so make sure it is 14x14 pixels for it to show correctly.
482 |
483 | ### CSS Styled Text
484 | cat '$HOME/scripts/apple.html'
485 |
486 | > Download apple.html to your machine (to ~/scripts), and then add this to TextBar.
487 |
488 | ### Is my External drive mounted (with HTML Styled Text)?
489 | [ -d /Volumes/MyExtDrive ] && echo " MyExtDrive mounted" || echo "MyExtDrive not mounted"
490 |
491 | ### Show last 10 (ish) files backed-up by CrashPlan
492 | $HOME/scripts/CrashPlan.sh
493 |
494 | ###### [Download Script](Scripts/CrashPlan.sh)
495 |
496 | > Download CrashPlan.sh to your machine (to ~/scripts), and then add this to TextBar.
497 |
498 | ### Show macOS Desktop Space Number
499 | $HOME/scripts/SpaceNumber.sh
500 |
501 | ###### [Download Script](Scripts/SpaceNumber.sh)
502 |
503 | > Requires you to name your wallpapers for each space - see notes in the script for more details. Download SpaceNumber.sh to your machine (to ~/scripts). and then add this to TextBar.
504 |
505 | ## External TextBar Recipe Sites
506 | * [https://github.com/raguay/TextBarScripts](https://github.com/raguay/TextBarScripts)
507 |
508 | ## Preferences
509 | > Requires TextBar v1.4.9 (or later)
510 |
511 | I'm working on a UI screen for preferences, but, until then you can set the Default Font/Font-Size, and Shell using ```defaults write```
512 |
513 | ### How to set the default Font
514 | defaults write com.RichSomerfield.TextBar DefaultFontName -string "HelveticaNeue-UltraLight"
515 | > Requires a restart of the TextBar app
516 |
517 | ### How to set the default Font-Size
518 | defaults write com.RichSomerfield.TextBar DefaultFontSize -int 10
519 | > Requires a restart of the TextBar app
520 |
521 | ### How to set the default Shell
522 | defaults write com.RichSomerfield.TextBar DefaultShell -string "/bin/sh"
523 | > Requires a restart of the TextBar app
524 |
525 | ### How to set the default Max Width of textbar items
526 | defaults write com.RichSomerfield.TextBar DefaultMaxWidth -int 100
527 | > Requires TextBar v1.4.47 (or later)
528 |
529 | > Requires a restart of the TextBar app
530 |
531 | > Note: This is in points. Use '0' for unlimited.
532 |
533 | > Note: This only works on OS X Yosemite (10.10)
534 |
535 | ### How to enable more default images
536 | defaults write com.RichSomerfield.TextBar DefaultAllImages -bool YES
537 |
538 | > Requires a restart of the TextBar app to read the folder
539 |
540 | ### How to use your own images
541 | defaults write com.RichSomerfield.TextBar DefaultAdditionalImagesFolder -string "/Users/rich/images/png"
542 | 
543 | > Requires TextBar v1.6.1 (or later)
544 |
545 | > Requires a restart of the TextBar app to read the folder
546 |
547 | > Note: Only loads 'png' files
548 |
549 | > Note: This will be moving to a new preferences UI when I get time to implement it
550 |
551 | To remove use:
552 |
553 | defaults delete com.RichSomerfield.TextBar DefaultAdditionalImagesFolder
554 |
555 | ### How to set the default TextBar image size
556 | defaults write com.RichSomerfield.TextBar DefaultImageSize -int 18
557 | > Requires TextBar v1.6.19 (or later)
558 |
559 | > Requires a restart of the TextBar app
560 |
561 | ### How to set the default TextBar preferences image size
562 | defaults write com.RichSomerfield.TextBar DefaultMenuImageSize -int 18
563 | > Requires TextBar v1.6.19 (or later)
564 |
565 | > Requires a restart of the TextBar app
566 |
567 | ### How to set the default TextBar notification image size
568 | defaults write com.RichSomerfield.TextBar DefaultNotificationImageSize -int 18
569 | > Requires TextBar v1.6.19 (or later)
570 |
571 | > Requires a restart of the TextBar app
572 |
573 | ## Actions
574 | Since v1.7.15, TextBar support custom actions. TextBar has, when you click on the text in the menubar, added the text to the clipboard. Now you can customize that behaviour to perform your own actions. Effectively you can build your own menu bar apps (i.e. app launcher, fav folder launcher, ...).
575 |
576 | ### How To
577 | * Go to TextBar -> Preferences
578 | * Change the Action to 'Script'
579 | * Add your script
580 |
581 | ### Details
582 | When your script runs, TextBar will pass two environment variables into the shell. These provide you with the index (i.e. position from 0...end in the menu list), and the actual text.
583 |
584 | The two environment variables are:
585 |
586 | * TEXTBAR_INDEX
587 | * TEXTBAR_TEXT
588 |
589 | ### Basic Example
590 | * Add an action script of "echo $TEXTBAR_INDEX $TEXTBAR_TEXT > $HOME/output.txt"
591 |
592 | When you trigger this action, it'll send the index and text to the output.txt file.
593 |
594 | ### Spotify Example
595 | * Download the following files:
596 | * ShowSpotify.scpt
597 | * SpotifyControl.scpt
598 | * Copy them to your ~/scripts folder
599 | * Configure a Textbar item to have a script of:
600 | * osascript $HOME/scripts/ShowSpotify.scpt
601 | * Configure the Textbar item to have an action script of:
602 | * osascript $HOME/scripts/SpotifyControl.scpt
603 |
604 | You should now be able to skip tracks and play/pause from the Textbar item.
605 |
606 | ### Quick Finder Launcher Example
607 | * Create a new TextBar item with an image
608 | * Configure your script to be:
609 | * echo "\nOpen"
610 | * Configure your action script to be:
611 | * osascript -e 'tell application "Finder" to make new Finder window'
612 |
613 | This'll only show the image in the menubar, but the 'Open' action will be shown in the menu.
614 | 
615 |
616 | If you want to have more launcher items, then you'll need to create the action script to check for the TEXTBAR_INDEX environment variable value in your action script.
617 |
618 | ### iCloud Tabs
619 | * Download the following files:
620 | * icloudtabs.scpt
621 | * icloudtabsaction.scpt
622 | * Copy them to your ~/scripts folder
623 | * Create a new TextBar item
624 | * Configure a Textbar item to have a script of:
625 | * echo 'Tabs' && python ~/scripts/icloudtabs.py
626 | * Configure the Textbar item to have an action script of:
627 | * python ~/scripts/icloudtabsaction.py
628 |
629 | This'll show your iCloud tabs from your other devices - it omits the tabs from the local machine.
630 |
--------------------------------------------------------------------------------
/Resources/buymeacoffee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Resources/buymeacoffee.png
--------------------------------------------------------------------------------
/Screenshots/AdditionalImages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/AdditionalImages.png
--------------------------------------------------------------------------------
/Screenshots/CPUBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/CPUBar.png
--------------------------------------------------------------------------------
/Screenshots/CPUSpeed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/CPUSpeed.png
--------------------------------------------------------------------------------
/Screenshots/ConsoleApp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/ConsoleApp.png
--------------------------------------------------------------------------------
/Screenshots/ControlPlaneContext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/ControlPlaneContext.png
--------------------------------------------------------------------------------
/Screenshots/GitStatus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/GitStatus.png
--------------------------------------------------------------------------------
/Screenshots/HTMLView.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/HTMLView.png
--------------------------------------------------------------------------------
/Screenshots/HotDonutsNow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/HotDonutsNow.png
--------------------------------------------------------------------------------
/Screenshots/LatestEmail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/LatestEmail.png
--------------------------------------------------------------------------------
/Screenshots/MouseKeyboardBattery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/MouseKeyboardBattery.png
--------------------------------------------------------------------------------
/Screenshots/NightScoutCGM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/NightScoutCGM.png
--------------------------------------------------------------------------------
/Screenshots/QuickLauncher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/QuickLauncher.png
--------------------------------------------------------------------------------
/Screenshots/SiteStatus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/SiteStatus.png
--------------------------------------------------------------------------------
/Screenshots/TextBarLive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/TextBarLive.png
--------------------------------------------------------------------------------
/Screenshots/TextBarLiveItems.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/TextBarLiveItems.png
--------------------------------------------------------------------------------
/Screenshots/URLView.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/URLView.png
--------------------------------------------------------------------------------
/Screenshots/UpdatedAt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/UpdatedAt.png
--------------------------------------------------------------------------------
/Screenshots/Weather.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/Weather.png
--------------------------------------------------------------------------------
/Screenshots/WiFiOff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/WiFiOff.png
--------------------------------------------------------------------------------
/Screenshots/advanced.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/advanced.png
--------------------------------------------------------------------------------
/Screenshots/proxysettings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/proxysettings.png
--------------------------------------------------------------------------------
/Screenshots/v3-dragdrop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/v3-dragdrop.png
--------------------------------------------------------------------------------
/Screenshots/v3-export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/v3-export.png
--------------------------------------------------------------------------------
/Screenshots/v3-textbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/v3-textbar.png
--------------------------------------------------------------------------------
/Screenshots/webbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/webbar.png
--------------------------------------------------------------------------------
/Screenshots/webcharts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Screenshots/webcharts.png
--------------------------------------------------------------------------------
/Scripts/CPUSpeed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | CPUSPEED=`cat ~/bin/scripts/.CPUSpeed.txt | tr -d '\n' | sed -E 's/.*(.{16})$/\1/'`
4 |
5 | IDLE=`top -n0 -l1 | head -4 | tail -1 | awk '{print $7}' | sed -e 's/%//g'`
6 | if ((`echo "$IDLE > 80.00" | bc` == 1)); then
7 | CPUSPEED=$CPUSPEED'▁ '
8 | elif ((`echo "$IDLE > 60.00" | bc` == 1)); then
9 | CPUSPEED=$CPUSPEED'▂ '
10 | elif ((`echo "$IDLE > 40.00" | bc` == 1)); then
11 | CPUSPEED=$CPUSPEED'▃ '
12 | elif ((`echo "$IDLE > 20.00" | bc` == 1)); then
13 | CPUSPEED=$CPUSPEED'▅ '
14 | else
15 | CPUSPEED=$CPUSPEED'▇ '
16 | fi
17 |
18 | echo -n "$CPUSPEED" > ~/bin/scripts/.CPUSpeed.txt
19 | echo -n "$CPUSPEED"
20 |
--------------------------------------------------------------------------------
/Scripts/CheckOutlookMail.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/CheckOutlookMail.scpt
--------------------------------------------------------------------------------
/Scripts/CrashPlan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "CrashPlan"
4 | #tail -n100 /Library/Logs/CrashPlan/backup_files.log.0 | grep ' /' | tail -n10 | cut -d' ' -f2,3,7- | rev | cut -d' ' -f3- | rev
5 | tail -n100 /Library/Logs/CrashPlan/backup_files.log.0 | sed -n -E 's/^I (.*) [0-9]+ [a-z0-9]+ [0-9] (.*) \([0-9]+\) \[.*\]$/\1 \2/p' | tail -n10
6 |
--------------------------------------------------------------------------------
/Scripts/LatestEmail.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/LatestEmail.scpt
--------------------------------------------------------------------------------
/Scripts/NightScoutCGM.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This will pull data from a NightScout Continuous Glucose Monitoring website.
3 | # The Unicode stuff is rough, but it works.
4 | # See: http://www.nightscout.info/
5 |
6 | # USE
7 | # Call this script with your own NightScout URL to query your setup for data
8 | # and print it out. Example:
9 | #
10 | # ❯ ./NightScoutCGM.sh https://cgmtest.herokuapp.com
11 | # 166 → @ 09:42 AM
12 | #
13 | # You can supply an option API secret if you're using NightScout in secure
14 | # mode. Example:
15 | #
16 | # ❯ ./NightScoutCGM.sh https://cgmtest.herokuapp.com 12345789
17 | # 166 → @ 09:42 AM
18 | #
19 | # For more information on securing NightScout see:
20 | #
21 | # https://nightscout.github.io/nightscout/security/
22 | #
23 | # For more information on using API secret tokens with a secure NightScout
24 | # installation see:
25 | #
26 | # https://github.com/nightscout/cgm-remote-monitor/wiki/API-v1-Security
27 |
28 | API_SECRET=${2:-notdefined}
29 | DATA=$(curl --silent --fail --header "API-SECRET: ${API_SECRET}" ${1}/api/v1/entries/current)
30 | VALUE=$(echo $DATA | awk '{print $3}')
31 | DIRECTION=$(echo $DATA | awk '{print $4}' | sed 's/\"//g')
32 | TIME=$(echo $DATA | awk '{print $1}' | date +'%I:%M %p')
33 | # This maps the direction strings to nice Unicode characters
34 | DIRECTION=$(echo $DIRECTION | sed 's/NONE/⇼/')
35 | DIRECTION=$(echo $DIRECTION | sed 's/TripleUp/⤊/')
36 | DIRECTION=$(echo $DIRECTION | sed 's/DoubleUp/⇈/')
37 | DIRECTION=$(echo $DIRECTION | sed 's/SingleUp/↑/')
38 | DIRECTION=$(echo $DIRECTION | sed 's/FortyFiveUp/↗/')
39 | DIRECTION=$(echo $DIRECTION | sed 's/Flat/→/')
40 | DIRECTION=$(echo $DIRECTION | sed 's/FortyFiveDown/↘/')
41 | DIRECTION=$(echo $DIRECTION | sed 's/SingleDown/↓/')
42 | DIRECTION=$(echo $DIRECTION | sed 's/DoubleDown/⇊/')
43 | DIRECTION=$(echo $DIRECTION | sed 's/TripleDown/⤋/')
44 | DIRECTION=$(echo $DIRECTION | sed 's/NOT COMPUTABLE/—/')
45 | DIRECTION=$(echo $DIRECTION | sed 's/RATE OUT OF RANGE/⚠︎/')
46 | # The end result
47 | echo $VALUE $DIRECTION @ $TIME
48 |
--------------------------------------------------------------------------------
/Scripts/OutlookNextMeeting.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/OutlookNextMeeting.scpt
--------------------------------------------------------------------------------
/Scripts/OutlookNextMeetingMini.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/OutlookNextMeetingMini.scpt
--------------------------------------------------------------------------------
/Scripts/SelectedFinderFile-ShowTags.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/SelectedFinderFile-ShowTags.scpt
--------------------------------------------------------------------------------
/Scripts/SelectedFinderFile.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/SelectedFinderFile.scpt
--------------------------------------------------------------------------------
/Scripts/ShowSpotify.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/ShowSpotify.scpt
--------------------------------------------------------------------------------
/Scripts/SiteStatus.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | WORKSPACE=~/scripts/isOnline
4 | # list of websites. each website in new line. leave an empty line in the end.
5 | # each line can have an url to test and an optional displayname:
6 | # for example:
7 | # http://hostname.com
8 | # hostname.com/testme
9 | # hostname.com:8181
10 | # hostname.com;Pretty Display Name
11 | LISTFILE=$WORKSPACE/websites.lst
12 | # List of site/status
13 | SITESTATUS=$WORKSPACE/sitestatus.txt
14 |
15 | SITEUPCOUNT=0
16 | SITEDOWNCOUNT=0
17 |
18 | # Clean up file
19 | if [ -f $SITESTATUS ]; then rm -f $SITESTATUS; fi
20 |
21 | # main loop
22 | while read p; do
23 |
24 | #Load the website line into an array
25 | IFS=';' read -ra WWW <<< "$p"
26 | if [ ${#WWW[@]} -eq 1 ]; then
27 | DISPLAYNAME=${WWW[0]}
28 | else
29 | DISPLAYNAME=${WWW[1]}
30 | fi
31 |
32 | response=$(/usr/bin/curl -L --referer ${WWW[0]} --user-agent "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" --write-out %{http_code} --silent --output /dev/null ${WWW[0]})
33 |
34 | if [ $response -eq 200 ] ; then
35 | # Site up
36 | # Increment counter
37 | SITEUPCOUNT=$[SITEUPCOUNT+1]
38 |
39 | # Add info to SITESTATUS file
40 | echo -e "${DISPLAYNAME} : \e[32m[ok]\e[0m" >> $SITESTATUS
41 | else
42 | # Site Down
43 | # Increment counter
44 | SITEDOWNCOUNT=$[SITEDOWNCOUNT+1]
45 |
46 | # Add info to SITESTATUS file
47 | echo -e "${DISPLAYNAME} : \e[31m[DOWN]\e[0m" >> $SITESTATUS
48 | fi
49 | done <$LISTFILE
50 |
51 | #Prepend the counts to SITESTATUS
52 | echo -e "\e[92m●\e[39m$SITEUPCOUNT \e[91m●\e[39m$SITEDOWNCOUNT\n$(cat $SITESTATUS)" > $SITESTATUS
53 | cat $SITESTATUS
54 |
--------------------------------------------------------------------------------
/Scripts/SpaceNumber.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script displays the number of the current space (desktop) in the menu bar
4 | # It assumes that each space has been given a desktop picture in System Preferences,
5 | # and that the name of that picture begins with the number of the space followed by a hyphen.
6 | # Example: /Users/Joe/Pictures/backgrounds/8-tile.tiff for desktop number 8
7 |
8 | # Get the file name of the current desktop picture
9 | S=`osascript -e 'tell application "System Events" ' -e ' return (picture of current desktop) as text' -e 'end tell' 2>/dev/null`
10 |
11 | # Strip off directory path, i.e. everything before first slash
12 | S=${S##*/}
13 |
14 | # Strip off everything after first hyphen
15 | S=${S%%-*}
16 |
17 | # Display the space number
18 | echo $S
--------------------------------------------------------------------------------
/Scripts/SpotifyControl.scpt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richie5um/TextBar-Recipes/104f48bef2416872019179e899dfaed7f236c529/Scripts/SpotifyControl.scpt
--------------------------------------------------------------------------------
/Scripts/cpubar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | free=`top -l 2 | grep "CPU usage" | tail -1 | awk '{printf "%.0f", $7+0}'`
4 | let used=100-$free
5 |
6 | printf "CPU "
7 | printf "%2d%% " $used
8 | #printf "["
9 | let count=0;
10 | BAR='▮'
11 | while [ $count -le 100 ]
12 | do
13 | if [ $used -ge $count ]
14 | then
15 | if [ $used -le 50 ]
16 | then
17 | printf "\e[32m$BAR" # green
18 | elif [ $used -le 80 ]
19 | then
20 | printf "\e[33m$BAR" # yellow
21 | elif [ $used -le 100 ]
22 | then
23 | printf "\e[31m$BAR" # red
24 | fi
25 | else
26 | #printf "\e[37m$BAR"
27 | printf "\e[1;30m$BAR"
28 | #printf " "
29 | fi
30 | let count=${count}+10
31 | done
32 | #printf "]"
33 |
34 | echo ''
35 |
36 | ps xro %cpu=,comm= | while read cpu comm; ((i++<5)); do
37 | int=$cpu
38 | int="${int%%.*}"
39 |
40 | echo "$color$cpu% $(basename "$comm")"$'\e[0m'"";
41 | done
42 |
--------------------------------------------------------------------------------
/Scripts/get_fanspeed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script uses spindump for measuring fanspeed
4 | # It's only tested on OS X "El Capitan"
5 | #
6 | # 2016-01-14 Kai Laufer
7 |
8 | PASSWORD=${1}
9 | FAN_SPEED=$(echo "${PASSWORD}" | sudo -S spindump -notarget 1 -nofile | grep "Fan speed" | cut -f 2 -d ":" | sed "s/ rpm//g" | sed "s/ //g")
10 | echo "${FAN_SPEED}"
11 |
--------------------------------------------------------------------------------
/Scripts/git_status.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! -z "$2" ]; then
4 | #INDEX=`cd "$2" ; git status --short 2> /dev/null`
5 | INDEX=`cd "$2" ; git -c color.status=always status --short 2> /dev/null`
6 |
7 | STAGED=$(echo "$INDEX" | grep -Ev '^\?\? ' | wc -l | tr -d " \t")
8 | UNSTAGED=$(echo "$INDEX" | grep -E '^\?\? ' | wc -l | tr -d " \t")
9 |
10 | if [ ! -z "$1" ]; then
11 | echo -n "$1 "
12 | fi
13 | echo -e "\e[92m●\e[39m$STAGED \e[91m●\e[39m$UNSTAGED"
14 | else
15 | echo "Invalid Path"
16 | fi
17 | echo "$INDEX"
18 |
--------------------------------------------------------------------------------
/Scripts/icloudtabs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # Author: Rich Somerfield
3 | # Modified from: https://github.com/kmarchand/iCloudTabsAlfredWorkflow/blob/master/icloudtabs-all.py
4 |
5 | import os
6 | import subprocess
7 | import shutil
8 | import tempfile
9 | import plistlib
10 |
11 | # RichS: Required so we can redirect the output to stdout (http://stackoverflow.com/a/4546129/6247)
12 | import codecs
13 | import locale
14 | import sys
15 |
16 | sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
17 |
18 | def create_temporary_copy(path):
19 | temp_dir = tempfile.gettempdir()
20 | temp_path = os.path.join(temp_dir, 'safari_sync_plist_copy.plist')
21 | shutil.copy2(os.path.expanduser(path), temp_path)
22 | return temp_path
23 |
24 |
25 | # make a temp copy of the plist file
26 | temp_plist = create_temporary_copy('~/Library/SyncedPreferences/com.apple.Safari.plist')
27 |
28 | # Use plutil to convert binary plist to xml
29 | os.system('plutil -convert xml1 %s' % temp_plist)
30 |
31 | # Use plistlib to convert plist XML to a dictionary
32 | info = plistlib.readPlist(temp_plist)
33 |
34 | # Clean up (delete) temp file
35 | os.remove(temp_plist)
36 |
37 | # Pull out the device elements from the info dict for easier parsing later
38 | devicetabs = []
39 | for uid in info['values'].values():
40 | try:
41 | devicetabs.append([uid['value']['DeviceName'], uid['value']['Tabs']])
42 | except:
43 | pass
44 |
45 | # Get local machine's host and computer names to exclude both from the list
46 | hostname_proc = subprocess.Popen(['scutil --get LocalHostName'], stdout=subprocess.PIPE, shell=True)
47 | (hostname_out, hostname_err) = hostname_proc.communicate()
48 | hostname = hostname_out.strip()
49 |
50 | computername_proc = subprocess.Popen(['scutil --get ComputerName'], stdout=subprocess.PIPE, shell=True)
51 | (computername_out, computername_err) = computername_proc.communicate()
52 | computername = computername_out.strip()
53 |
54 | # Print out in device separated sections
55 | for device in devicetabs:
56 | device_name = device[0]
57 | if device_name not in [hostname, computername.decode("utf-8")]:
58 | print('%s:' % device_name)
59 | for tab in device[1]:
60 | print(u' * %s <\\e[94m%s\\e[0m>' % (tab['Title'], tab['URL']))
61 |
--------------------------------------------------------------------------------
/Scripts/icloudtabsaction.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # Author: Rich Somerfield
3 | import os
4 | import sys
5 |
6 | textbar_text = os.environ['TEXTBAR_TEXT']
7 | if 0 < len(textbar_text):
8 | starttoken = " <"
9 | endtoken = ">"
10 |
11 | startIndex = textbar_text.rfind(starttoken)
12 | endIndex = textbar_text.rfind(endtoken)
13 |
14 | if 0 <= startIndex and startIndex < endIndex:
15 | url = textbar_text[startIndex+len(starttoken):endIndex]
16 | print url
17 | os.system('open %s' % url)
--------------------------------------------------------------------------------
/Scripts/ip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #OS X: Your local network IP is:
3 | IP=`ifconfig | grep inet | grep -v inet6 | cut -d" " -f2 | tail -n1`
4 | echo "" $IP""
5 |
--------------------------------------------------------------------------------
/Scripts/load.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script uses "top" for getting LOAD-stats
4 | # It's only tested on OS X "El Capitan"
5 | #
6 | # 2016-01-14 Kai Laufer
7 |
8 | echo $(top -l 1 | grep "Load Avg:")
9 |
--------------------------------------------------------------------------------
/Scripts/membar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Name: membar.sh
4 | # Version: 0.1
5 | #
6 | # Author: Kai Laufer
7 | # Mail: mail@kai-laufer.de
8 | #
9 | # Date: 03.06.2015
10 | # Last modified: 05.06.2015
11 |
12 | GET_USAGE=($(top -l 1 | grep "PhysMem" | sed "s/PhysMem: //g" | sed "s/(//g" | sed "s/)//g" | sed "s/M//g" \
13 | | sed "s/,//g" | sed "s/\.//g" | sed "s/unused//g" | sed "s/used//g" | sed "s/wired//g"))
14 |
15 | for USAGE in ${GET_USAGE[*]}; do
16 | OLD_USAGE=${USAGE}
17 | if [[ ${USAGE} == *"G"* ]]; then
18 | USAGE=$(echo ${USAGE} | sed "s/G//g")
19 | let USAGE=${USAGE}*1024
20 | GET_USAGE=($(echo ${GET_USAGE[*]} | sed "s/${OLD_USAGE}/${USAGE}/g"))
21 | fi
22 | done
23 |
24 | let TOTAL_RAM=${GET_USAGE[0]}+${GET_USAGE[2]}
25 | BAR='▮'
26 |
27 | # You could also display
28 | # wired mem and free mem
29 | # in percent:
30 | # used=${PERC_LIST[0]}
31 | # wired=${PERC_LIST[1]}
32 | # free=${PERC_LIST[2]}
33 | function in_percent() {
34 | local IN_PERCENT=$((100*${VALUE}/${TOTAL_RAM}))
35 | echo ${IN_PERCENT}
36 | }
37 |
38 | PERC_LIST=()
39 | for VALUE in ${GET_USAGE[*]}; do
40 | PERC=$(in_percent)
41 | PERC_LIST+=(${PERC})
42 | done
43 |
44 | if [[ ${PERC_LIST[0]} -lt 70 ]]; then
45 | OUT="\e[32m${BAR}"
46 | elif [[ ${PERC_LIST[0]} -lt 90 ]]; then
47 | OUT="\e[33m${BAR}"
48 | else
49 | OUT="\e[31m${BAR}"
50 | fi
51 |
52 | printf "\e[0;30mMEM ${PERC_LIST[0]}%% "
53 |
54 | SEQ=${PERC_LIST[0]:0:1}
55 | ROUND_UP=${PERC_LIST[0]:1:2}
56 | if [[ ${ROUND_UP} -ge 5 ]]; then
57 | let SEQ=SEQ+1
58 | fi
59 |
60 | for (( I=0; I < "${SEQ}"; I++ )); do
61 | printf "${OUT}"
62 | done
63 |
64 | RANGE=$((10-${SEQ}))
65 | for (( I=0; I < "${RANGE}"; I++ )); do
66 | printf "\e[1;30m${BAR}"
67 | done
68 |
69 | # Include top 5 apps in textbar menu
70 | echo ''
71 |
72 | ps xmo rss=,pmem=,comm= | while read rss pmem comm; ((n++<5)); do
73 |
74 | size="$[rss/1024]";
75 | short=$[4-${#size}];
76 | size="(${size}M)";
77 | i=0;
78 | while ((i++ < short)); do size=" $size"; done;
79 |
80 | pmem="${pmem%%.*}"
81 | color=$'\e[32m '
82 |
83 | echo "$pmem% $size $(basename "$comm")"$'\e[0m'"";
84 | #echo "$color$pmem% $size $(basename "$comm")"$'\e[0m'"";
85 | done
--------------------------------------------------------------------------------
/Scripts/mounts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | MOUNTS=`/sbin/mount \
4 | | egrep '^/' \
5 | | fgrep ' on /Volumes' \
6 | | wc -l \
7 | | tr -dc '[0-9]'`
8 |
9 | #echo "Mounts: $MOUNTS"
10 | echo "" Mounts: $MOUNTS""
11 |
--------------------------------------------------------------------------------
/Scripts/multitextbar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # some little scripts to use with "TextBar - Mac App" http://www.richsomerfield.com/apps/
3 |
4 | while [[ $# -gt 0 ]] && [[ ."$1" = .--* ]] ;
5 | do
6 | opt="$1";
7 | shift; #expose next argument
8 | case "$opt" in
9 | "--" ) break 2;;
10 | "--vpn" )
11 | VPN="$1"; shift;;
12 | "--vpn="* ) # alternate format: --vpn=host.on.vpn
13 | VPN="${opt#*=}";;
14 | "--vbox" )
15 | VBOX=true;;
16 | "--timezone" )
17 | TIMEZONE="$1"; shift;;
18 | "--timezone="* )
19 | TIMEZONE="${opt#*=}";;
20 | "--timeicon" )
21 | TIMEICON="$1"; shift;;
22 | "--timeicon="* )
23 | TIMEICON="${opt#*=}";;
24 | # "--withdefault" )
25 | # WITHDEFAULT="$optional_default";; #set to some default value
26 | # "--withdefault=*" )
27 | # WITHDEFAULT="${opt#*=}";; #take argument
28 | *) echo >&2 "Invalid option: $@"; exit 1;;
29 | esac
30 | done
31 |
32 |
33 | # show me if the default gateway is reachable and if my vpn connection works!
34 | # ~/bin/multitextbar.sh --vpn=some.place.in.your.vpn.net
35 | if [ -n "$VPN" ]; then
36 | gw=$(route -n get default 2>/dev/null| awk '/gateway/ {print $2}')
37 | if [ -z "$gw" ]; then
38 | # show gw white on red background
39 | echo '\e[41m\e[37mgw'
40 | else
41 | # show gw with yellow background if unreachable
42 | ping -o -n -q -t 1 -c 1 $gw &>/dev/null || echo '\e[43mgw'
43 | fi
44 | if (ping -o -n -q -t 3 -c 3 $VPN &>/dev/null) then
45 | echo vpn
46 | else
47 | echo '\e[41m\e[37mvpn'
48 | fi
49 |
50 | # show some statistics
51 | echo "local gateway: $gw"
52 | echo "vpn gateway for ($VPN): $(route -n get $VPN 2>/dev/null| awk '/gateway/ {print $2}')"
53 | fi
54 |
55 |
56 | # how many and what virtual boxes are running?
57 | # ~/bin/multitextbar.sh --vbox
58 | if [ -n "$VBOX" ]; then
59 | VBoxManage list runningvms | awk -F\" '{a[i++]=$2};END{print NR; print "virtual boxes running: " NR;for (j=i-1; j>=0;) print a[j--]}'
60 | fi
61 |
62 |
63 | # what time is it somewhere else?
64 | # ~/bin/multitextbar.sh --timezone=Australia/Sydney --timeicon="🇦🇺"
65 | if [ -n "$TIMEZONE" ]; then
66 | DATE=`TZ=$TIMEZONE date +"%k:%M"` ; echo "$TIMEICON$DATE"
67 | fi
68 |
69 |
--------------------------------------------------------------------------------
/Scripts/pingTime.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! -z "$1" ]; then
4 | MYPING=`ping -c 1 "$1" | sed -En '/time=/{s!^.+time=([0-9]*)\..+!\1!;p;}'`
5 | if [ "$MYPING" == "" ]; then
6 | printf -v MYPING "%04d" "0"
7 | else
8 | printf -v MYPING "%04d" $MYPING
9 | fi
10 | echo $MYPING
11 | else
12 | echo "Missing Server"
13 | fi
14 |
--------------------------------------------------------------------------------
/Scripts/ssid.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | SSID=$( { networksetup -getairportnetwork en0 | sed 's/.*[:] //'; } 2>&1 )
4 | SSID=`echo $SSID | sed 's/You are not associated with an AirPort network. Wi-Fi power is currently off./WiFi Off/'`
5 |
6 | if [[ $SSID == *"WiFi Off"* ]] ; then # Faster scan if wifi not available
7 | echo "\e[41m $SSID "
8 | echo "----TEXTBAR----"
9 | echo "REFRESH=5"
10 | else
11 | echo $SSID
12 | fi
--------------------------------------------------------------------------------
/Scripts/vbox.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | vms=$(/usr/local/bin/VBoxManage list vms | awk -F\" '{a[i++]=$2};END{for (j=i-1; j>=0;) print a[j--]}')
4 | vms_run=$(/usr/local/bin/VBoxManage list runningvms | awk -F\" '{a[i++]=$2};END{for (j=i-1; j>=0;) print a[j--]}')
5 |
6 | # set this to use line feeds instaed of spaces as selector
7 | IFS=$(echo -en "\n\b")
8 |
9 | echo
10 | for vm in $vms
11 | do
12 | state=''
13 |
14 | for vm_r in $vms_run
15 | do
16 | if [ "$vm" == "$vm_r" ]
17 | then
18 | state='\e[32m'
19 | fi
20 | done
21 |
22 | echo -e "$state$vm"
23 | echo
24 |
25 | done
--------------------------------------------------------------------------------
/Scripts/vbox_runvm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | /usr/local/bin/VBoxManage startvm "$TEXTBAR_TEXT"
4 |
--------------------------------------------------------------------------------
/apple.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------