Resize to relative screen size #839
-
|
I would like a command that lets me resize a window to 1/3 of the screen and inversely the other one to 2/3. Since I work with different external monitors (with different resolutions) relative instead of absolute numbers would be great. If this is already achievable I would appreciate a cue into the right direction. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
|
I'm not seeing this, other than using an external keybinding tool to do the calculation based on screen width (example: Hammerspoon) and then calling |
Beta Was this translation helpful? Give feedback.
-
|
I made this script but it has two issues:
#!/usr/bin/env sh
AEROSPACE_STATE="/tmp/aerospace.state"
WIDTH=$(osascript -e 'tell app "Finder" to get bounds of window of desktop' | sed -e 's/0, 0, //' -e 's/, .*//')
echo "Width: $WIDTH"
AEROSPACE_CYCLE=$(cat "$AEROSPACE_STATE" 2>/dev/null)
case "$AEROSPACE_CYCLE" in
"third")
AEROSPACE_CYCLE="half"
TARGET=$(bc -e "$WIDTH / 2")
echo $TARGET
;;
"half")
AEROSPACE_CYCLE="twothird"
TARGET=$(bc -e "$WIDTH / 3 * 2")
echo $TARGET
;;
"twothird")
AEROSPACE_CYCLE="third"
TARGET=$(bc -e "$WIDTH / 3")
echo $TARGET
;;
*)
AEROSPACE_CYCLE="half"
TARGET=$(bc -e "$WIDTH / 2")
echo $TARGET
;;
esac
echo "$AEROSPACE_CYCLE" > "$AEROSPACE_STATE"
echo "Cycle: $AEROSPACE_CYCLE, Target: $TARGET"
aerospace resize smart $TARGET |
Beta Was this translation helpful? Give feedback.
-
|
Duplicate of #397 |
Beta Was this translation helpful? Give feedback.
-
|
I wrote a script that does exactly this: https://gist.github.com/Leftium/14026b69b98125ff547974dcb1c52332#file-aerospace-cycle-size (actually it does a little more, but the size cycling a la Raycast is very convenient.) |
Beta Was this translation helpful? Give feedback.
Duplicate of #397