dots/stow/.config/aerospace/toggle-tiling.sh

45 lines
1.2 KiB
Bash
Executable file

#!/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