summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Text/Swaybar.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-05 02:49:22 +0000
committerjao <jao@gnu.org>2022-02-06 00:24:10 +0000
commitafc2d1ed565910b372f65eaf77ea90878ac3ab2b (patch)
tree4b2b79d683b82cc0e16460884c8bfcc6c27b33cb /src/Xmobar/Text/Swaybar.hs
parentc0a9c6df0080a0db5981047f80c9c120ac1cef61 (diff)
downloadxmobar-afc2d1ed565910b372f65eaf77ea90878ac3ab2b.tar.gz
xmobar-afc2d1ed565910b372f65eaf77ea90878ac3ab2b.tar.bz2
swaybar-protocol: support for clickable Action
Diffstat (limited to 'src/Xmobar/Text/Swaybar.hs')
-rw-r--r--src/Xmobar/Text/Swaybar.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Xmobar/Text/Swaybar.hs b/src/Xmobar/Text/Swaybar.hs
index 0a7b8af..69739ed 100644
--- a/src/Xmobar/Text/Swaybar.hs
+++ b/src/Xmobar/Text/Swaybar.hs
@@ -16,9 +16,10 @@
--
------------------------------------------------------------------------------
-module Xmobar.Text.Swaybar (preamble, formatSwaybar) where
+module Xmobar.Text.Swaybar (prepare, formatSwaybar) where
import Data.Aeson
+
import Data.ByteString.Lazy.UTF8 (toString)
import GHC.Generics
@@ -28,8 +29,9 @@ import Xmobar.Config.Types (Config)
import Xmobar.Run.Parsers ( Segment
, Widget(..)
, tColorsString
- , colorComponents
- )
+ , colorComponents)
+
+import Xmobar.Text.SwaybarClicks (startHandler)
data Preamble =
Preamble {version :: !Int, click_events :: Bool} deriving (Eq,Show,Generic)
@@ -71,3 +73,6 @@ formatSwaybar' _ _ = defaultBlock
formatSwaybar :: Config -> [Segment] -> String
formatSwaybar conf segs = asString elems ++ ","
where elems = filter (not . null . full_text) (map (formatSwaybar' conf) segs)
+
+prepare :: IO ()
+prepare = startHandler >> putStrLn preamble