summaryrefslogtreecommitdiffhomepage
path: root/src/lib/Xmobar/Plugins/Locks.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-25 15:10:29 +0000
committerjao <jao@gnu.org>2018-11-25 15:10:29 +0000
commit77df1ac30fa7af5948f7ff64f5fee9aed64552b3 (patch)
tree647a4eb67ff1c293a5c530538ee88fc0093b577a /src/lib/Xmobar/Plugins/Locks.hs
parente0d6da82de8d0d1cef98896164c6016b84e47068 (diff)
downloadxmobar-77df1ac30fa7af5948f7ff64f5fee9aed64552b3.tar.gz
xmobar-77df1ac30fa7af5948f7ff64f5fee9aed64552b3.tar.bz2
Back to app/src, since it seems they're the default convention for stack
Diffstat (limited to 'src/lib/Xmobar/Plugins/Locks.hs')
-rw-r--r--src/lib/Xmobar/Plugins/Locks.hs64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/lib/Xmobar/Plugins/Locks.hs b/src/lib/Xmobar/Plugins/Locks.hs
deleted file mode 100644
index 19bce20..0000000
--- a/src/lib/Xmobar/Plugins/Locks.hs
+++ /dev/null
@@ -1,64 +0,0 @@
------------------------------------------------------------------------------
--- |
--- Module : Plugins.Locks
--- Copyright : (c) Patrick Chilton
--- License : BSD-style (see LICENSE)
---
--- Maintainer : Patrick Chilton <chpatrick@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- A plugin that displays the status of the lock keys.
---
------------------------------------------------------------------------------
-
-module Xmobar.Plugins.Locks(Locks(..)) where
-
-import Graphics.X11
-import Data.List
-import Data.Bits
-import Control.Monad
-import Graphics.X11.Xlib.Extras
-import Xmobar.Run.Commands
-import Xmobar.System.Kbd
-import Xmobar.Utils (nextEvent')
-
-data Locks = Locks
- deriving (Read, Show)
-
-locks :: [ ( KeySym, String )]
-locks = [ ( xK_Caps_Lock, "CAPS" )
- , ( xK_Num_Lock, "NUM" )
- , ( xK_Scroll_Lock, "SCROLL" )
- ]
-
-run' :: Display -> Window -> IO String
-run' d root = do
- modMap <- getModifierMapping d
- ( _, _, _, _, _, _, _, m ) <- queryPointer d root
-
- ls <- filterM ( \( ks, _ ) -> do
- kc <- keysymToKeycode d ks
- return $ case find (elem kc . snd) modMap of
- Nothing -> False
- Just ( i, _ ) -> testBit m (fromIntegral i)
- ) locks
-
- return $ unwords $ map snd ls
-
-instance Exec Locks where
- alias Locks = "locks"
- start Locks cb = do
- d <- openDisplay ""
- root <- rootWindow d (defaultScreen d)
- _ <- xkbSelectEventDetails d xkbUseCoreKbd xkbIndicatorStateNotify m m
-
- allocaXEvent $ \ep -> forever $ do
- cb =<< run' d root
- nextEvent' d ep
- getEvent ep
-
- closeDisplay d
- return ()
- where
- m = xkbAllStateComponentsMask