~ruther/nixos-config

e8e5b7a42afb30724aecbc39b3c33ab8aed62b97 — Frantisek Bohacek 1 year, 6 months ago e7ac038
feat: improve nmaster behavior upon closing windows
2 files changed, 21 insertions(+), 8 deletions(-)

M modules/desktop/qtile/config/xmonadcustom.py
M modules/desktop/qtile/home.nix
M modules/desktop/qtile/config/xmonadcustom.py => modules/desktop/qtile/config/xmonadcustom.py +16 -6
@@ 251,6 251,12 @@ class MonadTall(_SimpleLayoutBase):
    def remove(self, client: Window) -> Window | None:
        "Remove client from layout"
        self.do_normalize = True
        index = self.clients.index(client)
        if index < self.master_length:
            self.decrease_nmaster(False)
        elif len(self.clients) - self.master_length - 1 == 0:
            self.decrease_nmaster(False)

        return self.clients.remove(client)

    @expose_command()


@@ 789,20 795,24 @@ class MonadTall(_SimpleLayoutBase):
        self.group.focus(self.clients.current_client)

    @expose_command()
    def decrease_nmaster(self):
    def decrease_nmaster(self, normalize=True):
        self.master_length -= 1
        if self.master_length <= 0:
            self.master_length = 1
        self.group.layout_all()
        self.normalize()

        if normalize:
            self.group.layout_all()
            self.normalize()

    @expose_command()
    def increase_nmaster(self):
    def increase_nmaster(self, normalize=True):
        self.master_length += 1
        if self.master_length >= len(self.clients):
            self.master_length = len(self.clients) - 1
        self.group.layout_all()
        self.normalize()

        if normalize:
            self.group.layout_all()
            self.normalize()

    @expose_command
    def focus_first(self):

M modules/desktop/qtile/home.nix => modules/desktop/qtile/home.nix +5 -2
@@ 15,6 15,9 @@ let
    cargoHash = "sha256-7S8TXqtKWR4utBeUe9Q7RrmHgJg5lqkLdmo9b+MTRGg=";
    hash = "sha256-7S8TXqtKWR4utBeUe9Q7RrmHgJg5lqkLdmo9b+MTRGg=";
  };

  currentDirectory = builtins.toString ./.;
  rootConfigDirectory = builtins.toString ./../../../.;
in {
  # services.udev.extraRules =
  #     ''ACTION=="change", SUBSYSTEM=="drm", RUN+="${pkgs.autorandr}/bin/autorandr -c"'';


@@ 107,8 110,8 @@ in {
from string import Template
import os

setupLocationRef = Template("${location}")
configLocationRef = Template("${location}/modules/desktop/qtile/config")
setupLocationRef = Template("${rootConfigDirectory}")
configLocationRef = Template("${currentDirectory}/modules/desktop/qtile/config")

setupLocation = setupLocationRef.substitute(os.environ)
configLocation = configLocationRef.substitute(os.environ)

Do not follow this link