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
|
2022-07-09 17:08:10 -04:00
|
|
|
import XMonad.Internal.Dependency
|
2021-11-24 01:22:03 -05:00
|
|
|
import Xmobar.Plugins.Common
|
2020-03-15 15:10:25 -04:00
|
|
|
|
2021-11-27 17:33:02 -05:00
|
|
|
newtype Screensaver = Screensaver (String, Colors) 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
|
2021-11-27 17:33:02 -05:00
|
|
|
start (Screensaver (text, colors)) cb = do
|
2022-07-09 17:08:10 -04:00
|
|
|
withDBusClientConnection cb $ \c -> do
|
2021-11-27 13:24:13 -05:00
|
|
|
matchSignal display c
|
2022-07-09 17:08:10 -04:00
|
|
|
display =<< callQuery (toClient c)
|
2021-11-24 01:22:03 -05:00
|
|
|
where
|
2021-11-27 17:33:02 -05:00
|
|
|
display = displayMaybe cb $ return . (\s -> colorText colors s text)
|
2020-03-20 15:41:13 -04:00
|
|
|
|