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
# ./yubikey-touch-detector.nix
./safeeyes.nix
./lid.nix
];
nix =
@ -5013,7 +5014,7 @@ This ensures that all user-configuration happens here in the config file.
isNormalUser = true;
description = "Leon S";
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; [ ];
};
};
@ -5148,7 +5149,6 @@ Enable OpenGL, Sound, Bluetooth and various drivers.
keyboard.qmk.enable = true;
pulseaudio = {
enable = lib.mkIf (!config.services.pipewire.enable) true;
package = pkgs.pulseaudioFull;
@ -5187,6 +5187,7 @@ Pipewire handles communication on Wayland. This enables several sound tools as w
pulse.enable = true;
jack.enable = true;
audio.enable = true;
wireplumber.enable = true;
alsa = {
enable = true;
support32Bit = true;
@ -5748,6 +5749,7 @@ Enables the blueman service including the nice system tray icon.
_:
{
services.blueman.enable = true;
services.hardware.bolt.enable = true;
}
#+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
**** 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
:PROPERTIES:
@ -6420,6 +6455,7 @@ Integrates 1password mostly. There are more options at [[#h:f0b2ea93-94c8-48d8-8
{ pkgs, ... }:
{
# boot.initrd.luks.yubikeySupport = true;
programs.browserpass.enable = true;
programs._1password.enable = true;
programs._1password-gui = {
enable = true;
@ -6555,7 +6591,6 @@ This holds packages that I can use as provided, or with small modifications (as
picard-tools
audacity
sox
google-chrome
# printing
cups
@ -7710,18 +7745,18 @@ The rest of the related configuration is found here:
on-click = "xdg-open https://github.com/notifications";
};
"custom/nix-updates" = {
exec = "update-checker";
on-click = "update-checker && notify-send 'The system has been updated'";
interval = "once";
tooltip = true;
return-type = "json";
format = "{} {icon}";
format-icon = {
"has-updates" = "";
"updated" = " ";
};
};
# "custom/nix-updates" = {
# exec = "update-checker";
# on-click = "update-checker && notify-send 'The system has been updated'";
# interval = "once";
# tooltip = true;
# return-type = "json";
# format = "{} {icon}";
# format-icon = {
# "has-updates" = "";
# "updated" = " ";
# };
# };
idle_inhibitor = {
format = "{icon}";
@ -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+s" = "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}+Right" = "focus right";
"${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";
};
}
{
command = "opacity 0.99";
criteria = {
app_id = "chromium-browser";
};
}
{
command = "sticky enable, shadows enable";
criteria = {
@ -8561,13 +8606,15 @@ The rest of the settings is at [[#h:bbf2ecb6-c8ff-4462-b5d5-d45b28604ddf][work]]
{
home.packages = with pkgs; [
stable.teams-for-linux
google-chrome
shellcheck
dig
docker
];
programs.ssh = {
programs = {
git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
ssh = {
matchBlocks = {
"uc" = {
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 = {
dc_adm = {
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 =
let
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
audacity
sox
google-chrome
# printing
cups

View file

@ -80,6 +80,10 @@ in
"${modifier}+Ctrl+Shift+m" = "move container to workspace 11:M";
"${modifier}+Ctrl+s" = "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}+Right" = "focus right";
"${modifier}+Down" = "focus down";
@ -186,6 +190,12 @@ in
app_id = "firefox";
};
}
{
command = "opacity 0.99";
criteria = {
app_id = "chromium-browser";
};
}
{
command = "sticky enable, shadows enable";
criteria = {

View file

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

View file

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

View file

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

View file

@ -15,7 +15,6 @@
keyboard.qmk.enable = true;
pulseaudio = {
enable = lib.mkIf (!config.services.pipewire.enable) true;
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;
jack.enable = true;
audio.enable = true;
wireplumber.enable = true;
alsa = {
enable = true;
support32Bit = true;

View file

@ -6,7 +6,7 @@
isNormalUser = true;
description = "Leon S";
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; [ ];
};
};

View file

@ -3,13 +3,15 @@
{
home.packages = with pkgs; [
stable.teams-for-linux
google-chrome
shellcheck
dig
docker
];
programs.ssh = {
programs = {
git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
ssh = {
matchBlocks = {
"uc" = {
hostname = "uc.clip.vbc.ac.at";
@ -33,7 +35,7 @@
};
};
programs.firefox = {
firefox = {
profiles = {
dc_adm = {
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 =
let
terminal = false;
@ -298,6 +319,5 @@
};
};
programs.git.userEmail = "leon.schwarzaeugl@imba.oeaw.ac.at";
}

View file

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