Sway - monocle mode?

One of the things I like about hyprland and bspwm is monocle mode (the ability to zoom a window to the full screen, this is not the same as fullscreen mode).

I can probably script something, but it would probably be hacky.

Does this exist for sway?

Is Command-F what you are looking for?

Edit: It toggles a window between full screen and original position.

Yeh, fullscreen != monocle mode, it sort of works, most of the time, but it is not the solution for some applications, like browsers.

Hacky script:

#!/bin/bash

current=$(swaymsg -t get_workspaces | jq '.[] | select(.focused==true).name' | cut -d"\"" -f2)
monocle=99

if [[ "$current" != "$monocle" ]]; then
    swaymsg move container to workspace $monocle
    swaymsg workspace $monocle
    echo $current > /tmp/current
else
    prev=$(</tmp/current)
    swaymsg move container to workspace $prev
    swaymsg workspace $prev 
    rm /tmp/current # Remove temp file.
fi     

assigned to a bindsym, it pushes the application window to workspace 99 and focuses. Pressed again, it returns the window to the original workspace and focuses.

1 Like