summaryrefslogtreecommitdiffhomepage
path: root/src/Actions.hs
diff options
context:
space:
mode:
authorAlexander Polakov <plhk@sdf.org>2013-02-07 16:08:56 +0400
committerJose Antonio Ortega Ruiz <jao@gnu.org>2013-03-13 21:11:46 +0100
commitfcdc939572cfece0a8ce99f9164aa85f217ef369 (patch)
tree68841ad65e3e7e33ca247bd9c1ef1cb02f1428a5 /src/Actions.hs
parent8dffc6e722a58924ea65b50dc0e1471b3dd3976b (diff)
downloadxmobar-fcdc939572cfece0a8ce99f9164aa85f217ef369.tar.gz
xmobar-fcdc939572cfece0a8ce99f9164aa85f217ef369.tar.bz2
Introduce Actions
Actions are event re-actions. Currently only ButtonPress event is handled by Actions and only one action is defined, which is called Spawn (run external command). Type (and parser) can be extended to EWMH actions (switch to desktop, close window, whatever).
Diffstat (limited to 'src/Actions.hs')
-rw-r--r--src/Actions.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Actions.hs b/src/Actions.hs
new file mode 100644
index 0000000..156dc4e
--- /dev/null
+++ b/src/Actions.hs
@@ -0,0 +1,23 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : Xmobar.Actions
+-- Copyright : (c) Alexander Polakov
+-- License : BSD-style (see LICENSE)
+--
+-- Maintainer : Jose A. Ortega Ruiz <jao@gnu.org>
+-- Stability : unstable
+-- Portability : unportable
+--
+-----------------------------------------------------------------------------
+
+module Actions where
+
+import System.Process (system)
+import Control.Monad (void)
+
+data Action = Spawn String
+ deriving (Eq)
+
+runAction :: Action -> IO ()
+runAction (Spawn s) = void $ system (s ++ "&")
+runAction _ = return ()