From d433166f0bb3e1d7e8da20c1d9007bee2b39e522 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 11 Aug 2012 21:56:12 +0200 Subject: Add sample option for persistent and update option description Description for lowerOnStart was missing. --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 5fba067..6fb6ef2 100644 --- a/readme.md +++ b/readme.md @@ -221,6 +221,14 @@ Other configuration options: : position = Top +`lowerOnStart` +: When True the window is initially hidden (can be toggled) + +`persistent` +: When True the window status is fixed i.e. hiding or revealing is not + possible. This option can be toggled at runtime. + + `border` : TopB, TopBM, BottomB, BottomBM, FullB, FullBM or NoBorder (default). -- cgit v1.2.3 From d574e620411a6743805b3f0233b55bfdebfa05c9 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 11 Aug 2012 22:20:30 +0200 Subject: Documentation for the DBus Interface --- readme.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 6fb6ef2..5ea2cc4 100644 --- a/readme.md +++ b/readme.md @@ -301,6 +301,30 @@ xmobar --help): Mail bug reports and suggestions to +## The DBus Interface + +xmobar can be controlled over dbus. All signals defined in [src/Signal.hs] as +`data SignalType` can now be sent over dbus to xmobar. + +[src/Signal.hs]: https://github.com/jaor/xmobar/raw/master/src/Signal.hs + +- Bus Name: `org.Xmobar.Control` +- Object Path: `/org/Xmobar/Control` +- Member Name: Any of SignalType, e.g. `string:Reveal` +- Interface Name: `org.Xmobar.Control` + +An example using the `dbus-send` command line utility: + + dbus-send \ + --session \ + --dest=org.Xmobar.Control \ + --type=method_call \ + --print-reply \ + '/org/Xmobar/Control' \ + org.Xmobar.Control.SendSignal \ + "string:Toggle" + + ## The Output Template The output template must contain at least one command. xmobar will -- cgit v1.2.3 From a7a2234de9a4f5f7bc5cdd626f40d8505967d1c0 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Sat, 11 Aug 2012 22:21:15 +0200 Subject: Documentation for the BufferedPipeReader plugin (+ sample script) The sample script is quite generic. It works for demo purposes and can be used as a template for users to write their own scripts. --- readme.md | 29 +++++++++++++++++++++++++++++ samples/status.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100755 samples/status.sh (limited to 'readme.md') diff --git a/readme.md b/readme.md index 5ea2cc4..e66b438 100644 --- a/readme.md +++ b/readme.md @@ -951,6 +951,35 @@ can be used in the output template as `%mydate%` - Reads its displayed output from the given pipe. +`BufferedPipeReader Alias [ (Timeout, Bool, "/path/to/pipe1") + , (Timeout, Bool, "/path/to/pipe2") + , .. + ]` + +- Display data from multiple pipes. +- Timeout (in tenth of seconds) is the value after which the previous content is + restored i.e. if there was already something from a previous pipe it will be + put on display again, overwriting the current status. +- A pipe with Timout of 0 will be displayed permanently, just like `PipeReader` +- The boolean option indicates whether new data for this pipe should make xmobar + appear (unhide, reveal). In this case, the Timeout additionally specifies when + the window should be hidden again. The output is restored in any case. +- Use it for OSD like status bars e.g. for setting the volume or brightness: + + Run BufferedPipeReader "bpr" + [ ( 0, False, "/tmp/xmobar_window" ) + , ( 15, True, "/tmp/xmobar_status" ) + ] + + Have your window manager send window titles to `"/tmp/xmobar_window"`. They will + always be shown and not reveal your xmobar. + Sending some status information to `"/tmp/xmobar_status"` will reveal xmonad + for 1.5 seconds and temporarily overwrite the window titles. +- Take a look at [samples/status.sh] + +[samples/status.sh]: http://github.com/jaor/xmobar/raw/master/samples/status.sh + + `XMonadLog` - Aliases to XMonadLog diff --git a/samples/status.sh b/samples/status.sh new file mode 100755 index 0000000..fc8af11 --- /dev/null +++ b/samples/status.sh @@ -0,0 +1,47 @@ +#!/bin/sh + + +STATUSPIPE="/tmp/xmobar_status_jrk" +NORMAL='#eee8d5' +MUTED='#cb4b16' +FGCOLOR="#657b83" + +function isMuted () { + # retrieve mute status + # return an arbitrary string for true or nothing at all + echo +} + +function getPercent () { + # somehow retrieve the percent value as plain int (e.g. "66") + echo "66" +} + + +function percentBar () { + local res= i=1 + local percent=$( getPercent ) + + if [ -n "$( isMuted )" ]; then + res="" + else + res="" + fi + + while [ $i -lt $percent ]; do + res+='#' + i=$((i+1)) + done + + res+="" + + while [ $i -lt 100 ]; do + res+='-' + i=$((i+1)) + done + + echo "$res" +} + + +echo "$( percentBar )" > "$STATUSPIPE" -- cgit v1.2.3 From 89063445bca98bd27544e0fec4e1dfbfe2730c28 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 11 Aug 2012 23:34:05 +0200 Subject: A bit of documentation re mpris --- news.md | 2 ++ readme.md | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'readme.md') diff --git a/news.md b/news.md index 963f5c5..991a981 100644 --- a/news.md +++ b/news.md @@ -8,6 +8,8 @@ _New features_ MPD status (thanks to Ben Boeckel). - Dependencies updated to latest mtl and libmpd (thanks to Sergei Trofimovich). + - Dependencies on the deprecated dbus-core removed in favour of + dbus 0.10. _Bug fixes_ diff --git a/readme.md b/readme.md index e66b438..1c13d27 100644 --- a/readme.md +++ b/readme.md @@ -121,7 +121,7 @@ Otherwise, you'll need to install them yourself. `with_mpris` : Enables support for MPRIS v1/v2 protocol. - Requires the [dbus-core] and [text] packages. + Requires the [dbus] and [text] packages. `with_inotify` : Support for inotify in modern linux kernels. This option is needed @@ -676,7 +676,7 @@ Monitors have default aliases. ### `Mpris1 PlayerName Args RefreshRate` - Aliases to `mpris1` -- Requires [dbus-core] and [text] packages. +- Requires [dbus] and [text] packages. To activate, pass `--flags="with_mpris"` during compilation. - PlayerName: player supporting MPRIS v1 protocol, in lowercase. - Args: default monitor arguments. @@ -1188,7 +1188,7 @@ Copyright © 2010-2012 Jose Antonio Ortega Ruiz [iwlib]: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html [hinotify]: http://hackage.haskell.org/package/hinotify/ [libmpd]: http://hackage.haskell.org/package/libmpd/ -[dbus-core]: http://hackage.haskell.org/package/dbus-core +[dbus]: http://hackage.haskell.org/package/dbus [text]: http://hackage.haskell.org/package/text [sawfish]: http://sawfish.wikia.com/ [utf8-string]: http://hackage.haskell.org/package/utf8-string/ -- cgit v1.2.3 From b8cf77207eb7dfa99f842f5b7e63fee95efe3796 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Mon, 13 Aug 2012 07:28:55 +0200 Subject: Revert lowerOnStart to its original behaviour I misunderstood the intention of lowerOnStart and changed the implementation to what I thought it would have to do. This was wrong indeed, so back to original behaviour. --- readme.md | 3 --- src/Window.hs | 1 + src/Xmobar.hs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 1c13d27..7d06087 100644 --- a/readme.md +++ b/readme.md @@ -221,9 +221,6 @@ Other configuration options: : position = Top -`lowerOnStart` -: When True the window is initially hidden (can be toggled) - `persistent` : When True the window status is fixed i.e. hiding or revealing is not possible. This option can be toggled at runtime. diff --git a/src/Window.hs b/src/Window.hs index 9024fff..50bfc56 100644 --- a/src/Window.hs +++ b/src/Window.hs @@ -24,6 +24,7 @@ createWin d fs c = do (r,o) = setPosition (position c) srs (fi ht) win <- newWindow d (defaultScreenOfDisplay d) rootw r o setProperties r c d win srs + when (lowerOnStart c) (lowerWindow d win) mapWindow d win return (r,win) diff --git a/src/Xmobar.hs b/src/Xmobar.hs index d758301..5328b6e 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -78,7 +78,6 @@ runX xc f = runReaderT f xc startLoop :: XConf -> MVar SignalType -> [[(Maybe ThreadId, TVar String)]] -> IO () startLoop xcfg@(XConf _ _ w _ conf) sig vs = do tv <- atomically $ newTVar [] - when (lowerOnStart conf) $ putMVar sig Hide _ <- forkIO (checker tv [] vs sig `catch` \(SomeException _) -> void (putStrLn "Thread checker failed")) #ifdef THREADED_RUNTIME -- cgit v1.2.3 From 501b4afb25692bf8449088594d46a3c22645d325 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Mon, 13 Aug 2012 07:30:27 +0200 Subject: Add a bit about DBus to documentation Only one process can export the dbus interface at a time. --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 7d06087..c78f9ab 100644 --- a/readme.md +++ b/readme.md @@ -302,6 +302,10 @@ xmobar --help): xmobar can be controlled over dbus. All signals defined in [src/Signal.hs] as `data SignalType` can now be sent over dbus to xmobar. +Due to current limitations of the implementation only one process of xmobar can +aquire the dbus. This is handled in a FCFS manor, meaning that the first process +will get the dbus interface. Other processes will run without further problems, +yet have no dbus interface. [src/Signal.hs]: https://github.com/jaor/xmobar/raw/master/src/Signal.hs -- cgit v1.2.3 From b973eb269f6017c488bb71474f457a3b479ea90e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 13 Aug 2012 15:09:58 +0200 Subject: Jochen in the list of contributors --- readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index c78f9ab..36c2173 100644 --- a/readme.md +++ b/readme.md @@ -1126,11 +1126,11 @@ the greater Haskell community. In particular, xmobar [incorporates patches] by Ben Boeckel, Roman Cheplyaka, John Goerzen, Juraj Hercek, Tomas Janousek, Spencer -Janssen, Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry -Kurochkin, Svein Ove, Martin Perner, Jens Petersen, Petr Rockai, -Andrew Sackville-West, Alexander Solovyov, Artem Tarasov, Sergei -Trofimovich, Thomas Tuegel, Jan Vornberger, Daniel Wagner and Norbert -Zeh. +Janssen, Jochen Keil, Lennart Kolmodin, Krzysztof Kosciuszkiewicz, +Dmitry Kurochkin, Svein Ove, Martin Perner, Jens Petersen, Petr +Rockai, Andrew Sackville-West, Alexander Solovyov, Artem Tarasov, +Sergei Trofimovich, Thomas Tuegel, Jan Vornberger, Daniel Wagner and +Norbert Zeh. [incorporates patches]: http://www.ohloh.net/p/xmobar/contributors -- cgit v1.2.3