From 960ab8cc5d8687f572d571ee646e11cf3bbedab4 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Fri, 28 Apr 2023 18:08:25 +0200
Subject: Make updates to run KDE as desired in both openrc and systemd
---
.config/systemd/user/plasma-herbstluftwm_x11.service | 11 +++++++++++
.config/systemd/user/plasma-kwin_x11.service | 1 +
.local/bin/herbstluftwm | 1 +
.local/bin/x | 7 +------
.local/etc/wrapper.d/herbstluftwm.sh | 6 ++++++
.local/etc/x/xinit.d/kde.rc | 13 +++++++++++++
6 files changed, 33 insertions(+), 6 deletions(-)
create mode 100644 .config/systemd/user/plasma-herbstluftwm_x11.service
create mode 120000 .config/systemd/user/plasma-kwin_x11.service
create mode 120000 .local/bin/herbstluftwm
create mode 100644 .local/etc/wrapper.d/herbstluftwm.sh
create mode 100644 .local/etc/x/xinit.d/kde.rc
diff --git a/.config/systemd/user/plasma-herbstluftwm_x11.service b/.config/systemd/user/plasma-herbstluftwm_x11.service
new file mode 100644
index 0000000..d18f09e
--- /dev/null
+++ b/.config/systemd/user/plasma-herbstluftwm_x11.service
@@ -0,0 +1,11 @@
+[Install]
+WantedBy=plasma-workspace.target
+
+[Unit]
+Description = KDE Plasma with HerbstluftWM
+Before = plasma-workspace.target
+
+[Service]
+ExecStart = %h/.local/bin/herbstluftwm
+Slice = session.slice
+Restart = on-failure
diff --git a/.config/systemd/user/plasma-kwin_x11.service b/.config/systemd/user/plasma-kwin_x11.service
new file mode 120000
index 0000000..dc1dc0c
--- /dev/null
+++ b/.config/systemd/user/plasma-kwin_x11.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/.local/bin/herbstluftwm b/.local/bin/herbstluftwm
new file mode 120000
index 0000000..3da827c
--- /dev/null
+++ b/.local/bin/herbstluftwm
@@ -0,0 +1 @@
+../share/wrapper.sh
\ No newline at end of file
diff --git a/.local/bin/x b/.local/bin/x
index ed5e26f..d00fda0 100755
--- a/.local/bin/x
+++ b/.local/bin/x
@@ -12,12 +12,7 @@ then
exit 1
fi
- # Remove the old config
- rm -f -- "$HOME/.xinitrc"
-
- # Add the base configuration
- cat -- "$HOME/.local/etc/x/xinitrc" "$HOME/.local/etc/x/xinit.d/$1.rc" \
- >> "$HOME/.xinitrc"
+ cp -v -- "$HOME/.local/etc/x/xinit.d/$1.rc" "$HOME/.xinitrc"
fi
# Make sure the xinitrc exists, just in case
diff --git a/.local/etc/wrapper.d/herbstluftwm.sh b/.local/etc/wrapper.d/herbstluftwm.sh
new file mode 100644
index 0000000..d213bc7
--- /dev/null
+++ b/.local/etc/wrapper.d/herbstluftwm.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+WRAPPER_BINS="
+ /run/current-system/sw/bin/herbstluftwm
+ /usr/bin/herbstluftwm
+"
diff --git a/.local/etc/x/xinit.d/kde.rc b/.local/etc/x/xinit.d/kde.rc
new file mode 100644
index 0000000..f023808
--- /dev/null
+++ b/.local/etc/x/xinit.d/kde.rc
@@ -0,0 +1,13 @@
+# start dbus if necessary
+[ -f "/etc/X11/xinit/xinitrc.d/80-dbus" ] && source /etc/X11/xinit/xinitrc.d/80-dbus
+
+# Background services
+xcompmgr &
+redshift -l 51.50:4.59 &
+
+# Export additional environment vars
+export KDEWM=hersbtluftwm
+export WINIT_X11_SCALE_FACTOR=1
+
+# Start KDE
+exec dbus-launch --exit-with-session startplasma-x11
--
cgit v1.1