Making the most out of the touchbar

Sunday, 31 January 2021 @ 12:10
tech
One of the most useless thing ever made, but maybe not that much

How to transform something useless to useful?

/images/2021/01/touchbar.jpeg

I take no credit at all!

I found this interesting post on the internet and I though it would be cool to try this out.

What you should do?

Download the trial of Better touch Tools.

If you like it, you can buy it for as low as $8.50 + Taxes. That’s relatively cheap.

What Do I have in my setting

I simply split in 4 section the touchbar:

  1. Shortcuts: I use sooooo often the screenshot feature that I wanted a supershortcut. cmd+shift+4 is uneasy for me. A simpler button always ready is perfect. I added mission control and launchpad just for fun. I find the first gesture super easy and the second a lot less useful
  2. Apps: I wanted an easy shortcut for my chat, chrome and terminal. I sometime get lost in the various desktops. An easy way to find my way home easier
  3. Spotify: Always know what I’m listening. I stole the script from the internet and added a short press for pause/play and a longer one for next song.
  4. Audio/Display controls: always being able quickly to handle volume and brightness is mandatory for me

And it’s done.

I added a three tap == middle click but only in chrome, for opening links in new tabs.

Spotify integration.

Everything revolves around the cool script made in Applescript.

This is for the Spotify widget

property LIMIT_TITLE : 32
property LIMIT_ARTIST : 40

property strArtist : ""
property strTitle : ""
property strColor : "100,200,100,255"
if application "Spotify" is running then
	tell application "Spotify"
		set strTitle to ((get name of current track) & "")
		set strArtist to ((get artist of current track) & "")
		if player state is playing then
			set strColor to "100,200,100,255"
		else
			set strColor to "200,200,200,255"
		end if
	end tell
end if

if length of strTitle is greater than LIMIT_TITLE then
	set strTitle to (text 1 thru LIMIT_TITLE of strTitle & "...")
end if
if length of strArtist is greater than LIMIT_ARTIST then
	set strArtist to (text 1 thru LIMIT_ARTIST of strArtist & "...")
end if
set strText to (strTitle & " \\n " & strArtist)

return "{
\"text\": \"" & strText & "\",
\"font_color\": \"" & strColor & "\"
}"

And this is for its

if application "Spotify" is running then
	tell application "Spotify"
		if player state is playing then
			pause
		else
			play
		end if
	end tell
end if

With an awesome trigger for long-press

if application "Spotify" is running then
	tell application "Spotify"
		if player state is playing then
			next track
		else
			if shuffling is false then
				set shuffling to true
			end if
			play track "spotify:user:1173300082:playlist:7hddqcY0hQfRlVZeQpDfrT"
		end if
	end tell
end if

Try this out

Download my preset and just import in BTT

And now?

Better touch tools supports a whole bunch of stuff. I’ll be digging in its features in the next months. And I’m also trying to find the official js automation docs, for a better integration with apps. It’ll take a bit

Update 2021-02-09

I managed to make minor (but cool) improvements on the spotify widget, I updated the reference above and the preset.

Update 2021-10-18

/images/2021/10/touchbar.jpg

I kept playing around with the touchbar and various presets. I found the GoldenChaos presets, which is super cool and powerful. I extracted a bunch of features and copied a couple of cool implementation and made my own.

What’s new?

Download new preset

seeya

⪡ Back