Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Krohnkite): init Krohnkite kwin script #420

Open
wants to merge 17 commits into
base: trunk
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 213 additions & 3 deletions modules/kwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pkgs,
...
}:

let
cfg = config.programs.plasma;
validTitlebarButtons = {
Expand Down Expand Up @@ -56,6 +55,14 @@ let
names:
builtins.listToAttrs (lib.imap1 (i: v: (lib.nameValuePair "Name_${builtins.toString i}" v)) names);

virtualDesktopIdAttrs =
number:
builtins.listToAttrs (
map (i: (lib.nameValuePair "Id_${builtins.toString i}" "Desktop_${builtins.toString i}")) (
lib.range 1 number
)
);

capitalizeWord =
word:
let
Expand Down Expand Up @@ -564,6 +571,175 @@ in
};
};
};

krohnkite = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable Krohnkite.";
};

settings = {
geometry = {
gaps = {
sidmoreoss marked this conversation as resolved.
Show resolved Hide resolved
top = lib.mkOption {
type = with lib.types; nullOr (ints.between 0 999);
default = null;
example = 8;
description = "Top screen gap for krohnkite.";
};
left = lib.mkOption {
type = with lib.types; nullOr (ints.between 0 999);
default = null;
example = 8;
description = "Left screen gap for krohnkite.";
};
right = lib.mkOption {
type = with lib.types; nullOr (ints.between 0 999);
default = null;
example = 8;
description = "Right screen gap for krohnkite.";
};
bottom = lib.mkOption {
type = with lib.types; nullOr (ints.between 0 999);
default = null;
example = 8;
description = "Bottom screen gap for krohnkite.";
};
tiles = lib.mkOption {
type = with lib.types; nullOr (ints.between 0 999);
default = null;
example = 8;
description = "Gap between tiles for krohnkite.";
};
};

tileWidthLimit = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to limit tile width for krohnkite.";
};
ratio = lib.mkOption {
type = with lib.types; nullOr (ints.between 1 100);
default = null;
example = 1.6;
description = "Tile width limiting ratio for krohnkite.";
};
};
};

layouts = {
sidmoreoss marked this conversation as resolved.
Show resolved Hide resolved
btree.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable binary tree layout for krohnkite.";
};
columns = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable columns layout for krohnkite.";
};
balanced = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable balanced mode for columns layout.";
};
};
floating.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable floating layout for krohnkite.";
};
monocle = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable monocle layout for krohnkite.";
};
maximize = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Fully maximize windows (no borders, no gaps) for monocle layout.";
sidmoreoss marked this conversation as resolved.
Show resolved Hide resolved
};
};
quarter.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable quarter layout for krohnkite.";
};
spiral.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable spiral layout for krohnkite.";
};
threeColumn.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable three column layout for krohnkite.";
};
tile = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable tile layout for krohnkite.";
};
};
stacked.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable stacked layout for krohnkite.";
};
spread.enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable spread layout for krohnkite.";
};
stair = {
enable = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable stacked layout for krohnkite.";
};
reverseDirection = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to reverse stair layout direction.";
};
};

enableLayoutPerActivity = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable layout per activity for krohnkite.";
};
enableLayoutPerDesktop = lib.mkOption {
type = with lib.types; nullOr bool;
default = null;
example = true;
description = "Whether to enable layout per desktop for krohnkite.";
};
};
};
};
};
};

Expand Down Expand Up @@ -633,7 +809,9 @@ in

home.packages =
with pkgs;
[ ] ++ lib.optionals (cfg.kwin.scripts.polonium.enable == true) [ polonium ];
[ ]
++ lib.optionals (cfg.kwin.scripts.polonium.enable == true) [ polonium ]
++ lib.optionals (cfg.kwin.scripts.krohnkite.enable == true) [ kdePackages.krohnkite ];
HeitorAugustoLN marked this conversation as resolved.
Show resolved Hide resolved

programs.plasma.configFile."kwinrc" = (
lib.mkMerge [
Expand Down Expand Up @@ -710,14 +888,18 @@ in

# Virtual Desktops
(lib.mkIf (cfg.kwin.virtualDesktops.number != null) {
Desktops.Number = cfg.kwin.virtualDesktops.number;
Desktops = lib.mkMerge [
{ Number = cfg.kwin.virtualDesktops.number; }
(virtualDesktopIdAttrs cfg.kwin.virtualDesktops.number)
];
})
(lib.mkIf (cfg.kwin.virtualDesktops.rows != null) {
Desktops.Rows = cfg.kwin.virtualDesktops.rows;
})
(lib.mkIf (cfg.kwin.virtualDesktops.names != null) {
Desktops = lib.mkMerge [
{ Number = builtins.length cfg.kwin.virtualDesktops.names; }
(virtualDesktopIdAttrs (builtins.length cfg.kwin.virtualDesktops.names))
(virtualDesktopNameAttrs cfg.kwin.virtualDesktops.names)
];
})
Expand Down Expand Up @@ -765,6 +947,34 @@ in
};
})

(lib.mkIf (cfg.kwin.scripts.krohnkite.enable != null) {
Plugins.krohnkiteEnabled = cfg.kwin.scripts.krohnkite.enable;
Script-krohnkite = {
screenGapTop = cfg.kwin.scripts.krohnkite.settings.geometry.gaps.top;
screenGapLeft = cfg.kwin.scripts.krohnkite.settings.geometry.gaps.left;
screenGapRight = cfg.kwin.scripts.krohnkite.settings.geometry.gaps.right;
screenGapBottom = cfg.kwin.scripts.krohnkite.settings.geometry.gaps.bottom;
tileLayoutGap = cfg.kwin.scripts.krohnkite.settings.geometry.gaps.tiles;
limitTileWidth = cfg.kwin.scripts.krohnkite.settings.geometry.tileWidthLimit.enable;
limitTileWidthRatio = cfg.kwin.scripts.krohnkite.settings.geometry.tileWidthLimit.ratio;
enableBTreeLayout = cfg.kwin.scripts.krohnkite.settings.layouts.btree.enable;
enableColumnsLayout = cfg.kwin.scripts.krohnkite.settings.layouts.columns.enable;
columnsBalanced = cfg.kwin.scripts.krohnkite.settings.layouts.columns.balanced;
enableFloatingLayout = cfg.kwin.scripts.krohnkite.settings.layouts.floating.enable;
enableMonocleLayout = cfg.kwin.scripts.krohnkite.settings.layouts.monocle.enable;
monocleMaximize = cfg.kwin.scripts.krohnkite.settings.layouts.monocle.maximize;
enableQuarterLayout = cfg.kwin.scripts.krohnkite.settings.layouts.quarter.enable;
enableSpiralLayout = cfg.kwin.scripts.krohnkite.settings.layouts.spiral.enable;
enableSpreadLayout = cfg.kwin.scripts.krohnkite.settings.layouts.spread.enable;
enableStackedLayout = cfg.kwin.scripts.krohnkite.settings.layouts.stacked.enable;
enableStairLayout = cfg.kwin.scripts.krohnkite.settings.layouts.stair.enable;
enableThreeColumnLayout = cfg.kwin.scripts.krohnkite.settings.layouts.threeColumn.enable;
enableTileLayout = cfg.kwin.scripts.krohnkite.settings.layouts.tile.enable;
layoutPerActivity = cfg.kwin.scripts.krohnkite.settings.layouts.enableLayoutPerActivity;
layoutPerDesktop = cfg.kwin.scripts.krohnkite.settings.layouts.enableLayoutPerDesktop;
};
sidmoreoss marked this conversation as resolved.
Show resolved Hide resolved
})

(lib.mkIf (cfg.kwin.tiling.padding != null) {
Tiling = {
padding = cfg.kwin.tiling.padding;
Expand Down
Loading