diff --git a/modules/optional/xserver.nix b/modules/optional/xserver.nix index 0c58fa9..e559fe7 100644 --- a/modules/optional/xserver.nix +++ b/modules/optional/xserver.nix @@ -1,6 +1,8 @@ { + pkgs, lib, minimal, + config, ... }: lib.optionalAttrs (!minimal) { @@ -26,4 +28,21 @@ lib.optionalAttrs (!minimal) { }; }; services.autorandr.enable = true; + services.udev.extraRules = let + exe = + pkgs.writeShellScript "set-key-repeat" + '' + if [ -d "/tmp/.X11-unix" ]; then + for D in /tmp/.X11-unix/*; do + file=$(${pkgs.coreutils}/bin/basename $D) + export DISPLAY=":''${file:1}" + user=$(${pkgs.coreutils}/bin/stat -c '%U' "$D") + ${pkgs.util-linux}/bin/runuser -u "$user" -- ${pkgs.xorg.xset}/bin/xset r rate \ + ${toString config.services.xserver.autoRepeatDelay} ${toString config.services.xserver.autoRepeatInterval} + done + fi + ''; + in '' + ACTION=="add", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", RUN+="${exe}" + ''; } diff --git a/users/common/graphical/Xorg/wallpapers.nix b/users/common/graphical/Xorg/wallpapers.nix index 9c9aa46..05aaf3a 100644 --- a/users/common/graphical/Xorg/wallpapers.nix +++ b/users/common/graphical/Xorg/wallpapers.nix @@ -7,12 +7,7 @@ exe = pkgs.writeShellScript "set-wallpaper" '' - if [ -d "/tmp/.X11-unix" ]; then - for D in /tmp/.X11-unix/*; do - file=$(${pkgs.coreutils}/bin/basename $D) - DISPLAY=":''${file:1}" ${pkgs.feh}/bin/feh --no-fehbg --bg-fill --randomize --recursive ${wallpaper-folder}/ - done - fi + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill --randomize --recursive ${wallpaper-folder}/ ''; in { systemd.user = { @@ -22,7 +17,6 @@ in { Description = "Set a random wallpaper every 3 minutes"; }; Timer = { - OnActiveSec = "2 sec"; OnUnitActiveSec = "3 min"; }; Install.WantedBy = ["timers.target"]; @@ -38,6 +32,7 @@ in { ExecStart = exe; }; + Install.WantedBy = ["graphical-session.target"]; }; }; }; diff --git a/users/common/graphical/Xorg/xinitrc b/users/common/graphical/Xorg/xinitrc index 240f0f9..889f51c 100644 --- a/users/common/graphical/Xorg/xinitrc +++ b/users/common/graphical/Xorg/xinitrc @@ -4,11 +4,6 @@ # # Executed by startx (run your window manager from here) -xset m 1 0 -xsetroot -solid '#000000' -# -xset r rate 235 60 - # copied from nixos wiki # https://nixos.wiki/wiki/Using_X_without_a_Display_Manager if test -z "$DBUS_SESSION_BUS_ADDRESS"; then @@ -20,7 +15,4 @@ if command -v dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment DISPLAY XAUTHORITY fi -autorandr -c -streamdeck --no-ui & -systemctl --user start set-wallpaper.timer & exec i3 diff --git a/users/patrick/streamdeck.nix b/users/patrick/streamdeck.nix index 46d36db..af7c6ab 100644 --- a/users/patrick/streamdeck.nix +++ b/users/patrick/streamdeck.nix @@ -1,4 +1,8 @@ -{config, ...}: { +{ + config, + pkgs, + ... +}: { programs.streamdeck-ui = { enable = true; settings = { @@ -70,4 +74,18 @@ }; }; }; + systemd.user = { + services = { + streamdeck-ui = { + Unit = { + Description = "start streamdeck-ui"; + }; + Service = { + Type = "exec"; + ExecStart = "${pkgs.streamdeck-ui}/bin/streamdeck-ui --no-ui"; + }; + Install.WantedBy = ["graphical-session.target"]; + }; + }; + }; }