File: Main.hs

package info (click to toggle)
haskell-status-notifier-item 0.3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 148 kB
  • sloc: haskell: 875; xml: 66; makefile: 6
file content (48 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
module Main where

import Control.Concurrent.MVar
import Control.Monad
import Data.Semigroup ((<>))
import Data.Version (showVersion)
import Options.Applicative
import Paths_status_notifier_item (version)
import StatusNotifier.Item.Service
import Text.Printf

itemsParamsParser = ItemParams
  <$> strOption
  (  long "icon-name"
  <> short 'n'
  <> metavar "NAME"
  <> value "emacs"
  <> help "The icon the item will display."
  ) <*> strOption
  (  long "overlay-name"
  <> short 'o'
  <> metavar "NAME"
  <> value "steam"
  <> help "The icon that will be used for the overlay."
  ) <*> strOption
  (  long "dbus-name"
  <> short 'd'
  <> metavar "NAME"
  <> value "org.SampleSNI"
  <> help "The dbus name used for this sample item."
  )

versionOption :: Parser (a -> a)
versionOption = infoOption
                (printf "status-notifier-item %s" $ showVersion version)
                (  long "version"
                <> help "Show the version number of gtk-sni-tray"
                )

main :: IO ()
main = do
  itemParams <- execParser $ info (helper <*> versionOption <*> itemsParamsParser)
                (  fullDesc
                <> progDesc "Run a static StatusNotifierItem"
                )
  buildItem itemParams
  void $ getChar