33 lines
877 B
Haskell
33 lines
877 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Screensaver plugin
|
|
--
|
|
-- Use the custom DBus interface exported by the XMonad process so I can react
|
|
-- to signals spawned by commands
|
|
|
|
module Xmobar.Plugins.Screensaver
|
|
( Screensaver (..)
|
|
, ssAlias
|
|
)
|
|
where
|
|
|
|
import qualified RIO.Text as T
|
|
import XMonad.Internal.DBus.Screensaver
|
|
import Xmobar
|
|
import Xmobar.Plugins.Common
|
|
|
|
newtype Screensaver = Screensaver (T.Text, Colors) deriving (Read, Show)
|
|
|
|
ssAlias :: T.Text
|
|
ssAlias = "screensaver"
|
|
|
|
instance Exec Screensaver where
|
|
alias (Screensaver _) = T.unpack ssAlias
|
|
start (Screensaver (text, colors)) cb =
|
|
withDBusClientConnection cb "screensaver" $ \sys -> do
|
|
matchSignal dpy sys
|
|
dpy =<< callQuery sys
|
|
where
|
|
dpy = displayMaybe cb $ return . (\s -> colorText colors s text)
|