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

Add configuration for Hot Corners #308

Draft
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Draft
Changes from all 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
68 changes: 67 additions & 1 deletion modules/kwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,50 @@ let
if list == null
then null
else builtins.concatStringsSep ", " list;

hotCornersPosition = [
"top"
"topRight"
"right"
"bottomRight"
"bottom"
"bottomLeft"
"left"
"topLeft"
];

hotCornersActions = [
"none"
"showDesktop"
"lockScreen"
"krunner"
"activityManager"
"applicationLauncher"
"presentWindowsAllDesktops"
"presentWindowsCurrentDesktop"
"presentWindowsCurrentApp"
"overview"
"grid"
"toggleWindowSwitching"
"toggleAlternativeWindowSwitching"
];

hotCornerType = types.submodule {
options = {
position = mkOption {
type = with types; enum hotCornersPosition;
default = null;
example = "topRight";
description = "The position of the hot corner.";
};
action = mkOption {
type = with types; enum hotCornersActions;
default = null;
example = "showDesktop";
description = "The action to be performed when the hot corner is triggered.";
};
};
};
in
{
imports = [
Expand Down Expand Up @@ -296,6 +340,28 @@ in
};
};

hotCorners = mkOption {
type = with types; nullOr (listOf hotCornerType);
default = null;
description = "Configure hot corners.";
apply = hotCorners:
let
positionIndex = position: getIndexFromEnum position;
capitalizedPosition = position: capitalizeWord position;
in
optionalAttrs (hotCorners != null) (mkMerge [
(mkIf (any (corner: corner.action == "presentWindowsCurrentApp") hotCorners) {
Effect-windowview.BorderActivateClass = map (corner: positionIndex corner.position) (filter (corner: corner.action == "presentWindowsCurrentApp") hotCorners);
})
(mkIf (any (corner: corner.action == "presentWindowsCurrentDesktop") hotCorners) {
Effect-windowview.BorderActivate = map (corner: positionIndex corner.position) (filter (corner: corner.action == "presentWindowsCurrentDesktop") hotCorners);
})
(mkIf (any (corner: corner.action == "presentWindowsAllDesktops") hotCorners) {
Effect-windowview.BorderActivateAll = map (corner: positionIndex corner.position) (filter (corner: corner.action == "presentWindowsAllDesktops") hotCorners);
})
]);
};

edgeBarrier = mkOption {
type = with types; nullOr (ints.between 0 1000);
default = null;
Expand Down Expand Up @@ -597,6 +663,6 @@ in
TimerDelay = cfg.kwin.scripts.polonium.settings.callbackDelay;
};
})
]);
]) // cfg.kwin.hotCorners;
});
}
Loading