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 Control.Monad (liftM2)
import Data.List (isInfixOf)
import qualified Data.Monoid import qualified Data.Monoid
import XMonad 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 import XMonad.Hooks.DynamicLog
( PP
( ppCurrent,
ppExtras,
ppHidden,
ppHiddenNoWindows,
ppOrder,
ppSep,
ppSort,
ppTitleSanitize,
ppUrgent
),
shorten,
wrap,
xmobarBorder,
xmobarColor,
xmobarRaw,
xmobarStrip,
)
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
( activateLogHook,
ewmh,
ewmhFullscreen,
)
import XMonad.Hooks.InsertPosition (Focus (Newer), Position (End), insertPosition)
import XMonad.Hooks.StatusBar import XMonad.Hooks.StatusBar
( defToggleStrutsKey,
statusBarProp,
withEasySB,
)
import qualified XMonad.Layout.LayoutModifier import qualified XMonad.Layout.LayoutModifier
import XMonad.Layout.Spacing import XMonad.Layout.Spacing
( Border (Border),
Spacing,
spacingRaw,
)
import XMonad.Layout.WindowNavigation import XMonad.Layout.WindowNavigation
import XMonad.StackSet (Workspace (tag), currentTag, integrate', stack, greedyView, shift, focusWindow) ( Direction2D (L, R),
import XMonad.Util.EZConfig Navigate (Go),
import XMonad.Util.Loggers windowNavigation,
import XMonad.Util.SpawnOnce )
import XMonad.Util.Ungrab 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.Util.WorkspaceCompare (getSortByIndex)
import XMonad.Hooks.InsertPosition (insertPosition, Position(Master, End), Focus (Newer)) import XMonad.Hooks.RefocusLast (RecentWins(previous))
import XMonad.Hooks.ManageHelpers
import Data.List (isInfixOf)
main :: IO () main :: IO ()
main = do main = do
@ -39,22 +114,27 @@ main = do
("M-S-s", unGrab *> spawn "cast_screenshot"), ("M-S-s", unGrab *> spawn "cast_screenshot"),
("M-f", runOrRaise "brave" (className =? "Brave-browser")), ("M-f", runOrRaise "brave" (className =? "Brave-browser")),
("M-i", raise (className =? "jetbrains-idea")), ("M-i", raise (className =? "jetbrains-idea")),
("M-<Space>", spawn "rofi -show drun"), ("M-<Space>", spawn "rofi -show drun"),
("M-p", spawn "dmen"), ("M-p", spawn "dmen"),
-- audio settings -- audio settings
("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute"), ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute"),
("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute"), ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute"),
("<XF86AudioMute>", spawn "amixer set Master toggle"), ("<XF86AudioMute>", spawn "amixer set Master toggle"),
("<XF86AudioPlay>", spawn "playerctl play-pause"),
("<XF86AudioPrev>", spawn "playerctl previous"),
("<XF86AudioNext>", spawn "playerctl next"),
-- window navigation -- window navigation
("M-l", sendMessage $ Go R), ("M-l", sendMessage $ Go R),
("M-h", sendMessage $ Go L), ("M-h", sendMessage $ Go L),
-- layout switching -- layout switching
("M-<Tab>", sendMessage NextLayout), ("M-<Tab>", sendMessage NextLayout),
-- dmenu stuff -- dmenu stuff
("M1-<F4>", spawn "dshutdown") ("M1-<F4>", spawn "powerbutton"),
-- lockscreen
("M-<Escape>",spawn "betterlockscreen -l")
] ]
myXmobarPP :: [String] -> PP myXmobarPP :: [String] -> PP
myXmobarPP colors = myXmobarPP colors =
def def
@ -90,13 +170,13 @@ myXmobarPP colors =
thefilter = do thefilter = do
currentWS <- withWindowSet (pure . currentTag) currentWS <- withWindowSet (pure . currentTag)
return $ reverse . dropWhile (liftM2 (&&) ((currentWS /=) . tag) isEmptyWs) . reverse return $ reverse . dropWhile (liftM2 (&&) ((currentWS /=) . tag) isEmptyWs) . reverse
where
isEmptyWs workspace = null $ integrate' $ stack workspace isEmptyWs workspace = null $ integrate' $ stack workspace
myStartupHook :: X () myStartupHook :: X ()
myStartupHook = do myStartupHook = do
spawnOnce "picom &" spawnOnce "picom &"
spawnOnce "sh $HOME/.fehbg" spawnOnce "sh $HOME/.fehbg"
spawnOnce "websocketd --port=8974 wnpClient &"
getWalColors :: IO [String] getWalColors :: IO [String]
getWalColors = do 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 :: [String]
myWorkspaces = show <$> [1 .. 9] myWorkspaces = show <$> [1 .. 9]
myLayout = windowNavigation tiled ||| Mirror tiled ||| Full myLayout = windowNavigation tiled ||| Mirror tiled ||| Full
where where
tiled = mySpacing' 8 $ Tall nmaster delta ratio tiled = mySpacing' 8 $ Tall nmaster delta ratio
@ -142,13 +221,14 @@ myManageHook =
title =? "Signal" --> viewShift (myWorkspaces !! 2), title =? "Signal" --> viewShift (myWorkspaces !! 2),
className =? "TelegramDesktop" --> viewShift (myWorkspaces !! 2), className =? "TelegramDesktop" --> viewShift (myWorkspaces !! 2),
className =? "Gimp" --> doShift (myWorkspaces !! 8), className =? "Gimp" --> doShift (myWorkspaces !! 8),
className =? "VirtualBox Manager" --> doShift (myWorkspaces !! 4),
(className =? "firefox" <&&> resource =? "Dialog") --> doFloat, -- Float Firefox Dialog (className =? "firefox" <&&> resource =? "Dialog") --> doFloat, -- Float Firefox Dialog
className =? "alfaview" --> viewShift (myWorkspaces !! 5),
className =? "jetbrains-idea" --> viewShift (myWorkspaces !! 4), className =? "jetbrains-idea" --> viewShift (myWorkspaces !! 4),
(className =? "jetbrains-studio") <&&> (title ~=? "win") --> doIgnore (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 -- IntelliJ fix
(~=?) :: Eq a => Query [a] -> [a] -> Query Bool (~=?) :: Eq a => Query [a] -> [a] -> Query Bool