audio fn keys

This commit is contained in:
qvalentin 2021-10-08 18:15:05 +02:00
parent 8f212ce394
commit 995541b03d
1 changed files with 110 additions and 30 deletions

114
xmonad.hs
View File

@ -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
@ -39,22 +114,27 @@ main = do
("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"),
-- 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
@ -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,7 +192,6 @@ 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
@ -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 =? "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