πŸ†• [v3.6.9] AquaTouch – The Powerful Touch Bar Redesign.

Hey, do you already have an idea how this can be done? :smiley:

@Sem_Jalapeno

Sorry, I haven't looked into that latley as I've been quite busy. I just had a quick look.

The schedule widgets are run using iCalBuddy's terminal commands. I've checked what commands I can use and these strike my eye:

  'eventsToday'      Print events occurring today
  'eventsToday+NUM'  Print events occurring between today and NUM days into
                     the future
  'eventsNow'        Print events occurring at present time
  'eventsFrom:START to:END'
                     Print events occurring between the two specified dates

Currently, eventsToday and eventsToday+NUM is being used.

eventsNow looks promising, but I have a feeling it'll return a blank if there are no events now.

eventsFrom doesn't seem all that useful for this case, but I'm sleepy and not really thinking at all right now XD

I have a feeling it might be possible by comparing eventsNow with theh current thing, i'll experiment.

Sorry for the wait! This one is pretty complicated if you have seen the code :confused:

Hi Everyone, it's time to Hype up the next update!

I'd just like to get some opinions here, is there anything missing that you'd want to see in AQT v3.4.0?


Oh, did you want to see how it all looked like? :wink:

That's a secret for now! Tease~


@Dom, @Ikzy, @Caliguvara, @Andreas_Hegenberg, @GoldenChaos, @ErmakOFF1990ya, @Keno_Thourakhome, @franklins

3 Likes

I'm pretty sure in a near future Apple will contact you to buy your preset man :joy: ....

1 Like

"Notice Me" XD :joy:

can't wait to update :slight_smile: seems like a bunch of good improvements and some nice additions!

1 Like

I've fixed the problem (not by showing the solution, but to show more events at one place, creating the idea of a widget).

Important to have font size 7 justified (or maybe bigger for just two lines)

Code
set upcomingEvents to do shell script "/usr/local/bin/icalBuddy -n -ea -nc -ps \"|β€’ |\" -iep \"title,datetime\" -po \"datetime,title\" -tf \"%H:%M\" -df \"%b %d\" -eed eventsToday+7 | awk -F \"β€’ \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" \"$3}'"

set eventsList to theSplit(upcomingEvents, "

")


set output to "a"
set outputb to "b"
set outputc to "c"

--@yyuuiko: if/else had an error so using try instead.
--if the first item of eventsList is not "" then

try
	--@yyuuiko: remove 'Today at ' if available
	set findReplace to item 1 of eventsList
	if "Today at" is in findReplace then
		--Delete 'Today at'
		set output to replaceText("Today at ", "", findReplace)
		
	else if "Today - " is in findReplace then
		--Delete 'Today at'
		set output to replaceText("Today - ", "All-day - ", findReplace)
		
	else if "Tomorrow at " is in findReplace then
		--Delete 'Tomorrow at '
		set output to replaceText("Tomorrow at ", "", findReplace)
	else
		set output to findReplaces
	end if
end try

try
	--@yyuuiko: remove 'Today at ' if available
	set findReplaces to item 2 of eventsList
	
	if "Today at" is in findReplaces then
		
		--Delete 'Today at'
		set outputb to replaceText("Today at ", "", findReplaces)
		
	else if "Today - " is in findReplaces then
		
		--Delete 'Today at'
		set outputb to replaceText("Today - ", "All-day - ", findReplaces)
		
	else if "Tomorrow at " is in findReplaces then
		
		--Delete 'Tomorrow at '
		set outputb to replaceText("Tomorrow at ", "", findReplaces)
		
	else
		set outputb to findReplaces
	end if
	
end try

try
	
	--@yyuuiko: remove 'Today at ' if available
	
	set findReplacess to item 3 of eventsList
	if "Today at" is in findReplacess then
		
		--Delete 'Today at'
		set outputc to replaceText("Today at ", "", findReplacess)
		
	else if "Today - " is in findReplacess then
		--Delete 'Today at'
		set outputc to replaceText("Today - ", "All-day - ", findReplacess)
		
	else if "Tomorrow at " is in findReplacess then
		--Delete 'Tomorrow at '
		set outputc to replaceText("Tomorrow at ", "", findReplacess)
	else
		set outputc to findReplacess
	end if
end try

return output & return & outputb & return & outputc


on theSplit(theString, theDelimiter)
	
	-- save delimiters to restore old settings
	set oldDelimiters to AppleScript's text item delimiters
	
	-- set delimiters to delimiter to be used
	set AppleScript's text item delimiters to theDelimiter
	
	-- create the array
	set theArray to every text item of theString
	
	-- restore the old setting
	set AppleScript's text item delimiters to oldDelimiters
	
	-- return the result
	return theArray
end theSplit

--@yyuuiko: Find Replace function

on replaceText(find, replace, subject)
	--set subject to "a"
	set prevTIDs to text item delimiters of AppleScript
	set text item delimiters of AppleScript to find
	set subject to text items of subject
	set text item delimiters of AppleScript to replace
	set subject to subject as text
	set text item delimiters of AppleScript to prevTIDs
	
	return subject
end replaceText

@Sem_Jalapeno

I'm not sure what you did here... From what I can pick up, this is a two-line adaption for the front widget?

@Sem_Jalapeno

I've got it working! I think... Test it out and see what you think.

Show AppleScript

--tell application "BetterTouchTool" to set LclCalWgtMode to get_string_variable "CALWGT-DisplayEventsAs" 
-- β†’Disabled as you are not connected to the new changes in AQT Settings Engine in b3.4.0!

-- β–ˆβ–ˆβ–ˆ !! Set the variable below to your preference β–ˆβ–ˆβ–ˆ

set LclCalWgtMode to "AlwaysNext" --Choose 'Now+Next' or 'AlwaysNext'

-- β–ˆβ–ˆβ–ˆ !! Set the variable above to your preference β–ˆβ–ˆβ–ˆ



----Level 2 Logic Below----

if LclCalWgtMode is "Now+Next" then
	my NowOrNext() --used if widget is set to display Now or Next event
	
else if LclCalWgtMode is "AlwaysNext" then
	my AlwaysNext()
	
else if LclCalWgtMode is missing value or LclCalWgtMode is "" or LclCalWgtMode is not "Now+Next" or LclCalWgtMode is not "AlwaysNext" then
	--my NowOrNext()
	return "Incorrect Setup Variable"
end if


----Level 1 Logic Below----

on NowOrNext() --used if widget is set to display Now or Next event
	
	set upcomingEvents to do shell script "/usr/local/bin/icalBuddy -n -nc -ps \"|β€’ |\" -iep \"title,datetime\" -po \"datetime,title\" -tf \"%1I:%M %p\" -df \"%b %d\" -ea -eed eventsToday | head -n 1 | awk -F \"β€’ \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" - \"$3}'"
	
	set maxSize to 50
	
	if length of upcomingEvents is greater than maxSize then
		--textoverflow
		set upcomingEvents to text 1 thru (maxSize - 3) of upcomingEvents & "..."
	else if upcomingEvents is "" then
		return "{\"text\":\" No Events Today \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
	end if
	
	--@yuuiko: Remove Grey "Loading" format
	return "{\"text\":\" " & upcomingEvents & " \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
end NowOrNext

on AlwaysNext() --used if widget is set to always display Next event
	
	set currentEvent to do shell script "/usr/local/bin/icalBuddy -n -nc -ps \"|β€’ |\" -iep \"title,datetime\" -po \"datetime,title\" -tf \"%1I:%M %p\" -df \"%b %d\" -ea -eed eventsNow | head -n 1 | awk -F \"β€’ \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" - \"$3}'"
	
	if currentEvent is "" then
		my reportNextEvent1()
	else if currentEvent is not "" then
		my reportNextEvent2()
	end if
	
end AlwaysNext


----Script Functions Below----

on reportNextEvent1() --use if there is no event occuring, the next event. Reports the 1st Next event from now
	
	set upcomingEvents to do shell script "/usr/local/bin/icalBuddy -n -nc -ps \"|β€’ |\" -iep \"title,datetime\" -po \"datetime,title\" -tf \"%1I:%M %p\" -df \"%b %d\" -eed eventsToday+7 | awk -F \"β€’ \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" - \"$3}'"
	
	set eventsList to theSplit(upcomingEvents, "
")
	
	try
		--@yuuiko: remove 'Today at ' if available
		set findReplace to the first item of eventsList
		
		if "Today at" is in findReplace then
			--Delete 'Today at'
			set output to replaceText("Today at ", "", findReplace)
		end if
		
		if "Today - " is in findReplace then
			--Delete 'Today -'
			set output to replaceText("Today - ", "All-day - ", findReplace)
		end if
		
		set maxSize to 50
		
		if length of output is greater than maxSize then
			--textoverflow
			set output to text 1 thru (maxSize - 3) of output & "..."
		else if output is "" then
			return "{\"text\":\" No Events Today \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		end if
		
		--@yuuiko: Remove Grey "Loading" format
		return "{\"text\":\" " & output & " \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		
	on error
		
		--@yuuiko: Remove Grey "Loading" format
		return "{\"text\":\" Could not Retrieve\",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		
	end try
	
end reportNextEvent1

on reportNextEvent2() --use if there is an event occuring 'now', to step over 'now event'. Reports the 2nd Next event from now
	
	set upcomingEvents to do shell script "/usr/local/bin/icalBuddy -n -nc -ps \"|β€’ |\" -iep \"title,datetime\" -po \"datetime,title\" -tf \"%1I:%M %p\" -df \"%b %d\" -eed eventsToday+7 | awk -F \"β€’ \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" - \"$3}'"
	
	set eventsList to theSplit(upcomingEvents, "
")
	
	try
		--@yuuiko: remove 'Today at ' if available
		set findReplace to the second item of eventsList
		
		if "Today at" is in findReplace then
			--Delete 'Today at'
			set output to replaceText("Today at ", "", findReplace) --call FindReplace Function
		end if
		
		if "Today - " is in findReplace then
			--Delete 'Today -'
			set output to replaceText("Today - ", "All-day - ", findReplace) --call FindReplace Function
		end if
		
		set maxSize to 50
		
		if length of output is greater than maxSize then
			--textoverflow
			set output to text 1 thru (maxSize - 3) of output & "..."
		else if output is "" then
			return "{\"text\":\" No Events Today \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		end if
		
		--@yuuiko: Remove Grey "Loading" format
		return "{\"text\":\" " & output & " \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		
	on error
		
		--@yuuiko: Remove Grey "Loading" format
		return "{\"text\":\" Could not Retrieve\",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
		
	end try
	
end reportNextEvent2

on theSplit(theString, theDelimiter) --List to Array Variable Function
	-- save delimiters to restore old settings
	set oldDelimiters to AppleScript's text item delimiters
	-- set delimiters to delimiter to be used
	set AppleScript's text item delimiters to theDelimiter
	-- create the array
	set theArray to every text item of theString
	-- restore the old setting
	set AppleScript's text item delimiters to oldDelimiters
	-- return the result
	return theArray
	
end theSplit

on replaceText(find, replace, subject) --Find Replace Function
	--set subject to "a"
	set prevTIDs to text item delimiters of AppleScript
	set text item delimiters of AppleScript to find
	set subject to text items of subject
	
	set text item delimiters of AppleScript to replace
	set subject to subject as text
	set text item delimiters of AppleScript to prevTIDs
	
	return subject
end replaceText

When set to Always Next;

  • It will look if there is an event occuring now.
  • If there is none, it will grab the 1st next event.
  • If there is, it will grab the 2nd next event, skipping the 1st next event which would be the current event.

The logic sounds simple but it took quite some hours to implement :wink:

A three-line adaption :wink:

Oh wow, looks so simple now :see_no_evil: Thanks!

Hello! Complete and utter novice here, I understand next to nothing about BTT. I recently bought a new MacBook and wanted to be fancy so I downloaded AquaTouch. It's great!

However, one question. For some reason when I go to iTunes (which is frequent) the touch bar resorts back to the default iTunes bar. You know, the one with the giant scrubbing timeline? Is this intentional? It prevents me from using gestures, the only app in which it does this which makes it kinda frustrating. Is there a way for AquaTouch to go to the 'Play' button, where it shows the song currently playing?

Any help would be appreciated, thanks!

Hi @celtics345!
I'm glad you're liking AQT!


As regards to your question, yes, this is intentional behaviour for now.

There are two types of sets, Full sets and Extension sets.

iTunes is one of those apps that has an extension set. These are designed only to be opened briefly to access quick, extra controls. Since AQT v3.3.0, the icon on the control strip indicates what type of set it is:

Other than iTunes, you may notice this type of set for Finder, Safari, TextEdit, etc.

Recap: yes, this is by design. It's made so that you use the native set while having the option to occasionally open AQT up for extra controls.


Due to your feedback I've decided to upgrade the iTunes set and make it functional enough to replace the native set! It'll be somewhat like my new Spotify set!


P.S.

p.s. the new update comes with updated spotify and Now Playing widgets!
πŸ†• [v3.6.9] AquaTouch – The Powerful Touch Bar Redesign. - #259 by yuuiko

Thanks for the quick response, I really appreciate it. I get it now, the whole full versus extension thing. That makes sense. Only thing is I feel the native iTunes set isn’t functional.

As for you taking my advice and updating it though, awesome news! Wow. Thank you very much for that, can’t wait to try it out!

1 Like

Hi there!

Sorry for the delays @everyone!

I got swamped with a massive pile of schoolwork (final year.. yay..) so AQT may come later than you expect. My list of to-dos for AQT are shrinking though, and I'll be postponing extra Safari Widget support (Google Sheets, Google Slides, Outlook for Web) in favour for an earlier release date.

My Need To-Do list right now:

So, in summary, Sorry for the wait!! I'm soo busyy!

1 Like

Guys, after using AquaTouch it completely wiped out my "default" touch bar, so I have virtually nothing there: an esc button on the left, and media button on the right with a small arrow next to it.

How do I reset and return to my default touch bar?

Hi @foratera!

I think you’ve pressed the β€˜minimise control strip’ button in the setup instructions. Sounds like that. AQT shouldn’t change any of your system settings unless you choose to do so, but I guess you accidently clicked the button or something.

To revert your control strip, head to:
system preferences > Keyboard > Customise Touch Bar...

Then drag in the default set or whatever you please.

Sorry for the unclear instructions! I’ve had a friend who also had trouble installing so i’ll do my best to fix that up in the next update~

Firstly, amazing bit of work. Really enjoying using it not overwhelming and useful.

Was just wondering how to keep the gestures global? I find using the finger gestures for volume and brightness really helpful, but they don't work when I use Safari or Spotify for instance how do I get this to work? Sorry if noobish on been answered before ( I did search)

Hi @Akshay_Morzeria, Glad you're enjoying it

Unfortunatley BTT Can't affect anything outside of it's little container, so gestures are limited to when BTT is open in the touchbar. I wish I was able to globally adjust gestures too, but due to system limitations it isn't possible for an app to sense it outside of it's bar.

I did contact @Andreas_Hegenberg about this and he said there was a way, but it was way too inefficient and sucked up too much power... you wouldn't want that

Approacing: release of 3.4.0!

40%20pm

All that's left is to update the usage documentation!

* Gasp * there’s a huge changelog.