From 6af142e20b2c5d1ee4510bd98e4dc629cdd36e4c Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 16 Oct 2023 23:24:07 +0200 Subject: [PATCH] pinwheel: Use `hyprland` `enable` option --- hosts/pinwheel/modules/bemenu/default.nix | 7 +++++-- hosts/pinwheel/modules/foot/default.nix | 7 +++++-- hosts/pinwheel/modules/light/default.nix | 7 +++++-- hosts/pinwheel/modules/screenshot/default.nix | 6 ++++-- hosts/pinwheel/modules/sound/default.nix | 6 ++++-- hosts/pinwheel/modules/spotify/default.nix | 7 +++++-- hosts/pinwheel/modules/swaylock/default.nix | 7 +++++-- hosts/pinwheel/modules/waybar/default.nix | 8 +++++--- 8 files changed, 38 insertions(+), 17 deletions(-) diff --git a/hosts/pinwheel/modules/bemenu/default.nix b/hosts/pinwheel/modules/bemenu/default.nix index 00e1365..12a765c 100644 --- a/hosts/pinwheel/modules/bemenu/default.nix +++ b/hosts/pinwheel/modules/bemenu/default.nix @@ -1,9 +1,12 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + hyprlandEnabled = config.mod.hyprland.enable; +in { home-manager.users.alex = { home.packages = [ pkgs.bemenu ]; - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ "$mod, SPACE, exec, ${pkgs.bemenu}/bin/bemenu-run --fn 'DejaVuSansM Nerd Font Mono 14'" diff --git a/hosts/pinwheel/modules/foot/default.nix b/hosts/pinwheel/modules/foot/default.nix index 12fb563..abad1ee 100644 --- a/hosts/pinwheel/modules/foot/default.nix +++ b/hosts/pinwheel/modules/foot/default.nix @@ -1,4 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + hyprlandEnabled = config.mod.hyprland.enable; +in { home-manager.users.alex = { programs.foot = { @@ -12,7 +15,7 @@ }; }; - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ "$mod, RETURN, exec, ${pkgs.foot}/bin/foot" diff --git a/hosts/pinwheel/modules/light/default.nix b/hosts/pinwheel/modules/light/default.nix index 646ef2d..48526d8 100644 --- a/hosts/pinwheel/modules/light/default.nix +++ b/hosts/pinwheel/modules/light/default.nix @@ -1,10 +1,13 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + hyprlandEnabled = config.mod.hyprland.enable; +in { users.users.alex.extraGroups = [ "video" ]; programs.light.enable = true; home-manager.users.alex = { - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ ", XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 5" diff --git a/hosts/pinwheel/modules/screenshot/default.nix b/hosts/pinwheel/modules/screenshot/default.nix index 37be871..5198838 100644 --- a/hosts/pinwheel/modules/screenshot/default.nix +++ b/hosts/pinwheel/modules/screenshot/default.nix @@ -1,5 +1,7 @@ -{ inputs, pkgs, system, ...}: +{ inputs, pkgs, lib, system, config, ...}: let + hyprlandEnabled = config.mod.hyprland.enable; + grimblast = inputs.hyprland-contrib.packages.${system}.grimblast; area = "${pkgs.libnotify}/bin/notify-send 'ps: selected area' && ${grimblast}/bin/grimblast copy area"; screen = "${pkgs.libnotify}/bin/notify-send 'ps: selected screen' &&${grimblast}/bin/grimblast copy output"; @@ -8,7 +10,7 @@ in home-manager.users.alex = { home.packages = [ grimblast ]; - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ "$mod, Print, exec, ${area}" diff --git a/hosts/pinwheel/modules/sound/default.nix b/hosts/pinwheel/modules/sound/default.nix index 36f5259..cf6640b 100644 --- a/hosts/pinwheel/modules/sound/default.nix +++ b/hosts/pinwheel/modules/sound/default.nix @@ -1,5 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: let + hyprlandEnabled = config.mod.hyprland.enable; + toggle-output-mute = pkgs.writeShellScript "foo" '' ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l) @@ -30,7 +32,7 @@ in }; home-manager.users.alex = { - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+" diff --git a/hosts/pinwheel/modules/spotify/default.nix b/hosts/pinwheel/modules/spotify/default.nix index 69a335f..ef51bc0 100644 --- a/hosts/pinwheel/modules/spotify/default.nix +++ b/hosts/pinwheel/modules/spotify/default.nix @@ -1,4 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + hyprlandEnabled = config.mod.hyprland.enable; +in { home-manager.users.alex = { home.packages = with pkgs; [ @@ -6,7 +9,7 @@ playerctl ]; - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ "$mod ALT, LEFT, exec, ${pkgs.playerctl}/bin/playerctl -p spotify previous" diff --git a/hosts/pinwheel/modules/swaylock/default.nix b/hosts/pinwheel/modules/swaylock/default.nix index c04a8fb..4931b40 100644 --- a/hosts/pinwheel/modules/swaylock/default.nix +++ b/hosts/pinwheel/modules/swaylock/default.nix @@ -1,4 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + hyprlandEnabled = config.mod.hyprland.enable; +in { home-manager.users.alex = { programs.swaylock = { @@ -11,7 +14,7 @@ }; }; - wayland.windowManager.hyprland = { + wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled { settings = { bind = [ "$mod SHIFT, x, exec, ${pkgs.swaylock}/bin/swaylock -f && systemctl suspend" diff --git a/hosts/pinwheel/modules/waybar/default.nix b/hosts/pinwheel/modules/waybar/default.nix index 64a5cf1..1c0446e 100644 --- a/hosts/pinwheel/modules/waybar/default.nix +++ b/hosts/pinwheel/modules/waybar/default.nix @@ -1,5 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: let + hyprlandEnabled = config.mod.hyprland.enable; + spotify-status = pkgs.writeShellScript "spotify-status" '' STATUS=$(${pkgs.playerctl}/bin/playerctl -p spotify status 2>&1) @@ -108,7 +110,7 @@ in fixed-center = false; output = [ "eDP-1" ]; - modules-left = [ "hyprland/workspaces" ]; + modules-left = lib.mkIf hyprlandEnabled [ "hyprland/workspaces" ]; modules-right = [ "custom/work-vpn-status" "custom/spotify" @@ -195,7 +197,7 @@ in fixed-center = false; output = [ "HDMI-A-1" ]; - modules-left = [ "hyprland/workspaces" ]; + modules-left = lib.mkIf hyprlandEnabled [ "hyprland/workspaces" ]; modules-right = [ "custom/work-vpn-status" "clock"