about summary refs log tree commit diff
path: root/src/XMonad/Custom/Prompt.hs
blob: 9e046c6be2155d3c6b566c1c1b79bd752f0ca77c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Custom.Prompt
-- Copyright   :  (c) 2018-2019 Azat Bahawi <azahi@teknik.io>
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  Azat Bahawi <azahi@teknik.io>
-- Stability   :  unstable
-- Portability :  unportable
--
-----------------------------------------------------------------------------

module XMonad.Custom.Prompt
    ( listCompFunc
    , aListCompFunc
    , predicateFunction
    ) where

import           Data.Char
import           Data.List
import           XMonad.Prompt

listCompFunc :: XPConfig -> [String] -> String -> IO [String]
listCompFunc c xs s = return (filter (searchPredicate c s) xs)

aListCompFunc :: XPConfig -> [(String, a)] -> String -> IO [String]
aListCompFunc c xs = listCompFunc c (map fst xs)

predicateFunction :: String -> String -> Bool
predicateFunction x y = lc x `isInfixOf` lc y where lc = map toLower

Consider giving Nix/NixOS a try! <3