[Hyprland] Adds window rules and introduces per-system config.
This commit is contained in:
@@ -35,66 +35,66 @@
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable {
|
||||
text =
|
||||
let
|
||||
workspaceSettings = (
|
||||
lib.imap0 (
|
||||
idx:
|
||||
{ name, value }:
|
||||
let
|
||||
offset = idx * 10;
|
||||
in
|
||||
lib.concatMapStrings (
|
||||
i:
|
||||
let
|
||||
ws = offset + i;
|
||||
in
|
||||
''
|
||||
hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" })
|
||||
''
|
||||
) (lib.range 1 10)
|
||||
) (lib.attrsToList config.hardware.monitors)
|
||||
);
|
||||
transformMap = {
|
||||
"none" = {
|
||||
normal = 0;
|
||||
flipped = 4;
|
||||
};
|
||||
"90" = {
|
||||
normal = 1;
|
||||
flipped = 5;
|
||||
};
|
||||
"180" = {
|
||||
normal = 2;
|
||||
flipped = 6;
|
||||
};
|
||||
"270" = {
|
||||
normal = 3;
|
||||
flipped = 7;
|
||||
};
|
||||
};
|
||||
|
||||
monitorTransform =
|
||||
m:
|
||||
let
|
||||
t = transformMap.${m.rotation};
|
||||
in
|
||||
if m.flipped then t.flipped else t.normal;
|
||||
|
||||
monitorString = name: m: ''
|
||||
hl.monitor({
|
||||
output = "${name}",
|
||||
mode = "${m.mode}",
|
||||
position = "${m.position}",
|
||||
transform = ${toString (monitorTransform m)},
|
||||
})
|
||||
'';
|
||||
|
||||
monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors;
|
||||
in
|
||||
lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings);
|
||||
};
|
||||
};
|
||||
# config = {
|
||||
# xdg.configFile."hypr/monitors.lua" = lib.mkIf config.wayland.windowManager.hyprland.enable {
|
||||
# text =
|
||||
# let
|
||||
# workspaceSettings = (
|
||||
# lib.imap0 (
|
||||
# idx:
|
||||
# { name, value }:
|
||||
# let
|
||||
# offset = idx * 10;
|
||||
# in
|
||||
# lib.concatMapStrings (
|
||||
# i:
|
||||
# let
|
||||
# ws = offset + i;
|
||||
# in
|
||||
# ''
|
||||
# hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${toString i}" })
|
||||
# ''
|
||||
# ) (lib.range 1 10)
|
||||
# ) (lib.attrsToList config.hardware.monitors)
|
||||
# );
|
||||
# transformMap = {
|
||||
# "none" = {
|
||||
# normal = 0;
|
||||
# flipped = 4;
|
||||
# };
|
||||
# "90" = {
|
||||
# normal = 1;
|
||||
# flipped = 5;
|
||||
# };
|
||||
# "180" = {
|
||||
# normal = 2;
|
||||
# flipped = 6;
|
||||
# };
|
||||
# "270" = {
|
||||
# normal = 3;
|
||||
# flipped = 7;
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# monitorTransform =
|
||||
# m:
|
||||
# let
|
||||
# t = transformMap.${m.rotation};
|
||||
# in
|
||||
# if m.flipped then t.flipped else t.normal;
|
||||
#
|
||||
# monitorString = name: m: ''
|
||||
# hl.monitor({
|
||||
# output = "${name}",
|
||||
# mode = "${m.mode}",
|
||||
# position = "${m.position}",
|
||||
# transform = ${toString (monitorTransform m)},
|
||||
# })
|
||||
# '';
|
||||
#
|
||||
# monitorSettings = lib.mapAttrsToList monitorString config.hardware.monitors;
|
||||
# in
|
||||
# lib.concatStringsSep "\n" (workspaceSettings ++ monitorSettings);
|
||||
# };
|
||||
# };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user