nixos-config/modules/services/gamemode/default.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
cfg = config.ptw.services.gamemode;
in {
options.ptw.services.gamemode = {
enable = lib.mkEnableOption "Enable and configure gamemode";
};
config = lib.mkIf cfg.enable {
programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
general = {
reaper_freq = 5;
desiredgov = "performance";
igpu_desiredgov = "powersave";
igpu_power_threshold = 0.3;
softrealtime = "on";
renice = 0;
ioprio = 0;
inhibit_screensaver = 1;
};
gpu = {
amd_performance_level = "high";
};
custom = let
2023-02-22 12:35:28 +00:00
switchScript = groupName: pkgs.writeShellScript "switch-input-group.sh" ''
${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SwitchInputMethodGroup string:'${groupName}'
'';
2023-02-22 12:35:28 +00:00
pauseFcitx = switchScript "Group 2";
resumeFcitx = switchScript "Group 1";
in {
2023-02-22 12:35:28 +00:00
start = ''${pauseFcitx}'';
end = ''${resumeFcitx}'';
};
};
};
};
}