-
-
Notifications
You must be signed in to change notification settings - Fork 300
swayimg: init #2064
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
base: master
Are you sure you want to change the base?
swayimg: init #2064
Conversation
|
Any idea why ci fails? |
0xda157
left a comment
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.
Any idea why ci fails?
the pre-commit hooks are failing. you can avoid this happening in the future by running nix develop which will install the pre-commit hooks on your local git repo.
adding a testbed for this module is highly recommended, so pr reviews can test it themselves and the ci will reflect any configurations issues in the nixpkgs' module system.
| humanName = "swayimg"; | ||
|
|
||
| configElements = | ||
| { colors, opacity }: |
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.
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.
thanks for the pointers I'm not sure about how i should implement this, im fairly new to nix/stylix. should i add a extra option like;
extraOptions = {
background = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Used to set bg even if `opacity` or `colors` is null.";
internal = true;
default = null;
};
};and then adjust the bg's like?;
gallery = {
background = lib.mkIf (opacity.applications != 1.0) "#00000000";
}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 pattern is basically that internal options are used to share context across configElements function boundaries.
I suppose the base00 + swayimgOpacity expression should behave as follows:
colors |
opacity |
Expression |
|---|---|---|
| disabled | disabled | undeclared |
| disabled | enabled | undeclared |
| enabled | disabled | base00 |
| enabled | enabled | base00 + swayimgOpacity |
In that case, you would have something like:
extraOptions.opacity = lib.mkOption {
type = lib.types.str;
description = /* ... */;
internal = true;
default = "";
};
configElements = [
(
{ cfg, colors }: {
programs.swayimg.settings.viewer.window = base00 + cfg.opacity;
}
)
({ cfg, opacity }: { cfg.opacity = /* swayimgOpacity */; })
];Co-authored-by: 0xda157 <[email protected]>
Co-authored-by: 0xda157 <[email protected]>
Co-authored-by: 0xda157 <[email protected]>
Co-authored-by: 0xda157 <[email protected]>
| githubId = 87434959; | ||
| }; | ||
| sand4rt = { | ||
| email = "[email protected]"; |
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.
If you do not wish to publish your email, it might be simpler to not include this optional field:
| email = "[email protected]"; |
This line would also have to be removed in /generated/all-maintainers.nix.
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 suppose the following declarations are black for the same reason we have commit ccb411c ("mpv: set background to black (#1008)"):
Line 25 in dc3c7b9
transparency = "#000000ff"; Line 29 in dc3c7b9
background = "#00000000"; Line 32 in dc3c7b9
shadow = "#00000000"; Lines 41 to 42 in dc3c7b9
shadow = "#000000d0"; background = "#00000000";
Why is the transparency once 00 and once ff?
Unsure how I feel about hard-coding #000000d0. Would it not be better to set this one to base00?
| in | ||
| { | ||
| environment = { | ||
| loginShellInit = "${lib.getExe package} flake-parts/flake.nix"; |
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.
Opening a Nix file with an image viewer is probably wrong. What about opening an actual image:
text = "swayimg ${
(pkgs.callPackages ../../../stylix/testbed/images.nix {}).${
config.stylix.polarity
}
}";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 testbed should enable the underlying Home Manager module of our /modules/swayimg/hm.nix module. Take a look at how other testbeds achieve this.
| with colors.withHashtag; | ||
| let | ||
| swayimgOpacity = lib.toHexString ( | ||
| ((builtins.floor (opacity.applications * 100 + 0.5)) * 255) / 100 |
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.
These parentheses should be optional:
| ((builtins.floor (opacity.applications * 100 + 0.5)) * 255) / 100 | |
| builtins.floor (opacity.applications * 100 + 0.5) * 255 / 100 |
| font = | ||
| with config.stylix.fonts.monospace; | ||
| with config.stylix.fonts.sizes; | ||
| { | ||
| inherit name; | ||
| size = applications; |
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 should go into a new configElements function that takes fonts as argument.
| humanName = "swayimg"; | ||
|
|
||
| configElements = | ||
| { colors, opacity }: |
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 pattern is basically that internal options are used to share context across configElements function boundaries.
I suppose the base00 + swayimgOpacity expression should behave as follows:
colors |
opacity |
Expression |
|---|---|---|
| disabled | disabled | undeclared |
| disabled | enabled | undeclared |
| enabled | disabled | base00 |
| enabled | enabled | base00 + swayimgOpacity |
In that case, you would have something like:
extraOptions.opacity = lib.mkOption {
type = lib.types.str;
description = /* ... */;
internal = true;
default = "";
};
configElements = [
(
{ cfg, colors }: {
programs.swayimg.settings.viewer.window = base00 + cfg.opacity;
}
)
({ cfg, opacity }: { cfg.opacity = /* swayimgOpacity */; })
];
Uh oh!
There was an error while loading. Please reload this page.