From 0369d277a8959f6064a93354b03c45f5cf59a03d Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 14 Mar 2025 08:38:05 +0100 Subject: graphical: factorize sway components in other modules --- usecases/desktop/graphical.nix | 5 ++ usecases/desktop/graphical/greetd.nix | 29 ++++++++ usecases/desktop/graphical/sway.nix | 121 ++------------------------------ usecases/desktop/graphical/swaylock.nix | 65 +++++++++++++++++ usecases/desktop/graphical/swaync.nix | 47 +++++++++++++ usecases/desktop/graphical/wlsunset.nix | 23 ++++++ 6 files changed, 174 insertions(+), 116 deletions(-) create mode 100644 usecases/desktop/graphical/greetd.nix create mode 100644 usecases/desktop/graphical/swaylock.nix create mode 100644 usecases/desktop/graphical/swaync.nix create mode 100644 usecases/desktop/graphical/wlsunset.nix diff --git a/usecases/desktop/graphical.nix b/usecases/desktop/graphical.nix index dbc3a34..787c455 100644 --- a/usecases/desktop/graphical.nix +++ b/usecases/desktop/graphical.nix @@ -6,12 +6,17 @@ inputs: { (import ./graphical/alacritty.nix inputs) (import ./graphical/firefox.nix inputs) ./graphical/ghostty.nix + ./graphical/greetd.nix (import ./graphical/gtk.nix inputs) + # ./graphical/librewolf.nix (import ./graphical/mpv.nix inputs) (import ./graphical/plymouth.nix inputs) (import ./graphical/rofi.nix inputs) (import ./graphical/sway.nix inputs) + ./graphical/swaylock.nix + ./graphical/swaync.nix (import ./graphical/waybar.nix inputs) + ./graphical/wlsunset.nix (import ./graphical/zathura.nix inputs) ]; diff --git a/usecases/desktop/graphical/greetd.nix b/usecases/desktop/graphical/greetd.nix new file mode 100644 index 0000000..615b3b5 --- /dev/null +++ b/usecases/desktop/graphical/greetd.nix @@ -0,0 +1,29 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.reborn.greetd; +in +{ + options.reborn.greetd = { + enable = lib.mkEnableOption "Reborn greetd config"; + + command = lib.mkOption { + description = "Default session command"; + type = lib.types.str; + default = "sway"; + }; + }; + + config = lib.mkIf cfg.enable { + services.greetd = { + enable = true; + vt = 6; + settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd ${cfg.command}"; + }; + + }; +} diff --git a/usecases/desktop/graphical/sway.nix b/usecases/desktop/graphical/sway.nix index ca7a286..34dc978 100644 --- a/usecases/desktop/graphical/sway.nix +++ b/usecases/desktop/graphical/sway.nix @@ -6,10 +6,11 @@ _inputs: ... }: { - services.greetd = { - enable = true; - vt = 6; - settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; + reborn = { + greetd.enable = true; + swaylock.enable = true; + swaync.enable = true; + wlsunset.enable = true; }; home-manager.users.minijackson = @@ -214,117 +215,6 @@ _inputs: }; }; - services.swaync = { - enable = true; - - settings = { - widgets = [ - "buttons-grid" - "mpris" - "volume" - "backlight" - "inhibitors" - "title" - "dnd" - "notifications" - ]; - widget-config = { - buttons-grid.actions = [ - { - label = "󰜉"; - command = "systemctl reboot"; - } - { - label = "󰐥"; - command = "systemctl poweroff"; - } - ]; - volume = { - label = "󰕾"; - show-per-app = true; - show-per-app-label = true; - }; - }; - }; - - style = pkgs.substituteAll { - src = ./swaync.css; - inherit (osConfig.theme.colors) - background1 - background2 - background5 - dimDominant - dominant - foreground - foreground3 - softBackground - ; - }; - }; - - services.wlsunset = { - enable = true; - latitude = "48.864716"; - longitude = "2.349014"; - # Reduce blue light anyways - temperature = { - day = 4000; - night = 2500; - }; - }; - - programs.swaylock = { - enable = true; - settings = - let - inherit (osConfig.theme.colors) - background - brightGreen - brightOrange - brightRed - dominant - neutralOrange - neutralRed - ; - in - { - ignore-empty-password = true; - show-failed-attempts = true; - - image = "${../../../res/wallpapers/wallpaper-1920x1080-install-gentoo.png}"; - - font = "monospace"; - - inside-color = "${lib.removePrefix "#" dominant}dd"; - inside-clear-color = "${lib.removePrefix "#" neutralOrange}dd"; - inside-ver-color = "${lib.removePrefix "#" neutralOrange}dd"; - inside-wrong-color = "${lib.removePrefix "#" neutralRed}dd"; - - key-hl-color = "${lib.removePrefix "#" brightGreen}ee"; - bs-hl-color = "${lib.removePrefix "#" neutralRed}ee"; - - line-color = "${lib.removePrefix "#" background}ee"; - line-clear-color = "${lib.removePrefix "#" background}ee"; - line-ver-color = "${lib.removePrefix "#" background}ee"; - line-wrong-color = "${lib.removePrefix "#" background}ee"; - - ring-color = "${lib.removePrefix "#" dominant}ee"; - ring-clear-color = "${lib.removePrefix "#" brightOrange}ee"; - ring-ver-color = "${lib.removePrefix "#" brightOrange}ee"; - ring-wrong-color = "${lib.removePrefix "#" brightRed}ee"; - - separator-color = "${lib.removePrefix "#" background}ee"; - - text-color = "${lib.removePrefix "#" background}ff"; - text-clear-color = "${lib.removePrefix "#" background}ff"; - text-ver-color = "${lib.removePrefix "#" background}ff"; - text-wrong-color = "${lib.removePrefix "#" background}ff"; - - indicator-radius = 75; - indicator-thickness = 10; - }; - }; - xsession.importedVariables = [ "DBUS_SESSION_BUS_ADDRESS" "DISPLAY" @@ -353,7 +243,6 @@ _inputs: ]; programs.xwayland.enable = true; - security.pam.services.swaylock = { }; xdg.portal = { wlr = { diff --git a/usecases/desktop/graphical/swaylock.nix b/usecases/desktop/graphical/swaylock.nix new file mode 100644 index 0000000..6dc7683 --- /dev/null +++ b/usecases/desktop/graphical/swaylock.nix @@ -0,0 +1,65 @@ +{ config, lib, ... }: +let + cfg = config.reborn.swaylock; +in +{ + options.reborn.swaylock = { + enable = lib.mkEnableOption "Reborn swaylock config"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.minijackson.programs.swaylock = { + enable = true; + settings = + let + inherit (config.theme.colors) + background + brightGreen + brightOrange + brightRed + dominant + neutralOrange + neutralRed + ; + in + { + ignore-empty-password = true; + show-failed-attempts = true; + + image = "${../../../res/wallpapers/wallpaper-1920x1080-install-gentoo.png}"; + + font = "monospace"; + + inside-color = "${lib.removePrefix "#" dominant}dd"; + inside-clear-color = "${lib.removePrefix "#" neutralOrange}dd"; + inside-ver-color = "${lib.removePrefix "#" neutralOrange}dd"; + inside-wrong-color = "${lib.removePrefix "#" neutralRed}dd"; + + key-hl-color = "${lib.removePrefix "#" brightGreen}ee"; + bs-hl-color = "${lib.removePrefix "#" neutralRed}ee"; + + line-color = "${lib.removePrefix "#" background}ee"; + line-clear-color = "${lib.removePrefix "#" background}ee"; + line-ver-color = "${lib.removePrefix "#" background}ee"; + line-wrong-color = "${lib.removePrefix "#" background}ee"; + + ring-color = "${lib.removePrefix "#" dominant}ee"; + ring-clear-color = "${lib.removePrefix "#" brightOrange}ee"; + ring-ver-color = "${lib.removePrefix "#" brightOrange}ee"; + ring-wrong-color = "${lib.removePrefix "#" brightRed}ee"; + + separator-color = "${lib.removePrefix "#" background}ee"; + + text-color = "${lib.removePrefix "#" background}ff"; + text-clear-color = "${lib.removePrefix "#" background}ff"; + text-ver-color = "${lib.removePrefix "#" background}ff"; + text-wrong-color = "${lib.removePrefix "#" background}ff"; + + indicator-radius = 75; + indicator-thickness = 10; + }; + }; + + security.pam.services.swaylock = { }; + }; +} diff --git a/usecases/desktop/graphical/swaync.nix b/usecases/desktop/graphical/swaync.nix new file mode 100644 index 0000000..34b7dba --- /dev/null +++ b/usecases/desktop/graphical/swaync.nix @@ -0,0 +1,47 @@ +{ config, lib, ... }: +let + cfg = config.reborn.swaync; +in +{ + options.reborn.swaync = { + enable = lib.mkEnableOption "Reborn swaync config"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.minijackson.services.swaync = { + enable = true; + + settings = { + widgets = [ + "buttons-grid" + "mpris" + "volume" + "backlight" + "inhibitors" + "title" + "dnd" + "notifications" + ]; + widget-config = { + buttons-grid.actions = [ + { + label = "󰜉"; + command = "systemctl reboot"; + } + { + label = "󰐥"; + command = "systemctl poweroff"; + } + ]; + volume = { + label = "󰕾"; + show-per-app = true; + show-per-app-label = true; + }; + }; + }; + + style = ./swaync.css; + }; + }; +} diff --git a/usecases/desktop/graphical/wlsunset.nix b/usecases/desktop/graphical/wlsunset.nix new file mode 100644 index 0000000..869f377 --- /dev/null +++ b/usecases/desktop/graphical/wlsunset.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: +let + cfg = config.reborn.wlsunset; +in +{ + options.reborn.wlsunset = { + enable = lib.mkEnableOption "Reborn wlsunset config"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.minijackson.services.wlsunset = { + enable = true; + latitude = "48.864716"; + longitude = "2.349014"; + # Reduce blue light anyways + temperature = { + day = 4000; + night = 2500; + }; + }; + + }; +} -- cgit v1.2.3