From b7060ee406afb7551dc50132f64a9b06fc730bd5 Mon Sep 17 00:00:00 2001 From: Adam Gausmann Date: Tue, 29 Jul 2025 10:56:55 -0500 Subject: [PATCH] Fix lock screen display power timeout on niri --- install.py | 4 ++-- templates/.config/niri/config.kdl.j2 | 1 + templates/bin/jdisplays | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 templates/bin/jdisplays diff --git a/install.py b/install.py index 6c592f3..d125dea 100755 --- a/install.py +++ b/install.py @@ -165,8 +165,8 @@ class HostConfig: temperature_path: str | None = None terminal: str = "alacritty" lock_cmd: str = "swaylock -c 000000" - display_on_cmd: str = "wlopm --on *" - display_off_cmd: str = "wlopm --off *" + display_on_cmd: str = "jdisplays on" + display_off_cmd: str = "jdisplays off" use_jump_host: bool = False inputs: list[InputConfig] = field(factory=list) outputs: list[OutputConfig] = field(factory=list) diff --git a/templates/.config/niri/config.kdl.j2 b/templates/.config/niri/config.kdl.j2 index 038743c..562ba51 100644 --- a/templates/.config/niri/config.kdl.j2 +++ b/templates/.config/niri/config.kdl.j2 @@ -192,6 +192,7 @@ spawn-at-startup "wireplumber" spawn-at-startup "waybar" spawn-at-startup "xwayland-satellite" ":12" spawn-at-startup "wpaperd" +spawn-at-startup "swayidle" environment { DISPLAY ":12" diff --git a/templates/bin/jdisplays b/templates/bin/jdisplays new file mode 100755 index 0000000..0ea12b0 --- /dev/null +++ b/templates/bin/jdisplays @@ -0,0 +1,14 @@ +#!/bin/sh + +case "$1" in + 0|off) onoff=off ;; + 1|on) onoff=on ;; + *) exit 1 ;; +esac + +if [ -e "$NIRI_SOCKET" ] +then + niri msg action power-$onoff-monitors +else + wlopm --$onoff '*' +fi