From 76cbdaaf2fd6a9880749449272b6ca13c54c4df8 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Sat, 2 Mar 2024 23:46:20 +0100 Subject: [PATCH] make the amdgpu_top special workspace depend on the presence of an amd gpu in the future I'll need to make some custom module where I define what hardware the system has, I'd like not to rely on things like this for now this is enough I hope --- modules/gui/hyprland.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/gui/hyprland.nix b/modules/gui/hyprland.nix index 89c5a43..3ddf704 100644 --- a/modules/gui/hyprland.nix +++ b/modules/gui/hyprland.nix @@ -10,6 +10,8 @@ hmCfg = config.home-manager.users.${username}; osuCfg = config.myOptions.programs.osu; + isAmdGpuPresent = builtins.elem "amdgpu" config.boot.initrd.kernelModules; + inherit (inputs.nixpkgs-wayland.packages.${pkgs.system}) foot wl-clipboard swww wlsunset swaylock; inherit (inputs.anyrun.packages.${pkgs.system}) anyrun; hyprcontrib = inputs.hyprcontrib.packages.${pkgs.system}; @@ -143,7 +145,8 @@ in { # scratchpads "special:btop, decorate:false" - "special:amdgpu_top, decorate:false" + (mkIf isAmdGpuPresent + "special:amdgpu_top, decorate:false") "special:pipewire, decorate:false" "special:nixos, decorate:false" (mkIf config.services.asusd.enable @@ -329,7 +332,8 @@ in { "$mainMod SHIFT, X, exec, ${hyprland}/bin/hyprctl kill" # scratchpad binds "$mainMod, B, togglespecialworkspace, btop" - "$mainMod, A, togglespecialworkspace, amdgpu_top" + (mkIf isAmdGpuPresent + "$mainMod, A, togglespecialworkspace, amdgpu_top") "$mainMod, V, togglespecialworkspace, pipewire" "$mainMod, N, togglespecialworkspace, nixos" # rog button on laptop keyboard @@ -428,13 +432,16 @@ in { exec = [ # kill (almost) everything on special workspaces "${pkgs.procps}/bin/pkill btop" - "${pkgs.procps}/bin/pkill amdgpu_top" + (mkIf isAmdGpuPresent + "${pkgs.procps}/bin/pkill amdgpu_top") "${pkgs.procps}/bin/pkill helvum" "${pkgs.procps}/bin/pkill pavucontrol" # and run it all again "[workspace special:btop silent;tile] ${foot}/bin/foot -e ${pkgs.btop}/bin/btop" - "[workspace special:amdgpu_top silent;tile] ${foot}/bin/foot -e ${pkgs.amdgpu_top}/bin/amdgpu_top -i 0" - "[workspace special:amdgpu_top silent;tile] ${foot}/bin/foot -e ${pkgs.amdgpu_top}/bin/amdgpu_top -i 1" + (mkIf isAmdGpuPresent + "[workspace special:amdgpu_top silent;tile] ${foot}/bin/foot -e ${pkgs.amdgpu_top}/bin/amdgpu_top -i 0") + (mkIf isAmdGpuPresent + "[workspace special:amdgpu_top silent;tile] ${foot}/bin/foot -e ${pkgs.amdgpu_top}/bin/amdgpu_top -i 1") "[workspace special:pipewire silent;tile] ${pkgs.helvum}/bin/helvum" "[workspace special:pipewire silent;tile] ${pkgs.pavucontrol}/bin/pavucontrol"