feat(bbsteamie): add gaming mode button
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
1bb3f8e5e1
commit
2413c5b74f
1 changed files with 77 additions and 9 deletions
|
@ -1,5 +1,31 @@
|
|||
{config, ...}: let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.vars) mainUser;
|
||||
|
||||
inherit (lib) getExe;
|
||||
|
||||
switch-session = pkgs.writeShellApplication {
|
||||
name = "switch-session";
|
||||
|
||||
text = ''
|
||||
mkdir -p /etc/sddm.conf.d
|
||||
|
||||
cat <<EOF | tee /etc/sddm.conf.d/autologin.conf
|
||||
[Autologin]
|
||||
User=${mainUser}
|
||||
Session=$1
|
||||
Relogin=true
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
|
||||
gaming-mode = pkgs.writeShellScriptBin "gaming-mode" ''
|
||||
sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service
|
||||
'';
|
||||
in {
|
||||
# Auto-login to plasma
|
||||
services = {
|
||||
|
@ -11,16 +37,59 @@ in {
|
|||
wayland.enable = true;
|
||||
autoLogin.relogin = true;
|
||||
};
|
||||
|
||||
autoLogin = {
|
||||
enable = true;
|
||||
user = mainUser;
|
||||
};
|
||||
|
||||
defaultSession = "plasma";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."set-session" = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
before = ["display-manager.service"];
|
||||
|
||||
path = [switch-session];
|
||||
|
||||
script = ''
|
||||
switch-session "plasma"
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services."to-gaming-mode" = {
|
||||
wantedBy = lib.mkForce [];
|
||||
|
||||
path = [switch-session];
|
||||
|
||||
script = ''
|
||||
switch-session "gamescope-wayland"
|
||||
systemctl restart display-manager
|
||||
sleep 10
|
||||
switch-session "plasma"
|
||||
'';
|
||||
};
|
||||
|
||||
security.sudo.extraRules = [
|
||||
{
|
||||
users = [mainUser];
|
||||
groups = [100];
|
||||
commands = [
|
||||
{
|
||||
command = "${pkgs.systemd}/bin/systemctl start to-gaming-mode.service";
|
||||
options = ["SETENV" "NOPASSWD"];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
home-manager.users.${mainUser}.xdg.desktopEntries."Gaming Mode" = {
|
||||
name = "Gaming Mode";
|
||||
exec = getExe gaming-mode;
|
||||
icon = "steam";
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.firefox
|
||||
pkgs.wl-clipboard
|
||||
];
|
||||
|
||||
programs = {
|
||||
xwayland.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
|
@ -29,7 +98,6 @@ in {
|
|||
# Enable flatpak support
|
||||
services.flatpak.enable = true;
|
||||
services.packagekit.enable = true;
|
||||
|
||||
jovian.steam = {
|
||||
enable = true;
|
||||
user = mainUser;
|
||||
|
|
Loading…
Reference in a new issue