Speaking of @Andreas_Hegenberg - how can I convert all these empty script widgets to buttons without changing their style properties and UUID's? That and the Microphone Mute bug are all that remains before the next stable version is ready. I'd love to release it tomorrow as v2.641!
If you could do it faster and would be willing I can send you my current snapshot (made a few minor changes since yesterday).
I missed your comment about Trello! This is actually because Fantastical and Trello use the same keyboard shortcut by default. Personally, I disabled the keyboard shortcut in Trello since I never use it, and they have a handy option to turn it off in the app preferences.
To convert many items in a preset I'd recommend to install NodeJS because it makes it very easy to work with json files (like the BTT Presets).
This little script would convert all Apple Script widgets that just have return " " in them, to buttons (see attachment).
To use the script:
1.) Install NodeJS, easiest via NVM curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
then nvm install v8.12
2.) Save the script to some location on your disk, then open a terminal at that location.
3.) To start the script just type node convert-preset.js
The script currently assumes a file called "GoldenChaos-BTT 2.639-2.bttpreset" in the same folder as the script.
var fs = require('fs');
//read the preset json (uncompressed only)
var presetContentString = fs.readFileSync(
'./GoldenChaos-BTT 2.639-2.bttpreset'
);
var presetJSON = JSON.parse(presetContentString);
var numberOfConverted = 0;
function parseTriggers(triggers) {
for (let presetTrigger of triggers) {
// here we can now modify the trigger.
// first check if the trigger has an apple script string
if (
presetTrigger['BTTTriggerConfig'] &&
presetTrigger['BTTTriggerConfig']['BTTTouchBarAppleScriptString']
) {
// check if the apple script contains return " "
if (
presetTrigger['BTTTriggerConfig'][
'BTTTouchBarAppleScriptString'
] == 'return " "'
) {
// THIS IS THE IMPORTANT PART:
// change the type of the trigger to a button:
presetTrigger['BTTTriggerType'] = 629; //629 is the type of a touchbar button
delete presetTrigger['BTTTriggerConfig']['BTTTouchBarAppleScriptString'];
numberOfConverted++;
}
}
// for groups we need to look at the child items:
if (presetTrigger['BTTAdditionalActions']) {
parseTriggers(presetTrigger['BTTAdditionalActions']);
}
}
}
console.log('start...');
for (let presetApp of presetJSON['BTTPresetContent']) {
console.log('looking at triggers for app:', presetApp['BTTAppName']);
parseTriggers(presetApp['BTTTriggers']);
}
// save the edited json:
fs.writeFile('convertedPreset.bttpreset', JSON.stringify(presetJSON), 'utf8', () => {
console.log('finished converting and saved to convertedPreset.bttpreset! Converted:', numberOfConverted, 'items.');
});
I think this could also be useful for other changes in the future.
Hi @GoldenChaos - fabulous work on this! I'm really enjoying the presets and learning a lot about how to configure things on the touchbar. Not using all the presets for my workflow, but benefitting from your setup of group open/close etc. I've changed some of the 'close group' buttons to be on the right if they open via a right-hand button (keep same hand in motion, better for my interaction), and various other small things like that.
Incidentally, I like the wifi on/off button since I work in many places without internet, but I have an issue with the touchbar and my computer freezing/lagging when I disable internet. I have the latest version of BTT and the GoldenChaos preset 2.639-3 - is this issue fixed in a recent update? Does the same thing happen to you when you disable internet, or is this just me?
@MaximilianP it's defined in the "Other" tab with the various named Setting triggers specifically, find the named trigger called "Check Date/Time Settings". In general, variables are set inside named triggers that start with either "Check" or "Refresh".
Yes! I will put instructions in the first post for this. For now:
Navigate to the "Other" tab in BTT, you'll see the two included presets right at the top.
You can copy them and make your own!
To add your custom preset button to the GC-BTT settings menu:
Navigate to the "Touch Bar" tab in BTT
Open up the modal widget group "GC-BTT Settings"
Find the Presets section by scrolling down a bit, then copy one of the buttons in there and edit to whatever you named your preset.
Make sure to keep the "Check All Settings" trigger at the end of the preset so that GC-BTT safely refreshes its settings
If you don't want your custom preset scripts to get deleted when you upgrade, make sure to copy them over into a BetterTouchTool preset separate from GC-BTT.
@Futil I didn't forget you!! I don't personally use pomodoro, are there any awesome pomodoro apps that it would be useful to integrate with? Or would a generic timer function be more useful?
I may have done something wrong with the upgrade, but after reapplying the settings it doesn't appear to have reapplied them...
So, I was on 2.639-4 and had gone into GC-BTT Settings menu via ⌘⌥⇧P to try some custom settings. Two obvious ones were enabling the wifi button and removing the date so it just showed time.
To upgrade, I disabled the preset by unticking the Active box (maybe I should have deleted it?), clicked the 2.641 link and chose Direct Import to BTT. Upon restarting BTT, I went back into GC-BTT Settings menu and pressed Reapply Settings - it went through the progress bar and went back to the normal view. I now found the wifi button was no longer there and the full date is showing again.
Happy to report back on any tests you'd like me to do.
Am I doing something wrong with the thumbs up/down keys for Spotify? They don't seem to have an effect..
And I found the named Trigger: Check Date/Time Settings and changed the time format how I wanted.
But it seems that the time format comes from somewhere else, and I haven't figured out where.
At least is my setting not reflected.
set dateFormat24Hour to ""
try
set dateFormat24Hour to get_string_variable "dateFormatLarge24Hour"
end try
if dateFormat24Hour is missing value or dateFormat24Hour is "E MMM d H.mm" then
-- if one's not set, assume they're all unset.
-- set default values for all three date formats: large, medium and small
set_persistent_string_variable "dateFormatLarge24Hour" to "E d MMM H.mm"
set_persistent_string_variable "dateFormatMedium24Hour" to "d MMM H.mm"
set_persistent_string_variable "dateFormatSmall24Hour" to "H.mm"
end if
I have a few buttons made but disabled by default because they aren’t functionally implemented yet. Those are two of them also sadly not sure if it will ever be possible since Spotify doesn’t expose those actions anywhere that I can see. Maybe I’ll remove these buttons then, but am I really ready to give up on dreams?
EDIT: Missed the date/time formatting bit. I’ll write up an explanation shortly.
Ok, I hope I'm not missing something obvious here...
If I tick the visible check box next to "Now Playing Actions", it appears in the Touch Bar which I can press and it reveals a very useful set of buttons to use while listening to music in iTunes (it could do with volume buttons in there too if possible please). However if I quit iTunes, that button stays visible, and I have to go back to preferences to hide it again.
I see there is a "Now Playing Widget" within Home Strip which appears when playing music, but pressing that doesn't do anything. Is there a way to make it open the Now Playing Actions instead, or is there another way to show a button that I can press to show Now Playing Actions please?
Edit: Actually, it turns out the best way to use those useful actions is to make them visible and hide the text, so I can just click on them to view their actions.
ah okay no worries! then I hide those buttons again
I would be neat to access those to actions directly there. Spotify has them implemented in their TouchBar - is there a way to just link them?
No hurry on the date/time formatting. It is really not a biggie.
You're supposed to leave those groups hidden - you access them by long-pressing their associated widget or menu bar icon like so:
Long Press Now Playing Widget -> Now Playing Actions
Long Press Calendar or Date/Time -> Calendar Actions
Long Press Reminders Widget -> Reminders Actions
Long Press Volume Up/Wi-Fi/Bluetooth/"Connect to X" -> Connectivity Actions
Long Press Weather Widget -> 7-Day Forecast
So there's some logic to it try long pressing on lots of things!
@MaximilianP I'll look into it, but last I remember it's not possible since the actions need to be exposed to AppleScript. I'll check again, but I'm like 98% positive it's not accessible.
You can add this preset underneath the other two and run it whenever you want. Simply change the three date formats to your liking.
(You could also run this from any script editor, too. Plus, the setting will persist between upgrades!)
-- Custom 24-Hour Date/Time Format
-- This is a PRESET script, called from group GC-BTT Settings
tell application "BetterTouchTool"
-- Bend the date/time format to our will
set_persistent_string_variable "dateFormatLarge24Hour" to "E d MMM H.mm"
set_persistent_string_variable "dateFormatMedium24Hour" to "d MMM H.mm"
set_persistent_string_variable "dateFormatSmall24Hour" to "H.mm"
-- Use 24-Hour Time
set_persistent_string_variable "timeFormat" to "24Hour"
-- Refresh the Date/Time widget
trigger_named "Refresh Date/Time Widget"
end tell