mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 20:10:23 +10:00
Adding submaps and search prompts to Xmonad.
This commit is contained in:
2
.bashrc
2
.bashrc
@@ -7,7 +7,7 @@
|
|||||||
# My bash config. Not much to see here. Some pretty standard stuff.
|
# My bash config. Not much to see here. Some pretty standard stuff.
|
||||||
|
|
||||||
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
||||||
EDITOR="kak"
|
EDITOR="nvim"
|
||||||
export TERM="st-256color"
|
export TERM="st-256color"
|
||||||
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
|
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,15 @@ import XMonad.Hooks.SetWMName
|
|||||||
import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs.
|
import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs.
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
import XMonad.Actions.Promote
|
|
||||||
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
|
|
||||||
import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
|
import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
|
||||||
import XMonad.Actions.WindowGo (runOrRaise)
|
|
||||||
import XMonad.Actions.WithAll (sinkAll, killAll)
|
|
||||||
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
||||||
import XMonad.Actions.GridSelect
|
import XMonad.Actions.GridSelect
|
||||||
import XMonad.Actions.MouseResize
|
import XMonad.Actions.MouseResize
|
||||||
|
import XMonad.Actions.Promote
|
||||||
|
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
|
||||||
|
import XMonad.Actions.WindowGo (runOrRaise)
|
||||||
|
import XMonad.Actions.WithAll (sinkAll, killAll)
|
||||||
|
import qualified XMonad.Actions.Search as S
|
||||||
|
|
||||||
-- Layouts modifiers
|
-- Layouts modifiers
|
||||||
import XMonad.Layout.Decoration
|
import XMonad.Layout.Decoration
|
||||||
@@ -79,7 +80,7 @@ import XMonad.Layout.ZoomRow (zoomReset, ZoomMessage(ZoomFullToggle))
|
|||||||
-- VARIABLES
|
-- VARIABLES
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
myFont :: [Char]
|
myFont :: [Char]
|
||||||
myFont = "xft:Mononoki Nerd Font:regular:pixelsize=11"
|
myFont = "xft:Mononoki Nerd Font:bold:pixelsize=13"
|
||||||
|
|
||||||
myModMask :: KeyMask
|
myModMask :: KeyMask
|
||||||
myModMask = mod4Mask -- Sets modkey to super/windows key
|
myModMask = mod4Mask -- Sets modkey to super/windows key
|
||||||
@@ -112,8 +113,8 @@ myStartupHook = do
|
|||||||
spawnOnce "nm-applet &"
|
spawnOnce "nm-applet &"
|
||||||
spawnOnce "volumeicon &"
|
spawnOnce "volumeicon &"
|
||||||
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x292d3e --height 18 &"
|
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x292d3e --height 18 &"
|
||||||
--spawnOnce "emacs --daemon &"
|
spawnOnce "emacs --daemon &"
|
||||||
spawnOnce "kak -d -s mysession &"
|
-- spawnOnce "kak -d -s mysession &"
|
||||||
setWMName "LG3D"
|
setWMName "LG3D"
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
@@ -121,17 +122,17 @@ myStartupHook = do
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
myColorizer :: Window -> Bool -> X (String, String)
|
myColorizer :: Window -> Bool -> X (String, String)
|
||||||
myColorizer = colorRangeFromClassName
|
myColorizer = colorRangeFromClassName
|
||||||
(0x31,0x2e,0x39) -- lowest inactive bg
|
(0x29,0x2d,0x3e) -- lowest inactive bg
|
||||||
(0x31,0x2e,0x39) -- highest inactive bg
|
(0x29,0x2d,0x3e) -- highest inactive bg
|
||||||
(0x61,0x57,0x72) -- active bg
|
(0xc7,0x92,0xea) -- active bg
|
||||||
(0xc0,0xa7,0x9a) -- inactive fg
|
(0xc0,0xa7,0x9a) -- inactive fg
|
||||||
(0xff,0xff,0xff) -- active fg
|
(0x29,0x2d,0x3e) -- active fg
|
||||||
|
|
||||||
-- gridSelect menu layout
|
-- gridSelect menu layout
|
||||||
mygridConfig :: p -> GSConfig Window
|
mygridConfig :: p -> GSConfig Window
|
||||||
mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
|
mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
|
||||||
{ gs_cellheight = 30
|
{ gs_cellheight = 40
|
||||||
, gs_cellwidth = 200
|
, gs_cellwidth = 250
|
||||||
, gs_cellpadding = 8
|
, gs_cellpadding = 8
|
||||||
, gs_originFractX = 0.5
|
, gs_originFractX = 0.5
|
||||||
, gs_originFractY = 0.5
|
, gs_originFractY = 0.5
|
||||||
@@ -142,6 +143,88 @@ spawnSelected' :: [(String, String)] -> X ()
|
|||||||
spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
|
spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
|
||||||
where conf = def
|
where conf = def
|
||||||
|
|
||||||
|
-- Set favorite apps for the spawnSelected'
|
||||||
|
myAppGrid :: [([Char], [Char])]
|
||||||
|
myAppGrid = [ ("Audacity", "audacity")
|
||||||
|
, ("Deadbeef", "deadbeef")
|
||||||
|
, ("Emacs", "emacs")
|
||||||
|
, ("Firefox", "firefox")
|
||||||
|
, ("Geany", "geany")
|
||||||
|
, ("Geary", "geary")
|
||||||
|
, ("Gimp", "gimp")
|
||||||
|
, ("Kdenlive", "kdenlive")
|
||||||
|
, ("LibreOffice Impress", "loimpress")
|
||||||
|
, ("LibreOffice Writer", "lowriter")
|
||||||
|
, ("OBS", "obs")
|
||||||
|
, ("PCManFM", "pcmanfm")
|
||||||
|
, ("Simple Terminal", "st")
|
||||||
|
, ("Steam", "steam")
|
||||||
|
, ("Surf Browser", "surf suckless.org")
|
||||||
|
, ("Xonotic", "xonotic-glx")
|
||||||
|
]
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- XPROMPT SETTINGS
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
dtXPConfig :: XPConfig
|
||||||
|
dtXPConfig = def
|
||||||
|
{ font = "xft:Mononoki Nerd Font:size=9"
|
||||||
|
, bgColor = "#292d3e"
|
||||||
|
, fgColor = "#d0d0d0"
|
||||||
|
, bgHLight = "#c792ea"
|
||||||
|
, fgHLight = "#000000"
|
||||||
|
, borderColor = "#535974"
|
||||||
|
, promptBorderWidth = 0
|
||||||
|
, promptKeymap = dtXPKeymap
|
||||||
|
, position = Top
|
||||||
|
-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
|
||||||
|
, height = 20
|
||||||
|
, historySize = 256
|
||||||
|
, historyFilter = id
|
||||||
|
, defaultText = []
|
||||||
|
, autoComplete = Just 100000 -- set Just 100000 for .1 sec
|
||||||
|
, showCompletionOnTab = False
|
||||||
|
, searchPredicate = isPrefixOf
|
||||||
|
, alwaysHighlight = True
|
||||||
|
, maxComplRows = Nothing -- set to Just 5 for 5 rows
|
||||||
|
}
|
||||||
|
|
||||||
|
-- The same config minus the autocomplete feature which is annoying on
|
||||||
|
-- certain Xprompts, like the search engine prompts.
|
||||||
|
dtXPConfig' :: XPConfig
|
||||||
|
dtXPConfig' = dtXPConfig
|
||||||
|
{ autoComplete = Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
-- A list of all of the standard Xmonad prompts
|
||||||
|
promptList :: [(String, XPConfig -> X ())]
|
||||||
|
promptList = [ ("m", manPrompt) -- manpages prompt
|
||||||
|
, ("p", passPrompt) -- get passwords (requires 'pass')
|
||||||
|
, ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
|
||||||
|
, ("r", passRemovePrompt) -- remove passwords (requires 'pass')
|
||||||
|
, ("s", sshPrompt) -- ssh prompt
|
||||||
|
, ("x", xmonadPrompt) -- xmonad prompt
|
||||||
|
]
|
||||||
|
|
||||||
|
-- A list of my custom prompts
|
||||||
|
promptList' :: [(String, XPConfig -> String -> X (), String)]
|
||||||
|
promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
|
||||||
|
]
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- CUSTOM PROMPTS
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- calcPrompt requires a cli calculator called qalcualte-gtk.
|
||||||
|
-- You could use this as a template for other custom prompts that
|
||||||
|
-- use command line programs that return a single line of output.
|
||||||
|
calcPrompt :: XPConfig -> String -> X ()
|
||||||
|
calcPrompt c ans =
|
||||||
|
inputPrompt c (trim ans) ?+ \input ->
|
||||||
|
liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
|
||||||
|
where
|
||||||
|
trim = f . f
|
||||||
|
where f = reverse . dropWhile isSpace
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- XPROMPT KEYMAP (emacs-like key bindings)
|
-- XPROMPT KEYMAP (emacs-like key bindings)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
@@ -185,47 +268,45 @@ dtXPKeymap = M.fromList $
|
|||||||
]
|
]
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- XPROMPT SETTINGS
|
-- SEARCH ENGINES
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
dtXPConfig :: XPConfig
|
-- Xmonad has several search engines available to use located in
|
||||||
dtXPConfig = def
|
-- XMonad.Actions.Search. Additionally, you can add other search engines
|
||||||
{ font = "xft:Mononoki Nerd Font:size=9"
|
-- such as those listed below.
|
||||||
, bgColor = "#292d3e"
|
archwiki, ebay, news, reddit, urban :: S.SearchEngine
|
||||||
, fgColor = "#d0d0d0"
|
|
||||||
, bgHLight = "#c792ea"
|
|
||||||
, fgHLight = "#000000"
|
|
||||||
, borderColor = "#535974"
|
|
||||||
, promptBorderWidth = 0
|
|
||||||
, promptKeymap = dtXPKeymap
|
|
||||||
, position = Top
|
|
||||||
-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
|
|
||||||
, height = 20
|
|
||||||
, historySize = 256
|
|
||||||
, historyFilter = id
|
|
||||||
, defaultText = []
|
|
||||||
, autoComplete = Just 100000 -- set Just 100000 for .1 sec
|
|
||||||
, showCompletionOnTab = False
|
|
||||||
, searchPredicate = isPrefixOf
|
|
||||||
, alwaysHighlight = True
|
|
||||||
, maxComplRows = Nothing -- set to Just 5 for 5 rows
|
|
||||||
}
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
|
||||||
-- CALCPROMPT requires qalculate-gtk to be installed
|
ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
|
||||||
------------------------------------------------------------------------
|
news = S.searchEngine "news" "https://news.google.com/search?q="
|
||||||
-- You could use this as a template for other custom prompts that
|
reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
|
||||||
-- use command line programs that return a single line of output.
|
urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
|
||||||
calcPrompt :: XPConfig -> String -> X ()
|
|
||||||
calcPrompt c ans =
|
-- This is the list of search engines that I want to use. Some are from
|
||||||
inputPrompt c (trim ans) ?+ \input ->
|
-- XMonad.Actions.Search, and some are the ones that I added above.
|
||||||
liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
|
searchList :: [(String, S.SearchEngine)]
|
||||||
where
|
searchList = [ ("a", archwiki)
|
||||||
trim = f . f
|
, ("d", S.duckduckgo)
|
||||||
where f = reverse . dropWhile isSpace
|
, ("e", ebay)
|
||||||
|
, ("g", S.google)
|
||||||
|
, ("h", S.hoogle)
|
||||||
|
, ("i", S.images)
|
||||||
|
, ("n", news)
|
||||||
|
, ("r", reddit)
|
||||||
|
, ("s", S.stackage)
|
||||||
|
, ("t", S.thesaurus)
|
||||||
|
, ("v", S.vocabulary)
|
||||||
|
, ("b", S.wayback)
|
||||||
|
, ("u", urban)
|
||||||
|
, ("w", S.wikipedia)
|
||||||
|
, ("y", S.youtube)
|
||||||
|
, ("z", S.amazon)
|
||||||
|
]
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- KEYBINDINGS
|
-- KEYBINDINGS
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
-- I am using the Xmonad.Util.EZConfig module which allows keybindings
|
||||||
|
-- to be written in simpler, emacs-like format.
|
||||||
myKeys :: [([Char], X ())]
|
myKeys :: [([Char], X ())]
|
||||||
myKeys =
|
myKeys =
|
||||||
-- Xmonad
|
-- Xmonad
|
||||||
@@ -233,17 +314,8 @@ myKeys =
|
|||||||
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
||||||
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
||||||
|
|
||||||
-- Prompts
|
-- Run Prompt
|
||||||
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
|
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
|
||||||
, ("M-S-o", xmonadPrompt dtXPConfig) -- Xmonad Prompt
|
|
||||||
, ("M-S-s", sshPrompt dtXPConfig) -- Ssh Prompt
|
|
||||||
, ("M-S-m", manPrompt dtXPConfig) -- Manpage Prompt
|
|
||||||
-- Require pass to be installed
|
|
||||||
, ("M1-C-p", passPrompt dtXPConfig) -- Get Passwords Prompt
|
|
||||||
, ("M1-C-g", passGeneratePrompt dtXPConfig) -- Generate Passwords Prompt
|
|
||||||
, ("M1-C-r", passRemovePrompt dtXPConfig) -- Remove Passwords Prompt
|
|
||||||
-- Calculator prompt
|
|
||||||
, ("M1-C-c", calcPrompt dtXPConfig "qalc") -- Requires qalculate-gtk
|
|
||||||
|
|
||||||
-- Windows
|
-- Windows
|
||||||
, ("M-S-c", kill1) -- Kill the currently focused client
|
, ("M-S-c", kill1) -- Kill the currently focused client
|
||||||
@@ -255,24 +327,7 @@ myKeys =
|
|||||||
, ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
|
, ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
|
||||||
|
|
||||||
-- Grid Select
|
-- Grid Select
|
||||||
, (("M-S-t"), spawnSelected'
|
, ("M-S-t", spawnSelected' myAppGrid) -- grid select favorite apps
|
||||||
[ ("Audacity", "audacity")
|
|
||||||
, ("Deadbeef", "deadbeef")
|
|
||||||
, ("Emacs", "emacs")
|
|
||||||
, ("Firefox", "firefox")
|
|
||||||
, ("Geany", "geany")
|
|
||||||
, ("Geary", "geary")
|
|
||||||
, ("Gimp", "gimp")
|
|
||||||
, ("Kdenlive", "kdenlive")
|
|
||||||
, ("LibreOffice Impress", "loimpress")
|
|
||||||
, ("LibreOffice Writer", "lowriter")
|
|
||||||
, ("OBS", "obs")
|
|
||||||
, ("PCManFM", "pcmanfm")
|
|
||||||
, ("Simple Terminal", "st")
|
|
||||||
, ("Steam", "steam")
|
|
||||||
, ("Surf Browser", "surf suckless.org")
|
|
||||||
, ("Xonotic", "xonotic-glx")
|
|
||||||
])
|
|
||||||
, ("M-S-g", goToSelected $ mygridConfig myColorizer) -- goto selected
|
, ("M-S-g", goToSelected $ mygridConfig myColorizer) -- goto selected
|
||||||
, ("M-S-b", bringSelected $ mygridConfig myColorizer) -- bring selected
|
, ("M-S-b", bringSelected $ mygridConfig myColorizer) -- bring selected
|
||||||
|
|
||||||
@@ -332,7 +387,13 @@ myKeys =
|
|||||||
|
|
||||||
-- Scratchpads
|
-- Scratchpads
|
||||||
, ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
|
, ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
|
||||||
, ("M-C-c", namedScratchpadAction myScratchPads "cmus")
|
, ("M-C-c", namedScratchpadAction myScratchPads "mocp")
|
||||||
|
|
||||||
|
-- Controls for mocp music player.
|
||||||
|
, ("M-u p", spawn "mocp --play")
|
||||||
|
, ("M-u l", spawn "mocp --next")
|
||||||
|
, ("M-u h", spawn "mocp --previous")
|
||||||
|
, ("M-u <Space>", spawn "mocp --toggle-pause")
|
||||||
|
|
||||||
-- Open My Preferred Terminal. I also run the FISH shell. Setting FISH as my default shell
|
-- Open My Preferred Terminal. I also run the FISH shell. Setting FISH as my default shell
|
||||||
-- breaks some things so I prefer to just launch "fish" when I open a terminal.
|
-- breaks some things so I prefer to just launch "fish" when I open a terminal.
|
||||||
@@ -341,10 +402,9 @@ myKeys =
|
|||||||
--- Dmenu Scripts (Alt+Ctr+Key)
|
--- Dmenu Scripts (Alt+Ctr+Key)
|
||||||
--, ("M-S-<Return>", spawn "dmenu_run")
|
--, ("M-S-<Return>", spawn "dmenu_run")
|
||||||
, ("M1-C-e", spawn "./.dmenu/dmenu-edit-configs.sh")
|
, ("M1-C-e", spawn "./.dmenu/dmenu-edit-configs.sh")
|
||||||
, ("M1-C-h", spawn "./.dmenu/dmenu-hugo.sh")
|
|
||||||
, ("M1-C-m", spawn "./.dmenu/dmenu-sysmon.sh")
|
, ("M1-C-m", spawn "./.dmenu/dmenu-sysmon.sh")
|
||||||
--, ("M1-C-p", spawn "passmenu")
|
--, ("M1-C-p", spawn "passmenu")
|
||||||
, ("M1-C-s", spawn "./.dmenu/dmenu-surfraw.sh")
|
--, ("M1-C-s", spawn "./.dmenu/dmenu-surfraw.sh")
|
||||||
, ("M1-C-/", spawn "./.dmenu/dmenu-scrot.sh")
|
, ("M1-C-/", spawn "./.dmenu/dmenu-scrot.sh")
|
||||||
|
|
||||||
--- My Applications (Super+Alt+Key)
|
--- My Applications (Super+Alt+Key)
|
||||||
@@ -376,7 +436,14 @@ myKeys =
|
|||||||
, ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
|
, ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
|
||||||
, ("<XF86Eject>", spawn "toggleeject")
|
, ("<XF86Eject>", spawn "toggleeject")
|
||||||
, ("<Print>", spawn "scrotd 0")
|
, ("<Print>", spawn "scrotd 0")
|
||||||
] where nonNSP = WSIs (return (\ws -> W.tag ws /= "nsp"))
|
]
|
||||||
|
-- Appending search engines to keybindings list
|
||||||
|
++ [("M-s " ++ k, S.promptSearch dtXPConfig' f) | (k,f) <- searchList ]
|
||||||
|
++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
|
||||||
|
++ [("M-p " ++ k, f dtXPConfig') | (k,f) <- promptList ]
|
||||||
|
++ [("M-p " ++ k, f dtXPConfig' g) | (k,f,g) <- promptList' ]
|
||||||
|
-- Appending named scratchpads to keybindings list
|
||||||
|
where nonNSP = WSIs (return (\ws -> W.tag ws /= "nsp"))
|
||||||
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "nsp"))
|
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "nsp"))
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
@@ -408,7 +475,7 @@ myWorkspaces = clickable . (map xmobarEscape)
|
|||||||
-- if you are using clickable workspaces. You need the className or title
|
-- if you are using clickable workspaces. You need the className or title
|
||||||
-- of the program. Use xprop to get this info.
|
-- of the program. Use xprop to get this info.
|
||||||
|
|
||||||
myManageHook :: Query (Data.Monoid.Endo WindowSet)
|
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
|
||||||
myManageHook = composeAll
|
myManageHook = composeAll
|
||||||
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
|
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
|
||||||
-- I'm doing it this way because otherwise I would have to write out
|
-- I'm doing it this way because otherwise I would have to write out
|
||||||
@@ -494,7 +561,7 @@ myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts float
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
myScratchPads :: [NamedScratchpad]
|
myScratchPads :: [NamedScratchpad]
|
||||||
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
||||||
, NS "mocp" spawnCmus findCmus manageCmus
|
, NS "mocp" spawnMocp findMocp manageMocp
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
spawnTerm = myTerminal ++ " -n scratchpad"
|
spawnTerm = myTerminal ++ " -n scratchpad"
|
||||||
@@ -505,9 +572,9 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
|||||||
w = 0.9
|
w = 0.9
|
||||||
t = 0.95 -h
|
t = 0.95 -h
|
||||||
l = 0.95 -w
|
l = 0.95 -w
|
||||||
spawnCmus = myTerminal ++ " -n mocp 'mocp'"
|
spawnMocp = myTerminal ++ " -n mocp 'mocp'"
|
||||||
findCmus = resource =? "mocp"
|
findMocp = resource =? "mocp"
|
||||||
manageCmus = customFloating $ W.RationalRect l t w h
|
manageMocp = customFloating $ W.RationalRect l t w h
|
||||||
where
|
where
|
||||||
h = 0.9
|
h = 0.9
|
||||||
w = 0.9
|
w = 0.9
|
||||||
|
|||||||
92
.xmonad/xmonadctl.hs
Normal file
92
.xmonad/xmonadctl.hs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import Graphics.X11.Xlib
|
||||||
|
import Graphics.X11.Xlib.Extras
|
||||||
|
import System.Environment
|
||||||
|
import System.IO
|
||||||
|
import Data.Char
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = parse True "XMONAD_COMMAND" =<< getArgs
|
||||||
|
|
||||||
|
parse :: Bool -> String -> [String] -> IO ()
|
||||||
|
parse input addr args = case args of
|
||||||
|
["--"] | input -> repl addr
|
||||||
|
| otherwise -> return ()
|
||||||
|
("--":xs) -> sendAll addr xs
|
||||||
|
("-a":a:xs) -> parse input a xs
|
||||||
|
("-h":_) -> showHelp
|
||||||
|
("--help":_) -> showHelp
|
||||||
|
("-?":_) -> showHelp
|
||||||
|
(a@('-':_):_) -> hPutStrLn stderr ("Unknown option " ++ a)
|
||||||
|
|
||||||
|
(x:xs) -> sendCommand addr x >> parse False addr xs
|
||||||
|
[] | input -> repl addr
|
||||||
|
| otherwise -> return ()
|
||||||
|
|
||||||
|
|
||||||
|
repl :: String -> IO ()
|
||||||
|
repl addr = do e <- isEOF
|
||||||
|
case e of
|
||||||
|
True -> return ()
|
||||||
|
False -> do l <- getLine
|
||||||
|
sendCommand addr l
|
||||||
|
repl addr
|
||||||
|
|
||||||
|
sendAll :: String -> [String] -> IO ()
|
||||||
|
sendAll addr ss = foldr (\a b -> sendCommand addr a >> b) (return ()) ss
|
||||||
|
|
||||||
|
sendCommand :: String -> String -> IO ()
|
||||||
|
sendCommand addr s = do
|
||||||
|
d <- openDisplay ""
|
||||||
|
rw <- rootWindow d $ defaultScreen d
|
||||||
|
a <- internAtom d addr False
|
||||||
|
m <- internAtom d s False
|
||||||
|
allocaXEvent $ \e -> do
|
||||||
|
setEventType e clientMessage
|
||||||
|
setClientMessageEvent e rw a 32 m currentTime
|
||||||
|
sendEvent d rw False structureNotifyMask e
|
||||||
|
sync d False
|
||||||
|
|
||||||
|
showHelp :: IO ()
|
||||||
|
showHelp = do pn <- getProgName
|
||||||
|
putStrLn ("Send commands to a running instance of xmonad. xmonad.hs must be configured with XMonad.Hooks.ServerMode to work.\n-a atomname can be used at any point in the command line arguments to change which atom it is sending on.\nIf sent with no arguments or only -a atom arguments, it will read commands from stdin.\nEx:\n" ++ pn ++ " cmd1 cmd2\n" ++ pn ++ " -a XMONAD_COMMAND cmd1 cmd2 cmd3 -a XMONAD_PRINT hello world\n" ++ pn ++ " -a XMONAD_PRINT # will read data from stdin.\nThe atom defaults to XMONAD_COMMAND.")
|
||||||
|
|
||||||
|
|
||||||
|
-- 1 - view"<action=xdotool key super+1>dev</action>"
|
||||||
|
-- 2 - shift"<action=xdotool key super+1>dev</action>"
|
||||||
|
-- 3 - view"<action=xdotool key super+2>www</action>"
|
||||||
|
-- 4 - shift"<action=xdotool key super+2>www</action>"
|
||||||
|
-- 5 - view"<action=xdotool key super+3>sys</action>"
|
||||||
|
-- 6 - shift"<action=xdotool key super+3>sys</action>"
|
||||||
|
-- 7 - view"<action=xdotool key super+4>doc</action>"
|
||||||
|
-- 8 - shift"<action=xdotool key super+4>doc</action>"
|
||||||
|
-- 9 - view"<action=xdotool key super+5>vbox</action>"
|
||||||
|
-- 10 - shift"<action=xdotool key super+5>vbox</action>"
|
||||||
|
-- 11 - view"<action=xdotool key super+6>chat</action>"
|
||||||
|
-- 12 - shift"<action=xdotool key super+6>chat</action>"
|
||||||
|
-- 13 - view"<action=xdotool key super+7>mus</action>"
|
||||||
|
-- 14 - shift"<action=xdotool key super+7>mus</action>"
|
||||||
|
-- 15 - view"<action=xdotool key super+8>vid</action>"
|
||||||
|
-- 16 - shift"<action=xdotool key super+8>vid</action>"
|
||||||
|
-- 17 - view"<action=xdotool key super+9>gfx</action>"
|
||||||
|
-- 18 - shift"<action=xdotool key super+9>gfx</action>"
|
||||||
|
-- 19 - screen0
|
||||||
|
-- 20 - screen-to-0
|
||||||
|
-- 21 - screen1
|
||||||
|
-- 22 - screen-to-1
|
||||||
|
-- 23 - shrink
|
||||||
|
-- 24 - expand
|
||||||
|
-- 25 - next-layout
|
||||||
|
-- 26 - default-layout
|
||||||
|
-- 27 - restart-wm
|
||||||
|
-- 28 - restart-wm-no-resume
|
||||||
|
-- 29 - xterm
|
||||||
|
-- 30 - run
|
||||||
|
-- 31 - kill
|
||||||
|
-- 32 - refresh
|
||||||
|
-- 33 - focus-up
|
||||||
|
-- 34 - focus-down
|
||||||
|
-- 35 - swap-up
|
||||||
|
-- 36 - swap-down
|
||||||
|
-- 37 - swap-master
|
||||||
|
-- 38 - sink
|
||||||
|
-- 39 - quit-wm
|
||||||
Reference in New Issue
Block a user