ADD power prompt
This commit is contained in:
parent
238af29fa3
commit
42c4e2f22f
20
xmonad.hs
20
xmonad.hs
|
@ -10,7 +10,7 @@ import System.Exit
|
||||||
import System.IO
|
import System.IO
|
||||||
|
|
||||||
import Data.List (sortBy)
|
import Data.List (sortBy)
|
||||||
import Data.Maybe (isJust)
|
import Data.Maybe (fromMaybe, isJust)
|
||||||
import Data.Ord (comparing)
|
import Data.Ord (comparing)
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
|
@ -156,6 +156,23 @@ hotPromptTheme = myPromptTheme
|
||||||
, position = Top
|
, position = Top
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO is there a better way to get the prompt to say what I want?
|
||||||
|
data PowerPrompt = PowerPrompt
|
||||||
|
|
||||||
|
instance XPrompt PowerPrompt where
|
||||||
|
showXPrompt PowerPrompt = "Select Option: "
|
||||||
|
|
||||||
|
myPowerPrompt = mkXPrompt PowerPrompt conf comps
|
||||||
|
$ fromMaybe (return ())
|
||||||
|
. (`lookup` commands)
|
||||||
|
where
|
||||||
|
comps = (mkComplFunFromList' (map fst commands))
|
||||||
|
conf = hotPromptTheme
|
||||||
|
commands =
|
||||||
|
map (\cmd -> (cmd, spawn $ "systemctl " ++ cmd))
|
||||||
|
[ "poweroff", "suspend", "reboot", "hibernate"]
|
||||||
|
|
||||||
-- osd
|
-- osd
|
||||||
|
|
||||||
-- getOffset :: X Int
|
-- getOffset :: X Int
|
||||||
|
@ -293,6 +310,7 @@ myKeys c =
|
||||||
, ("M-M1-.", addName "backlight max" $ spawn "adj_backlight max")
|
, ("M-M1-.", addName "backlight max" $ spawn "adj_backlight max")
|
||||||
, ("M-<F2>", addName "restart xmonad" $ spawn "killall xmobar; xmonad --restart")
|
, ("M-<F2>", addName "restart xmonad" $ spawn "killall xmobar; xmonad --restart")
|
||||||
, ("M-S-<F2>", addName "recompile xmonad" $ spawn "killall xmobar; xmonad --recompile && xmonad --restart")
|
, ("M-S-<F2>", addName "recompile xmonad" $ spawn "killall xmobar; xmonad --recompile && xmonad --restart")
|
||||||
|
, ("M-p", addName "power menu" myPowerPrompt)
|
||||||
, ("M-<Home>", addName "quit xmonad" $
|
, ("M-<Home>", addName "quit xmonad" $
|
||||||
confirmPrompt hotPromptTheme "Quit XMonad?" $
|
confirmPrompt hotPromptTheme "Quit XMonad?" $
|
||||||
io (exitWith ExitSuccess))
|
io (exitWith ExitSuccess))
|
||||||
|
|
Loading…
Reference in New Issue