Skip to content

Commit

Permalink
Wait to startup mcg until xmonad has gotten a little further
Browse files Browse the repository at this point in the history
This is a quick'n'dirty workaround for
xmonad/xmonad#422. Hopefully a better answer
shows up there someday.
  • Loading branch information
jfly committed Sep 26, 2022
1 parent 4bf96ed commit 6a25547
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pattern/audio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,26 @@ in
XDG_RUNTIME_DIR = "/run/user/${builtins.toString config.snow.user.uid}";
};

systemd.user.targets = {
# This xmonad target just exists as a workaround for
# https://github.com/xmonad/xmonad/issues/422.
# See shared/xmonad/xmonad.hs for where this target gets triggered.
"xmonad" = {
enable = true;
partOf = [ "graphical-session.target" ];
};
};
systemd.user.services = {
"mcg" = {
enable = true;
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];

# We can't use graphical-session because of
# https://github.com/xmonad/xmonad/issues/422.
# wantedBy = [ "graphical-session.target" ];
# partOf = [ "graphical-session.target" ];
wantedBy = [ "xmonad.target" ];
partOf = [ "xmonad.target" ];

serviceConfig = {
ExecStart = "${mcg}/bin/mcg";
};
Expand Down
5 changes: 5 additions & 0 deletions shared/xmonad/xmonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ isNotInfixOf a b = not (a `isInfixOf` b)
main = do
dirs <- getDirectories
let conf = docks $ ewmh desktopConfig {
-- Trigger the xmonad.target target. This really shouldn't be
-- necessary, but we're using it as a workaround for
-- https://github.com/xmonad/xmonad/issues/422. See pattern/audio.nix
-- for details.
startupHook = spawn "systemctl --user start xmonad.target",
manageHook = manageDocks <+> manageSpawn <+> windowPlacement <+> manageHook desktopConfig,
handleEventHook = handleEventHook def <+> Hacks.windowedFullscreenFixEventHook <+> swallowEventHook (className =? "Alacritty" <&&> fmap ( "xmonad-no-swallow" `isNotInfixOf`) title) (return True),
layoutHook = myLayout,
Expand Down

0 comments on commit 6a25547

Please sign in to comment.