Simple Window Manager - SWM

Do you using a big size / 4K monitor? my stage manager automatically hides itself when i maximize window but might work differently
Can you try this;
1 - Open SWM and press P. it will open preset folder
2 - Open COM.js file with an html editor or text edit
3 - Change this line
BTTCareForStageManager:1, to BTTCareForStageManager:0,
and save it. restart bettertouchtool

Also can you try to use resize left half screen action too, it works differently than maximize window

Do you using keyboard shortcut or button on UI for maximize action

let me know if thats what you want

I will add a setting if this one solves your issue

1 Like

thank you for taking the time to try and help me out.

@yw4z SWM v1.0.2 doesn't work well with BTT (v4.394).
BTT crashes with following steps:

  1. Fresh install BTT 4.394.
  2. Import SWM v1.0.2.
  3. Press Fn+W keys to show SWM Popup Window, then cancel it.
  4. Restart BTT from menu bar.
  5. BTT crashed and keep relaunching.

I checked the file ~/Library/Application Support/BetterTouchTool/btt_user_variables.plist and figured out BTT crashes when there is value existed for key SWM-FA.

<dict>
	<key>SWM-FA</key>
	<integer>0</integer>
	<key>SWM-Stg</key>
	<string>{"Version":102,"Gap":0,"GapSize":20,"Distance":50,"POV":1,"PDP":1,"FOV":0,"FOM":0,"Grid":"7x3:8x5:5x6","MXGap":1,"wGestures":1,"Titlebar":1}</string>
</dict>

After I removed the key SWM-FA from plist file, BTT gets back to work.

@skyjia thanks for reporting

hi @Andreas_Hegenberg
maybe it could be general issue not related with latest alphas
also you can read post above. thanks

This one sets SWM-FA variable as string

also i'm using this on code. this is also string beside 0 has no quotes

callBTT('set_persistent_string_variable',{variable_name:'SWM-FA',to:0})

but plist file is integer

<dict>
	<key>SWM-FA</key>
	<integer>0</integer>
</dict>

ah, you are passing a number but using the set_persistent_string_variable function. You should pass the 0 in quotes, as string.

I’ll add some code to handle this. The crash should already be fixed in the latest alpha

@Andreas_Hegenberg thanks. i added quotes. i thought it was automatically converted

@skyjia still do you have that issue on latest alpha

4.396 (uploading now) automatically converts if necessary :wink:

1 Like

hi @yw4z
I upgraded BTT to 4.396 and this issue has been fixed.

@Andreas_Hegenberg thanks for your help. :+1:

I installed this preset, got some error with it and now I can't launch better touch tool. Using Setapp version. How can I fix this without losing my configurations?

Tried reinstalling
Using this defaults write com.hegenberg.BetterTouchTool BTTSafeModeEnabled YES
And deleting preset folder in ~/Library/Application Support/BetterTouchTool/PresetBundles but it just recreates itself and it's empty anyway

Any ideas?

@asgeirtj
that issue is fixed on latest alpha releases

First try this
β€’ go to ~/Library/Application Support/BetterTouchTool/ folder
β€’ open btt_user_variables.plist
β€’ delete this lines

<key>SWM-FA</key>
	<integer>0</integer>

also you can try btt manually but im not sure SetApp allows this
you can download latest alpha and replace BetterTouchTool.app from
https://folivora.ai/releases/

Updated gumroad page with 1.0.3 version

:hammer_and_wrench: Fixes

  • Right click on minimize button not working on non-active windows
  • Maximize function not uses same method with other resize actions when its triggered with keyboard shortcut
  • BTT starts crashing after SWM install. This one is solved on latest alpha release of BTT and also i wanted to fix on SWM side because some users might use old versions of BTT

I use Setapp which is version:


this seems to be the newest version of better touch tool:

is there some alpha version also? I'm confused

@asgeirtj can you use an older version of BTT on SetApp. i guess that bug appeared in 4.375. wait for an answer from Andreas
@Andreas_Hegenberg can you look at this. im not sure how SetApp works

The SetApp version will be updated soon, alpha releases are not available on SetApp currently

1 Like

@yw4z, I noticed a high CPU usage when using SWM. I think it is caused by this code:

ACL=async()=>{
ACC=await get_string_variable({variable_name:'SWM-FA'})
if(ACC=="0"){
	setTimeout(i=>ACL(),50)
}else{
	if(ACC==""){
		b()
		ALR('No window selected or Application has no visible window')
	}else{
		let s=ACC.split(":")
		AFP=s[0]
		FC=(s[1]=="true")?1:0
	}
	callBTT('set_persistent_string_variable',{variable_name:'SWM-FA',to:"0"})
}}

This will request the variable SWM-FA every 50ms as long as SWM-FA is "0", continuously keeping BTT awake and working. What does it do?

@Andreas_Hegenberg
Hi, i don't think that script is the problem because it should end after getting SWM-FA variable. that interval should be already ended if you see SWM UI. you can try with a higher timing like 500 for setTimeout to reduce checks. only it will effect startup time of SWM

here is logic for that code

when user tries to open SWM with keyboard shortcut or right clicking on yellow button SWM checks app name and fullscreen status of app first before showing UI with this code and stores it in SWM-FA variable

(async()=>{

n=await get_string_variable("focused_window_app_name")

set_persistent_string_variable({variable_name:'SWM-FA',to:(n=="")?"":(n+":"+((await get_number_variable("fullscreen_active"))==1))})

returnToBTT(1)

})()

i cannot get app name after showing SWM because BTT returns "BetterTouchTool" as frontmost app

then i launch this script in floating view html to get app name

ACL=async()=>{
// get variable
ACC=await get_string_variable({variable_name:'SWM-FA'})
if(ACC=="0"){
	setTimeout(i=>ACL(),50) // if its "0" check  again after 50ms
}else{
	if(ACC==""){ // it will be blank if there is no window
		b() // close SWM window
		ALR('No window selected or Application has no visible window')
	}else{ // even ACC variable is null interval should not repeat it self
		let s=ACC.split(":") // variable > Finder:false > AppName:FullscreenStatus
		AFP=s[0] // Global variable AppName
		FC=(s[1]=="true")?1:0 // Global variable FullscreenStatus
	}
	callBTT('set_persistent_string_variable',{variable_name:'SWM-FA',to:"0"})
// reset SWM-FA to 0. Also i added a trigger for sets SWM-FA to 0 on BTT launch
}}

i used 50ms to reduce startup time of SWM to reduce as much as possible. because i dont know how time will BTT take to set variable on first script that i shared

And there is no other intervals running background for SWM. its only interval and it should be ended if SWM popup visible

But there is many delayed events to improve startup time that might cause problem
you can look last setTimeout in BTTInitialize

i call BM(0) at closing SWM

BTTWillHideWindow=i=>BM(0);
BTTWillCloseWindow=i=>BM(0);
BM=m=>{document.body.style.marginTop=m?"0px":"500px"}

it just changes window margin to remove shuttering or glitch like effect on next launch

ah I see - then it's probably because I experimented with the "pre-load" option in the advanced webview settings while looking at the cache issue you described.
If the pre-load option is active the webview is loaded (but not visible) before using the keyboard shortcut to show it. In that case SWM-FA variable might not be set (until pressing the keyboard shortcut).

ofc it will recheck variable continuously if javascript running in background. but it should set SWM-FA to "0" even if you didnt use keyboard shortcut in that scenario

btw webkit is so CPU hungry for interval type of events. i'm able to freeze macOS few times but not sure did they fixed that issue

if it sets to "0" it will continue calling the ACL function every 50ms or do I miss something?

if(ACC=="0"){
	setTimeout(i=>ACL(),50) // if its "0" check  again after 50ms
}

yes you r right. if you run floating view html in background that function will create an endless loop. i can add a safety check maybe is_script_running_in_background like variable needed to solve that if we want to keep running in background