-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
hyprland: prioritize variables and beziers #4263
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,22 +175,34 @@ in { | |
| shouldGenerate = cfg.systemdIntegration || cfg.extraConfig != "" | ||
| || combinedSettings != { }; | ||
|
|
||
| toHyprconf = attrs: | ||
| toHyprconf = with lib; | ||
| attrs: indentLevel: | ||
| let | ||
| indent = concatStrings (replicate indentLevel " "); | ||
|
|
||
| mkSection = n: attrs: '' | ||
| ${n} { | ||
| ${toHyprconf attrs}} | ||
| ${indent}${n} { | ||
| ${toHyprconf attrs (indentLevel + 1)}${indent}} | ||
| ''; | ||
| mkFields = lib.generators.toKeyValue { listsAsDuplicateKeys = true; }; | ||
| sections = lib.filterAttrs (n: v: lib.isAttrs v) attrs; | ||
| fields = lib.filterAttrs (n: v: !(lib.isAttrs v)) attrs; | ||
| in lib.concatStringsSep "\n" (lib.mapAttrsToList mkSection sections) | ||
| + mkFields fields; | ||
| sections = filterAttrs (n: v: isAttrs v) attrs; | ||
|
|
||
| mkFields = generators.toKeyValue { listsAsDuplicateKeys = true; }; | ||
| allFields = filterAttrs (n: v: !(isAttrs v)) attrs; | ||
| importantFields = | ||
| filterAttrs (n: _: (hasPrefix "$" n) || (hasPrefix "bezier" n)) | ||
| allFields; | ||
|
Comment on lines
+191
to
+193
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could hyprland possibly be made order-agnostic in the future?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will ask.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it could be made order-agnostic, but not with the current config parser, which processes the file line-by-line. |
||
| 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)))); | ||
|
ncfavier marked this conversation as resolved.
|
||
| in lib.mkIf shouldGenerate { | ||
| 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 | ||
| '' + lib.optionalString (combinedSettings != { }) | ||
| (toHyprconf combinedSettings) | ||
| (toHyprconf combinedSettings 0) | ||
| + lib.optionalString (cfg.extraConfig != "") cfg.extraConfig; | ||
| onChange = lib.mkIf (cfg.package != null) '' | ||
| ( # execute in subshell so that `shopt` won't affect other scripts | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit late, but shouldn't
sourcealso be included here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in some cases it might break users' configs.