add hypridle+lock, setup printing, make eww a toggle

This commit is contained in:
Leon Vatthauer 2024-05-13 08:40:09 +02:00
parent 30021a9998
commit 5c2a2c611b
Signed by: leonv
SSH key fingerprint: SHA256:G4+ddwoZmhLPRB1agvXzZMXIzkVJ36dUYZXf5NxT+u8
8 changed files with 166 additions and 15 deletions

View file

@ -13,6 +13,30 @@
# optimize power usage # optimize power usage
powerManagement.enable = true; powerManagement.enable = true;
# prevent overheat
services.thermald.enable = true;
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
#Optional helps save long term battery health
START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
# optimize storage # optimize storage
nix.optimise.automatic = true; nix.optimise.automatic = true;
@ -26,6 +50,12 @@
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness" ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
''; '';
services.logind.extraConfig = ''
# dont shutdown when power button is short-pressed
HandlePowerKey=lock
'';
services.logind.lidSwitch = "lock";
networking.hostName = "absol"; networking.hostName = "absol";
# networking.wireless.enable = true; # networking.wireless.enable = true;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -70,14 +100,13 @@
console.keyMap = "us"; console.keyMap = "us";
# Enable CUPS to print documents. # Enable CUPS to print documents.
#services.avahi = { services.avahi = {
# enable = true; enable = true;
# nssmdns4 = true; nssmdns4 = true;
# openFirewall = true; openFirewall = true;
#}; };
services.printing = { services.printing = {
enable = true; enable = true;
# drivers = [ pkgs.splix ];
}; };
# bluetooth # bluetooth
@ -118,6 +147,7 @@
variant = "macchiato"; variant = "macchiato";
}; };
in [ in [
texliveFull
# for connecting to nas # for connecting to nas
nfs-utils nfs-utils
@ -134,7 +164,7 @@
# deps for hyprland / eww # deps for hyprland / eww
socat socat
texliveFull xdg-desktop-portal-hyprland
]; ];
system.stateVersion = "24.05"; system.stateVersion = "24.05";

34
absol/hypr/hypridle.conf Normal file
View file

@ -0,0 +1,34 @@
general {
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
before_sleep_cmd = loginctl lock-session # lock before suspend.
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
}
#listener {
# timeout = 150 # 2.5min.
# on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor.
# on-resume = brightnessctl -r # monitor backlight restore.
#}
# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
#listener {
# timeout = 150 # 2.5min.
# on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight.
# on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight.
#}
listener {
timeout = 300 # 5min
on-timeout = loginctl lock-session # lock screen when timeout has passed
}
listener {
timeout = 330 # 5.5min
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed
on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired.
}
listener {
timeout = 1800 # 30min
on-timeout = systemctl suspend # suspend pc
}

View file

@ -110,6 +110,9 @@
# scratchpad # scratchpad
"$mod, C, togglespecialworkspace, scratchpad" "$mod, C, togglespecialworkspace, scratchpad"
# status bar
"$mod, T, exec, eww open --toggle top-bar"
]; ];
bindm = [ bindm = [
"$mod, mouse:272, movewindow" "$mod, mouse:272, movewindow"
@ -124,8 +127,11 @@
", XF86MonBrightnessDown, exec, brillo -q -U 5" ", XF86MonBrightnessDown, exec, brillo -q -U 5"
]; ];
exec-once = [ exec-once = [
"bash ~/Git/nixos/absol/hypr/start.sh" "/home/leonv/Git/nixos/absol/hypr/killer.sh"
"/home/leonv/Git/nixos/absol/hypr/start.sh"
"hyprctl setcursor Bibata-Original-Classic 48" "hyprctl setcursor Bibata-Original-Classic 48"
"systemctl --user import-environment"
"hypridle"
]; ];
}; };
}; };

70
absol/hypr/hyprlock.conf Normal file
View file

@ -0,0 +1,70 @@
# GENERAL
general {
disable_loading_bar = true
hide_cursor = true
}
# BACKGROUND
background {
monitor =
path = /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg
blur_passes = 2
}
# TIME
label {
monitor =
text = cmd[update:30000] echo "$(date +"%R")"
# color = $text
font_size = 90
# font_family = $font
position = -130, -100
halign = right
valign = top
shadow_passes = 2
}
# DATE
label {
monitor =
text = cmd[update:43200000] echo "$(date +"%A, %d %B %Y")"
# color = $text
font_size = 25
# font_family = $font
position = -130, -250
halign = right
valign = top
shadow_passes = 2
}
input-field {
monitor =
size = 200, 50
outline_thickness = 3
dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = false
dots_rounding = -1 # -1 default circle, -2 follow input-field rounding
outer_color = rgb(151515)
inner_color = rgb(200, 200, 200)
font_color = rgb(10, 10, 10)
fade_on_empty = true
fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered.
placeholder_text = <i>Input Password...</i> # Text rendered in the input box when it's empty.
hide_input = false
rounding = -1 # -1 means complete rounding (circle/oval)
check_color = rgb(204, 136, 34)
fail_color = rgb(204, 34, 34) # if authentication failed, changes outer_color and fail message color
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> # can be set to empty
fail_transition = 300 # transition time in ms between normal outer_color and fail_color
capslock_color = -1
numlock_color = -1
bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above)
invert_numlock = false # change color if numlock is off
swap_font_color = false # see below
position = 0, -20
halign = center
valign = center
}

8
absol/hypr/killer.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
sleep 1
killall -e xdg-desktop-portal-hyprland
killall -e xdg-desktop-portal-wlr
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 2
/usr/lib/xdg-desktop-portal &

View file

@ -6,8 +6,5 @@
swww init swww init
swww img /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg swww img /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg
eww daemon
eww open top-bar
# notification # notification
mako mako &

View file

@ -3,7 +3,7 @@
imports = [ imports = [
./../common ./../common
./hypr/hyprland.nix ./hypr/hyprland.nix
# ./eww ./eww
]; ];
/* The home.stateVersion option does not have a default and must be set */ /* The home.stateVersion option does not have a default and must be set */
home.stateVersion = "24.05"; home.stateVersion = "24.05";
@ -62,6 +62,8 @@
qimgv qimgv
playerctl playerctl
hyprpicker hyprpicker
hypridle
hyprlock
wev wev
inputs.hyprland-contrib.packages.${pkgs.system}.grimblast inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
bluez bluez
@ -91,6 +93,10 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
xdg.configHome = /home/leonv/.config;
xdg.configFile."hypr/hypridle.conf".source = ./hypr/hypridle.conf;
xdg.configFile."hypr/hyprlock.conf".source = ./hypr/hyprlock.conf;
programs.zsh = { programs.zsh = {
enable = true; enable = true;
shellAliases = { shellAliases = {