From 344b4492a7ff1a45de69ae131c061cc9439b50e3 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 2 Sep 2023 21:00:33 +0200 Subject: [PATCH 1/4] Add settings and style for waybar --- modules/home/desktop/sway/waybar.nix | 208 +++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) diff --git a/modules/home/desktop/sway/waybar.nix b/modules/home/desktop/sway/waybar.nix index 88d5434..3f157a3 100644 --- a/modules/home/desktop/sway/waybar.nix +++ b/modules/home/desktop/sway/waybar.nix @@ -6,5 +6,213 @@ enable = true; target = "sway-session.target"; }; + settings = { + mainbar = { + layer = "top"; + spacing = 6; + disable-toolptips = true; + modules-center = []; + modules-left = [ + "sway/workspaces" + "sway/mode" + ]; + modules-right = [ + "network" + "custom/sep" + "memory" + "cpu" + "custom/sep" + "pulseaudio" + "custom/sep" + "clock" + "custom/sep" + "tray" + ]; + "clock" = { + "format-alt" = "{:%Y-%m-%d}"; + "timezone" = "Europe/Paris"; + "tooltip" = false; + }; + "cpu" = { + "format" = "{usage}% {icon}"; + "format-icons" = [ "" ]; + "states" = { + "critical" = 90; + "warning" = 70; + }; + "tooltip" = false; + }; + "custom/sep" = { + "format" = "|"; + "tooltip" = false; + }; + "idle_inhibitor" = { + "format" = "{icon}"; + "format-icons" = { + "activated" = ""; + "deactivated" = ""; + }; + }; + "memory" = { + "format" = "{used:0.1f}G/{total:0.1f}G "; + "interval" = 30; + "states" = { + "critical" = 90; + "warning" = 70; + }; + }; + "network" = { + "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + "format-disconnected" = "Disconnected ⚠ "; + "format-ethernet" = "{ifname}: {ipaddr}/{cidr} 󰈀 "; + "format-linked" = "{ifname} (No IP) 󰈀 "; + "format-wifi" = "{essid} ({signalStrength}%)  "; + "tooltip" = false; + }; + "pulseaudio" = { + "format" = "{format_source} {volume}% {icon} "; + "format-bluetooth" = "{volume}% {icon}"; + "format-icons" = { + "car" = ""; + "default" = ""; + "handsfree" = "󰋎"; + "headphones" = "󰋋"; + "headset" = "󰋎"; + "phone" = ""; + "portable" = ""; + }; + "format-muted" = "{format_source} 󰝟 "; + "format-source" = "{volume}%  "; + "format-source-muted" = " "; + "tooltip" = false; + }; + "sway/mode" = { + "format" = "{}"; + }; + "sway/workspace" = { + "disable-scroll" = true; + }; + "temperature" = { + "critical-threshold" = 80; + "format" = "{temperatureC}°C  "; + "thermal-zone" = "6"; + }; + }; + }; + style = '' + @define-color color-base-bg #323232; + @define-color color-base-fg #ddd; + + @define-color color-hover #f268b3; + @define-color color-selected #1cd180; + + @define-color color-ok #1cd180; + @define-color color-warning #f2b768; + @define-color color-critical #f268b3; + + * { + border: none; + border-radius: 0; + min-height:0; + } + + window#waybar { + background: @color-base-bg ; + color: @color-base-fg; + font-family: "Fira Code Nerd Font"; + font-size: 12px; + } + + button, + button:disabled,label:disabled{ + color:inherit; + } + + button:hover{ + background:none; + box-shadow:inherit; + box-shadow:inherit; + text-shadow:inherit; + text-shadow:inherit; + border-top:none; + } + #workspaces { + color:#fff; + } + #workspaces button { + margin:0 3px; + padding:4px 4px; + color:#9c9c9c; + border-bottom: 1px solid transparent; + } + + #workspaces button:hover { + box-shadow:inherit; + text-shadow:inherit; + color: @color-hover; + border-bottom: 1px solid @color-hover; + } + + #workspaces button.focused { + background:#1cd180 ; + color:#000; + } + #workspaces button.visible:not(.focused) { + color: @color-selected; + border-color: @color-selected; + } + + #clock, + #cpu, + #memory, + #backlight, + #network, + #tray, + #mode, + #battery, + #idle_inhibitor { + padding: 2px 4px; + margin: 0; + background-color: transparent; + } + + #mode{ + background:@color-warning; + font-weight:bold; + } + #pulseaudio {} + #pulseaudio.muted { + color:@color-critical; + } + + #battery.discharging { + color: @color-base-fg; + border-bottom: none; + } + + #battery.charging, #battery.plugged { + border-bottom: 1px solid @color-ok; + color: @color-selected; + } + + #battery.critical:not(.charging), + #cpu.critical, + #memory.critical{ + border-color: @color-critical; + color: @color-critical; + } + + #battery.warning:not(.charging), + #cpu.warning, + #memory.warning{ + border-color: @color-warning; + color: @color-warning; + } + + #tray { + font-family: "DejaVu sans"; + font-size: 12px; + } + ''; }; } From d566c9dd482e5350736922a8e659393a906bf709 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 2 Sep 2023 21:19:22 +0200 Subject: [PATCH 2/4] Use stateVersion variable everywhere --- nixos/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/default.nix b/nixos/default.nix index 5d37b4c..caa3fef 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -56,5 +56,5 @@ }; }; - system.stateVersion = "23.05"; + system.stateVersion = stateVersion; } From 89e223ca232c6627db06e756a2d2f8b2509f7fd1 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 2 Sep 2023 21:29:17 +0200 Subject: [PATCH 3/4] Username become a variable --- flake.nix | 1 + nixos/default.nix | 4 ++-- nixos/includes/system/user.nix | 10 +++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 3948651..87c5b45 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,7 @@ in rec { specialArgs = { inherit stateVersion; hostname = "mrmeeseeks"; + username = "ephase"; }; modules = [ ./nixos/default.nix diff --git a/nixos/default.nix b/nixos/default.nix index caa3fef..3bfcf83 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, stateVersion, hostname, ... }: +{ config, pkgs, lib, stateVersion, hostname, username, ... }: { imports = @@ -41,7 +41,7 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - users.ephase = { + users.${username} = { home.stateVersion = stateVersion; programs.home-manager.enable = true; imports = [ diff --git a/nixos/includes/system/user.nix b/nixos/includes/system/user.nix index 10f97a1..b3f2970 100644 --- a/nixos/includes/system/user.nix +++ b/nixos/includes/system/user.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, username, ... }: { # Services services.pcscd.enable = true; @@ -12,14 +12,10 @@ # Configs fonts.fontconfig.enable = true; - users.users.ephase = { + users.users.${username} = { shell = pkgs.zsh; isNormalUser = true; extraGroups = [ "video" "wheel" ]; - home = "/home/ephase"; - packages = with pkgs; [ - remmina - gcc - ]; + home = "/home/${username}"; }; } From 93343473aab0dd09a31f2801837b74c2bb90598a Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 2 Sep 2023 21:36:08 +0200 Subject: [PATCH 4/4] Remove unuser nixfile parameters --- modules/home/desktop/qt.nix | 3 +-- modules/home/desktop/sway/fuzzel.nix | 3 +-- modules/home/desktop/sway/swaylock.nix | 3 +-- modules/home/desktop/sway/waybar.nix | 3 +-- modules/home/desktop/xdg.nix | 3 +-- modules/home/foot.nix | 3 +-- modules/home/zathura.nix | 3 +-- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/modules/home/desktop/qt.nix b/modules/home/desktop/qt.nix index c0e8a26..d1836a6 100644 --- a/modules/home/desktop/qt.nix +++ b/modules/home/desktop/qt.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +_: { qt = { enable = true; platformTheme = "gnome"; diff --git a/modules/home/desktop/sway/fuzzel.nix b/modules/home/desktop/sway/fuzzel.nix index eb170e2..9bdd92e 100644 --- a/modules/home/desktop/sway/fuzzel.nix +++ b/modules/home/desktop/sway/fuzzel.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +_: { programs.fuzzel = { enable = true; settings = { diff --git a/modules/home/desktop/sway/swaylock.nix b/modules/home/desktop/sway/swaylock.nix index f40fb29..a1ec08b 100644 --- a/modules/home/desktop/sway/swaylock.nix +++ b/modules/home/desktop/sway/swaylock.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +_: { programs.swaylock = { enable = true; settings = { diff --git a/modules/home/desktop/sway/waybar.nix b/modules/home/desktop/sway/waybar.nix index 3f157a3..6fbcf69 100644 --- a/modules/home/desktop/sway/waybar.nix +++ b/modules/home/desktop/sway/waybar.nix @@ -1,5 +1,4 @@ -{ pkgs, config, ...}: -{ +_: { programs.waybar = { enable = true; systemd = { diff --git a/modules/home/desktop/xdg.nix b/modules/home/desktop/xdg.nix index 949c2ac..f987b29 100644 --- a/modules/home/desktop/xdg.nix +++ b/modules/home/desktop/xdg.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +_: { xdg = { enable = true; userDirs = { diff --git a/modules/home/foot.nix b/modules/home/foot.nix index 13153e8..51e109f 100644 --- a/modules/home/foot.nix +++ b/modules/home/foot.nix @@ -1,5 +1,4 @@ -{ pkgs, ...}: -{ +_: { programs.foot = { enable = true; settings = { diff --git a/modules/home/zathura.nix b/modules/home/zathura.nix index 890c4a1..d2f9623 100644 --- a/modules/home/zathura.nix +++ b/modules/home/zathura.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +_: { programs.zathura = { enable = true; options = {