Frank1
September 4, 2023, 5:51pm
1
@Andreas_Hegenberg What I would find very useful is, if this floating menu tied to a specific window.
So if this menu would show a "text field" (when the mouse is over it) where I could write a short note.
Ideally I would have such a menu in the Finder for the download folder with its own note and for other folders as well. Depending on the folder window the correct note would be shown.
But for this it needs an editable text field. Do you think this would be possible?
Something like this
that's possible, I'll post an example tomorrow!
Frank1
September 11, 2023, 7:59pm
4
If you find time ... I am still interested
Can you try this? (Requires BTT 4.232 alpha, currently uploading)
In this example it will bind to the app + window title. So a different window title would load a different note. It would also be possible to base it on the window id, which stays the same as long as the window is not closed.
Frank1
September 12, 2023, 11:26am
6
Thank you, that's a good start
Unfortunately not. The notes are bound to an app, but not to a specific window. Means all Finder windows show the same note.
And the notes window is now always open. But it's probably a matter of settings that it only opens when the mouse is over it.
And it is difficult to click the window to have the cursor in it. The note window moves quickly up and down along the "mother" window.
When an app is closed and reopened, sometimes the notes are still there and sometimes not.
Sometimes the notes are already gone when the window of another app is selected.
Is your BTT able to grab window titles in general? You can check in the CAG configuration:
The opening and positioning are just settings. Can you describe how you want it to be positioned? Then I'll change them and post an updated preset.
True, app closing/opening logic is not added yet, but should only be a few lines of codes, I'll check!
Frank1
September 13, 2023, 6:36am
8
"your BTT"? I was not aware that I had a special edition. But yes, I use that a lot.
My favorite would be, expanded and not expanded on the top right of the window, like this.
Thanks
Attached is a slightly updated version, best to use with >=4.235:
Window Notes3.bttpreset (18.8 KB)
You could also make it expand to the left so it would also work if the window is maximized
1 Like
Frank1
September 13, 2023, 5:38pm
10
Thank you. The notes are app and window specific. Exactly how it should be. But when the mac goes to sleep, all the notes are gone when it wakes up.
Ah, replace "set_string_variable" with "set_persistent_string_variable" in the webview item's code:
<html>
<head>
<style>
#editableDiv {
width: 100%;
height: 100%;
display: block;
}
#editableDiv:focus {
outline: none;
}
</style>
<script>
async function BTTNotification(note) {
setTimeout(async () => {
let data = JSON.parse(note);
console.log(data.note, data.name);
if (get_string_variable !== undefined) {
console.log(data.note, data.name);
// example to get the currently active app, this works for any BTT variable you define:
if (
data.note == "BTTVariableChanged" &&
(data.name == "BTTActiveAppBundleIdentifier" ||
data.name == "BTTActiveWindowTitle")
) {
let toSave = document.getElementById("editableDiv").innerHTML;
console.log("to save", toSave);
await set_persistent_string_variable({
variable_name:
"currentText" +
(window.bundleIdentifier ? window.bundleIdentifier : "") +
(window.windowTitle ? window.windowTitle : ""),
to: toSave,
});
let bundleIdentifier = await get_string_variable({
variable_name: "BTTActiveAppBundleIdentifier",
});
let windowTitle = await get_string_variable({
variable_name: "BTTActiveWindowTitle",
});
if (!windowTitle) {
windowTitle = await get_string_variable({
variable_name: "windowName",
});
}
let savedContent = await get_string_variable({
variable_name: "currentText" + bundleIdentifier + windowTitle,
});
window.windowTitle = windowTitle;
window.bundleIdentifier = bundleIdentifier;
document.getElementById("editableDiv").innerHTML = savedContent
? savedContent
: "";
}
}
}, 100);
}
</script>
</head>
<body>
<div id="editableDiv" contenteditable></div>
</body>
</html>
``
1 Like
Frank1
September 14, 2023, 11:52am
12
Very good, thank you. Where/how is the text of the notes saved/stored. When I export the preset, do I export and save the notes with it?
No, such variables are currently stored in ~/Application Support/BetterTouchTool/btt_user_variables.plist
They can be viewed using the system plist editor (not 100% sure whether that is included in macOS or requires a Xcode installation)
(Or in the BTT settings:
Frank1
September 14, 2023, 12:29pm
14
Ok, then a question for my general understanding.
If I want to be sure I have made a backup of EVERYTHING, then I need to make a copy of the BTT folder in Applications Support. And in it are also all presets included. Correct?
Correct, however there is one additional file with generic settings like "launch on startup" etc.:
~/Library/Preferences/com.hegenberg.BetterTouchTool.plist
So if you backup ~/Library/Preferences/com.hegenberg.BetterTouchTool.plist
and ~/Library/Application Support/BetterTouchTool, you have absolutely everything
1 Like