From d6c84e8b89440d9a31e6acfdd0d66092528e1948 Mon Sep 17 00:00:00 2001
From: Siraaj Khandkar <siraaj@khandkar.net>
Date: Thu, 13 Jan 2022 14:03:34 -0500
Subject: [PATCH] Track X session launchers

---
 home/.xinitrc                      | 12 ++++++++++++
 home/.xlaunch                      | 26 ++++++++++++++++++++++++++
 home/.xlaunch.d.citadel/compositor |  8 ++++++++
 home/.xlaunch.d/setxkbmap          | 19 +++++++++++++++++++
 4 files changed, 65 insertions(+)
 create mode 100755 home/.xinitrc
 create mode 100755 home/.xlaunch
 create mode 100755 home/.xlaunch.d.citadel/compositor
 create mode 100755 home/.xlaunch.d/setxkbmap

diff --git a/home/.xinitrc b/home/.xinitrc
new file mode 100755
index 0000000..a329c4b
--- /dev/null
+++ b/home/.xinitrc
@@ -0,0 +1,12 @@
+#! /bin/bash
+
+set -e
+
+if which systemd; then
+    opt_systemd='--systemd'
+else
+    opt_systemd=''
+fi
+
+dbus-update-activation-environment $opt_systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
+exec dbus-launch --sh-syntax --exit-with-session ~/.xlaunch
diff --git a/home/.xlaunch b/home/.xlaunch
new file mode 100755
index 0000000..be3cc36
--- /dev/null
+++ b/home/.xlaunch
@@ -0,0 +1,26 @@
+#! /bin/bash
+
+set -e
+
+
+launch_common() {
+    xbindkeys
+    xscreensaver &
+    mpd --kill || true
+    mpd
+    for script in ~/.xlaunch.d/*; do
+        "$script"
+    done
+}
+
+launch_specialized() {
+    # XXX dunst lazily started by dbus
+    for script in ~/.xlaunch.d."$(hostname)"/*; do
+        "$script"
+    done
+}
+
+launch_common
+launch_specialized
+
+exec dwm
diff --git a/home/.xlaunch.d.citadel/compositor b/home/.xlaunch.d.citadel/compositor
new file mode 100755
index 0000000..434b4b8
--- /dev/null
+++ b/home/.xlaunch.d.citadel/compositor
@@ -0,0 +1,8 @@
+#! /bin/bash
+
+picom \
+    --shadow \
+    --active-opacity=0.95 \
+    --inactive-opacity=0.8 \
+    --config ~/.compton.conf \
+    &
diff --git a/home/.xlaunch.d/setxkbmap b/home/.xlaunch.d/setxkbmap
new file mode 100755
index 0000000..62495c6
--- /dev/null
+++ b/home/.xlaunch.d/setxkbmap
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+set -e
+
+#-- Keyboard layout
+# From setxkbmap man page:
+#     > Note that setxkbmap adds options specified in the command line to the
+#     > options that were set before (as saved in root window  proper‐ ties).
+#     > If you want to replace all previously specified options, use the
+#     > -option flag with an empty argument first.
+#setxkbmap -layout us,ru,el -variant ',phonetic_winkeys,' -option ''
+#setxkbmap -layout us,ru,el -variant ',phonetic_winkeys,' -option grp:ctrls_toggle
+setxkbmap -layout us,ru -variant ',phonetic_winkeys' -option ''
+setxkbmap -layout us,ru -variant ',phonetic_winkeys' -option grp:ctrls_toggle
+
+#xmodmap -e 'remove lock = Caps_Lock'
+#setxkbmap -option ctrl:nocaps
+
+setxkbmap -option caps:ctrl_modifier
-- 
2.20.1