audio fn keys
This commit is contained in:
parent
8f212ce394
commit
995541b03d
134
xmonad.hs
134
xmonad.hs
|
@ -1,22 +1,97 @@
|
|||
import Control.Monad (liftM2)
|
||||
import Data.List (isInfixOf)
|
||||
import qualified Data.Monoid
|
||||
import XMonad
|
||||
import XMonad.Actions.WindowGo
|
||||
( ChangeLayout (NextLayout),
|
||||
Default (def),
|
||||
Full (Full),
|
||||
Mirror (Mirror),
|
||||
MonadReader (reader),
|
||||
Query,
|
||||
Tall (Tall),
|
||||
WindowSet,
|
||||
WindowSpace,
|
||||
X,
|
||||
XConfig
|
||||
( borderWidth,
|
||||
focusedBorderColor,
|
||||
layoutHook,
|
||||
logHook,
|
||||
manageHook,
|
||||
modMask,
|
||||
normalBorderColor,
|
||||
startupHook,
|
||||
terminal,
|
||||
workspaces
|
||||
),
|
||||
className,
|
||||
composeAll,
|
||||
doF,
|
||||
doFloat,
|
||||
doIgnore,
|
||||
doShift,
|
||||
mod4Mask,
|
||||
resource,
|
||||
sendMessage,
|
||||
spawn,
|
||||
title,
|
||||
withWindowSet,
|
||||
xmonad,
|
||||
(-->),
|
||||
(<&&>),
|
||||
(<+>),
|
||||
(=?),
|
||||
(|||),
|
||||
)
|
||||
import XMonad.Actions.WindowGo (raise, runOrRaise)
|
||||
import XMonad.Hooks.DynamicLog
|
||||
( PP
|
||||
( ppCurrent,
|
||||
ppExtras,
|
||||
ppHidden,
|
||||
ppHiddenNoWindows,
|
||||
ppOrder,
|
||||
ppSep,
|
||||
ppSort,
|
||||
ppTitleSanitize,
|
||||
ppUrgent
|
||||
),
|
||||
shorten,
|
||||
wrap,
|
||||
xmobarBorder,
|
||||
xmobarColor,
|
||||
xmobarRaw,
|
||||
xmobarStrip,
|
||||
)
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
( activateLogHook,
|
||||
ewmh,
|
||||
ewmhFullscreen,
|
||||
)
|
||||
import XMonad.Hooks.InsertPosition (Focus (Newer), Position (End), insertPosition)
|
||||
import XMonad.Hooks.StatusBar
|
||||
( defToggleStrutsKey,
|
||||
statusBarProp,
|
||||
withEasySB,
|
||||
)
|
||||
import qualified XMonad.Layout.LayoutModifier
|
||||
import XMonad.Layout.Spacing
|
||||
( Border (Border),
|
||||
Spacing,
|
||||
spacingRaw,
|
||||
)
|
||||
import XMonad.Layout.WindowNavigation
|
||||
import XMonad.StackSet (Workspace (tag), currentTag, integrate', stack, greedyView, shift, focusWindow)
|
||||
import XMonad.Util.EZConfig
|
||||
import XMonad.Util.Loggers
|
||||
import XMonad.Util.SpawnOnce
|
||||
import XMonad.Util.Ungrab
|
||||
( Direction2D (L, R),
|
||||
Navigate (Go),
|
||||
windowNavigation,
|
||||
)
|
||||
import XMonad.StackSet (Workspace (tag), currentTag, focusWindow, greedyView, integrate', shift, stack)
|
||||
import XMonad.Util.EZConfig (additionalKeysP)
|
||||
import XMonad.Util.Loggers (logTitles)
|
||||
import XMonad.Util.SpawnOnce (spawnOnce)
|
||||
import XMonad.Util.Ungrab (unGrab)
|
||||
import XMonad.Util.WorkspaceCompare (getSortByIndex)
|
||||
import XMonad.Hooks.InsertPosition (insertPosition, Position(Master, End), Focus (Newer))
|
||||
import XMonad.Hooks.ManageHelpers
|
||||
import Data.List (isInfixOf)
|
||||
import XMonad.Hooks.RefocusLast (RecentWins(previous))
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
@ -33,34 +108,39 @@ main = do
|
|||
workspaces = myWorkspaces,
|
||||
manageHook = myManageHook,
|
||||
layoutHook = myLayout,
|
||||
logHook = activateLogHook (reader focusWindow >>= doF)<+> logHook def
|
||||
logHook = activateLogHook (reader focusWindow >>= doF) <+> logHook def
|
||||
}
|
||||
`additionalKeysP` [ ("M-S-z", spawn "xscreensaver-command -lock"),
|
||||
("M-S-s", unGrab *> spawn "cast_screenshot"),
|
||||
("M-f", runOrRaise "brave" (className =? "Brave-browser")),
|
||||
("M-i", raise (className =? "jetbrains-idea")),
|
||||
|
||||
("M-<Space>", spawn "rofi -show drun") ,
|
||||
("M-p", spawn "dmen") ,
|
||||
("M-<Space>", spawn "rofi -show drun"),
|
||||
("M-p", spawn "dmen"),
|
||||
-- audio settings
|
||||
("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute"),
|
||||
("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute"),
|
||||
("<XF86AudioMute>", spawn "amixer set Master toggle"),
|
||||
("<XF86AudioPlay>", spawn "playerctl play-pause"),
|
||||
("<XF86AudioPrev>", spawn "playerctl previous"),
|
||||
("<XF86AudioNext>", spawn "playerctl next"),
|
||||
-- window navigation
|
||||
("M-l", sendMessage $ Go R),
|
||||
("M-h", sendMessage $ Go L),
|
||||
-- layout switching
|
||||
("M-<Tab>", sendMessage NextLayout),
|
||||
-- dmenu stuff
|
||||
("M1-<F4>", spawn "dshutdown")
|
||||
("M1-<F4>", spawn "powerbutton"),
|
||||
-- lockscreen
|
||||
("M-<Escape>",spawn "betterlockscreen -l")
|
||||
]
|
||||
|
||||
|
||||
myXmobarPP :: [String] -> PP
|
||||
myXmobarPP colors =
|
||||
def
|
||||
{ ppSep = walXmobarColor 1 " • ",
|
||||
ppTitleSanitize = xmobarStrip,
|
||||
ppCurrent = wrap " " "" . xmobarBorder "Top" (colors!!6) 2,
|
||||
ppCurrent = wrap " " "" . xmobarBorder "Top" (colors !! 6) 2,
|
||||
ppHidden = white . wrap " " "",
|
||||
ppHiddenNoWindows = white . wrap " " "",
|
||||
ppUrgent = red . wrap (yellow "!") (yellow "!"),
|
||||
|
@ -69,9 +149,9 @@ myXmobarPP colors =
|
|||
ppSort = hideWorkspaces
|
||||
}
|
||||
where
|
||||
formatFocused = wrap (white "[") (white "]") . walXmobarColor 7. ppWindow
|
||||
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") .walXmobarColor 4. ppWindow
|
||||
walXmobarColor index = xmobarColor (colors!!index) ""
|
||||
formatFocused = wrap (white "[") (white "]") . walXmobarColor 7 . ppWindow
|
||||
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . walXmobarColor 4 . ppWindow
|
||||
walXmobarColor index = xmobarColor (colors !! index) ""
|
||||
ppWindow :: String -> String
|
||||
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
|
||||
|
||||
|
@ -90,13 +170,13 @@ myXmobarPP colors =
|
|||
thefilter = do
|
||||
currentWS <- withWindowSet (pure . currentTag)
|
||||
return $ reverse . dropWhile (liftM2 (&&) ((currentWS /=) . tag) isEmptyWs) . reverse
|
||||
where
|
||||
isEmptyWs workspace = null $ integrate' $ stack workspace
|
||||
|
||||
myStartupHook :: X ()
|
||||
myStartupHook = do
|
||||
spawnOnce "picom &"
|
||||
spawnOnce "sh $HOME/.fehbg"
|
||||
spawnOnce "websocketd --port=8974 wnpClient &"
|
||||
|
||||
getWalColors :: IO [String]
|
||||
getWalColors = do
|
||||
|
@ -112,13 +192,12 @@ mySpacing' i = spacingRaw True (Border i 0 i i) True (Border i 0 i i) True
|
|||
myWorkspaces :: [String]
|
||||
myWorkspaces = show <$> [1 .. 9]
|
||||
|
||||
|
||||
myLayout = windowNavigation tiled ||| Mirror tiled ||| Full
|
||||
where
|
||||
tiled = mySpacing' 8 $ Tall nmaster delta ratio
|
||||
nmaster = 1 -- Default number of windows in the master pane
|
||||
ratio = 1/2 -- Default proportion of screen occupied by master pane
|
||||
delta = 3/100 -- Percent of screen to increment by when resizing panes
|
||||
ratio = 1 / 2 -- Default proportion of screen occupied by master pane
|
||||
delta = 3 / 100 -- Percent of screen to increment by when resizing panes
|
||||
|
||||
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
|
||||
myManageHook =
|
||||
|
@ -142,13 +221,14 @@ myManageHook =
|
|||
title =? "Signal" --> viewShift (myWorkspaces !! 2),
|
||||
className =? "TelegramDesktop" --> viewShift (myWorkspaces !! 2),
|
||||
className =? "Gimp" --> doShift (myWorkspaces !! 8),
|
||||
className =? "VirtualBox Manager" --> doShift (myWorkspaces !! 4),
|
||||
(className =? "firefox" <&&> resource =? "Dialog") --> doFloat, -- Float Firefox Dialog
|
||||
className =? "jetbrains-idea" --> viewShift (myWorkspaces !! 4) ,
|
||||
className =? "alfaview" --> viewShift (myWorkspaces !! 5),
|
||||
className =? "jetbrains-idea" --> viewShift (myWorkspaces !! 4),
|
||||
(className =? "jetbrains-studio") <&&> (title ~=? "win") --> doIgnore
|
||||
] <+> insertPosition End Newer
|
||||
where viewShift = doF . liftM2 (.) greedyView shift
|
||||
|
||||
]
|
||||
<+> insertPosition End Newer
|
||||
where
|
||||
viewShift = doF . liftM2 (.) greedyView shift
|
||||
|
||||
-- IntelliJ fix
|
||||
(~=?) :: Eq a => Query [a] -> [a] -> Query Bool
|
||||
|
|
Loading…
Reference in New Issue