diff --git a/modules/hyprland.nix b/modules/hyprland.nix
index bca86e3..aca4c60 100644
--- a/modules/hyprland.nix
+++ b/modules/hyprland.nix
@@ -40,7 +40,7 @@ in
waybar = {
modules = {
left = [ "hyprland/workspaces" "tray" "hyprland/window" ];
- center = [ "clock" ];
+ center = [ "clock" "custom/spotify" ];
right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ];
};
enable = lib.mkDefault true;
diff --git a/modules/waybar/allmodules.nix b/modules/waybar/allmodules.nix
deleted file mode 100644
index e16be41..0000000
--- a/modules/waybar/allmodules.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-config:
-[ "hyprland/workspaces" "tray" "hyprland/window" ] ++
-[ "clock" ] ++
-[ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ]
diff --git a/modules/waybar/clock.nix b/modules/waybar/clock.nix
index f6d6607..2803d95 100644
--- a/modules/waybar/clock.nix
+++ b/modules/waybar/clock.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar.${name} = {
tooltip-format = "{:%Y %B}\n\n{calendar}";
interval = 1;
diff --git a/modules/waybar/cpu.nix b/modules/waybar/cpu.nix
index 18c3b37..b8a239d 100644
--- a/modules/waybar/cpu.nix
+++ b/modules/waybar/cpu.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format = "cpu: {usage}%";
tooltip = false;
diff --git a/modules/waybar/createmodules.nix b/modules/waybar/createmodules.nix
deleted file mode 100644
index ed2e6d5..0000000
--- a/modules/waybar/createmodules.nix
+++ /dev/null
@@ -1 +0,0 @@
-config: builtins.listToAttrs (import ./namedmodules.nix config)
diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix
index d2950e0..f037ca7 100644
--- a/modules/waybar/default.nix
+++ b/modules/waybar/default.nix
@@ -37,243 +37,258 @@ in
./workspaces.nix
./temperature.nix
./wireplumber.nix
+ ./spotify.nix
../../common/colors.nix
];
- config = lib.mkIf cfg.enable {
- modules.waybar = import ./createmodules.nix cfg.modules;
- home.packages = with pkgs; [
- font-awesome
- ];
- programs.waybar = {
- enable = true;
- package = cfg.package;
- settings = {
- mainBar = {
- layer = "top";
- position = "top";
- height = 39;
- margin-top = 8;
- margin-left = 10;
- margin-right = 10;
- output = [
- "DP-3"
- "DP-2"
- ];
- modules-left = cfg.modules.left;
- modules-center = cfg.modules.center;
- modules-right = cfg.modules.right;
+ config = lib.mkIf cfg.enable
+ rec {
+ modules.waybar.enabled = (
+ let
+ mods = config.modules.waybar.modules;
+ allmodules = mods.left ++ mods.center ++ mods.right;
+ namedmodules = builtins.map
+ (n: { name = n; value = { enable = true; }; })
+ allmodules;
+ createmodules = builtins.listToAttrs namedmodules;
+ in
+ createmodules
+ );
+
+ home.packages = with pkgs;
+ [
+ font-awesome
+ ];
+ programs.waybar = {
+ enable = true;
+ package = cfg.package;
+ settings = {
+ mainBar = {
+ layer = "top";
+ position = "top";
+ height = 39;
+ margin-top = 8;
+ margin-left = 10;
+ margin-right = 10;
+ output = [
+ "DP-3"
+ "DP-2"
+ ];
+ modules-left = cfg.modules.left;
+ modules-center = cfg.modules.center;
+ modules-right = cfg.modules.right;
+ };
};
- };
- style = ''
- * {
- /* `otf-font-awesome` is required to be installed for icons */
- font-family: "Maple Mono NF";
- font-size: 14px;
- }
+ style = ''
+ * {
+ /* `otf-font-awesome` is required to be installed for icons */
+ font-family: "Maple Mono NF";
+ font-size: 14px;
+ }
- window#waybar {
- background-color: transparent;
- border-radius: 999px;
- color: #${config.colorScheme.palette.base05};
- transition-property: background-color;
- transition-duration: .5s;
- }
- window#waybar.hidden {
- opacity: 0.2;
- }
+ window#waybar {
+ background-color: transparent;
+ border-radius: 999px;
+ color: #${config.colorScheme.palette.base05};
+ transition-property: background-color;
+ transition-duration: .5s;
+ }
+ window#waybar.hidden {
+ opacity: 0.2;
+ }
- window#waybar.termite {
- background-color: transparent;
- }
+ window#waybar.termite {
+ background-color: transparent;
+ }
- window#waybar.chromium {
- background-color: transparent;
- }
+ window#waybar.chromium {
+ background-color: transparent;
+ }
- button {
- /* Use box-shadow instead of border so the text isn't offset */
- box-shadow: inset 0 -1px transparent;
- /* Avoid rounded borders under each button name */
- border: none;
- border-radius: 0;
- }
+ button {
+ /* Use box-shadow instead of border so the text isn't offset */
+ box-shadow: inset 0 -1px transparent;
+ /* Avoid rounded borders under each button name */
+ border: none;
+ border-radius: 0;
+ }
- /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
- button:hover {
- background: inherit;
- border-radius: 999px;
- }
+ /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
+ button:hover {
+ background: inherit;
+ border-radius: 999px;
+ }
- #workspaces button {
- transition: all 0.2s;
- padding: 3px 3px 3px 5px;
- margin: 3px;
- min-width: 15px;
- min-height: 15px;
- background-color: transparent;
- color: #${config.colorScheme.palette.base04};
- border-radius: 999px;
- }
+ #workspaces button {
+ transition: all 0.2s;
+ padding: 3px 3px 3px 5px;
+ margin: 3px;
+ min-width: 15px;
+ min-height: 15px;
+ background-color: transparent;
+ color: #${config.colorScheme.palette.base04};
+ border-radius: 999px;
+ }
- #workspaces button:hover {
- background-color: #${config.colorScheme.palette.base17};
- }
+ #workspaces button:hover {
+ background-color: #${config.colorScheme.palette.base17};
+ }
- #workspaces button.active {
- font-weight: bold;
- background-color: #${config.colorScheme.palette.base0E};
- }
+ #workspaces button.active {
+ font-weight: bold;
+ background-color: #${config.colorScheme.palette.base0E};
+ }
- #workspaces button.urgent {
- background-color: #${config.colorScheme.palette.base08};
- }
+ #workspaces button.urgent {
+ background-color: #${config.colorScheme.palette.base08};
+ }
- #clock,
- #battery,
- #cpu,
- #memory,
- #disk,
- #temperature,
- #backlight,
- #network,
- #pulseaudio,
- #wireplumber,
- #custom-media,
- #mode,
- #idle_inhibitor,
- #custom-vpn,
- #scratchpad,
- #tray,
- #custom-updates,
- #custom-poweroff,
- #mpd {
- color: #${config.colorScheme.palette.base04};
- margin: 0px 2px;
- padding: 0 15px;
+ #clock,
+ #battery,
+ #cpu,
+ #memory,
+ #disk,
+ #temperature,
+ #backlight,
+ #network,
+ #pulseaudio,
+ #wireplumber,
+ #custom-media,
+ #mode,
+ #idle_inhibitor,
+ #custom-vpn,
+ #scratchpad,
+ #tray,
+ #custom-updates,
+ #custom-poweroff,
+ #mpd {
+ color: #${config.colorScheme.palette.base04};
+ margin: 0px 2px;
+ padding: 0 15px;
- border-radius: 999px;
- box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
- }
+ border-radius: 999px;
+ box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
+ }
- .modules-right > widget:last-child > #battery {
- margin-right: 0px;
- }
+ .modules-right > widget:last-child > #battery {
+ margin-right: 0px;
+ }
- #tray {
- padding: 4px 10px;
- border-radius: 999px 999px 999px 999px;
- box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
- }
+ #tray {
+ padding: 4px 10px;
+ border-radius: 999px 999px 999px 999px;
+ box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
+ }
- #window {
- margin-left: 6px;
- color: #${config.colorScheme.palette.base04};
- }
+ #window {
+ margin-left: 6px;
+ color: #${config.colorScheme.palette.base04};
+ }
- #workspaces {
- margin: 0 4px;
- padding: 4px 4px;
- border-radius: 999px;
- box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
- }
+ #workspaces {
+ margin: 0 4px;
+ padding: 4px 4px;
+ border-radius: 999px;
+ box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.base01};
+ }
- #cpu {
- border-radius: 999px 0px 0px 999px;
- margin-right: 0px;
- }
+ #cpu {
+ border-radius: 999px 0px 0px 999px;
+ margin-right: 0px;
+ }
- #memory {
- border-radius: 0px;
- padding: 0 10px;
- margin: 0px;
- box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.base01},
- inset 0px -2px 0 -1px #${config.colorScheme.palette.base01};
- }
+ #memory {
+ border-radius: 0px;
+ padding: 0 10px;
+ margin: 0px;
+ box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.base01},
+ inset 0px -2px 0 -1px #${config.colorScheme.palette.base01};
+ }
- #clock {
- box-shadow: none;
- }
+ #clock {
+ box-shadow: none;
+ }
- #battery {
- min-width: 50px;
- border-radius: 999px;
- box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
- background-color: #${config.colorScheme.palette.base01};
- transition: all 0.3s;
- }
+ #battery {
+ min-width: 50px;
+ border-radius: 999px;
+ box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.base01};
+ background-color: #${config.colorScheme.palette.base01};
+ transition: all 0.3s;
+ }
- #battery.charging, #battery.plugged {
- color: #${config.colorScheme.palette.base0B};
- background-color: transparent;
- animation: batteryCharging 1.2s linear 0s infinite normal forwards,
- }
- #battery.full {
- animation: batteryFull 7.0s linear 0s infinite normal forwards;
- }
- #battery.critical:not(.charging) {
- background-color: #${config.colorScheme.palette.base00};
- animation: batteryCritical 1.2s linear 0s infinite normal forwards;
- }
+ #battery.charging, #battery.plugged {
+ color: #${config.colorScheme.palette.base0B};
+ background-color: transparent;
+ animation: batteryCharging 1.2s linear 0s infinite normal forwards,
+ }
+ #battery.full {
+ animation: batteryFull 7.0s linear 0s infinite normal forwards;
+ }
+ #battery.critical:not(.charging) {
+ background-color: #${config.colorScheme.palette.base00};
+ animation: batteryCritical 1.2s linear 0s infinite normal forwards;
+ }
- #network {
+ #network {
- }
+ }
- #network.disconnected,
- #pulseaudio.muted {
- transition: all 0.2s;
- color: #${config.colorScheme.palette.base01};
- }
+ #network.disconnected,
+ #pulseaudio.muted {
+ transition: all 0.2s;
+ color: #${config.colorScheme.palette.base01};
+ }
- .custom-spotify {
- color: #${config.colorScheme.palette.base14};
- margin-right: 10px;
- }
+ .custom-spotify {
+ color: #${config.colorScheme.palette.base14};
+ margin-right: 10px;
+ }
- #temperature {
- margin-left: 0px;
- border-radius: 0px 999px 999px 0px;
- }
+ #temperature {
+ margin-left: 0px;
+ border-radius: 0px 999px 999px 0px;
+ }
- #temperature.critical {
- background-color: transparent;
- color: #${config.colorScheme.palette.base08};
- }
+ #temperature.critical {
+ background-color: transparent;
+ color: #${config.colorScheme.palette.base08};
+ }
- #tray {
- background-color: transparent;
- }
+ #tray {
+ background-color: transparent;
+ }
- #tray > .passive {
- -gtk-icon-effect: dim;
- }
+ #tray > .passive {
+ -gtk-icon-effect: dim;
+ }
- #tray > .needs-attention {
- background-color: #${config.colorScheme.palette.base08};
- border-radius: 999px;
- }
+ #tray > .needs-attention {
+ background-color: #${config.colorScheme.palette.base08};
+ border-radius: 999px;
+ }
- #scratchpad {
- background: rgba(0, 0, 0, 0.1);
- }
- #scratchpad.empty {
- background-color: transparent;
- }
+ #scratchpad {
+ background: rgba(0, 0, 0, 0.1);
+ }
+ #scratchpad.empty {
+ background-color: transparent;
+ }
- tooltip {
- background-color: #${config.colorScheme.palette.base00};
- border: 1px solid;
- border-color: #${config.colorScheme.palette.base04};
- border-radius: 10px;
- color: #${config.colorScheme.palette.base05};
- }
- tooltip label {
- padding: 5px;
- }
- '';
- };
- };
+ tooltip {
+ background-color: #${config.colorScheme.palette.base00};
+ border: 1px solid;
+ border-color: #${config.colorScheme.palette.base04};
+ border-radius: 10px;
+ color: #${config.colorScheme.palette.base05};
+ }
+ tooltip label {
+ padding: 5px;
+ }
+ '';
+ };
+ }
+ ;
}
diff --git a/modules/waybar/memory.nix b/modules/waybar/memory.nix
index ca98ede..a505a0d 100644
--- a/modules/waybar/memory.nix
+++ b/modules/waybar/memory.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format = "mem: {}%";
tooltip = false;
diff --git a/modules/waybar/namedmodules.nix b/modules/waybar/namedmodules.nix
deleted file mode 100644
index c43ab15..0000000
--- a/modules/waybar/namedmodules.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-config:
-builtins.map
- (n: { name = n; value = { enable = true; }; })
- (import ./allmodules.nix config)
diff --git a/modules/waybar/network.nix b/modules/waybar/network.nix
index e042e2e..3b53e4d 100644
--- a/modules/waybar/network.nix
+++ b/modules/waybar/network.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
diff --git a/modules/waybar/power.nix b/modules/waybar/power.nix
index 2093ca0..5a3e62a 100644
--- a/modules/waybar/power.nix
+++ b/modules/waybar/power.nix
@@ -3,14 +3,16 @@ let
name = "custom/poweroff";
in
{
- options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
- enable = lib.mkEnableOption "enable ${name} waybar module";
+ options.modules.waybar = {
+ modules = import ./addname.nix lib name;
+ enabled.${name} = {
+ enable = lib.mkEnableOption "enable ${name} waybar module";
+ };
};
imports = [
../wofi.nix
];
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
modules.wofi.enable = true;
programs.waybar.settings.mainBar."${name}" = {
format = "";
diff --git a/modules/waybar/spotify.nix b/modules/waybar/spotify.nix
new file mode 100644
index 0000000..672042f
--- /dev/null
+++ b/modules/waybar/spotify.nix
@@ -0,0 +1,31 @@
+{ lib, config, pkgs, ... }:
+let
+ name = "custom/spotify";
+in
+{
+ options.modules.waybar = {
+ modules = import ./addname.nix lib name;
+ enabled.${name} = {
+ enable = lib.mkEnableOption "enable ${name} waybar module";
+ };
+ };
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
+ programs.waybar.settings.mainBar.${name} = {
+ tooltip-format = "{:%Y %B}\n\n{calendar}";
+ interval = 1;
+ format = "{:%H:%M:%S}";
+ format-alt = "{:%Y-%m-%d %H:%M:%S}";
+ on-click-middle = "gnome-clocks";
+ calendar = {
+ weeks-pos = "left";
+ format = {
+ today = "{}"; # TODO: use nix-colors
+ weeks = "{}"; # TODO: use nix-colors
+ };
+ };
+ home.packages = [
+ pkgs.gnome.gnome-clocks
+ ];
+ };
+ };
+}
diff --git a/modules/waybar/temperature.nix b/modules/waybar/temperature.nix
index 740680a..ac43eba 100644
--- a/modules/waybar/temperature.nix
+++ b/modules/waybar/temperature.nix
@@ -3,11 +3,13 @@ let
name = "temperature";
in
{
- options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
- enable = lib.mkEnableOption "enable ${name} waybar module";
+ options.modules.waybar = {
+ modules = import ./addname.nix lib name;
+ enabled.${name} = {
+ enable = lib.mkEnableOption "enable ${name} waybar module";
+ };
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
diff --git a/modules/waybar/tray.nix b/modules/waybar/tray.nix
index 6483693..9dbde15 100644
--- a/modules/waybar/tray.nix
+++ b/modules/waybar/tray.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
spacing = 10;
};
diff --git a/modules/waybar/vpn.nix b/modules/waybar/vpn.nix
index 1173634..a509305 100644
--- a/modules/waybar/vpn.nix
+++ b/modules/waybar/vpn.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format = "VPN";
exec = "echo '{\"class\": \"connected\"}'";
diff --git a/modules/waybar/window.nix b/modules/waybar/window.nix
index d131b9b..270fd9e 100644
--- a/modules/waybar/window.nix
+++ b/modules/waybar/window.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
max-length = 36;
};
diff --git a/modules/waybar/wireplumber.nix b/modules/waybar/wireplumber.nix
index 4343c3a..d33c61e 100644
--- a/modules/waybar/wireplumber.nix
+++ b/modules/waybar/wireplumber.nix
@@ -3,11 +3,13 @@ let
name = "wireplumber";
in
{
- options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
- enable = lib.mkEnableOption "enable ${name} waybar module";
+ options.modules.waybar = {
+ modules = import ./addname.nix lib name;
+ enabled.${name} = {
+ enable = lib.mkEnableOption "enable ${name} waybar module";
+ };
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format = "{volume}% {icon}";
format-muted = "";
diff --git a/modules/waybar/workspaces.nix b/modules/waybar/workspaces.nix
index 6a5f05f..79f3713 100644
--- a/modules/waybar/workspaces.nix
+++ b/modules/waybar/workspaces.nix
@@ -4,10 +4,10 @@ let
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
- options.modules.waybar.${name} = {
+ options.modules.waybar.enabled.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
- config = lib.mkIf config.modules.waybar.${name}.enable {
+ config = lib.mkIf config.modules.waybar.enabled.${name}.enable {
programs.waybar.settings.mainBar."${name}" = {
format = "{name}";
on-click = "activate";