diff --git a/absol/configuration.nix b/absol/configuration.nix index 1dc1bc0..67ee2a3 100755 --- a/absol/configuration.nix +++ b/absol/configuration.nix @@ -13,6 +13,30 @@ # optimize power usage 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 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" ''; + services.logind.extraConfig = '' + # don’t shutdown when power button is short-pressed + HandlePowerKey=lock + ''; + services.logind.lidSwitch = "lock"; + networking.hostName = "absol"; # networking.wireless.enable = true; networking.networkmanager.enable = true; @@ -70,14 +100,13 @@ console.keyMap = "us"; # Enable CUPS to print documents. - #services.avahi = { - # enable = true; - # nssmdns4 = true; - # openFirewall = true; - #}; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; services.printing = { enable = true; - # drivers = [ pkgs.splix ]; }; # bluetooth @@ -118,6 +147,7 @@ variant = "macchiato"; }; in [ + texliveFull # for connecting to nas nfs-utils @@ -134,7 +164,7 @@ # deps for hyprland / eww socat - texliveFull + xdg-desktop-portal-hyprland ]; system.stateVersion = "24.05"; diff --git a/absol/eww/default.nix b/absol/eww/default.nix index 1cf6995..0d6db80 100644 --- a/absol/eww/default.nix +++ b/absol/eww/default.nix @@ -4,4 +4,4 @@ enable = true; configDir = ./config; }; -} \ No newline at end of file +} diff --git a/absol/hypr/hypridle.conf b/absol/hypr/hypridle.conf new file mode 100644 index 0000000..f040781 --- /dev/null +++ b/absol/hypr/hypridle.conf @@ -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 +} diff --git a/absol/hypr/hyprland.nix b/absol/hypr/hyprland.nix index 843f37e..a5d4084 100644 --- a/absol/hypr/hyprland.nix +++ b/absol/hypr/hyprland.nix @@ -110,6 +110,9 @@ # scratchpad "$mod, C, togglespecialworkspace, scratchpad" + + # status bar + "$mod, T, exec, eww open --toggle top-bar" ]; bindm = [ "$mod, mouse:272, movewindow" @@ -124,8 +127,11 @@ ", XF86MonBrightnessDown, exec, brillo -q -U 5" ]; 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" + "systemctl --user import-environment" + "hypridle" ]; }; }; diff --git a/absol/hypr/hyprlock.conf b/absol/hypr/hyprlock.conf new file mode 100644 index 0000000..1bc2625 --- /dev/null +++ b/absol/hypr/hyprlock.conf @@ -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 = Input Password... # 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 = $FAIL ($ATTEMPTS) # 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 +} + diff --git a/absol/hypr/killer.sh b/absol/hypr/killer.sh new file mode 100755 index 0000000..bea0005 --- /dev/null +++ b/absol/hypr/killer.sh @@ -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 & diff --git a/absol/hypr/start.sh b/absol/hypr/start.sh index 8cf276b..fada238 100755 --- a/absol/hypr/start.sh +++ b/absol/hypr/start.sh @@ -3,11 +3,8 @@ # init nmapplet # TODO add back once eww supports tray # nm-applet --indicator & -swww init +swww init swww img /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg -eww daemon -eww open top-bar - # notification -mako +mako & diff --git a/absol/leonv.nix b/absol/leonv.nix index 80a67da..19bb06d 100755 --- a/absol/leonv.nix +++ b/absol/leonv.nix @@ -3,7 +3,7 @@ imports = [ ./../common ./hypr/hyprland.nix - # ./eww + ./eww ]; /* The home.stateVersion option does not have a default and must be set */ home.stateVersion = "24.05"; @@ -62,6 +62,8 @@ qimgv playerctl hyprpicker + hypridle + hyprlock wev inputs.hyprland-contrib.packages.${pkgs.system}.grimblast bluez @@ -91,6 +93,10 @@ 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 = { enable = true; shellAliases = {