hgreet-0.1.0.0: Haskell module to interact with the greetd daemon trough it's IPC protocol.
Copyright(c) Hazel (Vawlpe) 2022
LicenseGPL-3.0-or-later
Maintainervawlpe@gmail.com
Stabilityexperimental
PortabilityLinux
Safe HaskellNone
LanguageHaskell2010

HGreet.Client

Description

To use this module, first get the path to the socket of the greetd daemon from the environment variable GREETD_SOCK. This requires the greetd daemon to be running. Then you can communicate with greetd using the withSocketDo function of this module, passing it a callback function that will have direct acccess to the open socket. For a simplified communication scheme you can implement a handler and pass it to handleResponse alongside the socket and command to run on successful authentication.

Documentation

withSocketDo Source #

Arguments

:: String

Path to the socket of the greetd daemon, usually found in the environment variable GREETD_SOCK

-> (Socket -> IO a)

Callback function that will have direct access to the open socket.

-> IO a

Result of the callback function as an IO action.

send Source #

Arguments

:: Socket

Open socket to the greetd daemon, usually obtained from the callback of a withSocketDo function.

-> Request

Request to send to the greetd daemon.

-> IO ()

Empty IO action result.

recv Source #

Arguments

:: Socket

Open socket to the greetd daemon, usually obtained from the callback of a withSocketDo function.

-> IO Response

Response received from the greetd daemon as an IO action.

handleResponse Source #

Arguments

:: (Response -> IO PromptResult)

Handler function that will be called for every response from greetd.

-> Response

Response from greetd that will be passed to the handler function.

-> Socket

Open socket to the greetd daemon, usually obtained from the callback of a withSocketDo function.

-> [String]

List of strings to pass as the command to execute to start session after authentication.

-> IO ()

Empty IO action result.

data PromptResult Source #

Constructors

Success

Successful prompt result.

Error

Error prompt result.

Info

Info prompt result.

Auth String

Auth prompt result.

Instances

Instances details
Eq PromptResult Source # 
Instance details

Defined in HGreet.Client

Show PromptResult Source # 
Instance details

Defined in HGreet.Client

Generic PromptResult Source # 
Instance details

Defined in HGreet.Client

Associated Types

type Rep PromptResult :: Type -> Type #

type Rep PromptResult Source # 
Instance details

Defined in HGreet.Client

type Rep PromptResult = D1 ('MetaData "PromptResult" "HGreet.Client" "hgreet-0.1.0.0-L18MbcRjDZbE3raonslubm" 'False) ((C1 ('MetaCons "Success" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Error" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Info" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Auth" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))