feat: work QOL features (lid turn off etc.)

This commit is contained in:
Swarsel 2024-09-04 16:16:30 +02:00
parent 23e1f73ce9
commit 74eabad262
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
12 changed files with 667 additions and 544 deletions

View file

@ -4941,6 +4941,7 @@ Also, the system state version is set here. No need to touch it.
./xdg-portal.nix ./xdg-portal.nix
# ./yubikey-touch-detector.nix # ./yubikey-touch-detector.nix
./safeeyes.nix ./safeeyes.nix
./lid.nix
]; ];
nix = nix =
@ -5013,7 +5014,7 @@ This ensures that all user-configuration happens here in the config file.
isNormalUser = true; isNormalUser = true;
description = "Leon S"; description = "Leon S";
hashedPasswordFile = lib.mkIf (!config.swarselsystems.initialSetup) config.sops.secrets.swarseluser.path; hashedPasswordFile = lib.mkIf (!config.swarselsystems.initialSetup) config.sops.secrets.swarseluser.path;
extraGroups = [ "networkmanager" "root" "docker""wheel" "lp" "audio" "video" "vboxusers" "scanner" ]; extraGroups = [ "networkmanager" "docker" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ];
packages = with pkgs; [ ]; packages = with pkgs; [ ];
}; };
}; };
@ -5148,7 +5149,6 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
keyboard.qmk.enable = true; keyboard.qmk.enable = true;
pulseaudio = { pulseaudio = {
enable = lib.mkIf (!config.services.pipewire.enable) true; enable = lib.mkIf (!config.services.pipewire.enable) true;
package = pkgs.pulseaudioFull; package = pkgs.pulseaudioFull;
@ -5187,6 +5187,7 @@ Pipewire handles communication on Wayland. This enables several sound tools as w
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
audio.enable = true; audio.enable = true;
wireplumber.enable = true;
alsa = { alsa = {
enable = true; enable = true;
support32Bit = true; support32Bit = true;
@ -5748,6 +5749,7 @@ Enables the blueman service including the nice system tray icon.
_: _:
{ {
services.blueman.enable = true; services.blueman.enable = true;
services.hardware.bolt.enable = true;
} }
#+end_src #+end_src
@ -6292,6 +6294,39 @@ A friend of mine used this service and I used to make fun of him. But I have to
} }
#+end_src #+end_src
**** Handle lid switch correctly
This turns off the display when the lid is closed.
#+begin_src nix :tangle profiles/common/nixos/lid.nix
{ config, pkgs, ... }:
{
services.logind = {
lidSwitch = "suspend";
lidSwitchDocked = "ignore";
};
services.acpid = {
enable = true;
lidEventCommands =
''
export PATH=$PATH:/run/current-system/sw/bin
export WAYLAND_DISPLAY=wayland-1
export XDG_RUNTIME_DIR=/run/user/1000
export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1)
LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open")
DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked")
if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then
swaymsg output eDP-2 disable
else
swaymsg output eDP-2 enable
fi
'';
};
}
#+end_src
*** Optional *** Optional
:PROPERTIES: :PROPERTIES:
@ -6420,6 +6455,7 @@ Integrates 1password mostly. There are more options at [[#h:f0b2ea93-94c8-48d8-8
{ pkgs, ... }: { pkgs, ... }:
{ {
# boot.initrd.luks.yubikeySupport = true; # boot.initrd.luks.yubikeySupport = true;
programs.browserpass.enable = true;
programs._1password.enable = true; programs._1password.enable = true;
programs._1password-gui = { programs._1password-gui = {
enable = true; enable = true;
@ -6555,7 +6591,6 @@ This holds packages that I can use as provided, or with small modifications (as
picard-tools picard-tools
audacity audacity
sox sox
google-chrome
# printing # printing
cups cups
@ -7663,8 +7698,8 @@ The rest of the related configuration is found here:
- [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]] - [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]]
#+begin_src nix :tangle profiles/common/home/waybar.nix #+begin_src nix :tangle profiles/common/home/waybar.nix
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
@ -7710,18 +7745,18 @@ The rest of the related configuration is found here:
on-click = "xdg-open https://github.com/notifications"; on-click = "xdg-open https://github.com/notifications";
}; };
"custom/nix-updates" = { # "custom/nix-updates" = {
exec = "update-checker"; # exec = "update-checker";
on-click = "update-checker && notify-send 'The system has been updated'"; # on-click = "update-checker && notify-send 'The system has been updated'";
interval = "once"; # interval = "once";
tooltip = true; # tooltip = true;
return-type = "json"; # return-type = "json";
format = "{} {icon}"; # format = "{} {icon}";
format-icon = { # format-icon = {
"has-updates" = ""; # "has-updates" = "";
"updated" = " "; # "updated" = " ";
}; # };
}; # };
idle_inhibitor = { idle_inhibitor = {
format = "{icon}"; format = "{icon}";
@ -7926,7 +7961,7 @@ The rest of the related configuration is found here:
}; };
style = builtins.readFile ../../../programs/waybar/style.css; style = builtins.readFile ../../../programs/waybar/style.css;
}; };
} }
#+end_src #+end_src
**** Firefox **** Firefox
@ -8249,6 +8284,10 @@ Currently, I am too lazy to explain every option here, but most of it is very se
"${modifier}+Ctrl+Shift+m" = "move container to workspace 11:M"; "${modifier}+Ctrl+Shift+m" = "move container to workspace 11:M";
"${modifier}+Ctrl+s" = "workspace 12:S"; "${modifier}+Ctrl+s" = "workspace 12:S";
"${modifier}+Ctrl+Shift+s" = "move container to workspace 12:S"; "${modifier}+Ctrl+Shift+s" = "move container to workspace 12:S";
"${modifier}+Ctrl+e" = "workspace 13:E";
"${modifier}+Ctrl+Shift+e" = "move container to workspace 13:E";
"${modifier}+Ctrl+t" = "workspace 14:T";
"${modifier}+Ctrl+Shift+t" = "move container to workspace 14:T";
"${modifier}+Left" = "focus left"; "${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right"; "${modifier}+Right" = "focus right";
"${modifier}+Down" = "focus down"; "${modifier}+Down" = "focus down";
@ -8355,6 +8394,12 @@ Currently, I am too lazy to explain every option here, but most of it is very se
app_id = "firefox"; app_id = "firefox";
}; };
} }
{
command = "opacity 0.99";
criteria = {
app_id = "chromium-browser";
};
}
{ {
command = "sticky enable, shadows enable"; command = "sticky enable, shadows enable";
criteria = { criteria = {
@ -8561,13 +8606,15 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
stable.teams-for-linux stable.teams-for-linux
google-chrome
shellcheck shellcheck
dig dig
docker docker
]; ];
programs.ssh = { programs = {
git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
ssh = {
matchBlocks = { matchBlocks = {
"uc" = { "uc" = {
hostname = "uc.clip.vbc.ac.at"; hostname = "uc.clip.vbc.ac.at";
@ -8591,7 +8638,7 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
}; };
}; };
programs.firefox = { firefox = {
profiles = { profiles = {
dc_adm = { dc_adm = {
id = 1; id = 1;
@ -8608,6 +8655,25 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
}; };
}; };
chromium = {
enable = true;
package = pkgs.chromium;
extensions = [
# 1password
"gejiddohjgogedgjnonbofjigllpkmbf"
# dark reader
"eimadpbcbfnmbkopoojfekhnkhdbieeh"
# ublock origin
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
# i still dont care about cookies
"edibdbjcniadpccecjdfdjjppcpchdlm"
# browserpass
"naepdomgkenhinolocfifgehidddafch"
];
};
};
xdg.desktopEntries = xdg.desktopEntries =
let let
terminal = false; terminal = false;
@ -8637,7 +8703,6 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
}; };
}; };
programs.git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
} }

View file

@ -12,7 +12,6 @@
picard-tools picard-tools
audacity audacity
sox sox
google-chrome
# printing # printing
cups cups

View file

@ -80,6 +80,10 @@ in
"${modifier}+Ctrl+Shift+m" = "move container to workspace 11:M"; "${modifier}+Ctrl+Shift+m" = "move container to workspace 11:M";
"${modifier}+Ctrl+s" = "workspace 12:S"; "${modifier}+Ctrl+s" = "workspace 12:S";
"${modifier}+Ctrl+Shift+s" = "move container to workspace 12:S"; "${modifier}+Ctrl+Shift+s" = "move container to workspace 12:S";
"${modifier}+Ctrl+e" = "workspace 13:E";
"${modifier}+Ctrl+Shift+e" = "move container to workspace 13:E";
"${modifier}+Ctrl+t" = "workspace 14:T";
"${modifier}+Ctrl+Shift+t" = "move container to workspace 14:T";
"${modifier}+Left" = "focus left"; "${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right"; "${modifier}+Right" = "focus right";
"${modifier}+Down" = "focus down"; "${modifier}+Down" = "focus down";
@ -186,6 +190,12 @@ in
app_id = "firefox"; app_id = "firefox";
}; };
} }
{
command = "opacity 0.99";
criteria = {
app_id = "chromium-browser";
};
}
{ {
command = "sticky enable, shadows enable"; command = "sticky enable, shadows enable";
criteria = { criteria = {

View file

@ -45,18 +45,18 @@
on-click = "xdg-open https://github.com/notifications"; on-click = "xdg-open https://github.com/notifications";
}; };
"custom/nix-updates" = { # "custom/nix-updates" = {
exec = "update-checker"; # exec = "update-checker";
on-click = "update-checker && notify-send 'The system has been updated'"; # on-click = "update-checker && notify-send 'The system has been updated'";
interval = "once"; # interval = "once";
tooltip = true; # tooltip = true;
return-type = "json"; # return-type = "json";
format = "{} {icon}"; # format = "{} {icon}";
format-icon = { # format-icon = {
"has-updates" = ""; # "has-updates" = "";
"updated" = " "; # "updated" = " ";
}; # };
}; # };
idle_inhibitor = { idle_inhibitor = {
format = "{icon}"; format = "{icon}";

View file

@ -1,4 +1,5 @@
_: _:
{ {
services.blueman.enable = true; services.blueman.enable = true;
services.hardware.bolt.enable = true;
} }

View file

@ -34,6 +34,7 @@
./xdg-portal.nix ./xdg-portal.nix
# ./yubikey-touch-detector.nix # ./yubikey-touch-detector.nix
./safeeyes.nix ./safeeyes.nix
./lid.nix
]; ];
nix = nix =

View file

@ -15,7 +15,6 @@
keyboard.qmk.enable = true; keyboard.qmk.enable = true;
pulseaudio = { pulseaudio = {
enable = lib.mkIf (!config.services.pipewire.enable) true; enable = lib.mkIf (!config.services.pipewire.enable) true;
package = pkgs.pulseaudioFull; package = pkgs.pulseaudioFull;

View file

@ -0,0 +1,26 @@
{ config, pkgs, ... }:
{
services.logind = {
lidSwitch = "suspend";
lidSwitchDocked = "ignore";
};
services.acpid = {
enable = true;
lidEventCommands =
''
export PATH=$PATH:/run/current-system/sw/bin
export WAYLAND_DISPLAY=wayland-1
export XDG_RUNTIME_DIR=/run/user/1000
export SWAYSOCK=$(ls /run/user/1000/sway-ipc.* | head -n 1)
LID_STATE=$(cat /proc/acpi/button/lid/*/state | grep -q closed && echo "closed" || echo "open")
DOCKED=$(swaymsg -t get_outputs | grep -q 'HDMI\|DP' && echo "docked" || echo "undocked")
if [ "$LID_STATE" == "closed" ] && [ "$DOCKED" == "docked" ]; then
swaymsg output eDP-2 disable
else
swaymsg output eDP-2 enable
fi
'';
};
}

View file

@ -6,6 +6,7 @@ _: {
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
audio.enable = true; audio.enable = true;
wireplumber.enable = true;
alsa = { alsa = {
enable = true; enable = true;
support32Bit = true; support32Bit = true;

View file

@ -6,7 +6,7 @@
isNormalUser = true; isNormalUser = true;
description = "Leon S"; description = "Leon S";
hashedPasswordFile = lib.mkIf (!config.swarselsystems.initialSetup) config.sops.secrets.swarseluser.path; hashedPasswordFile = lib.mkIf (!config.swarselsystems.initialSetup) config.sops.secrets.swarseluser.path;
extraGroups = [ "networkmanager" "root" "docker" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ]; extraGroups = [ "networkmanager" "docker" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ];
packages = with pkgs; [ ]; packages = with pkgs; [ ];
}; };
}; };

View file

@ -3,13 +3,15 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
stable.teams-for-linux stable.teams-for-linux
google-chrome
shellcheck shellcheck
dig dig
docker docker
]; ];
programs.ssh = { programs = {
git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
ssh = {
matchBlocks = { matchBlocks = {
"uc" = { "uc" = {
hostname = "uc.clip.vbc.ac.at"; hostname = "uc.clip.vbc.ac.at";
@ -33,7 +35,7 @@
}; };
}; };
programs.firefox = { firefox = {
profiles = { profiles = {
dc_adm = { dc_adm = {
id = 1; id = 1;
@ -269,6 +271,25 @@
}; };
}; };
chromium = {
enable = true;
package = pkgs.chromium;
extensions = [
# 1password
"gejiddohjgogedgjnonbofjigllpkmbf"
# dark reader
"eimadpbcbfnmbkopoojfekhnkhdbieeh"
# ublock origin
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
# i still dont care about cookies
"edibdbjcniadpccecjdfdjjppcpchdlm"
# browserpass
"naepdomgkenhinolocfifgehidddafch"
];
};
};
xdg.desktopEntries = xdg.desktopEntries =
let let
terminal = false; terminal = false;
@ -298,6 +319,5 @@
}; };
}; };
programs.git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
} }

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
# boot.initrd.luks.yubikeySupport = true; # boot.initrd.luks.yubikeySupport = true;
programs.browserpass.enable = true;
programs._1password.enable = true; programs._1password.enable = true;
programs._1password-gui = { programs._1password-gui = {
enable = true; enable = true;