ENH kinda generalize power prompts
This commit is contained in:
parent
1cf9e3e8bd
commit
12b68f7377
|
@ -69,16 +69,16 @@ runScreenLock =
|
||||||
False
|
False
|
||||||
myScreenlock
|
myScreenlock
|
||||||
|
|
||||||
runPowerOff :: X ()
|
runPowerOff :: MonadUnliftIO m => m ()
|
||||||
runPowerOff = spawn "systemctl poweroff"
|
runPowerOff = spawn "systemctl poweroff"
|
||||||
|
|
||||||
runSuspend :: X ()
|
runSuspend :: MonadUnliftIO m => m ()
|
||||||
runSuspend = spawn "systemctl suspend"
|
runSuspend = spawn "systemctl suspend"
|
||||||
|
|
||||||
runHibernate :: X ()
|
runHibernate :: MonadUnliftIO m => m ()
|
||||||
runHibernate = spawn "systemctl hibernate"
|
runHibernate = spawn "systemctl hibernate"
|
||||||
|
|
||||||
runReboot :: X ()
|
runReboot :: MonadUnliftIO m => m ()
|
||||||
runReboot = spawn "systemctl reboot"
|
runReboot = spawn "systemctl reboot"
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -106,7 +106,7 @@ confirmPrompt' :: T.Text -> X () -> XT.FontBuilder -> X ()
|
||||||
confirmPrompt' s x fb = confirmPrompt (XT.promptTheme fb) (T.unpack s) x
|
confirmPrompt' s x fb = confirmPrompt (XT.promptTheme fb) (T.unpack s) x
|
||||||
|
|
||||||
suspendPrompt :: XT.FontBuilder -> X ()
|
suspendPrompt :: XT.FontBuilder -> X ()
|
||||||
suspendPrompt = confirmPrompt' "suspend?" runSuspend
|
suspendPrompt = confirmPrompt' "suspend?" $ liftIO runSuspend
|
||||||
|
|
||||||
quitPrompt :: XT.FontBuilder -> X ()
|
quitPrompt :: XT.FontBuilder -> X ()
|
||||||
quitPrompt = confirmPrompt' "quit?" $ io exitSuccess
|
quitPrompt = confirmPrompt' "quit?" $ io exitSuccess
|
||||||
|
@ -224,7 +224,7 @@ powerPrompt lock fb = mkXPrompt PowerPrompt theme comp executeMaybeAction
|
||||||
]
|
]
|
||||||
sendMaybeAction a = setInput (show $ fromEnum a) >> setSuccess True >> setDone True
|
sendMaybeAction a = setInput (show $ fromEnum a) >> setSuccess True >> setDone True
|
||||||
executeMaybeAction a = case toEnum $ read a of
|
executeMaybeAction a = case toEnum $ read a of
|
||||||
Poweroff -> runPowerOff
|
Poweroff -> liftIO runPowerOff
|
||||||
Shutdown -> lock >> runSuspend
|
Shutdown -> lock >> liftIO runSuspend
|
||||||
Hibernate -> lock >> runHibernate
|
Hibernate -> lock >> liftIO runHibernate
|
||||||
Reboot -> runReboot
|
Reboot -> liftIO runReboot
|
||||||
|
|
Loading…
Reference in New Issue