From 2ea657e4c7ba17b9c96d8337a2a9bf71c89ab157 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 9 Mar 2024 19:37:27 -0500
Subject: linhes-system: lh_system_start.sh: split out apply_UI_settings to
 seperate script

lh_apply_UI_settings.sh: add sddm settings
---
 linhes/linhes-system/PKGBUILD                |  7 ++---
 linhes/linhes-system/lh_apply_UI_settings.sh | 39 ++++++++++++++++++++++++++++
 linhes/linhes-system/lh_system_start.sh      | 19 +++-----------
 3 files changed, 46 insertions(+), 19 deletions(-)
 create mode 100755 linhes/linhes-system/lh_apply_UI_settings.sh

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index 942975d..c87bfb6 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=76
+pkgrel=77
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -14,7 +14,7 @@ binfiles="add_storage.py balance_storage_groups.py empty_storage_groups.py remov
           checkXFSfrag.sh enableIRWake.sh idle.py lh_system_start.sh lh_notify-send
           lh_home_check.sh lh_myth_status.py lh_system_backup lh_system_backup_job
           jobqueue_helper.py gen_lib_xml.py lh_setup_fileshare.py lh_restart_needed.sh
-          diskspace.sh find_orphans.py optimize_mythdb.py lh_mtc.py
+          diskspace.sh find_orphans.py optimize_mythdb.py lh_mtc.py lh_apply_UI_settings.sh
           misc_recent_recordings.pl misc_status_config.py misc_status_info.sh
           misc_upcoming_recordings.pl misc_which_recorder.pl plexmediascanner.sh
           create_media_dirs.sh be_check.py
@@ -33,7 +33,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             '8b54c31b8efde3917f603c5307bebb0a2a00239ad9a983c2f5d8120003256449'
             'ae34515e144830f424d3bd3f6b1b446892d62beed20bca6f0fb19b0bbb779f27'
             '5e6d128f879b0fe7c1a190cccd75d4e5d00afc161f3bc9e92ffa2d87242cc9df'
-            'd3f6a06df2ff79592fa746d91aa094cd0fd1cad72c98b4db9b6e21a86fe4583a'
+            '3db3620b3430d1e8031596efa9eb50dea7f4c1b837c37929c3743c1eb65ac666'
             '6d4fb0ed1a5ed961b3a3884dce093118e50c2981a9cd5837d20abc5a6d4fd8aa'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833'
@@ -47,6 +47,7 @@ sha256sums=('e6eaa2fb4819fa60cb05b4d2e7328d2914af3a73028a735ec4d56e7ece33ecc0'
             'cd3306991c8b63f5402c0e52405cc1a6581cb3c42af74b7c2f879c8192f95610'
             'e371c6a289c68fe200d7da856c20a8c579efa23178f4d62235f7359d7f6e49a1'
             'ee9a4df83e463e0c8a2e862680a83cff07a36cf3606faf60f57bc11190ffb1c9'
+            'be52026eee470d70dcbf3ab364ef8ec92155b7990f589526928d46873cc72cdf'
             'd2d69b2bf6315bd37ff5f5b2f0cde8ab2fb89bae18f8796dc5208ffc1a9d743e'
             'a745356952470a5d718bef1961309ea30e4fa6a2860961cd52e09d6ec11e708e'
             '1819085bd2c9106482c5f243b95fddf3dae69212330ab76cb493add5c26a45a4'
diff --git a/linhes/linhes-system/lh_apply_UI_settings.sh b/linhes/linhes-system/lh_apply_UI_settings.sh
new file mode 100755
index 0000000..2cf98a1
--- /dev/null
+++ b/linhes/linhes-system/lh_apply_UI_settings.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+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 --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
+
+plasma-apply-wallpaperimage /usr/share/linhes/templates/lights-bud-abstract-4k-cq.jpg
+
+#sddm settings
+if grep -Fxq "User=km" /etc/sddm.conf.d/autologin.conf; then
+    echo "Updating /etc/sddm.conf.d/autologin.conf"
+    echo "[Autologin]" | sudo tee /etc/sddm.conf.d/autologin.conf
+    echo "User=$(whoami)" | sudo tee -a /etc/sddm.conf.d/autologin.conf
+    echo "Session=plasmax11" | sudo tee -a /etc/sddm.conf.d/autologin.conf
+fi
+
+if [ -f "/etc/sddm.conf" ]; then
+    sudo rm /etc/sddm.conf
+fi
+
+if [ ! -f "/etc/sddm.conf.d/theme.conf" ]; then
+    echo "[General]" | sudo tee /etc/sddm.conf.d/theme.conf
+    echo "Numlock=on" | sudo tee -a /etc/sddm.conf.d/theme.conf
+
+    echo "[Theme]" | sudo tee /etc/sddm.conf.d/theme.conf
+    echo "Current=breeze" | sudo tee -a /etc/sddm.conf.d/theme.conf
+    echo "CursorTheme=breeze_cursors" | sudo tee -a /etc/sddm.conf.d/theme.conf
+    echo "Font=Noto Sans,10,-1,0,400,0,0,0,0,0,0,0,0,0,0,1" | sudo tee -a /etc/sddm.conf.d/theme.conf
+fi
+
+#disable file indexing
+balooctl6 disable
diff --git a/linhes/linhes-system/lh_system_start.sh b/linhes/linhes-system/lh_system_start.sh
index 044a82c..3cbf5dc 100755
--- a/linhes/linhes-system/lh_system_start.sh
+++ b/linhes/linhes-system/lh_system_start.sh
@@ -17,20 +17,7 @@ function check_installer_user(){
 }
 
 function applyUIsettings(){
-    cp /usr/share/linhes/templates/plasma-org.kde.plasma.desktop-appletsrc ~/.config/
-    #restart plasma - disable as it seems to stop execution of this script
-    #kquitapp5 plasmashell
-    #kstart5 plasmashell > /dev/null 2>&1
-    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 ~/.powermanagementprofilesrc --group AC --group DPMSControl --key idleTime --delete
-    #disable file indexing
-    balooctl disable
-    sleep 2
-    plasma-apply-wallpaperimage /usr/share/linhes/templates/lights-bud-abstract-4k-cq.jpg
+    /usr/bin/lh_apply_UI_settings.sh
     msg "Welcome to LinHES 9!"
 }
 
@@ -101,8 +88,6 @@ function localweb_setup(){
 function first_configure(){
     if [ ! -f ~/.config/lh_configured ]; then
         msg "New install of LinHES. Starting setup."
-        #apply settings for all system types
-        applyUIsettings
         install_lh_apps
         nanorc_setup
         bashrc_setup
@@ -165,6 +150,8 @@ function start_myth() {
 
 #-------MAIN-------
 check_installer_user
+#apply settings for all system types
+applyUIsettings
 first_configure
 /usr/bin/enableIRWake.sh &
 storage_scan
-- 
cgit v0.12

