miku: Disable keypad lights with gamemode
This commit is contained in:
parent
a193b02ce0
commit
b58d5eb12f
@ -56,7 +56,7 @@
|
||||
];
|
||||
};
|
||||
in {
|
||||
inherit (pkgs) wayqt dfl-ipc dfl-applications dfl-utils qtgreet xwaylandvideobridge obs-cli;
|
||||
inherit (pkgs) wayqt dfl-ipc dfl-applications dfl-utils qtgreet xwaylandvideobridge obs-cli rgb_keyboard;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -166,6 +166,8 @@
|
||||
kernel.sysctl = {
|
||||
# League of Legends under Linux
|
||||
"abi.vsyscall32" = 0;
|
||||
# Fedora 39
|
||||
"vm.max_map_count" = 2147483642;
|
||||
};
|
||||
|
||||
extraModulePackages = [ kernel.vendor-reset ];
|
||||
|
@ -7,7 +7,15 @@ in {
|
||||
enable = lib.mkEnableOption "Enable and configure gamemode";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = let
|
||||
keyboardBrightnessScript = pkgs.writeShellScript "keyboard-brightness.sh" ''
|
||||
${pkgs.rgb_keyboard}/bin/rgb_keyboard -l ripple -b "$1"
|
||||
'';
|
||||
in lib.mkIf cfg.enable {
|
||||
security.sudo.extraConfig = ''
|
||||
${config.ptw.system.singleUser} ALL = (ALL) NOPASSWD: ${keyboardBrightnessScript}
|
||||
'';
|
||||
|
||||
programs.gamemode = {
|
||||
enable = true;
|
||||
enableRenice = true;
|
||||
@ -29,14 +37,28 @@ in {
|
||||
};
|
||||
|
||||
custom = let
|
||||
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}'
|
||||
'';
|
||||
switchScript = groupName: "${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SwitchInputMethodGroup string:'${groupName}'";
|
||||
pauseFcitx = switchScript "Group 2";
|
||||
resumeFcitx = switchScript "Group 1";
|
||||
|
||||
# The scripts
|
||||
start = pkgs.writeShellScript "gamemode-start.sh" ''
|
||||
# Disable Fcitx's IME
|
||||
${pauseFcitx}
|
||||
|
||||
# Turn on the keyboard lights
|
||||
${config.security.wrapperDir}/sudo ${keyboardBrightnessScript} 1
|
||||
'';
|
||||
end = pkgs.writeShellScript "gamemode-end.sh" ''
|
||||
# Resume Fcitx's IME
|
||||
${resumeFcitx}
|
||||
|
||||
# Turn off the keyboard lights
|
||||
${config.security.wrapperDir}/sudo ${keyboardBrightnessScript} 0
|
||||
'';
|
||||
in {
|
||||
start = ''${pauseFcitx}'';
|
||||
end = ''${resumeFcitx}'';
|
||||
start = "${start}";
|
||||
end = "${end}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
30
packages/applications/desktop/rgb_keyboard/default.nix
Normal file
30
packages/applications/desktop/rgb_keyboard/default.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
stdenv
|
||||
, fetchFromGitHub
|
||||
, gcc, gnumake
|
||||
, libusb
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "rgb_keyboard";
|
||||
version = "20230430";
|
||||
src = fetchFromGitHub {
|
||||
owner = "PapaTutuWawa";
|
||||
repo = "rgb_keyboard";
|
||||
rev = "5bbdafea77ef3c3eb47081494f3b58abcd5c4e27";
|
||||
sha256 = "0m5hvlhqncy1qn5v6gpsz9qd2p4cvcjjnma08vb4b2ybq4kfv7qw";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
libusb
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
${gnumake}/bin/make build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin/
|
||||
cp rgb_keyboard $out/bin/
|
||||
'';
|
||||
}
|
@ -123,4 +123,6 @@ in {
|
||||
gajim = prev.callPackage ./applications/networking/instant-messengers/gajim/default.nix {
|
||||
nbxmpp = prev.python3.pkgs.callPackage ./applications/networking/instant-messengers/gajim/nbxmpp.nix {};
|
||||
};
|
||||
|
||||
rgb_keyboard = prev.callPackage ./applications/desktop/rgb_keyboard/default.nix {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user