From ac37d50d7922484ead476d6e40e7617e1420e9c9 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 29 Mar 2024 00:14:06 +0530 Subject: added keybindings to manipulate floating windows --- .config/XMonad/lib/Defaults.hs | 3 +++ .config/XMonad/lib/Hooks.hs | 1 - .config/XMonad/lib/Keybindings.hs | 18 ++++++++++++++---- .config/XMonad/lib/Util.hs | 5 ----- 4 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 .config/XMonad/lib/Util.hs (limited to '.config/XMonad/lib') diff --git a/.config/XMonad/lib/Defaults.hs b/.config/XMonad/lib/Defaults.hs index 5eeb0a8..1aafc80 100644 --- a/.config/XMonad/lib/Defaults.hs +++ b/.config/XMonad/lib/Defaults.hs @@ -43,6 +43,9 @@ pausePlay = "playerctl play-pause" volUp = "pamixer -i 5" volDown = "pamixer -d 5" volMute = "pamixer -t" +micVolUp = "pamixer --default-source -i 5" +micVolDown = "pamixer --default-source -d 5" +micVolMute = "pamixer --default-source -t" backlightUp = "brightnessctl s +5" backlightDown = "brightnessctl s 5-" diff --git a/.config/XMonad/lib/Hooks.hs b/.config/XMonad/lib/Hooks.hs index 4dcb821..cb49a79 100644 --- a/.config/XMonad/lib/Hooks.hs +++ b/.config/XMonad/lib/Hooks.hs @@ -30,7 +30,6 @@ myManageHook = namedScratchpadManageHook myScratchpads , isFullscreen --> doFullFloat ] ---myLayoutHook = avoidStruts $ maximize $ windowNavigation $ smartBorders $ myGap $ myLayoutHook = avoidStruts $ maximize $ windowNavigation $ lessBorders Screen $ myGap $ emptyBSP ||| tabbed shrinkText myTabTheme ||| Grid diff --git a/.config/XMonad/lib/Keybindings.hs b/.config/XMonad/lib/Keybindings.hs index 224139a..b0bffa6 100644 --- a/.config/XMonad/lib/Keybindings.hs +++ b/.config/XMonad/lib/Keybindings.hs @@ -9,6 +9,8 @@ import XMonad.Actions.WithAll import XMonad.Actions.CycleWS import XMonad.Actions.GridSelect import XMonad.Actions.SwapWorkspaces +import XMonad.Actions.FloatKeys +import qualified XMonad.Actions.FlexibleResize as Flex -- layout modifiers import XMonad.Layout.Spacing @@ -21,7 +23,6 @@ import XMonad.Layout.BinarySpacePartition as BSP -- hooks import XMonad.Hooks.ManageDocks -import Util import Defaults import TreeSelect import Scratchpads @@ -32,6 +33,7 @@ myMouseKeybindings = [ , ((myModMask, 5), \w -> nextWS) , ((myModShiftMask, 4), \w -> shiftToPrev >> prevWS) , ((myModShiftMask, 5), \w -> shiftToNext >> nextWS) + , ((myModMask, 3), \w -> focus w >> Flex.mouseResizeWindow w) ] myFnKeybindingsP :: [(String, X())] @@ -50,9 +52,10 @@ myFnKeybindingsP = [ , ("", spawn pausePlay) , ("", spawn pausePlay) - , ("", spawn myCalculator) - , ("", spawn myDisplayMenu) , ("", spawn myEmailClient) + , ("", spawn myWallpaperMenu) + , ("", spawn myDisplayMenu) + , ("", spawn myCalculator) ] myKeybindings :: [((KeyMask, KeySym), X ())] @@ -87,11 +90,13 @@ myKeybindings = [ , ((myModMask, xK_h), sendMessage $ Go L) , ((myModMask, xK_k), sendMessage $ Go U) , ((myModMask, xK_j), sendMessage $ Go D) + -- swap windows , ((myModShiftMask, xK_l), sendMessage $ WN.Swap R) , ((myModShiftMask, xK_h), sendMessage $ WN.Swap L) , ((myModShiftMask, xK_k), sendMessage $ WN.Swap U) , ((myModShiftMask, xK_j), sendMessage $ WN.Swap D) + -- resize , ((myModMask .|. myModMask', xK_h), sendMessage $ ExpandTowards R) , ((myModMask .|. myModMask', xK_l), sendMessage $ ExpandTowards L) @@ -127,4 +132,9 @@ myKeybindings = [ ] myKeybindingsP :: [(String, X())] -myKeybindingsP = [] +myKeybindingsP = [ + ] ++ [ -- move and resize floating windows + ("M-" <> m <> k, withFocused $ f i) + | (i, k) <- zip [U, D, R, L] ["", "", "", ""] + , (f, m) <- [(directionMoveWindow 10, ""), (directionResizeWindow 10, "S-")] + ] diff --git a/.config/XMonad/lib/Util.hs b/.config/XMonad/lib/Util.hs deleted file mode 100644 index e3bce04..0000000 --- a/.config/XMonad/lib/Util.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Util where - -wsKeys :: [a] -> [b] -> [(a, b)] -wsKeys [] [] = [] -wsKeys (w:ws) (k:ks) = [(w, k)] ++ wsKeys ws ks -- cgit v1.2.3