Skip to content

Instantly share code, notes, and snippets.

@kris-anderson
Created November 22, 2023 06:17
Show Gist options
  • Save kris-anderson/bde9b33c79a6ab8fa648df1934fce376 to your computer and use it in GitHub Desktop.
Save kris-anderson/bde9b33c79a6ab8fa648df1934fce376 to your computer and use it in GitHub Desktop.
Script to have Amethyst.app switch to fullscreen in every space when on a laptop
#!/bin/sh
# disable shellcheck checks in entire file
# shellcheck disable=SC1090,SC1091
MONITOR_SIZE=$(osascript -e 'tell application "Finder" to get bounds of window of desktop')
if [ "$MONITOR_SIZE" = "0, 0, 1536, 960" ] || [ "$MONITOR_SIZE" = "0, 0, 1728, 1117" ]; then
#############
# desktop 1 #
#############
osascript <<EOD
tell application "System Events"
key code 18 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
#############
# desktop 2 #
#############
osascript <<EOD
tell application "System Events"
key code 19 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
#############
# desktop 3 #
#############
osascript <<EOD
tell application "System Events"
key code 20 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
#############
# desktop 4 #
#############
osascript <<EOD
tell application "System Events"
key code 21 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
#############
# desktop 5 #
#############
osascript <<EOD
tell application "System Events"
key code 23 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
#############
# desktop 6 #
#############
osascript <<EOD
tell application "System Events"
key code 22 using {control down}
end tell
EOD
sleep 0.5
osascript <<EOD
tell application "System Events"
keystroke "D" using {option down, shift down}
end tell
EOD
sleep 0.5
###################
# go to desktop 1 #
###################
osascript <<EOD
tell application "System Events"
key code 18 using {control down}
end tell
EOD
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment