[XMonad] Make scratchpads float by default, add new scratchpads
This commit is contained in:
parent
7d87de304b
commit
8a7486148e
@ -95,7 +95,8 @@ import XMonad.Util.WorkspaceCompare
|
|||||||
myConfig = def
|
myConfig = def
|
||||||
{ modMask = mod4Mask
|
{ modMask = mod4Mask
|
||||||
, terminal = "alacritty"
|
, terminal = "alacritty"
|
||||||
, manageHook = composeOne [ isFullscreen -?> doFullFloat ] <+> manageHook def
|
, manageHook
|
||||||
|
= namedScratchpadManageHook scratchpads
|
||||||
, layoutHook = myLayoutHook
|
, layoutHook = myLayoutHook
|
||||||
, borderWidth = 0
|
, borderWidth = 0
|
||||||
, normalBorderColor = "#0096ff"
|
, normalBorderColor = "#0096ff"
|
||||||
@ -209,31 +210,41 @@ getWorkspaceDmenu = myDmenu (workspaces myConfig)
|
|||||||
-- Selectors
|
-- Selectors
|
||||||
|
|
||||||
isGmailTitle t = isInfixOf "@gmail.com" t && isInfixOf "Gmail" t
|
isGmailTitle t = isInfixOf "@gmail.com" t && isInfixOf "Gmail" t
|
||||||
|
isMessagesTitle = isPrefixOf "Messages"
|
||||||
isChromeClass = isInfixOf "chrome"
|
isChromeClass = isInfixOf "chrome"
|
||||||
|
noSpecialChromeTitles = helper <$> title
|
||||||
|
where helper t = not $ any ($ t) [isGmailTitle, isMessagesTitle]
|
||||||
chromeSelectorBase = isChromeClass <$> className
|
chromeSelectorBase = isChromeClass <$> className
|
||||||
|
|
||||||
chromeSelector =
|
chromeSelector = chromeSelectorBase <&&> noSpecialChromeTitles
|
||||||
chromeSelectorBase <&&>
|
elementSelector = className =? "Element"
|
||||||
(\t -> not $ any ($ t) [isGmailTitle]) <$> title
|
|
||||||
spotifySelector = className =? "Spotify"
|
|
||||||
emacsSelector = className =? "Emacs"
|
emacsSelector = className =? "Emacs"
|
||||||
transmissionSelector = fmap (isPrefixOf "Transmission") title
|
|
||||||
gmailSelector = chromeSelectorBase <&&> fmap isGmailTitle title
|
gmailSelector = chromeSelectorBase <&&> fmap isGmailTitle title
|
||||||
|
messagesSelector = chromeSelectorBase <&&> isMessagesTitle <$> title
|
||||||
|
slackSelector = className =? "Slack"
|
||||||
|
spotifySelector = className =? "Spotify"
|
||||||
|
transmissionSelector = fmap (isPrefixOf "Transmission") title
|
||||||
volumeSelector = className =? "Pavucontrol"
|
volumeSelector = className =? "Pavucontrol"
|
||||||
|
|
||||||
virtualClasses =
|
virtualClasses =
|
||||||
[ (gmailSelector, "Gmail")
|
[ (gmailSelector, "Gmail")
|
||||||
|
, (messagesSelector, "Messages")
|
||||||
, (chromeSelector, "Chrome")
|
, (chromeSelector, "Chrome")
|
||||||
, (transmissionSelector, "Transmission")
|
, (transmissionSelector, "Transmission")
|
||||||
]
|
]
|
||||||
|
|
||||||
-- Commands
|
-- Commands
|
||||||
|
|
||||||
gmailCommand = "google-chrome-stable --new-window https://mail.google.com/mail/u/0/#inbox"
|
|
||||||
spotifyCommand = "spotify"
|
|
||||||
chromeCommand = "google-chrome-stable"
|
chromeCommand = "google-chrome-stable"
|
||||||
|
elementCommand = "element-desktop"
|
||||||
emacsCommand = "emacsclient -c"
|
emacsCommand = "emacsclient -c"
|
||||||
|
gmailCommand =
|
||||||
|
"google-chrome-stable --new-window https://mail.google.com/mail/u/0/#inbox"
|
||||||
htopCommand = "alacritty --title htop -e htop"
|
htopCommand = "alacritty --title htop -e htop"
|
||||||
|
messagesCommand =
|
||||||
|
"google-chrome-stable --new-window https://messages.google.com/web/conversations"
|
||||||
|
slackCommand = "slack"
|
||||||
|
spotifyCommand = "spotify"
|
||||||
transmissionCommand = "transmission-gtk"
|
transmissionCommand = "transmission-gtk"
|
||||||
volumeCommand = "pavucontrol"
|
volumeCommand = "pavucontrol"
|
||||||
|
|
||||||
@ -743,10 +754,23 @@ swapMinimizeStateAfter action =
|
|||||||
|
|
||||||
-- Named Scratchpads
|
-- Named Scratchpads
|
||||||
|
|
||||||
|
nearFullFloat = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
|
||||||
scratchpads =
|
scratchpads =
|
||||||
[ NS "htop" htopCommand (title =? "htop") nonFloating
|
[ NS "element" elementCommand elementSelector nearFullFloat
|
||||||
, NS "spotify" spotifyCommand spotifySelector nonFloating
|
, NS "gmail" gmailCommand gmailSelector nearFullFloat
|
||||||
, NS "volume" volumeCommand volumeSelector nonFloating
|
, NS "htop" htopCommand (title =? "htop") nearFullFloat
|
||||||
|
, NS "messages" messagesCommand messagesSelector nearFullFloat
|
||||||
|
, NS "slack" slackCommand slackSelector nearFullFloat
|
||||||
|
, NS "spotify" spotifyCommand spotifySelector nearFullFloat
|
||||||
|
, NS "transmission" transmissionCommand transmissionSelector nearFullFloat
|
||||||
|
, NS "volume" volumeCommand volumeSelector nearFullFloat
|
||||||
]
|
]
|
||||||
|
|
||||||
-- TODO: This doesnt work well with minimized windows
|
-- TODO: This doesnt work well with minimized windows
|
||||||
@ -863,17 +887,17 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
-- Specific program spawning
|
-- Specific program spawning
|
||||||
bindBringAndRaiseMany
|
bindBringAndRaiseMany
|
||||||
[ (modalt, xK_c, spawn chromeCommand, chromeSelector)
|
[ (modalt, xK_c, spawn chromeCommand, chromeSelector)
|
||||||
, (modalt, xK_e, spawn emacsCommand, emacsSelector)
|
|
||||||
, (modalt, xK_g, spawn gmailCommand, gmailSelector)
|
|
||||||
, (modalt, xK_t, spawn transmissionCommand, transmissionSelector)
|
|
||||||
] ++
|
] ++
|
||||||
|
|
||||||
-- ScratchPads
|
-- ScratchPads
|
||||||
[ ((modalt, xK_m), doScratchpad "htop")
|
[ ((modalt, xK_e), doScratchpad "element")
|
||||||
, ((modalt, xK_v), doScratchpad "volume")
|
, ((modalt, xK_g), doScratchpad "gmail")
|
||||||
|
, ((modalt, xK_h), doScratchpad "htop")
|
||||||
|
, ((modalt, xK_m), doScratchpad "messages")
|
||||||
|
, ((modalt, xK_k), doScratchpad "slack")
|
||||||
, ((modalt, xK_s), doScratchpad "spotify")
|
, ((modalt, xK_s), doScratchpad "spotify")
|
||||||
, ((modalt .|. controlMask, xK_s),
|
, ((modalt, xK_t), doScratchpad "transmission")
|
||||||
myRaiseNextMaybe (spawn spotifyCommand) spotifySelector)
|
, ((modalt, xK_v), doScratchpad "volume")
|
||||||
|
|
||||||
-- Specific program spawning
|
-- Specific program spawning
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user