Post

How to reset the Master layout on Hyprland

Since Hyprland does not come with a way to reset the Master layout like X11 window managers such as XMonad, this has to be done manually using hyprctl:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
# Reset the master layout on Hyprland.
# Hyprland does not come with a way to reset the layout
# like XMonad and some other window managers do.
# So we have to do it manually.
#
# Author: Yusef Aslam

# Reset the master/stack factor and orientation
hyprctl dispatch layoutmsg mfact -1.0
hyprctl dispatch layoutmsg mfact +0.45
hyprctl dispatch layoutmsg orientationleft

# Move windows out of fullscreen
hyprctl dispatch fullscreenstate 0

This script:

  • Reset the master / slave layout factor
  • Sets the orientation back to left (the default in my configuration)
  • Disables fullscreen mode for the active window

In order to get a behaviour similar to XMonad, this script can be bound to a key:

1
2
# reset the master layout
bind = $mainMod_SHIFT, SPACE, exec, ~/bin/hypr-resetlayout.sh
This post is licensed under CC BY 4.0 by the author.