/ de-omarchy / config / hypr / deo-autostart.lua
swadhinbiswas Fix: init o global via helpers.lua + launch shell on reload (not only hyprland.start) · 8/22/2026
9fab3c1
40 lines · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- ============================================================================
--  de-omarchy shell bridge
--
--  Hands the desktop over to the Omarchy Quickshell shell when the layer is
--  active, without editing the host autostart:
--    * stops any previous quickshell instance (moonshell / ii configs)
--    * stops the host's hypridle so Omarchy's shell owns idle/lock timing
--      (host hyprlock config is kept and reused for the lock UI)
--    * dedupes cliphist watchers (host execs already start two)
--  Then loads stock Omarchy autostart (shell supervisor, monitor watch,
--  udiskie, power profiles, post-boot hooks).
--
--  The supervisor is launched BOTH on session start (`hyprland.start`) and
--  immediately, so a plain `hyprctl reload` also brings the shell up — the
--  upstream autostart only hooks `hyprland.start`, which does not fire on
--  reload.
-- ============================================================================

local function kill_old_shell()
  hl.exec_cmd(
    "pkill -f 'quickshell.*-c moonshell' 2>/dev/null"
      .. "; pkill -f 'moonshell shell' 2>/dev/null"
      .. "; pkill -x hypridle 2>/dev/null"
      .. "; pkill -f 'wl-paste --type text --watch cliphist' 2>/dev/null"
      .. "; pkill -f 'wl-paste --type image --watch cliphist' 2>/dev/null"
      .. "; wl-paste --type text --watch cliphist store &"
      .. "; wl-paste --type image --watch cliphist store &"
      .. "; true"
  )
end

hl.on("hyprland.start", function()
  kill_old_shell()
  require("default.hypr.autostart")
end)

-- Also launch now so `hyprctl reload` (no fresh session) starts the shell.
kill_old_shell()
hl.exec_cmd("omarchy-launch-shell")