2020-04-01 22:06:00 -04:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- | Screensaver plugin
|
|
|
|
--
|
|
|
|
-- Use the custom DBus interface exported by the XMonad process so I can react
|
|
|
|
-- to signals spawned by commands
|
|
|
|
|
2021-06-21 23:41:57 -04:00
|
|
|
module Xmobar.Plugins.Screensaver
|
|
|
|
( Screensaver(..)
|
|
|
|
, ssAlias
|
|
|
|
) where
|
2020-03-15 15:10:25 -04:00
|
|
|
|
2020-03-25 18:55:52 -04:00
|
|
|
import Xmobar
|
2020-04-01 20:17:47 -04:00
|
|
|
|
|
|
|
import XMonad.Internal.DBus.Screensaver
|
2021-11-24 01:22:03 -05:00
|
|
|
import Xmobar.Plugins.Common
|
2020-03-15 15:10:25 -04:00
|
|
|
|
2021-11-21 17:54:00 -05:00
|
|
|
newtype Screensaver = Screensaver (String, String, String) deriving (Read, Show)
|
2020-03-15 15:10:25 -04:00
|
|
|
|
2021-06-21 23:41:57 -04:00
|
|
|
ssAlias :: String
|
|
|
|
ssAlias = "screensaver"
|
|
|
|
|
2020-03-15 15:10:25 -04:00
|
|
|
instance Exec Screensaver where
|
2021-11-24 01:22:03 -05:00
|
|
|
alias (Screensaver _) = ssAlias
|
|
|
|
start (Screensaver (text, colorOn, colorOff)) cb = do
|
2021-11-26 23:35:03 -05:00
|
|
|
withDBusClientConnection False cb $ \c -> do
|
2021-11-24 01:22:03 -05:00
|
|
|
matchSignal (cb . fmtState) c
|
|
|
|
cb . fmtState =<< callQuery c
|
|
|
|
where
|
2021-11-25 00:12:00 -05:00
|
|
|
fmtState = maybe na $ chooseColor text colorOn colorOff
|
2020-03-20 15:41:13 -04:00
|
|
|
|