mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 18:59:47 +01:00
hyprland: prioritize variables and beziers (#4263)
* hyprland: prioritize variables and beziers The `settings` key now handles `$variables` and `bezier`s differently, putting them at the top of the file. Also, proper indentation has been implemented. * Update modules/services/window-managers/hyprland.nix Co-authored-by: Naïm Favier <n@monade.li> * hyprland: add animations & beziers test --------- Co-authored-by: Naïm Favier <n@monade.li>
This commit is contained in:
parent
ee5673246d
commit
76dd6c6619
3 changed files with 53 additions and 16 deletions
|
@ -175,22 +175,34 @@ in {
|
||||||
shouldGenerate = cfg.systemdIntegration || cfg.extraConfig != ""
|
shouldGenerate = cfg.systemdIntegration || cfg.extraConfig != ""
|
||||||
|| combinedSettings != { };
|
|| combinedSettings != { };
|
||||||
|
|
||||||
toHyprconf = attrs:
|
toHyprconf = with lib;
|
||||||
|
attrs: indentLevel:
|
||||||
let
|
let
|
||||||
|
indent = concatStrings (replicate indentLevel " ");
|
||||||
|
|
||||||
mkSection = n: attrs: ''
|
mkSection = n: attrs: ''
|
||||||
${n} {
|
${indent}${n} {
|
||||||
${toHyprconf attrs}}
|
${toHyprconf attrs (indentLevel + 1)}${indent}}
|
||||||
'';
|
'';
|
||||||
mkFields = lib.generators.toKeyValue { listsAsDuplicateKeys = true; };
|
sections = filterAttrs (n: v: isAttrs v) attrs;
|
||||||
sections = lib.filterAttrs (n: v: lib.isAttrs v) attrs;
|
|
||||||
fields = lib.filterAttrs (n: v: !(lib.isAttrs v)) attrs;
|
mkFields = generators.toKeyValue { listsAsDuplicateKeys = true; };
|
||||||
in lib.concatStringsSep "\n" (lib.mapAttrsToList mkSection sections)
|
allFields = filterAttrs (n: v: !(isAttrs v)) attrs;
|
||||||
+ mkFields fields;
|
importantFields =
|
||||||
|
filterAttrs (n: _: (hasPrefix "$" n) || (hasPrefix "bezier" n))
|
||||||
|
allFields;
|
||||||
|
fields = builtins.removeAttrs allFields
|
||||||
|
(mapAttrsToList (n: _: n) importantFields);
|
||||||
|
in mkFields importantFields
|
||||||
|
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
||||||
|
+ removeSuffix indent (indent + (concatStringsSep ''
|
||||||
|
|
||||||
|
${indent}'' (splitString "\n" (mkFields fields))));
|
||||||
in lib.mkIf shouldGenerate {
|
in lib.mkIf shouldGenerate {
|
||||||
text = lib.optionalString cfg.systemdIntegration ''
|
text = lib.optionalString cfg.systemdIntegration ''
|
||||||
exec-once = ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
|
exec-once = ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
|
||||||
'' + lib.optionalString (combinedSettings != { })
|
'' + lib.optionalString (combinedSettings != { })
|
||||||
(toHyprconf combinedSettings)
|
(toHyprconf combinedSettings 0)
|
||||||
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
|
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
|
||||||
onChange = lib.mkIf (cfg.package != null) ''
|
onChange = lib.mkIf (cfg.package != null) ''
|
||||||
( # execute in subshell so that `shopt` won't affect other scripts
|
( # execute in subshell so that `shopt` won't affect other scripts
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
exec-once = /nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
|
exec-once = /nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
|
||||||
|
$mod=SUPER
|
||||||
|
bezier=smoothOut, 0.36, 0, 0.66, -0.56
|
||||||
|
bezier=smoothIn, 0.25, 1, 0.5, 1
|
||||||
|
bezier=overshot, 0.4,0.8,0.2,1.2
|
||||||
|
animations {
|
||||||
|
animation=border, 1, 2, smoothIn
|
||||||
|
animation=fade, 1, 4, smoothOut
|
||||||
|
animation=windows, 1, 3, overshot, popin 80%
|
||||||
|
enabled=true
|
||||||
|
}
|
||||||
|
|
||||||
decoration {
|
decoration {
|
||||||
col.shadow=rgba(00000099)
|
col.shadow=rgba(00000099)
|
||||||
shadow_offset=0 5
|
shadow_offset=0 5
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
touchpad {
|
touchpad {
|
||||||
scroll_factor=0.300000
|
scroll_factor=0.300000
|
||||||
|
}
|
||||||
|
accel_profile=flat
|
||||||
|
follow_mouse=1
|
||||||
|
kb_layout=ro
|
||||||
}
|
}
|
||||||
accel_profile=flat
|
|
||||||
follow_mouse=1
|
|
||||||
kb_layout=ro
|
|
||||||
}
|
|
||||||
$mod=SUPER
|
|
||||||
bindm=$mod, mouse:272, movewindow
|
bindm=$mod, mouse:272, movewindow
|
||||||
bindm=$mod, mouse:273, resizewindow
|
bindm=$mod, mouse:273, resizewindow
|
||||||
bindm=$mod ALT, mouse:272, resizewindow
|
bindm=$mod ALT, mouse:272, resizewindow
|
||||||
|
|
|
@ -15,6 +15,21 @@
|
||||||
|
|
||||||
"$mod" = "SUPER";
|
"$mod" = "SUPER";
|
||||||
|
|
||||||
|
animations = {
|
||||||
|
enabled = true;
|
||||||
|
animation = [
|
||||||
|
"border, 1, 2, smoothIn"
|
||||||
|
"fade, 1, 4, smoothOut"
|
||||||
|
"windows, 1, 3, overshot, popin 80%"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
bezier = [
|
||||||
|
"smoothOut, 0.36, 0, 0.66, -0.56"
|
||||||
|
"smoothIn, 0.25, 1, 0.5, 1"
|
||||||
|
"overshot, 0.4,0.8,0.2,1.2"
|
||||||
|
];
|
||||||
|
|
||||||
input = {
|
input = {
|
||||||
kb_layout = "ro";
|
kb_layout = "ro";
|
||||||
follow_mouse = 1;
|
follow_mouse = 1;
|
||||||
|
|
Loading…
Reference in a new issue