hzenity-0.4.1: Haskell interface to Zenity dialogs
Safe HaskellNone
LanguageHaskell2010

Zenity

Description

A wrapper for Zenity dialog boxes

Zenity is accessed through system calls, so it needs to be installed on the computer in order for this wrapper to work.

It is advised to turn on the following extensions when using this module:

DuplicateRecordFields
OverloadedStrings

Here is a simple example for how to use the library. It asks the user for a name and displays a greeting:

{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Monoid
import Zenity

greeting = do
  Just name <-
    zenity def {title = Just "Name entry"} $
      Entry $ def {text = Just "What's your name?"}
  zenity def $ Info def {text = Just $ "Greetings, " <> name <> "!"}

More examples can be found in the examples/ directory.

Synopsis

Documentation

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char

data Day #

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Instances

Instances details
Enum Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

succ :: Day -> Day #

pred :: Day -> Day #

toEnum :: Int -> Day #

fromEnum :: Day -> Int #

enumFrom :: Day -> [Day] #

enumFromThen :: Day -> Day -> [Day] #

enumFromTo :: Day -> Day -> [Day] #

enumFromThenTo :: Day -> Day -> Day -> [Day] #

Eq Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

(==) :: Day -> Day -> Bool #

(/=) :: Day -> Day -> Bool #

Data Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Day -> c Day #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day #

toConstr :: Day -> Constr #

dataTypeOf :: Day -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day) #

gmapT :: (forall b. Data b => b -> b) -> Day -> Day #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r #

gmapQ :: (forall d. Data d => d -> u) -> Day -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day #

Ord Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

compare :: Day -> Day -> Ordering #

(<) :: Day -> Day -> Bool #

(<=) :: Day -> Day -> Bool #

(>) :: Day -> Day -> Bool #

(>=) :: Day -> Day -> Bool #

max :: Day -> Day -> Day #

min :: Day -> Day -> Day #

Ix Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

range :: (Day, Day) -> [Day] #

index :: (Day, Day) -> Day -> Int #

unsafeIndex :: (Day, Day) -> Day -> Int #

inRange :: (Day, Day) -> Day -> Bool #

rangeSize :: (Day, Day) -> Int #

unsafeRangeSize :: (Day, Day) -> Int #

NFData Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

rnf :: Day -> () #

class Default a where #

A class for types with a default value.

Minimal complete definition

Nothing

Methods

def :: a #

The default value for this type.

Instances

Instances details
Default Double 
Instance details

Defined in Data.Default.Class

Methods

def :: Double #

Default Float 
Instance details

Defined in Data.Default.Class

Methods

def :: Float #

Default Int 
Instance details

Defined in Data.Default.Class

Methods

def :: Int #

Default Int8 
Instance details

Defined in Data.Default.Class

Methods

def :: Int8 #

Default Int16 
Instance details

Defined in Data.Default.Class

Methods

def :: Int16 #

Default Int32 
Instance details

Defined in Data.Default.Class

Methods

def :: Int32 #

Default Int64 
Instance details

Defined in Data.Default.Class

Methods

def :: Int64 #

Default Integer 
Instance details

Defined in Data.Default.Class

Methods

def :: Integer #

Default Ordering 
Instance details

Defined in Data.Default.Class

Methods

def :: Ordering #

Default Word 
Instance details

Defined in Data.Default.Class

Methods

def :: Word #

Default Word8 
Instance details

Defined in Data.Default.Class

Methods

def :: Word8 #

Default Word16 
Instance details

Defined in Data.Default.Class

Methods

def :: Word16 #

Default Word32 
Instance details

Defined in Data.Default.Class

Methods

def :: Word32 #

Default Word64 
Instance details

Defined in Data.Default.Class

Methods

def :: Word64 #

Default () 
Instance details

Defined in Data.Default.Class

Methods

def :: () #

Default All 
Instance details

Defined in Data.Default.Class

Methods

def :: All #

Default Any 
Instance details

Defined in Data.Default.Class

Methods

def :: Any #

Default CShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CShort #

Default CUShort 
Instance details

Defined in Data.Default.Class

Methods

def :: CUShort #

Default CInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CInt #

Default CUInt 
Instance details

Defined in Data.Default.Class

Methods

def :: CUInt #

Default CLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLong #

Default CULong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULong #

Default CLLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CLLong #

Default CULLong 
Instance details

Defined in Data.Default.Class

Methods

def :: CULLong #

Default CFloat 
Instance details

Defined in Data.Default.Class

Methods

def :: CFloat #

Default CDouble 
Instance details

Defined in Data.Default.Class

Methods

def :: CDouble #

Default CPtrdiff 
Instance details

Defined in Data.Default.Class

Methods

def :: CPtrdiff #

Default CSize 
Instance details

Defined in Data.Default.Class

Methods

def :: CSize #

Default CSigAtomic 
Instance details

Defined in Data.Default.Class

Methods

def :: CSigAtomic #

Default CClock 
Instance details

Defined in Data.Default.Class

Methods

def :: CClock #

Default CTime 
Instance details

Defined in Data.Default.Class

Methods

def :: CTime #

Default CUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CUSeconds #

Default CSUSeconds 
Instance details

Defined in Data.Default.Class

Methods

def :: CSUSeconds #

Default CIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntPtr #

Default CUIntPtr 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntPtr #

Default CIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CIntMax #

Default CUIntMax 
Instance details

Defined in Data.Default.Class

Methods

def :: CUIntMax #

Default ListFlags Source # 
Instance details

Defined in Zenity

Methods

def :: ListFlags #

Default InfoFlags Source # 
Instance details

Defined in Zenity

Methods

def :: InfoFlags #

Default FileSelectionFlags Source # 
Instance details

Defined in Zenity

Default EntryFlags Source # 
Instance details

Defined in Zenity

Methods

def :: EntryFlags #

Default CalendarFlags Source # 
Instance details

Defined in Zenity

Methods

def :: CalendarFlags #

Default Config Source # 
Instance details

Defined in Zenity

Methods

def :: Config #

Default [a] 
Instance details

Defined in Data.Default.Class

Methods

def :: [a] #

Default (Maybe a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Maybe a #

Integral a => Default (Ratio a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Ratio a #

Default a => Default (IO a) 
Instance details

Defined in Data.Default.Class

Methods

def :: IO a #

(Default a, RealFloat a) => Default (Complex a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Complex a #

Default (First a) 
Instance details

Defined in Data.Default.Class

Methods

def :: First a #

Default (Last a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Last a #

Default a => Default (Dual a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Dual a #

Default (Endo a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Endo a #

Num a => Default (Sum a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Sum a #

Num a => Default (Product a) 
Instance details

Defined in Data.Default.Class

Methods

def :: Product a #

Default r => Default (e -> r) 
Instance details

Defined in Data.Default.Class

Methods

def :: e -> r #

(Default a, Default b) => Default (a, b) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b) #

(Default a, Default b, Default c) => Default (a, b, c) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c) #

(Default a, Default b, Default c, Default d) => Default (a, b, c, d) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d) #

(Default a, Default b, Default c, Default d, Default e) => Default (a, b, c, d, e) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e) #

(Default a, Default b, Default c, Default d, Default e, Default f) => Default (a, b, c, d, e, f) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f) #

(Default a, Default b, Default c, Default d, Default e, Default f, Default g) => Default (a, b, c, d, e, f, g) 
Instance details

Defined in Data.Default.Class

Methods

def :: (a, b, c, d, e, f, g) #

Zenity dialogs

data Config Source #

General Zenity configuration

Use def for default configuration.

Constructors

Config 

Fields

Instances

Instances details
Default Config Source # 
Instance details

Defined in Zenity

Methods

def :: Config #

data CalendarFlags Source #

Flags for the Calendar dialog

Use def for default flags.

Constructors

CalendarFlags 

Fields

Instances

Instances details
Eq CalendarFlags Source # 
Instance details

Defined in Zenity

Show CalendarFlags Source # 
Instance details

Defined in Zenity

Default CalendarFlags Source # 
Instance details

Defined in Zenity

Methods

def :: CalendarFlags #

data EntryFlags Source #

Flags for the Entry dialog

Use def for default flags.

Constructors

EntryFlags 

Fields

Instances

Instances details
Eq EntryFlags Source # 
Instance details

Defined in Zenity

Show EntryFlags Source # 
Instance details

Defined in Zenity

Default EntryFlags Source # 
Instance details

Defined in Zenity

Methods

def :: EntryFlags #

data FileSelectionFlags Source #

Flags for the FileSelection dialog

Use def for default flags.

Constructors

FileSelectionFlags 

Fields

Instances

Instances details
Eq FileSelectionFlags Source # 
Instance details

Defined in Zenity

Show FileSelectionFlags Source # 
Instance details

Defined in Zenity

Default FileSelectionFlags Source # 
Instance details

Defined in Zenity

data InfoFlags Source #

Flags for the Error, Info, Notification and Warning dialogs

Note: $sel:noWrap:InfoFlags and $sel:noMarkup:InfoFlags have no effect on Notification dialogs.

Use def for default flags.

Constructors

InfoFlags 

Fields

Instances

Instances details
Eq InfoFlags Source # 
Instance details

Defined in Zenity

Show InfoFlags Source # 
Instance details

Defined in Zenity

Default InfoFlags Source # 
Instance details

Defined in Zenity

Methods

def :: InfoFlags #

data ReturnedColumn a Source #

What column(s) to return in a List dialog

The default value is Col 1.

When All is specified, the columns will be separated by newline characters (\n) in the result.

Constructors

All

Return all columns

Col a

Return the specified column (starting from 1)

Instances

Instances details
Functor ReturnedColumn Source # 
Instance details

Defined in Zenity

Methods

fmap :: (a -> b) -> ReturnedColumn a -> ReturnedColumn b #

(<$) :: a -> ReturnedColumn b -> ReturnedColumn a #

Eq a => Eq (ReturnedColumn a) Source # 
Instance details

Defined in Zenity

Show a => Show (ReturnedColumn a) Source # 
Instance details

Defined in Zenity

data ListFlags Source #

Flags for the List dialog

Use def for default flags.

Constructors

ListFlags 

Fields

Instances

Instances details
Eq ListFlags Source # 
Instance details

Defined in Zenity

Show ListFlags Source # 
Instance details

Defined in Zenity

Default ListFlags Source # 
Instance details

Defined in Zenity

Methods

def :: ListFlags #

newtype SelectionHeader Source #

Header for the selection column in a radio or check list (can be empty)

Constructors

SelectionHeader 

Instances

Instances details
Eq SelectionHeader Source # 
Instance details

Defined in Zenity

Show SelectionHeader Source # 
Instance details

Defined in Zenity

IsString SelectionHeader Source # 
Instance details

Defined in Zenity

data ListType a where Source #

List dialog type

Instances

Instances details
Eq (ListType a) Source # 
Instance details

Defined in Zenity

Methods

(==) :: ListType a -> ListType a -> Bool #

(/=) :: ListType a -> ListType a -> Bool #

Show (ListType a) Source # 
Instance details

Defined in Zenity

Methods

showsPrec :: Int -> ListType a -> ShowS #

show :: ListType a -> String #

showList :: [ListType a] -> ShowS #

radio :: ListType (Maybe Text) Source #

A radio list type with no selection header

check :: ListType [Text] Source #

A check list type with no selection header

data Matrix Source #

The contents of a list dialog

When used in a dialog, the matrix will be transformed in the following ways:

  • Make sure that the matrix is rectangular and has at least one column and one row. Any headers or elements that are added will be empty strings.
  • Any newline characters will be turned into space characters. (This is because newline characters are used internally as separators when returning multiple rows and/or columns.)

Constructors

Matrix 

Fields

Instances

Instances details
Eq Matrix Source # 
Instance details

Defined in Zenity

Methods

(==) :: Matrix -> Matrix -> Bool #

(/=) :: Matrix -> Matrix -> Bool #

Show Matrix Source # 
Instance details

Defined in Zenity

data Dialog a where Source #

Zenity commands

Things to be aware of:

  • In the very unlikely case of a file name containing newline characters, MultiFileSelection will give an incorrect result. This is because it uses \n to separate the files returned from Zenity.

zenity :: Config -> Dialog a -> IO a Source #

Run a Dialog action

Extra dialogs

keyedList Source #

Arguments

:: (Show a, Read a, Functor f) 
=> Config 
-> ListType (f Text) 
-> ListFlags

returnColumn and hideColumn will be ignored

-> Text

Column head (can be empty)

-> [(a, Text)]

List to select from

-> IO (f a) 

Make a list selection dialog that selects values from an association list

Each item is a pair of a value of type a and a text. Only the text will be shown in the dialog, but the value associated with the selected text will be returned.