ENH move some daemons back into xinit to keep them persistant

This commit is contained in:
Nathan Dwarshuis 2022-07-06 19:27:52 -04:00
parent b4af103dd1
commit e8b7c4afc5
3 changed files with 10 additions and 50 deletions

View File

@ -117,18 +117,7 @@ features = FeatureSet
, fsDynWorkspaces = allDWs'
, fsTabbedTheme = tabbedFeature
, fsShowKeys = runShowKeys
, fsDaemons = [ runNetAppDaemon
, runFlameshotDaemon
-- TODO the problem with launching
-- dunst here is that the history
-- will get nuked on each restart
, runNotificationDaemon
, runBwDaemon
-- TODO does this have a lag when
-- spawned within the WM?
, runClipManager
, runAutolock
]
, fsDaemons = [runNetAppDaemon, runAutolock]
}
evalConf db = do

View File

@ -13,10 +13,6 @@ module XMonad.Internal.Command.DMenu
, runBTMenu
, runShowKeys
, runAutorandrMenu
-- daemons
, runBwDaemon
, runClipManager
) where
import Control.Monad.Reader
@ -108,6 +104,7 @@ runAppMenu = spawnDmenuCmd "app launcher" ["-show", "drun"]
runWinMenu :: SometimesX
runWinMenu = spawnDmenuCmd "window switcher" ["-show", "window"]
-- TODO test that networkManager is actually running
runNetMenu :: SometimesX
runNetMenu = sometimesExeArgs "network control menu" "rofi NetworkManager"
True myDmenuNetworks $ themeArgs "#ff3333"
@ -119,31 +116,21 @@ runAutorandrMenu = sometimesExeArgs "autorandr menu" "rofi autorandr"
--------------------------------------------------------------------------------
-- | Password manager
runBwDaemon :: Sometimes (IO ProcessHandle)
runBwDaemon = sometimesIO_ "password manager daemon" "rofi bitwarden" tree cmd
where
tree = Only_ $ localExe myDmenuPasswords
cmd = snd <$> spawnPipeArgs "rofi-bw" ["-d", "3600"]
runBwMenu :: SometimesX
runBwMenu = sometimesIO_ "password manager" "rofi bitwarden"
(Only_ $ IOSometimes_ runBwDaemon) $ spawnCmd myDmenuPasswords
-- TODO test that this program is actually running (query the DBus?)
(Only_ $ localExe myDmenuPasswords) $ spawnCmd myDmenuPasswords
$ ["-c"] ++ themeArgs "#bb6600" ++ myDmenuMatchingArgs
--------------------------------------------------------------------------------
-- | Clipboard
runClipManager :: Sometimes (IO ProcessHandle)
runClipManager = sometimesIO_ "clipboard daemon" "greenclip" tree cmd
where
tree = Only_ $ sysExe myClipboardManager
cmd = snd <$> spawnPipeArgs "greenclip" ["daemon"]
runClipMenu :: SometimesX
runClipMenu = sometimesIO_ "clipboard manager" "rofi greenclip" tree act
where
act = spawnCmd myDmenuCmd args
tree = toAnd_ (sysExe myDmenuCmd) $ IOSometimes_ runClipManager
-- TODO test that greenclip daemon is actually running
tree = toAnd_ (sysExe myDmenuCmd) $ sysExe myClipboardManager
args = [ "-modi", "\"clipboard:greenclip print\""
, "-show", "clipboard"
, "-run-command", "'{cmd}'"

View File

@ -36,8 +36,6 @@ module XMonad.Internal.Command.Desktop
-- daemons
, runNetAppDaemon
, runFlameshotDaemon
, runNotificationDaemon
) where
import Control.Monad (void)
@ -86,9 +84,6 @@ myImageBrowser = "feh"
myNotificationCtrl :: String
myNotificationCtrl = "dunstctl"
myNotificationDaemon :: String
myNotificationDaemon = "dunst"
--------------------------------------------------------------------------------
-- | Misc constants
@ -180,17 +175,11 @@ runVolumeMute = featureSound "mute" volumeChangeSound (void toggleMute) $ return
--------------------------------------------------------------------------------
-- | Notification control
runNotificationDaemon :: Sometimes (IO ProcessHandle)
runNotificationDaemon = sometimesIO_ "notification daemon" "dunst" tree cmd
where
tree = Only_ $ sysExe myNotificationDaemon
cmd = snd <$> spawnPipe myNotificationDaemon
-- TODO test that dunst is actually running
runNotificationCmd :: String -> FilePath -> SometimesX
runNotificationCmd n arg = sometimesIO_ (n ++ " control") "dunstctl" tree cmd
where
tree = And_ (Only_ $ IOSometimes_ runNotificationDaemon)
(Only_ $ sysExe myNotificationCtrl)
tree = Only_ $ sysExe myNotificationCtrl
cmd = spawnCmd myNotificationCtrl [arg]
runNotificationClose :: SometimesX
@ -291,15 +280,10 @@ getCaptureDir = do
where
fallback = (</> ".local/share") <$> getHomeDirectory
runFlameshotDaemon :: Sometimes (IO ProcessHandle)
runFlameshotDaemon = sometimesIO_ "screen capture daemon" "flameshot" tree cmd
where
tree = Only_ $ sysExe myCapture
cmd = snd <$> (spawnPipe' $ (shell myCapture) { std_err = NoStream })
-- TODO test that flameshot is actually running
runFlameshot :: String -> String -> SometimesX
runFlameshot n mode = sometimesIO_ n myCapture
(Only_ $ IOSometimes_ runFlameshotDaemon) $ spawnCmd myCapture [mode]
(Only_ $ sysExe myCapture) $ spawnCmd myCapture [mode]
-- TODO this will steal focus from the current window (and puts it
-- in the root window?) ...need to fix