-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
kde: enable custom decorations #772
base: master
Are you sure you want to change the base?
Conversation
I am bit unsure why |
We are using the new If the behavior of |
That is the one I used, |
For reference, the following patch should make the CI pass: diff --git a/modules/kde/hm.nix b/modules/kde/hm.nix
index 92878a3..44f643c 100644
--- a/modules/kde/hm.nix
+++ b/modules/kde/hm.nix
@@ -33,7 +33,9 @@ let
types
;
- formatValue = value: if isBool value then if value then "true" else "false" else toString value;
+ formatValue =
+ value:
+ if isBool value then if value then "true" else "false" else toString value;
formatSection =
path: data:
@@ -45,7 +47,9 @@ let
directChildren = partitioned.right;
indirectChildren = partitioned.wrong;
in
- optional (directChildren != [ ]) header ++ directChildren ++ flatten indirectChildren;
+ optional (directChildren != [ ]) header
+ ++ directChildren
+ ++ flatten indirectChildren;
formatLines =
path: data:
@@ -72,7 +76,9 @@ let
# PascalCase is the standard naming for color scheme files. Schemes named
# in kebab-case will load when selected manually, but don't work with a
# look and feel package.
- colorschemeSlug = concatStrings (filter isString (builtins.split "[^a-zA-Z]" colors.scheme));
+ colorschemeSlug = concatStrings (
+ filter isString (builtins.split "[^a-zA-Z]" colors.scheme)
+ );
colorEffect = {
ColorEffect = 0;
@@ -326,29 +332,31 @@ in
};
};
- config = mkIf (config.stylix.enable && cfg.enable && pkgs.stdenv.hostPlatform.isLinux) {
- home = {
- packages = [ themePackage ];
-
- # This activation entry will run the theme activator when the homeConfiguration is activated
- activation.stylixLookAndFeel = hm.dag.entryAfter [ "writeBoundary" ] ''
- ${activator} || verboseEcho \
- "Stylix KDE theme setting failed. Note that it only works in an already running Plasma session."
- '';
- };
-
- xdg = {
- systemDirs.config = [ "${configPackage}" ];
-
- # This desktop entry will run the theme activator when a new Plasma session is started
- # Note: This doesn't run again if a new homeConfiguration is activated from a running Plasma session
- configFile."autostart/stylix-activator.desktop".text = ''
- [Desktop Entry]
- Type=Application
- Exec=${activator}
- Name=Stylix Activator
- X-KDE-AutostartScript=true
- '';
- };
- };
+ config =
+ mkIf (config.stylix.enable && cfg.enable && pkgs.stdenv.hostPlatform.isLinux)
+ {
+ home = {
+ packages = [ themePackage ];
+
+ # This activation entry will run the theme activator when the homeConfiguration is activated
+ activation.stylixLookAndFeel = hm.dag.entryAfter [ "writeBoundary" ] ''
+ ${activator} || verboseEcho \
+ "Stylix KDE theme setting failed. Note that it only works in an already running Plasma session."
+ '';
+ };
+
+ xdg = {
+ systemDirs.config = [ "${configPackage}" ];
+
+ # This desktop entry will run the theme activator when a new Plasma session is started
+ # Note: This doesn't run again if a new homeConfiguration is activated from a running Plasma session
+ configFile."autostart/stylix-activator.desktop".text = ''
+ [Desktop Entry]
+ Type=Application
+ Exec=${activator}
+ Name=Stylix Activator
+ X-KDE-AutostartScript=true
+ '';
+ };
+ };
} I will resolve this issue when I have more time. |
Thank you.
Do you mean the formatting CI, this PR or both? I am unsure whether I should reformat the code, leave it as is for later or help with anything else. |
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.
The problem is that your code is not formated with --width=80
:
Lines 122 to 125 in 2985ee9
nixfmt-rfc-style = { | |
enable = true; | |
settings.width = 80; | |
}; |
For reference, the current CI command is:
/nix/store/lch913ar0a3w3f6d63crf5vfvpckddk1-nixfmt-unstable-2024-12-04/bin/nixfmt --width=80
If you do not mind the pre-commit hooks (there is currently no developer shell variant without them, although this could be trivially added), feel free to use the developer shells:
stylix/docs/src/development_environment.md
Lines 1 to 14 in 2985ee9
# Development environment | |
To enter the developer shell, run: | |
```console | |
nix develop | |
``` | |
To automatically enter the developer shell upon entering the project directory | |
with [`direnv`](https://direnv.net), run: | |
```console | |
direnv allow | |
``` |
I can reformat the code, but I would say that it is not necessary, if the style updates in the near future. [...] I am unsure whether I should reformat the code, leave it as is for later or help with anything else.
Properly format the code, since the CI already uses the latest nixfmt-unstable-2024-12-04
.
Thank you very much for your help and sorry for the trouble. |
@@ -161,6 +204,7 @@ let | |||
lookAndFeelMetadata = builtins.toJSON lookAndFeelMetadata; | |||
lookAndFeelDefaults = formatConfig lookAndFeelDefaults; | |||
} | |||
# bash |
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.
# bash |
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.
The treesitter grammar (in neovim, for instance) uses this kind of comment to detect which language is in the string, enabling syntax highlighting and other editor integration, same as fenced code blocks in markdown. Should I remove it nonetheless?
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.
The treesitter grammar (in neovim, for instance) uses this kind of comment to detect which language is in the string, enabling syntax highlighting and other editor integration, same as fenced code blocks in markdown. Should I remove it nonetheless?
Yes.
"KDE theme setting failed. See `${activateDocs}`" | ||
activation.stylixLookAndFeel = hm.dag.entryAfter [ "writeBoundary" ] '' | ||
${activator} || verboseEcho \ | ||
"Stylix KDE theme setting failed. Note that it only works in an already running Plasma session." |
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.
This might be more concise:
"Stylix KDE theme setting failed. Note that it only works in an already running Plasma session." | |
"Stylix KDE theme setting failed. This only works in a running Plasma session." |
in | ||
{ | ||
options.stylix.targets.kde.enable = config.lib.stylix.mkEnableTarget "KDE" true; | ||
options.stylix.targets.kde = { | ||
enable = mkEnableTarget "KDE" true; |
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.
enable = mkEnableTarget "KDE" true; | |
enable = mkEnableTarget "KDE" true; | |
inherit (config.lib.stylix) | ||
colors | ||
mkEnableTarget | ||
; | ||
inherit (lib) | ||
concatStrings | ||
concatStringsSep | ||
filter | ||
flatten | ||
getExe | ||
isAttrs | ||
isBool | ||
isString | ||
hm | ||
last | ||
listToAttrs | ||
mapAttrsToList | ||
mkIf | ||
mkOption | ||
optional | ||
partition | ||
range | ||
toHexString | ||
types | ||
; |
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.
Subject: [PATCH 2/5] kde(refactor): remove top-level
with
and improve imports
Thanks for reducing the scope of the with
expressions.
I am aware that Nixpkgs has the convention of brining everything into scope with inhert
statements at the top of the file. However, Stylix currently does not really follow this to any extent. It might be better to apply this pattern treewide in a separate PR. @danth, what do you think?
Hi.
Fixing Plasma activation in #708 worked bit too well. Every time the theme is applied, it resets all custom theming options. I noticed this with decorations, so I added a new option to override
org.kde.breeze
with custom string.I also took the liberty of refactoring the module a bit. To improve module maintenance, I mainly reduced the scope of
with
expressions and improve color handling.