From 2f9cd04b34011c520ae42ff5b665dff2c6392d90 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 1 Jan 2025 01:46:17 -0500
Subject: linhes-system: lh_notify-send: change method to determing the display
 number

lh_apply_UI_settings.sh: change all cmds to use kwriteconfig6
---
 linhes/linhes-system/PKGBUILD                |  6 +++---
 linhes/linhes-system/lh_apply_UI_settings.sh | 10 +++++-----
 linhes/linhes-system/lh_notify-send          | 19 +++++++++++++------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index a425654..d220859 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=80
+pkgrel=81
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -34,7 +34,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             'ae34515e144830f424d3bd3f6b1b446892d62beed20bca6f0fb19b0bbb779f27'
             '9e52a21e9d0f3f993b819587256a1cd57dca04451d5f2d0fd76667b1d3f860f1'
             '3db3620b3430d1e8031596efa9eb50dea7f4c1b837c37929c3743c1eb65ac666'
-            '6d4fb0ed1a5ed961b3a3884dce093118e50c2981a9cd5837d20abc5a6d4fd8aa'
+            '1c36e4fdf41c1063e0a127ce4a90fbdef19879c381a87f622d7399ca931560cc'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833'
             'a523388ffdc6f30f2dd2ef4803b21bded8a35bfded499dc66b786adec71840a3'
@@ -47,7 +47,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             'cd3306991c8b63f5402c0e52405cc1a6581cb3c42af74b7c2f879c8192f95610'
             'e371c6a289c68fe200d7da856c20a8c579efa23178f4d62235f7359d7f6e49a1'
             'ee9a4df83e463e0c8a2e862680a83cff07a36cf3606faf60f57bc11190ffb1c9'
-            'be52026eee470d70dcbf3ab364ef8ec92155b7990f589526928d46873cc72cdf'
+            '88f023b94c0522189ae4acb40a2d5204e81fec8af430696e2b7cab9615809614'
             'd2d69b2bf6315bd37ff5f5b2f0cde8ab2fb89bae18f8796dc5208ffc1a9d743e'
             'a745356952470a5d718bef1961309ea30e4fa6a2860961cd52e09d6ec11e708e'
             '1819085bd2c9106482c5f243b95fddf3dae69212330ab76cb493add5c26a45a4'
diff --git a/linhes/linhes-system/lh_apply_UI_settings.sh b/linhes/linhes-system/lh_apply_UI_settings.sh
index 2cf98a1..2a8250d 100755
--- a/linhes/linhes-system/lh_apply_UI_settings.sh
+++ b/linhes/linhes-system/lh_apply_UI_settings.sh
@@ -2,11 +2,11 @@
 
 cp /usr/share/linhes/templates/plasma-org.kde.plasma.desktop-appletsrc ~/.config/
 plasma-apply-colorscheme BreezeDark
-kwriteconfig5 --group KDE --key SingleClick false
-kwriteconfig5 --file ~/.config/kscreenlockerrc --group Daemon --key Autolock false
-kwriteconfig5 --file ~/.config/kscreenlockerrc --group Daemon --key LockOnResume false
-kwriteconfig5 --file ~/.config/ksmserverrc --group General --key loginMode emptySession
-kwriteconfig5 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime --delete
+kwriteconfig6 --group KDE --key SingleClick false
+kwriteconfig6 --file ~/.config/kscreenlockerrc --group Daemon --key Autolock false
+kwriteconfig6 --file ~/.config/kscreenlockerrc --group Daemon --key LockOnResume false
+kwriteconfig6 --file ~/.config/ksmserverrc --group General --key loginMode emptySession
+kwriteconfig6 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime --delete
 kwriteconfig6 --file ~/.powerdevilrc --group AC --group Display --key DimDisplayWhenIdle false
 kwriteconfig6 --file ~/.powerdevilrc --group AC --group Display --key TurnOffDisplayWhenIdle false
 kwriteconfig6 --file ~/.powerdevilrc --group AC --group SuspendAndShutdown --key AutoSuspendAction 0
diff --git a/linhes/linhes-system/lh_notify-send b/linhes/linhes-system/lh_notify-send
index dd98ede..0a11de8 100755
--- a/linhes/linhes-system/lh_notify-send
+++ b/linhes/linhes-system/lh_notify-send
@@ -1,12 +1,19 @@
 #!/bin/bash
 
-#Detect the name of the display in use
-display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
-
-#Detect the user using such display
-user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
+#Detect the name of the display in use from 0 to 10
+for i in {0..10};
+do
+    #Detect the user using such display
+    user=$(who | grep "(:${i})" | awk '{print $1}' | head -n 1)
+    if [[ ! -z "$user" ]];
+    then
+        display="DISPLAY=:${i}"
+        break
+    fi
+done
 
 #Detect the id of the user
 uid=$(id -u $user)
 
-sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
+
+sudo -u $user $display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@"
-- 
cgit v0.12