From 6dd945510c09ff65c0c9976e123279d264aa4d14 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 30 May 2014 23:33:44 +0200 Subject: Unsafe versions of XPropertyLog and NamedXPropertyLog --- news.md | 3 ++- readme.md | 16 +++++++++++++++- src/Plugins/XMonadLog.hs | 18 +++++++++++++----- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/news.md b/news.md index aa252e6..1508bbf 100644 --- a/news.md +++ b/news.md @@ -10,7 +10,8 @@ _New features_ - New `CatInt` monitor, displaying integer values read from a file, by Nathaniel Wesley Filardo. - New `` tag for safer input parsing, also by Nathaniel. - + - New `UnsafeXMonadLog` monitor (by Eric Mrak) and their xproperty + counterparts, `UnsafeXPropertyLog` and `UnsafeNamedXPropertyLog`. _Bug fixes_ diff --git a/readme.md b/readme.md index f1c8f98..0736702 100644 --- a/readme.md +++ b/readme.md @@ -1075,9 +1075,23 @@ more than one battery. [samples/xmonadpropwrite.hs script]: https://github.com/jaor/xmobar/raw/master/samples/xmonadpropwrite.hs +### `UnsafeXPropertyLog PropName` + +- Aliases to `PropName` +- Same as `XPropertyLog`, but the input is not filtered to avoid + injection of actions (cf. `UnsafeXMonadLog`). The program writing + the value of the read property is responsible of performing any + needed cleanups. + +### `NamedXPropertyLog PropName Alias` + +- Aliases to `Alias` +- Same as `XPropertyLog`, but a custom alias can be specified. + ### `NamedXPropertyLog PropName Alias` -- Same as XPropertyLog, but a custom alias can be specified. +- Aliases to `Alias` +- Same as `UnsafeXPropertyLog`, but a custom alias can be specified. ### `Brightness Args RefreshRate` diff --git a/src/Plugins/XMonadLog.hs b/src/Plugins/XMonadLog.hs index b424565..158b7ef 100644 --- a/src/Plugins/XMonadLog.hs +++ b/src/Plugins/XMonadLog.hs @@ -33,7 +33,9 @@ import Actions (stripActions) data XMonadLog = XMonadLog | UnsafeXMonadLog | XPropertyLog String + | UnsafeXPropertyLog String | NamedXPropertyLog String String + | UnsafeNamedXPropertyLog String String deriving (Read, Show) instance Exec XMonadLog where @@ -41,16 +43,22 @@ instance Exec XMonadLog where alias UnsafeXMonadLog = "UnsafeXMonadLog" alias (XPropertyLog atom) = atom alias (NamedXPropertyLog _ name) = name + alias (UnsafeXPropertyLog atom) = atom + alias (UnsafeNamedXPropertyLog _ name) = name start x cb = do let atom = case x of - XMonadLog -> "_XMONAD_LOG" - UnsafeXMonadLog -> "_XMONAD_LOG" - XPropertyLog a -> a + XMonadLog -> "_XMONAD_LOG" + UnsafeXMonadLog -> "_XMONAD_LOG" + XPropertyLog a -> a + UnsafeXPropertyLog a -> a NamedXPropertyLog a _ -> a + UnsafeNamedXPropertyLog a _ -> a sanitize = case x of - UnsafeXMonadLog -> id - _ -> stripActions + UnsafeXMonadLog -> id + UnsafeXPropertyLog _ -> id + UnsafeNamedXPropertyLog _ _ -> id + _ -> stripActions d <- openDisplay "" xlog <- internAtom d atom False -- cgit v1.2.3