From c007790ecf56f538d25b53967c2aa5644a007401 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 30 Sep 2024 09:14:12 -0500 Subject: [PATCH] Add some snippy scripts for foxtrot quick switching between performance modes --- flake.nix | 19 +++++++++++++++++++ modules/home-manager/sway.nix | 3 ++- modules/nixos/default.nix | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a2d12e5..a2dd6aa 100644 --- a/flake.nix +++ b/flake.nix @@ -390,6 +390,7 @@ hardware.nixosModules.framework-13-7040-amd common + kde-connect password-manager graphical-workstation laptop @@ -418,6 +419,24 @@ modprobe -v mt7921e ''; }) + (writeShellApplication + { + name = "perfmode"; + # we use command -v $cmd here because we only want to invoke these calls _if_ the related package is installed on the system + # otherwise, they will likely have no effect anyways + text = '' + command -v powerprofilesctl &>/dev/null && set -x && powerprofilesctl set performance && set +x + command -v swaymsg &>/dev/null && set -x && swaymsg output eDP-1 mode 2880x1920@60Hz && set +x + ''; + }) + (writeShellApplication + { + name = "battmode"; + text = '' + command -v powerprofilesctl &>/dev/null && set -x && powerprofilesctl set power-saver && set +x + command -v swaymsg &>/dev/null && set -x && swaymsg output eDP-1 mode 2880x1920@120Hz && set +x + ''; + }) ]; }) ]; diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index af49e3b..23d22ff 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -119,6 +119,8 @@ }; startup = [ + {command = "kdeconnect-indicator";} + {command = "mako";} { command = "swaybg -i $HOME/.wallpaper"; } @@ -151,7 +153,6 @@ "timeout 600 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\" & maybe-good-morning &'" ]; } - {command = "mako";} # {command = "firefox";} # {command = "wezterm";} ]; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 83bbbab..973aaff 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -633,6 +633,7 @@ programs.kdeconnect.enable = true; /* + # handled by enabling networking.firewall = { allowedTCPPortRanges = [ { from = 1714; to = 1764; } ]; allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];