I am on Big Sur. My workflow involves like 10 static spaces that I access with CMD+NUM key shortcuts (not CTRL-NUM you can turn on in Sys Pref's Keyboard Shortcut section). Often I am just switching back and forth between two spaces, and would like to be able to toggle between the previous two spaces.
In Snow Leopard there was a 'double-tab-jump-back' key you could turn on with a 'defaults' terminal command (https://www.cultofmac.com/133205/use-a-secret-gesture-to-switch-to-the-previous-space-os-x-tips/). This is gone now:
$ defaults find double-tap-jump-back 2021-08-05 10:35:11.617 defaults[5047:253260] No domain, key, nor value containing 'double-tap-jump-back'
Ideally, I would bind CMD+` (I never use it to switch between app windows) to function exactly like CMD+TAB's app switcher but it would be for spaces. This will almost certainly never happen.
So instead I'd just like to figure out a way to switch to the previous space. This would probably involve multiple small applescripts. The main script would save the current space before jumping to the previous one upon a CMD+` keypress. Then I would need 10 other scripts that save the current space before jumping using my CMD+NUM shortcuts. If I switched between spaces using trackpad gestures, then the previous space would not be kept current, but I don't use the trackpad often enough for this corner case to be addressed.
Unfortunately I am just returning to MacOS from a GNOME-based linux desktop and am not very familiar with applescript. Could someone help me draft a template main applescript and then a template for my CMD+NUM applescripts? I imagine this is the only way to accomplish this :)
I have a American English ANSI keyboard on m1 macbook air. I only use the single, built-in monitor and keyboard on this device. I never use full screen apps in their own spaces because I can't switch to them directly. Here are my settings (I don't change keybinds in System Preferences and instead use BetterTouchTool to bind the "Switch to Desktop X" and "Move Window to Desktop X" functions):