aboutsummaryrefslogtreecommitdiff
path: root/.config/XMonad/xmonad.hs
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-05-18 18:11:21 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-05-18 18:11:21 +0530
commit4c82a12dd261a9f09e7bddbf2d6e1f92f3246472 (patch)
tree0f1648b596e9b98205b8c06313482ffd65fafc6f /.config/XMonad/xmonad.hs
parent74c6c6e6ae08fd6295f130dbaa38dbed2b127956 (diff)
added some keybindings including screenshot functionality and another scratchpad terminal
Diffstat (limited to '.config/XMonad/xmonad.hs')
-rw-r--r--.config/XMonad/xmonad.hs127
1 files changed, 79 insertions, 48 deletions
diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs
index da8f219..9cc9c5b 100644
--- a/.config/XMonad/xmonad.hs
+++ b/.config/XMonad/xmonad.hs
@@ -43,21 +43,30 @@ altMask = mod1Mask
myLockscreen = "notify-send 'to be set up!' 'to be set up!'"
myColorPicker = "colorpicker --short --one-shot --preview | xsel -b"
myFont = "xft:Sauce Code Pro:style=Regular:size=14"
+volUp = "pamixer -i 5"
+volDown = "pamixer -d 5"
+volMute = "pamixer -t"
+backlightUp = "brightnessctl s +5"
+backlightDown = "brightnessctl s 5-"
+screenshot = "flameshot screen"
+fullScreenshot = "flameshot full"
+customScreenshot = "flameshot gui"
myExtraWorkspaces = [(xK_0, "十")] -- , (xK_comma, " 十一 "), (xK_period, " 十二 "), (xK_slash, " 十三 ")]
-myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", "九"] ++ (map snd myExtraWorkspaces)
+myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", "九"] ++ map snd myExtraWorkspaces
myScratchpads =
[ NS "Term 0" "alacritty -t 'Term 0'" (title =? "Term 0") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
- , NS "Term 1" "alacritty -t 'Term 1'" (title =? "Term 1") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
- , NS "Term 2" "alacritty -t 'Term 2'" (title =? "Term 2") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
- , NS "lf" "alacritty -t 'lf' -e 'lf'" (title =? "lf") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
- , NS "arandr" "arandr" (className =? "Arandr") (customFloating $ W.RationalRect (1/4) (1/4) (1/2) (1/2))
- , NS "calc" "galculator" (className =? "Galculator") (customFloating $ W.RationalRect (5/13) (4/13) (3/13) (6/13))
- , NS "blueman" "blueman-manager" (className =? "Blueman-manager") (customFloating $ W.RationalRect (5.5/16) (4/13) (5/16) (6/13))
- , NS "pavucontrol" "pavucontrol" (className =? "Pavucontrol") (customFloating $ W.RationalRect (3/12) (1/12) (3/6) (5/6))
- , NS "wallpaper" "nitrogen" (className =? "Nitrogen") (customFloating $ W.RationalRect (3/12) (1/12) (3/6) (5/6))
- , NS "BPYTOP" "alacritty -t 'BPYTOP' -e 'bpytop'" (title =? "BPYTOP") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
+ , NS "Term 1" "alacritty -t 'Term 1'" (title =? "Term 1") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
+ , NS "Term 2" "alacritty -t 'Term 2'" (title =? "Term 2") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
+ , NS "Term 3" "alacritty -t 'Term 3'" (title =? "Term 3") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
+ , NS "lf" "alacritty -t 'lf' -e 'lf'" (title =? "lf") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
+ , NS "arandr" "arandr" (className =? "Arandr") (customFloating $ W.RationalRect (1/4) (1/4) (1/2) (1/2))
+ , NS "calc" "galculator" (className =? "Galculator") (customFloating $ W.RationalRect (5/13) (4/13) (3/13) (6/13))
+ , NS "blueman" "blueman-manager" (className =? "Blueman-manager") (customFloating $ W.RationalRect (5.5/16) (4/13) (5/16) (6/13))
+ , NS "pavucontrol" "pavucontrol" (className =? "Pavucontrol") (customFloating $ W.RationalRect (3/12) (1/12) (3/6) (5/6))
+ , NS "wallpaper" "nitrogen" (className =? "Nitrogen") (customFloating $ W.RationalRect (3/12) (1/12) (3/6) (5/6))
+ , NS "BPYTOP" "alacritty -t 'BPYTOP' -e 'bpytop'" (title =? "BPYTOP") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8))
]
myTabTheme = def { fontName = myFont
@@ -86,7 +95,7 @@ myTSConfig = TS.TSConfig { TS.ts_hidechildren = False
}
networkingTS =
- [ Node (TS.TSNode "Transmission" "" (spawn "transmission-gtk")) []
+ [ Node (TS.TSNode "Transmission" "" (spawn "qbittorrent")) []
, Node (TS.TSNode "TOR" "" (spawn "torbrowser-launcher")) []
, Node (TS.TSNode "Discord" "" (spawn "discord")) []
, Node (TS.TSNode "Icecat" "" (spawn "icecat")) []
@@ -97,11 +106,20 @@ networkingTS =
]
myNetworkingTS a = TS.treeselectAction a networkingTS
+screenshotTS =
+ [ Node (TS.TSNode "Custom Selection" "" (spawn customScreenshot)) []
+ , Node (TS.TSNode "Full Screen" "" (spawn screenshot)) []
+ , Node (TS.TSNode "All Screens" "" (spawn fullScreenshot)) []
+ ]
+myScreenshotTS a = TS.treeselectAction a screenshotTS
+
powerTS =
[ Node (TS.TSNode "Shutdown" "" (return()))
[ Node (TS.TSNode "Confirm" "" (spawn "shutdown now")) [] ]
, Node (TS.TSNode "Restart" "" (return()))
[ Node (TS.TSNode "Confirm" "" (spawn "reboot")) [] ]
+ , Node (TS.TSNode "Lock" "" (return()))
+ [ Node (TS.TSNode "Confirm" "" (spawn myLockscreen)) [] ]
, Node (TS.TSNode "Logout" "" (return()))
[ Node (TS.TSNode "Confirm" "" (io exitSuccess)) [] ]
]
@@ -127,6 +145,7 @@ scratchpadTS =
[ Node (TS.TSNode "Term 0" "" (namedScratchpadAction myScratchpads "Term 0")) []
, Node (TS.TSNode "Term 1" "" (namedScratchpadAction myScratchpads "Term 1")) []
, Node (TS.TSNode "Term 2" "" (namedScratchpadAction myScratchpads "Term 2")) []
+ , Node (TS.TSNode "Term 3" "" (namedScratchpadAction myScratchpads "Term 3")) []
, Node (TS.TSNode "lf" "" (namedScratchpadAction myScratchpads "lf")) []
, Node (TS.TSNode "BPYTOP" "" (namedScratchpadAction myScratchpads "BPYTOP")) []
, Node (TS.TSNode "Calculator" "" (namedScratchpadAction myScratchpads "calc")) []
@@ -138,14 +157,14 @@ scratchpadTS =
myScratchpadTS a = TS.treeselectAction a scratchpadTS
xmonadTS =
- [ Node (TS.TSNode "Go To Window" "" (goToSelected defaultGSConfig)) []
- , Node (TS.TSNode "Bring Window" "" (bringSelected defaultGSConfig)) []
- , Node (TS.TSNode "Rotate Windows" "" (sendMessage Rotate)) []
- , Node (TS.TSNode "Swap Windows" "" (sendMessage BSP.Swap)) []
- , Node (TS.TSNode "Un/Maximize" "" (withFocused (sendMessage . maximizeRestore))) []
- , Node (TS.TSNode "Sink Window" "" (withFocused $ windows . W.sink)) []
+ [ Node (TS.TSNode "Rotate Windows" "" (sendMessage Rotate)) []
, Node (TS.TSNode "Sticky Window" "" (windows copyToAll)) []
, Node (TS.TSNode "Un-sticky Window" "" (killAllOtherCopies)) []
+ , Node (TS.TSNode "Swap Windows" "" (sendMessage BSP.Swap)) []
+ , Node (TS.TSNode "Bring Window" "" (bringSelected defaultGSConfig)) []
+ , Node (TS.TSNode "Go To Window" "" (goToSelected defaultGSConfig)) []
+ , Node (TS.TSNode "Sink Window" "" (withFocused $ windows . W.sink)) []
+ , Node (TS.TSNode "Un/Maximize" "" (withFocused (sendMessage . maximizeRestore))) []
]
myXmonadTS a = TS.treeselectAction a xmonadTS
@@ -170,6 +189,7 @@ utilTS =
, Node (TS.TSNode "File Manager" "" (spawn "pcmanfm")) []
, Node (TS.TSNode "Calculator" "" (spawn "galculator")) []
, Node (TS.TSNode "Wallpapers" "" (spawn "nitrogen")) []
+ , Node (TS.TSNode "Screenshot" "" (return())) screenshotTS
]
myUtilTS a = TS.treeselectAction a utilTS
@@ -185,11 +205,10 @@ myTreeMenu a = TS.treeselectAction a
, Node (TS.TSNode "Gaming" "" (return())) gamingTS
, Node (TS.TSNode "Media" "" (return())) mediaTS
, Node (TS.TSNode "Power" "" (return())) powerTS
- , Node (TS.TSNode "Screenshot" "" (spawn "spectacle")) []
])
sGap = 4 -- screen gap
-wGap = 10 -- window gap
+wGap = 8 -- window gap
myGap = spacingRaw True (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True
myGap' = spacingRaw False (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True
@@ -202,9 +221,10 @@ main = do
, modMask = myModMask
, workspaces = myWorkspaces
, normalBorderColor = "#130F23"
- , focusedBorderColor = "#e310a9"
+ , focusedBorderColor = "#c44cf2"
, layoutHook = avoidStruts $ maximize $ windowNavigation $ smartBorders $ myGap $ (
- emptyBSP ||| tabbed shrinkText myTabTheme ||| emptyBSP ||| Grid)
+ emptyBSP ||| tabbed shrinkText myTabTheme ||| Grid
+ )
, startupHook = do
-- spawnOnce "lxsession"
spawnOnce "xmodmap /home/zt/.Xmodmap"
@@ -214,10 +234,10 @@ main = do
spawnOnce "polystart"
spawnOnce "nitrogen --restore"
spawnOnce "cbatticon"
- spawnOnce "blueman-applet"
- spawnOnce "nm-applet"
- spawnOnce "flameshot"
- spawnOnce "optimus-manager-qt"
+ -- spawnOnce "blueman-applet"
+ -- spawnOnce "nm-applet"
+ -- spawnOnce "flameshot"
+ -- spawnOnce "optimus-manager-qt"
setWMName "LG3D"
setDefaultCursor xC_left_ptr
, manageHook = namedScratchpadManageHook myScratchpads
@@ -227,34 +247,42 @@ main = do
]
} `additionalMouseBindings` [
- ((myModMask, 4), \w -> prevWS), ((myModMask, 5), \w -> nextWS)
+ ((myModMask, 4), \w -> prevWS)
+ , ((myModMask, 5), \w -> nextWS)
] `additionalKeys` ([
((myModMask, xK_Return), spawn ("open_terminal"))
, ((myModMask .|. shiftMask, xK_q), kill1)
-
+
+ -- volume keys
+ , ((myModMask, xK_equal), spawn volUp)
+ , ((myModMask, xK_minus), spawn volDown)
+ , ((myModMask, xK_BackSpace), spawn volMute)
+
+ -- brightness keys
+ , ((myModMask .|. shiftMask, xK_equal), spawn backlightUp)
+ , ((myModMask .|. shiftMask, xK_minus), spawn backlightDown)
+
-- modify gaps on runtime
- , ((myModMask, xK_equal), incWindowSpacing 1)
- , ((myModMask, xK_minus), decWindowSpacing 1)
- , ((myModMask .|. shiftMask, xK_equal), incScreenSpacing 1)
- , ((myModMask .|. shiftMask, xK_minus), decScreenSpacing 1)
+ , ((myModMask, xK_F2), incWindowSpacing 1)
+ , ((myModMask, xK_F1), decWindowSpacing 1)
+ , ((myModMask .|. shiftMask, xK_F2), incScreenSpacing 1)
+ , ((myModMask .|. shiftMask, xK_F1), decScreenSpacing 1)
-- view prev/next workspaces
, ((myModMask .|. shiftMask, xK_Tab), prevWS)
, ((myModMask, xK_Tab), nextWS)
+ , ((myModMask, xK_semicolon), prevWS)
+ , ((myModMask, xK_apostrophe), nextWS)
, ((altMask, xK_h), prevWS)
, ((altMask, xK_l), nextWS)
- -- do the same without the evil alt key
- , ((myModMask, xK_comma), prevWS)
- , ((myModMask, xK_period), nextWS)
-
+
-- move to prev/next workspaces
, ((altMask .|. shiftMask, xK_h), shiftToPrev >> prevWS)
, ((altMask .|. shiftMask, xK_l), shiftToNext >> nextWS)
- -- do the same without the evil alt key (might remove either pair later)
- , ((myModMask .|. shiftMask, xK_comma), shiftToPrev >> prevWS)
- , ((myModMask .|. shiftMask, xK_period), shiftToNext >> nextWS)
+ , ((myModMask .|. shiftMask, xK_semicolon), shiftToPrev >> prevWS)
+ , ((myModMask .|. shiftMask, xK_apostrophe), shiftToNext >> nextWS)
- -- focus previous.next monitor
+ -- focus previous/next monitor
, ((myModMask, xK_bracketleft), prevScreen)
, ((myModMask, xK_bracketright), nextScreen)
@@ -322,7 +350,7 @@ main = do
("M-c", spawn myColorPicker)
-- Launchers
, ("M-S-w", myDevTS myTSConfig)
- , ("M-x", myXmonadTS myTSConfig)
+ , ("M-q", myXmonadTS myTSConfig)
, ("M-e", myMediaTS myTSConfig)
, ("M-S-e", myGamingTS myTSConfig)
, ("M-w", myScratchpadTS myTSConfig)
@@ -335,24 +363,27 @@ main = do
, ("M-r", namedScratchpadAction myScratchpads "Term 0")
, ("M-t", namedScratchpadAction myScratchpads "Term 1")
, ("M-y", namedScratchpadAction myScratchpads "Term 2")
+ , ("M-u", namedScratchpadAction myScratchpads "Term 3")
, ("M-m", namedScratchpadAction myScratchpads "BPYTOP")
, ("M-S-m", namedScratchpadAction myScratchpads "calc")
, ("M-n", namedScratchpadAction myScratchpads "pavucontrol")
, ("M-S-n", namedScratchpadAction myScratchpads "arandr")
- , ("M-u", namedScratchpadAction myScratchpads "lf")
, ("M-b", namedScratchpadAction myScratchpads "blueman")
, ("M-S-r", namedScratchpadAction myScratchpads "wallpaper")
-- other apps
- , ("M-S-u", spawn "pcmanfm")
+ , ("M-g", spawn customScreenshot)
+ , ("M-S-o", spawn "pcmanfm")
+ , ("M-S-y", spawn "gimp")
+ , ("M-S-u", spawn "kdenlive")
, ("M-S-b", spawn "discord")
, ("M-S-i", spawn "librewolf")
, ("M-s", spawn "obs")
, ("M-d", spawn "emacs")
-- fn keys
- , ("<XF86MonBrightnessDown>", spawn "brightnessctl s 5-")
- , ("<XF86MonBrightnessUp>", spawn "brightnessctl s +5")
- , ("<XF86AudioLowerVolume>", spawn "pamixer -d 5")
- , ("<XF86AudioRaiseVolume>", spawn "pamixer -i 5")
- , ("<XF86AudioMute>", spawn "pamixer -t")
+ , ("<XF86MonBrightnessUp>", spawn backlightUp)
+ , ("<XF86MonBrightnessDown>", spawn backlightDown)
+ , ("<XF86AudioRaiseVolume>", spawn volUp)
+ , ("<XF86AudioLowerVolume>", spawn volDown)
+ , ("<XF86AudioMute>", spawn volMute)
]
- -- used keys: x e w o i p r t y q n b c d
+ -- used keys: x e w o i p r t y q n b c d