mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-24 13:11:53 -05:00
lavaridge: add support for dynamic resolution based on charging status
Some checks are pending
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
Some checks are pending
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
This commit is contained in:
parent
574c4ffa9e
commit
9a1723535e
|
@ -2,6 +2,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
@ -39,6 +40,31 @@
|
||||||
environment.variables.GDK_SCALE = "2";
|
environment.variables.GDK_SCALE = "2";
|
||||||
networking.hostName = "lavaridge";
|
networking.hostName = "lavaridge";
|
||||||
programs.firefox.policies.Preferences."media.ffmpeg.vaapi.enabled" = lib.mkForce false;
|
programs.firefox.policies.Preferences."media.ffmpeg.vaapi.enabled" = lib.mkForce false;
|
||||||
|
|
||||||
|
services.udev.extraRules = let
|
||||||
|
hyprlandDynamicRes = pkgs.writeShellScript "hyprland-dynamic-resolution" ''
|
||||||
|
MON="eDP-1"
|
||||||
|
RES="2880x1920"
|
||||||
|
|
||||||
|
for dir in /run/user/*; do
|
||||||
|
for hypr_dir in "$dir/hypr/"*/; do
|
||||||
|
socket="''${hypr_dir}.socket.sock"
|
||||||
|
if [[ -S $socket ]]; then
|
||||||
|
monitor_info=$(echo -e "monitors" | ${lib.getExe pkgs.socat} - UNIX-CONNECT:"$socket")
|
||||||
|
|
||||||
|
if echo "$monitor_info" | grep -q "$MON"; then
|
||||||
|
echo -e "keyword monitor $MON, $RES@$1, 0x0, 2, vrr, $2" | ${lib.getExe pkgs.socat} - UNIX-CONNECT:"$socket"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
in ''
|
||||||
|
SUBSYSTEM=="power_supply", ATTR{online}=="1", ACTION=="change", RUN+="${hyprlandDynamicRes} 120 1"
|
||||||
|
SUBSYSTEM=="power_supply", ATTR{online}=="0", ACTION=="change", RUN+="${hyprlandDynamicRes} 60 0"
|
||||||
|
'';
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
ar = {
|
ar = {
|
||||||
|
|
Loading…
Reference in a new issue