summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-25 06:18:16 +0000
committerjao <jao@gnu.org>2018-11-25 06:18:16 +0000
commit5aae9bf15e38d5a9ba8ffa3cca7fd545f4ffe1e1 (patch)
treeb81eaca5296a7beb1dd2283428a4b5922c23c6e2 /src
parent9d2c98871bbd04c585fae034072f934b5c3e8093 (diff)
downloadxmobar-5aae9bf15e38d5a9ba8ffa3cca7fd545f4ffe1e1.tar.gz
xmobar-5aae9bf15e38d5a9ba8ffa3cca7fd545f4ffe1e1.tar.bz2
Hlinting
Diffstat (limited to 'src')
-rw-r--r--src/lib/Xmobar/Plugins/Kbd.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/Xmobar/Plugins/Kbd.hs b/src/lib/Xmobar/Plugins/Kbd.hs
index 76914cc..f8ad971 100644
--- a/src/lib/Xmobar/Plugins/Kbd.hs
+++ b/src/lib/Xmobar/Plugins/Kbd.hs
@@ -36,9 +36,10 @@ splitLayout s = splitLayout' noLaySymbols $ split s '+'
splitLayout' :: [String] -> [String] -> [String]
-- end of recursion, remove empty strings
-splitLayout' [] s = map (takeWhile (\x -> x /= ':')) $ filter (\x -> length x > 0) s
+splitLayout' [] s = map (takeWhile (/= ':')) $ filter (not . null) s
-- remove current string if it has a 'bad' prefix
-splitLayout' bad s = splitLayout' (tail bad) [x | x <- s, not $ isPrefixOf (head bad) x]
+splitLayout' bad s =
+ splitLayout' (tail bad) [x | x <- s, not $ isPrefixOf (head bad) x]
-- split String at each Char
split :: String -> Char -> [String]
@@ -57,20 +58,19 @@ searchReplaceLayout :: KbdOpts -> String -> String
searchReplaceLayout opts s = let c = findIndex (\x -> fst x == s) opts in
case c of
Nothing -> s
- x -> let i = (fromJust x) in
- snd $ opts!!i
+ x -> let i = fromJust x in snd $ opts!!i
-- returns the active layout
getKbdLay :: Display -> KbdOpts -> IO String
getKbdLay dpy opts = do
lay <- getLayoutStr dpy
curLay <- getKbdLayout dpy
- return $ searchReplaceLayout opts $ (splitLayout lay)!!(curLay)
+ return $ searchReplaceLayout opts $ splitLayout lay!!curLay
-data Kbd = Kbd [(String, String)]
- deriving (Read, Show)
+newtype Kbd = Kbd [(String, String)]
+ deriving (Read, Show)
instance Exec Kbd where
alias (Kbd _) = "kbd"