aerospace: create script to toggle tiling

This commit is contained in:
Nico 2025-10-05 01:52:17 +10:00
parent 0d75b9d258
commit 63cad61e35
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0
2 changed files with 47 additions and 0 deletions

View file

@ -93,6 +93,8 @@ alt-shift-f = 'exec-and-forget open ~'
alt-shift-b = 'exec-and-forget /opt/homebrew/bin/firefox --new-window' alt-shift-b = 'exec-and-forget /opt/homebrew/bin/firefox --new-window'
alt-s = 'exec-and-forget screencapture -i -c' alt-s = 'exec-and-forget screencapture -i -c'
alt-shift-w = 'exec-and-forget $HOME/.config/aerospace/toggle-tiling.sh off'
# Layout # Layout
# See: https://nikitabobko.github.io/AeroSpace/commands#layout # See: https://nikitabobko.github.io/AeroSpace/commands#layout
alt-c = 'layout tiles horizontal vertical' alt-c = 'layout tiles horizontal vertical'

View file

@ -0,0 +1,45 @@
#!/bin/sh
disableTiling () {
defaults write com.apple.dock orientation bottom
defaults write com.apple.dock autohide -bool FALSE
defaults write com.apple.finder CreateDesktop true
killall Finder Dock sketchybar borders
aerospace enable off # fails when script called from aerospace directly, bin not in path
/run/current-system/sw/bin/aerospace enable off
osascript -e 'tell application "System Events"
tell dock preferences
set properties to {autohide menu bar:false, autohide:false}
end tell
end tell' -e 'tell application "System Events" to set visible of (every application process whose visible is true and name is not "Finder") to false'
}
enableTiling () {
aerospace enable on
sketchybar & disown
sh ~/.cache/matugen-jankyborders.sh & disown
defaults write com.apple.dock orientation right
defaults write com.apple.dock autohide -bool FALSE
defaults write com.apple.finder CreateDesktop false
killall Dock Finder
osascript -e '
tell application "System Events"
tell dock preferences
set properties to {autohide menu bar:true, autohide:true}
end tell
end tell
'
}
if [ "$1" = "on" ]; then
enableTiling
elif [ "$1" = "off" ]; then
disableTiling
else
echo "$0: [on|off]"
fi