summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2012-08-22Make it possible to delay Hide, Reveal and Toggle signalsJochen Keil
Previously Hide, Reveal and Toggle were immediate actions. This is the same behaviour as if called now with 0 as parameter. If the parameter is a positive non zero value it is taken as a delay for the requested action. After the delay (implemented using threadDelay) a new signal is sent with zero with no timeout being effective immediately. This is necessary to evaluate the persistency flag after the delay because it might have changed in the meantime. Effectively this means that it is possible to cancel the delayed operation by calling TogglePersistent.
2012-08-22Refactor MVar SignalType to TMVar SignalTypeJochen Keil
Replace MVar with TMVar from the STM package. This is common for ghc now. Since STM is used everywhere else in the src it also adds no additional dependencies. The main reason for this switch is, that readMVar, swapMVar, etc. are only atomically if there is no other producer for this MVar i.e. putMVar. For example readMVar is a combination of putMVar and takeMVar. Due to scheduling and readMVar's non-atomicity it is possible that values written to the MVar appear in the wrong order. Using TMVar fixes this problem, since it allows really atomical read/swap operations.
2012-08-22Allow multiple signals over dbus at onceJochen Keil
It's easy to implement, since arguments to dbus method calls are handed over as list anyway. It also removes the need for safeHead. Bottom line: extra functionality without extra cost.
2012-08-19Improving the documentation of monitor argsJose Antonio Ortega Ruiz
Following the discussion of pull request #59 in github.
2012-08-16Update src/Signal.hssoul9
Fix build failure: safeHead is needed even when dbus isn't.
2012-08-16Merging github pull request 57Jose Antonio Ortega Ruiz
Conflicts: readme.md
2012-08-16Documentation bit for 'lowerOnStart' optionJochen Keil
2012-08-16New configuration option 'hideOnStart'Jochen Keil
When set to True the window is initially not mapped, i.e. hidden. It then can be toggled manually (for example using the dbus interface) or automatically (by a plugin) to make it reappear (unhide/reveal).
2012-08-14Bugfix: Replace the TMVar String with a TVar (Maybe String)Jochen Keil
The problem was a race condition which occured when running multiple threads with a small timeout value. Then the TMVar could be left empty. (e.g. hitting a key which causes an operation to write to the pipe very fast) This meant that tryTakeTMVar would return Nothing which would cause all subsequent reset threads to not call cb and keep a stale string on display. By using a Maybe String wrapped in a TVar there is always a valid value available which can be used to restore the display (or not if it's Nothing, but that's desired then and not because another thread was scheduled earlier).
2012-08-13Documentation updatesJose Antonio Ortega Ruiz
2012-08-13LICENSE -> licenseJose Antonio Ortega Ruiz
2012-08-13with_dbus documentedJose Antonio Ortega Ruiz
2012-08-13TypoJose Antonio Ortega Ruiz
2012-08-13Merge for pull request #53Jose Antonio Ortega Ruiz
2012-08-13New goodies by Jochen spelled out in NEWSJose Antonio Ortega Ruiz
2012-08-13Jochen in the list of contributorsJose Antonio Ortega Ruiz
2012-08-13Missing file headers and lintingJose Antonio Ortega Ruiz
2012-08-13Missing import for 'when'Jose Antonio Ortega Ruiz
2012-08-13sh is not linked to bash on all systemsJochen Keil
This is a bash script, so for correctness is needs to be /bin/bash
2012-08-13Add a bit about DBus to documentationJochen Keil
Only one process can export the dbus interface at a time.
2012-08-13Revert lowerOnStart to its original behaviourJochen Keil
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.
2012-08-12Fancier status script sampleJochen Keil
This sample script uses colors and unicode signs for drawing a status bar for e.g. volume. The unicode character can be simply changed to an ascii one in case of problems.
2012-08-12Run the DBus/IPC handler only once on program startJochen Keil
The startCommand function is called for every configured plugin. This results in multiple calls to runIPC. This it not necessary however. startLoop is a much more appropriate place, since the other signal handler (checker and eventer) are run here to.
2012-08-12Catch error when DBus connection failsJochen Keil
connectSession throws a ClientError Exception when DBUS_SESSION_BUS_ADDRESS is unset. Without exception handler this will result in program termination. Since the DBus handler merely sends a signal to the event loop it does no harm when it won't run. Normal operation will continue just if compiled without dbus support.
2012-08-12Add IPC with DBus as optional build dependencyJochen Keil
Not everybody has/wants the DBus library so this can be chosen at compile time.
2012-08-12A bit of documentation re mprisJose Antonio Ortega Ruiz
2012-08-12Fix the MPRIS plugin to work with DBus >= 0.10Jochen Keil
This commit updates the mpris plugin to use the DBus 0.10 interface. DBus-Core does no longer exist and is deprecated. DBus 0.10 does not use proxies anymore. The dependency on Data.Text also disappeared. Since I do not have/use mpris I cannot test if this works. It should however, since the functionality was just transformed to use the new interface.
2012-08-11A bit of documentation re mprisJose Antonio Ortega Ruiz
2012-08-11Documentation for the BufferedPipeReader plugin (+ sample script)Jochen Keil
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.
2012-08-11Documentation for the DBus InterfaceJochen Keil
2012-08-11Add sample option for persistent and update option descriptionJochen Keil
Description for lowerOnStart was missing.
2012-08-11Fix the MPRIS plugin to work with DBus >= 0.10Jochen Keil
This commit updates the mpris plugin to use the DBus 0.10 interface. DBus-Core does no longer exist and is deprecated. DBus 0.10 does not use proxies anymore. The dependency on Data.Text also disappeared. Since I do not have/use mpris I cannot test if this works. It should however, since the functionality was just transformed to use the new interface.
2012-08-10Run the DBus event handler in startCommandJochen Keil
Actually run this stuff
2012-08-10Move the IsVariant SignalType instance to Signal moduleJochen Keil
This belongs here, otherwise ghc will complain about orphaned instances
2012-08-10Move safeHead to Plugins.UtilsJochen Keil
safeHead is a very general utility function with suits better into a common Util module.
2012-08-10Add an initial (working) version of the DBus IPC moduleJochen Keil
2012-08-10Add IPC with DBus as optional build dependencyJochen Keil
Not everybody has/wants the DBus library so this can be chosen at compile time.
2012-08-10New SignalType TogglePersistentJochen Keil
By sending a TogglePersistent signal the configuration option "persistent" can be changed. Thus it is possible to hide or show xmobar constantly.
2012-08-10New configuration option "persistent"Jochen Keil
When persistent is set to True then xmobar will always be mapped (revealed) and never be hidden. The flag is checked in eventLoop and operation to map/unmap windows is not carried out if persistence is desired.
2012-08-09Bugfix: Do not hide the window when toggling is off for this pipeJochen Keil
The window became hidden although the toggling behaviour was set to False for a particular pipe. This fixes this behaviour and hides the window only if the configuration option is set to True.
2012-08-09Bugfix: Replace TVar with TMVar for the old valueJochen Keil
This solves a problem when there is only one pipe in place. With a default value of "" and only one pipe with a timeout the value is overwritten with "" after the timeout. To prevent this from happening a TMVar is used which will never be filled if there is only one pipe.
2012-08-09Implement trigger method for BufferedPipeReader PluginJochen Keil
Using the trigger method activity on a pipe can now cause the window to appear (reveal) and disappear again after a given timeout. The timeout for hiding the window is the same as for restoring the pipes content. The timeout value is given in tenth of seconds.
2012-08-09Cosmetic surgeryJochen Keil
Realign methods, remove unnecessary imports and remove clutter
2012-08-09Add functions for {reveal,hid,toggl}ing the windowJochen Keil
Toggling is based is based on the current window status. If unmapped then reveal else hide. Sync is necessary or delays might occur. The functions are called from the event loop when the according signal is received When mapping (revealing) the window again we need to set the struts property again. The easiest way to do this is to call repositionWin. However, repositionWin needs access to the Config structure which is available in eventLoop. Because decomposition wouldn't be easy and I don't want to pass Config down to showWindow (which would need to return the new Rectangle then) this is done here.
2012-08-09Create signal handler in main and pass it down to the start* functionsJochen Keil
This is necessary for setting up the signal callback (trigger) from the Plugin interface. As another benefit it is now possible to implement the lowerOnStart config option properly by simply sending a Hide signal in startLoop.
2012-08-09Extend the interface so that plugins can send signalsJochen Keil
Also: realign methods to look pretty again.
2012-08-09Add signals for {show,hid,toggl}ingJochen Keil
Also make them {Read,Show}able which can be useful for printf debugging and does not hurt otherwise.
2012-08-09Move signal handler and data types to own moduleJochen Keil
This is necessary to make SignalType available for other modules without import loops. This also decoupels the modules and their functionality a bit more so this is generally a cleaner solution.
2012-08-09Modularize Window handling functionsJochen Keil
These functions are about creation, positioning and property setting of the xmobar window. An own module does them justice and eases the task of adding functions for revealing/hiding and toggling the window.
2012-08-08BufferedPipeReader: A plugin for temporary data displayJochen Keil
This plugin allows to display data from multiple pipes. New data will always overwrite the currently displayed data. However, if a timeout is specified, the previous content is restored. Configuration works like this: BufferedPipeReader <Alias> [ ( Timeout, "/path/to/fifo/pipe" ), (..), .. ] If Timeout is set to 0 then the content is persistent, i.e. it will be reset to any previous value, it will itself become the previous value. If Timeout is set to a negative value the earth will stop spinning, so don't do it.