home/xmonad: Choose projects plugin #5
1 changed files with 28 additions and 1 deletions
|
@ -38,6 +38,7 @@ import XMonad.Layout.LimitWindows (limitWindows)
|
||||||
import XMonad.Layout.NoBorders (smartBorders)
|
import XMonad.Layout.NoBorders (smartBorders)
|
||||||
import XMonad.Layout.Spacing (spacing)
|
import XMonad.Layout.Spacing (spacing)
|
||||||
import XMonad.Layout.ThreeColumns (ThreeCol (..))
|
import XMonad.Layout.ThreeColumns (ThreeCol (..))
|
||||||
|
import XMonad.Prompt (XPConfig, XPType (..), XPrompt (..), mkComplFunFromList', mkXPromptWithModes)
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import XMonad.Util.Run
|
import XMonad.Util.Run
|
||||||
|
@ -329,7 +330,8 @@ myKeys conf =
|
||||||
]
|
]
|
||||||
|
|
||||||
misc_kb =
|
misc_kb =
|
||||||
[ -- Change volume
|
[ ("M-o", projectPrompt def),
|
||||||
|
-- Change volume
|
||||||
("<XF86AudioMute>", spawn "amixer -q sset Master toggle"),
|
("<XF86AudioMute>", spawn "amixer -q sset Master toggle"),
|
||||||
("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"),
|
("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 5%+"),
|
||||||
("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-")
|
("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 5%-")
|
||||||
|
@ -350,3 +352,28 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) =
|
||||||
((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster)
|
((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster)
|
||||||
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Project
|
||||||
|
type ProjectName = String
|
||||||
|
|
||||||
|
data Project = Project
|
||||||
|
{ projectName :: !ProjectName,
|
||||||
|
projectStartHook :: !(Maybe (X ()))
|
||||||
|
}
|
||||||
|
|
||||||
|
data ProjectPrompt = ProjectPrompt XPConfig [ProjectName]
|
||||||
|
|
||||||
|
instance XPrompt ProjectPrompt where
|
||||||
|
showXPrompt (ProjectPrompt _ _) = "Choose Project: "
|
||||||
|
|
||||||
|
completionFunction (ProjectPrompt c ns) = mkComplFunFromList' c ns
|
||||||
|
|
||||||
|
modeAction (ProjectPrompt _ _) buf auto = xmessage buf
|
||||||
|
|
||||||
|
projectPrompt :: XPConfig -> X ()
|
||||||
|
projectPrompt c = do
|
||||||
|
let names = ["hello", "world"]
|
||||||
|
modes = [XPT $ ProjectPrompt c names]
|
||||||
|
|
||||||
|
mkXPromptWithModes modes c
|
||||||
|
|
Loading…
Reference in a new issue