koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FULLSCREEN option: windowed-fullscreen

aspauldingcode opened this issue · comments

Allow a bsp window (or a floating window) to be toggled as fullscreen.

This fullscreen just extends the window to the corners of the display, and toggles ignorance of gaps/bars spacing config to do so.

This way, we can get an alternative to native-fullscreen, which users don't have to script their own gaps/bar toggle respect/ignore keybind to get a bsp window to fullscreen instantly, and it also doesn't require us to write our own toggle for making the window float first and respect the current display dimensions..

All options need jq to be installed in the system

Option I
This command will make a floating window go full-screen or toggle full-screen for bsp mode
yabai -m window --grid 1:1:0:0:1:1 || yabai -m window --toggle zoom-fullscreen

Additionally, add this to .yabairc to automatically restore back from full-screen on focus change in bsp mode.

yabai -m signal --add event=window_focused action='if [[ $(yabai -m query --windows --window | jq ".\"is-floating\"") == "false" ]]; then
win_id=$(yabai -m query --windows --space | jq "map(select(.\"has-fullscreen-zoom\" and (.\"has-focus\" | not)))[0].id")
if [[ $win_id != "null" ]]; then yabai -m window $win_id --toggle zoom-fullscreen; fi
fi'

Option II
You can create an executable file to toggle monocle mode (make all apps full-screen and stack them) for a specific space:

  1. Create yabai-monocle file in your PATH
  2. Paste this into it:
    /opt/homebrew/bin/yabai -m space --layout $( [ "$(/opt/homebrew/bin/yabai -m query --spaces --space | /opt/homebrew/bin/jq -re .type)" = 'bsp' ] && echo 'stack' || echo 'bsp' )
  3. Make it executable
    chmod +x yabai-monocle
  4. Then this command will toggle it, or make a floating window go full-screen
    yabai -m window --grid 1:1:0:0:1:1 || yabai-monocle

Option III
Send a window to a new space. Then it will be in full-screen anyway, as the only window in it.
yabai -m space --create; yabai -m window --space next; yabai -m space --focus next

Additionally, you can add auto-deletion of empty spaces in .yabairc
yabai -m signal --add event=space_changed action='RSINDEX=$(yabai -m query --spaces | jq ".[] | select (.id == $YABAI_RECENT_SPACE_ID) | .index") && if [ "$(yabai -m query --spaces --space $RSINDEX | jq -re '.windows')" = "[]" ] ; then yabai -m space $RSINDEX --destroy ; fi'

Additionally
Cycle through windows/spaces/displays with 2 directional keys
Previous yabai -m window --focus prev || yabai -m space --focus prev || yabai -m space --focus last
Next yabai -m window --focus next || yabai -m space --focus next || yabai -m space --focus first

windowed-fullscreen
yabai -m window --grid 1:1:0:0:1:1 || yabai -m window --toggle zoom-fullscreen is already in my setup with alt + f.

However, this obeys my bar and window spacing.
What I want is a way to simply toggle a complete fullscreen without the native macOS implementation. This will require changes to yabai itself I am sure, otherwise I can create an advanced bash toggle script to disable all my gaps config and bar spacing temperarily to fullscreen the window, but I don't want that to be for the whole space. I wish I could do this for a single window.

In other words, an instant fullscreen toggle with a command like (yabai -m window --toggle windowed-fullscreen)