Remove 'with' from most modules

This commit is contained in:
Filippo Berto 2023-08-15 18:33:34 +02:00
parent 40032f7fd9
commit 7459ae0e96
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
27 changed files with 222 additions and 230 deletions

View file

@ -1,7 +1,8 @@
{ nixosConfig, config, pkgs, lib, ... }:
with lib;
let
inherit (pkgs.rice) colorPalette opacity;
inherit (pkgs.lib) nix-rice;
alpha = 255 * opacity;
grep = "${pkgs.gnugrep}/bin/grep";
cut = "${pkgs.coreutils}/bin/cut";
pavucontrol = "${pkgs.pavucontrol}/bin/pavucontrol";
@ -48,34 +49,31 @@ let
PATH=$PATH:"${lib.makeBinPath [ pkgs.rofi pkgs.rofi-power-menu pkgs.zsh ]}"
zsh -c 'rofi -show menu -modi "menu:rofi-power-menu --choices=shutdown/reboot/hibernate/logout"'
'';
colors = with pkgs.lib.nix-rice;
let alpha = 255 * opacity;
in palette.toARGBHex rec {
normal = {
foreground = color.darken 10 colorPalette.foreground;
background = color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.normal.blue;
};
active = {
inherit (colorPalette) foreground;
background = color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.normal.yellow;
};
selected = {
inherit (colorPalette) foreground;
background = color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.bright.red;
};
inherit (colorPalette.normal) green red yellow;
inherit (color) transparent;
orange = colorPalette.bright.red;
alert = orange;
colors = nix-rice.palette.toARGBHex rec {
normal = {
foreground = nix-rice.color.darken 10 colorPalette.foreground;
background = nix-rice.color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.normal.blue;
};
active = {
inherit (colorPalette) foreground;
background = nix-rice.color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.normal.yellow;
};
selected = {
inherit (colorPalette) foreground;
background = nix-rice.color.setAlphaRgba alpha colorPalette.background;
underline = colorPalette.bright.red;
};
inherit (colorPalette.normal) green red yellow;
inherit (nix-rice.color) transparent;
orange = colorPalette.bright.red;
alert = orange;
};
commonBar = {
locale = config.home.language.base;
monitor = "\${env:MONITOR}";
@ -141,7 +139,7 @@ in
settings = {
"settings" = { screenchange-reload = false; };
"bar/primary" = recursiveUpdate commonBar {
"bar/primary" = lib.recursiveUpdate commonBar {
modules-left = "bspwm";
# modules-center =
modules-right =
@ -152,7 +150,7 @@ in
};
};
"bar/secondary" = recursiveUpdate commonBar {
"bar/secondary" = lib.recursiveUpdate commonBar {
modules-left = "bspwm";
# modules-center =
modules-right =
@ -172,13 +170,13 @@ in
};
format = {
charging = recursiveUpdate colors.selected {
charging = lib.recursiveUpdate colors.selected {
text = "<animation-charging> <label-charging>";
};
discharging = recursiveUpdate colors.active {
discharging = lib.recursiveUpdate colors.active {
text = "<animation-discharging> <label-discharging>";
};
full = recursiveUpdate colors.normal { text = " <label-full>"; };
full = lib.recursiveUpdate colors.normal { text = " <label-full>"; };
};
label.text = "%percentage%%";
@ -202,16 +200,16 @@ in
};
in
{
focused = recursiveUpdate common colors.selected;
occupied = recursiveUpdate common colors.active;
urgent = recursiveUpdate (recursiveUpdate common colors.active) { background = colors.alert; };
empty = recursiveUpdate common colors.normal;
focused = lib.recursiveUpdate common colors.selected;
occupied = lib.recursiveUpdate common colors.active;
urgent = lib.recursiveUpdate (lib.recursiveUpdate common colors.active) { background = colors.alert; };
empty = lib.recursiveUpdate common colors.normal;
};
};
"module/cpu" = {
type = "internal/cpu";
format = recursiveUpdate colors.normal { text = " <label>"; };
format = lib.recursiveUpdate colors.normal { text = " <label>"; };
interval = 2;
label = "%percentage-sum%%";
ramp-load = ramp;
@ -228,7 +226,7 @@ in
"module/memory" = {
type = "internal/memory";
format = recursiveUpdate colors.normal { text = " <label>"; };
format = lib.recursiveUpdate colors.normal { text = " <label>"; };
interval = 2;
label = "%percentage_used%%";
ramp-used = ramp;
@ -257,7 +255,7 @@ in
format = {
padding = 1;
muted = colors.active;
volume = recursiveUpdate colors.normal {
volume = lib.recursiveUpdate colors.normal {
text = "<ramp-volume> <label-volume>";
};
};
@ -268,7 +266,7 @@ in
};
"module/temperature" = {
format = recursiveUpdate colors.normal {
format = lib.recursiveUpdate colors.normal {
text = "<ramp> <label>";
warn = {
text = "<ramp> <label-warn>";
@ -286,13 +284,13 @@ in
};
"module/powermenu" = {
type = "custom/script";
format = recursiveUpdate colors.normal { padding = 0; };
format = lib.recursiveUpdate colors.normal { padding = 0; };
exec = "echo ";
click.left = "${powermenu}";
};
"module/notifications" = {
type = "custom/script";
format = recursiveUpdate colors.normal { padding = 0; };
format = lib.recursiveUpdate colors.normal { padding = 0; };
exec = "${notificationStatus}";
click.left = "${notificationToggle}";
click.right = "${notificationHistory}";
@ -301,7 +299,7 @@ in
};
"module/keyboard-switch" = {
type = "custom/script";
format = recursiveUpdate colors.normal { padding = 0; };
format = lib.recursiveUpdate colors.normal { padding = 0; };
exec = "${keyboardStatus}";
click.left = "${keyboardToggle}";
interval = 1;