-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathNotifications.hs
More file actions
43 lines (38 loc) · 1.4 KB
/
Notifications.hs
File metadata and controls
43 lines (38 loc) · 1.4 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
{-# Language OverloadedStrings #-}
{-|
Module : Client.Configuration.Notifications
Description : Options for running commands to notify users
Copyright : (c) TheDaemoness, 2023
License : ISC
Maintainer : emertens@gmail.com
-}
module Client.Configuration.Notifications ( NotifyWith(..), NotifyWhile(..), notifySpec, notifyWhileSpec ) where
import Config.Schema (ValueSpec, atomSpec, nonemptySpec, stringSpec, (<!>))
import qualified Data.List.NonEmpty as NonEmpty
data NotifyWith
= NotifyWithCustom [String]
| NotifyWithDefault
| NotifyWithNotifySend
| NotifyWithOsaScript
| NotifyWithTerminalNotifier
| NotifyWithTerminal
deriving Show
data NotifyWhile
= NotifyWhileUnfocused
| NotifyWhileFocused
| NotifyWhileAlways
deriving Show
notifySpec :: ValueSpec NotifyWith
notifySpec =
NotifyWithCustom [] <$ atomSpec "no" <!>
NotifyWithDefault <$ atomSpec "yes" <!>
NotifyWithNotifySend <$ atomSpec "notify-send" <!>
NotifyWithOsaScript <$ atomSpec "osascript" <!>
NotifyWithTerminalNotifier <$ atomSpec "terminal-notifier" <!>
NotifyWithTerminal <$ atomSpec "terminal" <!>
NotifyWithCustom . NonEmpty.toList <$> nonemptySpec stringSpec
notifyWhileSpec :: ValueSpec NotifyWhile
notifyWhileSpec =
NotifyWhileUnfocused <$ atomSpec "unfocused" <!>
NotifyWhileFocused <$ atomSpec "focused" <!>
NotifyWhileAlways <$ atomSpec "always"