diff options
-rw-r--r-- | .config/XMonad/lib/Defaults.hs | 3 | ||||
-rw-r--r-- | .config/XMonad/lib/DvorakKeybindings.hs | 104 | ||||
-rw-r--r-- | .config/XMonad/lib/Hooks.hs | 6 | ||||
-rw-r--r-- | .config/XMonad/lib/Keybindings.hs | 244 | ||||
-rw-r--r-- | .config/XMonad/lib/QwertyKeybindings.hs | 241 | ||||
-rw-r--r-- | .config/XMonad/lib/Util.hs | 5 | ||||
-rw-r--r-- | .config/XMonad/xmonad.hs | 10 | ||||
-rwxr-xr-x | .xprofile | 2 |
8 files changed, 360 insertions, 255 deletions
diff --git a/.config/XMonad/lib/Defaults.hs b/.config/XMonad/lib/Defaults.hs index 8492cd7..5aee38a 100644 --- a/.config/XMonad/lib/Defaults.hs +++ b/.config/XMonad/lib/Defaults.hs @@ -67,8 +67,7 @@ myEmailClient = "thunderbird" myPasswordManager = "keepassxc" -- workspaces -myExtraWorkspaces = [(xK_0, "十")] -myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", "九"] ++ map snd myExtraWorkspaces +myWorkspaceNames = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"] -- screen gaps sGap = 3 diff --git a/.config/XMonad/lib/DvorakKeybindings.hs b/.config/XMonad/lib/DvorakKeybindings.hs new file mode 100644 index 0000000..31a0cd4 --- /dev/null +++ b/.config/XMonad/lib/DvorakKeybindings.hs @@ -0,0 +1,104 @@ +module DvorakKeybindings where + +import XMonad +import qualified XMonad.StackSet as W + +-- actions +import XMonad.Actions.CopyWindow +import XMonad.Actions.WithAll +import XMonad.Actions.CycleWS +import XMonad.Actions.GridSelect +import XMonad.Actions.SwapWorkspaces + +-- layout modifiers +import XMonad.Layout.Spacing +import XMonad.Layout.WindowNavigation as WN +import XMonad.Layout.Maximize + +-- Layouts +import XMonad.Layout.BinarySpacePartition as BSP + +-- hooks +import XMonad.Hooks.ManageDocks + +import Util +import Defaults +import Scratchpads + +myWorkspaceKeys = [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_B] +--myWorkspaceKeys = [xK_ampersand, xK_bracketleft, xK_braceleft, xK_braceright, xK_parenleft, xK_equal, xK_asterisk, xK_parenright, xK_plus, xK_bracketright] +myWorkspaces = wsKeys myWorkspaceKeys myWorkspaceNames + +myKeybindings :: [((KeyMask, KeySym), X ())] +myKeybindings = [ + ((myModMask, xK_Return), spawn myTerminal) + , ((myModShiftMask, xK_Return), spawn myLockscreen) + , ((myModMask, xK_s), spawn myLauncher) + + -- view prev/next workspaces + , ((myModShiftMask, xK_Tab ), prevWS) + , ((myModMask, xK_Tab ), nextWS) + --, ((myModMask, xK_semicolon ), prevWS) + --, ((myModMask, xK_apostrophe), nextWS) + --, ((myModMask', xK_h ), prevWS) + --, ((myModMask', xK_l ), nextWS) + + -- move to prev/next workspaces + --, ((myModShiftMask', xK_h ), shiftToPrev >> prevWS) + --, ((myModShiftMask', xK_l ), shiftToNext >> nextWS) + --, ((myModShiftMask', xK_semicolon ), shiftToPrev >> prevWS) + --, ((myModShiftMask', xK_apostrophe), shiftToNext >> nextWS) + + -- toggle maximize + --, ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) + + -- unfloat windows + --, ((myModMask .|. shiftMask, xK_f), withFocused $ windows . W.sink) + + -- cycle through windows + --, ((myModMask', xK_j), windows W.focusDown) + --, ((myModMask', xK_k), windows W.focusUp) + + -- 2D navigation + , ((myModMask, xK_n), sendMessage $ Go R) + , ((myModMask, xK_d), sendMessage $ Go L) + , ((myModMask, xK_t), sendMessage $ Go U) + , ((myModMask, xK_h), sendMessage $ Go D) + -- swap windows + , ((myModShiftMask, xK_n), sendMessage $ WN.Swap R) + , ((myModShiftMask, xK_d), sendMessage $ WN.Swap L) + , ((myModShiftMask, xK_t), sendMessage $ WN.Swap U) + , ((myModShiftMask, xK_h), sendMessage $ WN.Swap D) + -- resize + , ((myModMask .|. myModMask', xK_n), sendMessage $ ExpandTowards R) + , ((myModMask .|. myModMask', xK_d), sendMessage $ ExpandTowards L) + , ((myModMask .|. myModMask', xK_h), sendMessage $ ExpandTowards D) + , ((myModMask .|. myModMask', xK_t), sendMessage $ ExpandTowards U) + , ((myModMask .|. myModShiftMask', xK_n), sendMessage $ ShrinkFrom R) + , ((myModMask .|. myModShiftMask', xK_d), sendMessage $ ShrinkFrom L) + , ((myModMask .|. myModShiftMask', xK_h), sendMessage $ ShrinkFrom D) + , ((myModMask .|. myModShiftMask', xK_t), sendMessage $ ShrinkFrom U) + --, ((myModMask, xK_B), windows $ W.greedyView "十") + ] ++ [ + -- workspace switching + ((myModMask, key), windows $ W.greedyView ws) | (key,ws) <- myWorkspaces + -- ] ++ [ + -- -- moving window to workspace + -- ((myModShiftMask, key), windows $ W.shift ws) | (key,ws) <- myWorkspaces + -- ] ++ [ + -- -- to swap workspace + -- ((myModShiftMask', key), windows $ swapWithCurrent ws) | (key, ws) <- myWorkspaces + -- ] ++ [ + -- -- copy + -- ((m .|. myModMask, key), windows $ f ws) | (key, ws) <- myWorkspaces, (f, m) <- [(copy, myModShiftMask')] + -- ] ++ [ + -- -- for not swapping tags while using multihead + -- ((m .|. myModMask, key), windows $ f ws) | (key, ws) <- myWorkspaces, (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] -- ++ [ -- directly focus monitors instead of cycling + -- ((m .|. myModMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) + -- | (key, sc) <- zip [xK_e, xK_w] [0..] + -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + --] + +myKeybindingsP :: [(String, X())] +myKeybindingsP = [] diff --git a/.config/XMonad/lib/Hooks.hs b/.config/XMonad/lib/Hooks.hs index 4dcb821..1b2962b 100644 --- a/.config/XMonad/lib/Hooks.hs +++ b/.config/XMonad/lib/Hooks.hs @@ -24,9 +24,9 @@ import Scratchpads myManageHook = namedScratchpadManageHook myScratchpads <+> manageDocks <+> composeAll [ - className =? "discord" --> doShift ( myWorkspaces !! 9 ) - , className =? "thunderbird" --> doShift ( myWorkspaces !! 8 ) - , className =? "KeePassXC" --> doShift ( myWorkspaces !! 7 ) + className =? "discord" --> doShift ( myWorkspaceNames !! 9 ) + , className =? "thunderbird" --> doShift ( myWorkspaceNames !! 8 ) + , className =? "KeePassXC" --> doShift ( myWorkspaceNames !! 7 ) , isFullscreen --> doFullFloat ] diff --git a/.config/XMonad/lib/Keybindings.hs b/.config/XMonad/lib/Keybindings.hs index 9b3eaaa..c6f9205 100644 --- a/.config/XMonad/lib/Keybindings.hs +++ b/.config/XMonad/lib/Keybindings.hs @@ -1,36 +1,9 @@ module Keybindings where -import System.Exit -import System.IO - import XMonad -import qualified XMonad.StackSet as W - --- actions -import XMonad.Actions.CopyWindow -import XMonad.Actions.WithAll import XMonad.Actions.CycleWS -import XMonad.Actions.GridSelect -import XMonad.Actions.SwapWorkspaces - --- layout modifiers -import XMonad.Layout.Spacing -import XMonad.Layout.WindowNavigation as WN -import XMonad.Layout.Maximize - --- Layouts -import XMonad.Layout.BinarySpacePartition as BSP - --- hooks -import XMonad.Hooks.ManageDocks - --- utilities -import XMonad.Util.SpawnOnce -import XMonad.Util.EZConfig -import XMonad.Util.NamedScratchpad import Defaults -import Scratchpads myMouseKeybindings :: [((ButtonMask, Button), Window -> X ())] myMouseKeybindings = [ @@ -50,219 +23,4 @@ myFnKeybindingsP = [ , ("<XF86AudioPlay>", spawn pausePlay) , ("<XF86AudioPause>", spawn pausePlay) , ("<Pause>", spawn pausePlay) - ] - -myKeybindingsQWERTY :: [((KeyMask, KeySym), X ())] -myKeybindingsQWERTY = [ - ((myModMask, xK_Return), spawn myTerminal) - , ((myModShiftMask, xK_Return), spawn myLockscreen) - , ((myModMask .|. shiftMask, xK_q), kill1) - , ((myModShiftMask, xK_p), spawn myLauncher) - - -- shutdown, restart, etc - , ((myModMask .|. myModMask', xK_Delete), spawn "shutdown -P now") - , ((myModShiftMask .|. myModMask', xK_Delete), spawn "shutdown -r now") - - -- scratchpads - , ((myModMask, xK_u), myScratchpad "Term 0") - , ((myModMask, xK_i), myScratchpad "Term 1") - , ((myModMask, xK_o), myScratchpad "Term 2") - , ((myModMask, xK_p), myScratchpad "Term 3") - - -- 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_F2), incWindowSpacing 1) - -- , ((myModMask, xK_F1), decWindowSpacing 1) - -- , ((myModMask .|. shiftMask, xK_F2), incScreenSpacing 1) - -- , ((myModMask .|. shiftMask, xK_F1), decScreenSpacing 1) - - -- view prev/next workspaces - , ((myModShiftMask, xK_Tab ), prevWS) - , ((myModMask, xK_Tab ), nextWS) - , ((myModMask, xK_semicolon ), prevWS) - , ((myModMask, xK_apostrophe), nextWS) - , ((myModMask', xK_h ), prevWS) - , ((myModMask', xK_l ), nextWS) - - -- move to prev/next workspaces - , ((myModShiftMask', xK_h ), shiftToPrev >> prevWS) - , ((myModShiftMask', xK_l ), shiftToNext >> nextWS) - , ((myModShiftMask', xK_semicolon ), shiftToPrev >> prevWS) - , ((myModShiftMask', xK_apostrophe), shiftToNext >> nextWS) - - -- focus previous/next monitor - , ((myModMask, xK_bracketleft ), prevScreen) - , ((myModMask, xK_bracketright), nextScreen) - - -- move window to previous/next monitor - , ((myModShiftMask, xK_bracketleft ), shiftPrevScreen >> prevScreen) - , ((myModShiftMask, xK_bracketright), shiftNextScreen >> nextScreen) - - -- swap different screens - , ((myModMask .|. controlMask, xK_bracketleft ), swapPrevScreen >> prevScreen) - , ((myModMask .|. controlMask, xK_bracketright), swapNextScreen >> nextScreen) - - -- toggle maximize - , ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) - - -- unfloat windows - , ((myModMask .|. shiftMask, xK_f), withFocused $ windows . W.sink) - - -- cycle through windows - , ((myModMask', xK_j), windows W.focusDown) - , ((myModMask', xK_k), windows W.focusUp) - - -- 2D navigation - , ((myModMask, xK_l), sendMessage $ Go R) - , ((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_l), sendMessage $ ExpandTowards R) - , ((myModMask .|. myModMask', xK_h), sendMessage $ ExpandTowards L) - , ((myModMask .|. myModMask', xK_j), sendMessage $ ExpandTowards D) - , ((myModMask .|. myModMask', xK_k), sendMessage $ ExpandTowards U) - , ((myModMask .|. myModShiftMask', xK_l), sendMessage $ ShrinkFrom R) - , ((myModMask .|. myModShiftMask', xK_h), sendMessage $ ShrinkFrom L) - , ((myModMask .|. myModShiftMask', xK_j), sendMessage $ ShrinkFrom D) - , ((myModMask .|. myModShiftMask', xK_k), sendMessage $ ShrinkFrom U) - - ] ++ [ -- for extra workspace(s) - ((myModMask, key), windows $ W.greedyView ws) - | (key,ws) <- myExtraWorkspaces - ] ++ [ -- also for extra workspaces - ((myModShiftMask, key), windows $ W.shift ws) - | (key,ws) <- myExtraWorkspaces - ] ++ [ -- to swap workspace - ((myModShiftMask', k), windows $ swapWithCurrent i) - | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] -- ++ map fst myExtraWorkspaces - ] ++ [ -- copy - ((m .|. myModMask, k), windows $ f i) - | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] -- ++ map fst myExtraWorkspaces - , (f, m) <- [(copy, myModShiftMask')] - ] ++ [ -- for not swapping tags while using multihead - ((m .|. myModMask, k), windows $ f i) - | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] -- ++ map fst myExtraWorkspaces - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] ++ [ -- directly focus monitors instead of cycling - ((m .|. myModMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_e, xK_w] [0..] - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] - -myKeybindingsQWERTYP :: [(String, X())] -myKeybindingsQWERTYP = [ - -- actions - -- TODO: add reboot, shutdown, logout, copy, cut, paste - ("M-a w", spawn wifiOff) - , ("M-a S-w", spawn wifiOn) - , ("M-a s", spawn customScreenshot) - , ("M-a S-s", spawn fullScreenshot) - , ("M-a m", spawn volMute) - , ("M-a p", spawn pausePlay) - , ("M-a d", myScratchpad "arandr") - , ("M-a r", spawn "screenrefresh") - , ("M-a S-r", spawn "screenrefresh -b") - -- media - , ("M-m w", myScratchpad "wallpaper") - , ("M-S-x", myScratchpad "wallpaper") - , ("M-m o", spawn "obs") - , ("M-S-o", spawn "obs") - , ("M-S-u", myScratchpad "musicplayer") - , ("M-m S-o", spawn "osu") - , ("M-m s", spawn "syncplay") - , ("M-m g", spawn "gimp") - , ("M-m k", spawn "kdenlive") - , ("M-g", spawn "gimp") - , ("M-s-g", spawn "kdenlive") - , ("M-m l", spawn "lutris") - , ("M-m v", spawn "vlc") - , ("M-m m", spawn "minecraft-launcher") - -- system apps/scratchpads - , ("M-b t", spawn myTorrentClient) - , ("M-b i", spawn myBrowser) - , ("M-S-i", spawn myBrowser) - , ("M-b d", myScratchpad "arandr") - , ("M-b c", myScratchpad "calc") - , ("M-b b", myScratchpad "blueman") - , ("M-S-b", myScratchpad "blueman") - , ("M-b p", myScratchpad "pavucontrol") - , ("M-x", myScratchpad "pavucontrol") - , ("M-b m", myScratchpad "BPYTOP") - , ("M-S-m", myScratchpad "BPYTOP") - , ("M-b n", myScratchpad "nmtui") - , ("M-S-n", myScratchpad "nmtui") - -- websites - , ("M-n y", spawn $ myBrowser ++ " https://youtube.com") - , ("M-n d", spawn $ myBrowser ++ " https://duckduckgo.com") - , ("M-n g", spawn $ myBrowser ++ " https://google.com") - , ("M-n S-g", spawn $ myBrowser ++ " https://github.com") - , ("M-n j", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWddu55nsz8CezmJJ-GRVISZ1E") - , ("M-n k", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWddvzCv02lClCfDfUo97wzX1A") - , ("M-n c", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWdduy2V0DQQ4Lm0P572XJFVB9") - , ("M-n v", spawn $ myBrowser ++ " https://vidhukant.xyz") - , ("M-n m", spawn $ myBrowser ++ " https://myanimelist.net/profile/0ZeroTsu") - -- other apps - , ("M-y e", spawn myTextEditor) - , ("M-d", spawn myTextEditor) - , ("M-S-d", spawn "firejail discord") - , ("M-y S-e", spawn myEmailClient) - , ("M-t", spawn myEmailClient) - , ("M-y t", spawn myTorrentClient) - , ("M-S-t", spawn myTorrentClient) - , ("M-y S-t", spawn "torbrowser-launcher") - , ("M-y i", spawn myBrowser) - , ("M-y S-i", spawn myPrivateBrowser) - , ("M-y f", spawn "firefox") - , ("M-y v", spawn "virt-manager") - , ("M-v", spawn "virt-manager") - , ("M-y b", spawn "brave") - , ("M-y p", spawn myFileManager) - , ("M-s", spawn myFileManager) - , ("M-z", spawn myPasswordManager) - , ("M-y S-p", spawn $ myTerminal' ++ " -e " ++ myFileManager') - , ("M-c", spawn myColorPicker) - -- XMonad - , ("M-q q", gridselectWindow myGridSelect >>= flip whenJust (\w -> killWindow w)) - , ("M-q S-q", killAll) - , ("M-q r", sendMessage Rotate) - , ("M-q t", sendMessage ToggleStruts) - , ("M-q s", sendMessage BSP.Swap) - , ("M-q g", goToSelected myGridSelect) - , ("M-q c", windows copyToAll) - , ("M-q S-c", killAllOtherCopies) - , ("M-q b", bringSelected myGridSelect) - -- gaps - , ("M-q x d", decWindowSpacing 3) - , ("M-q x i", incWindowSpacing 3) - , ("M-q x S-d", decScreenSpacing 3) - , ("M-q x S-i", incScreenSpacing 3) - , ("M-q x b", setSmartSpacing False) - , ("M-q x S-b", setSmartSpacing True) - , ("M-q x n", setWindowSpacingEnabled False) - , ("M-q x S-n", setWindowSpacingEnabled True) - , ("M-q x m", setScreenSpacingEnabled False) - , ("M-q x S-m", setScreenSpacingEnabled True) - -- resize windows - , ("M-q h", sendMessage $ ExpandTowards L) - , ("M-q j", sendMessage $ ExpandTowards D) - , ("M-q k", sendMessage $ ExpandTowards U) - , ("M-q l", sendMessage $ ExpandTowards R) - , ("M-q S-h", sendMessage $ ShrinkFrom L) - , ("M-q S-j", sendMessage $ ShrinkFrom D) - , ("M-q S-k", sendMessage $ ShrinkFrom U) - , ("M-q S-l", sendMessage $ ShrinkFrom R) - ] ++ myFnKeybindingsP + ]
\ No newline at end of file diff --git a/.config/XMonad/lib/QwertyKeybindings.hs b/.config/XMonad/lib/QwertyKeybindings.hs new file mode 100644 index 0000000..c02a63b --- /dev/null +++ b/.config/XMonad/lib/QwertyKeybindings.hs @@ -0,0 +1,241 @@ +module QwertyKeybindings where + +import XMonad +import qualified XMonad.StackSet as W + +-- actions +import XMonad.Actions.CopyWindow +import XMonad.Actions.WithAll +import XMonad.Actions.CycleWS +import XMonad.Actions.GridSelect +import XMonad.Actions.SwapWorkspaces + +-- layout modifiers +import XMonad.Layout.Spacing +import XMonad.Layout.WindowNavigation as WN +import XMonad.Layout.Maximize + +-- Layouts +import XMonad.Layout.BinarySpacePartition as BSP + +-- hooks +import XMonad.Hooks.ManageDocks + +import Util +import Defaults +import Scratchpads + +myWorkspaceKeys = [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] +myWorkspaces = wsKeys myWorkspaceKeys myWorkspaceNames + +myKeybindings :: [((KeyMask, KeySym), X ())] +myKeybindings = [ + ((myModMask, xK_Return), spawn myTerminal) + , ((myModShiftMask, xK_Return), spawn myLockscreen) + , ((myModMask .|. shiftMask, xK_q), kill1) + , ((myModShiftMask, xK_p), spawn myLauncher) + + -- shutdown, restart, etc + , ((myModMask .|. myModMask', xK_Delete), spawn "shutdown -P now") + , ((myModShiftMask .|. myModMask', xK_Delete), spawn "shutdown -r now") + + -- scratchpads + , ((myModMask, xK_u), myScratchpad "Term 0") + , ((myModMask, xK_i), myScratchpad "Term 1") + , ((myModMask, xK_o), myScratchpad "Term 2") + , ((myModMask, xK_p), myScratchpad "Term 3") + + -- 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_F2), incWindowSpacing 1) + -- , ((myModMask, xK_F1), decWindowSpacing 1) + -- , ((myModMask .|. shiftMask, xK_F2), incScreenSpacing 1) + -- , ((myModMask .|. shiftMask, xK_F1), decScreenSpacing 1) + + -- view prev/next workspaces + , ((myModShiftMask, xK_Tab ), prevWS) + , ((myModMask, xK_Tab ), nextWS) + , ((myModMask, xK_semicolon ), prevWS) + , ((myModMask, xK_apostrophe), nextWS) + , ((myModMask', xK_h ), prevWS) + , ((myModMask', xK_l ), nextWS) + + -- move to prev/next workspaces + , ((myModShiftMask', xK_h ), shiftToPrev >> prevWS) + , ((myModShiftMask', xK_l ), shiftToNext >> nextWS) + , ((myModShiftMask', xK_semicolon ), shiftToPrev >> prevWS) + , ((myModShiftMask', xK_apostrophe), shiftToNext >> nextWS) + + -- focus previous/next monitor + , ((myModMask, xK_bracketleft ), prevScreen) + , ((myModMask, xK_bracketright), nextScreen) + + -- move window to previous/next monitor + , ((myModShiftMask, xK_bracketleft ), shiftPrevScreen >> prevScreen) + , ((myModShiftMask, xK_bracketright), shiftNextScreen >> nextScreen) + + -- swap different screens + , ((myModMask .|. controlMask, xK_bracketleft ), swapPrevScreen >> prevScreen) + , ((myModMask .|. controlMask, xK_bracketright), swapNextScreen >> nextScreen) + + -- toggle maximize + , ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) + + -- unfloat windows + , ((myModMask .|. shiftMask, xK_f), withFocused $ windows . W.sink) + + -- cycle through windows + , ((myModMask', xK_j), windows W.focusDown) + , ((myModMask', xK_k), windows W.focusUp) + + -- 2D navigation + , ((myModMask, xK_l), sendMessage $ Go R) + , ((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_l), sendMessage $ ExpandTowards R) + , ((myModMask .|. myModMask', xK_h), sendMessage $ ExpandTowards L) + , ((myModMask .|. myModMask', xK_j), sendMessage $ ExpandTowards D) + , ((myModMask .|. myModMask', xK_k), sendMessage $ ExpandTowards U) + , ((myModMask .|. myModShiftMask', xK_l), sendMessage $ ShrinkFrom R) + , ((myModMask .|. myModShiftMask', xK_h), sendMessage $ ShrinkFrom L) + , ((myModMask .|. myModShiftMask', xK_j), sendMessage $ ShrinkFrom D) + , ((myModMask .|. myModShiftMask', xK_k), sendMessage $ ShrinkFrom U) + ] ++ [ + -- workspace switching + ((myModMask, key), windows $ W.greedyView ws) | (key,ws) <- myWorkspaces + ] ++ [ + -- moving window to workspace + ((myModShiftMask, key), windows $ W.shift ws) | (key,ws) <- myWorkspaces + ] ++ [ + -- to swap workspace + ((myModShiftMask', key), windows $ swapWithCurrent ws) | (key, ws) <- myWorkspaces + ] ++ [ + -- copy + ((m .|. myModMask, key), windows $ f ws) | (key, ws) <- myWorkspaces, (f, m) <- [(copy, myModShiftMask')] + ] ++ [ + -- for not swapping tags while using multihead + ((m .|. myModMask, key), windows $ f ws) | (key, ws) <- myWorkspaces, (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] ++ [ -- directly focus monitors instead of cycling + ((m .|. myModMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_e, xK_w] [0..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] + +myKeybindingsP :: [(String, X())] +myKeybindingsP = [ + -- actions + -- TODO: add reboot, shutdown, logout, copy, cut, paste + ("M-a w", spawn wifiOff) + , ("M-a S-w", spawn wifiOn) + , ("M-a s", spawn customScreenshot) + , ("M-a S-s", spawn fullScreenshot) + , ("M-a m", spawn volMute) + , ("M-a p", spawn pausePlay) + , ("M-a d", myScratchpad "arandr") + , ("M-a r", spawn "screenrefresh") + , ("M-a S-r", spawn "screenrefresh -b") + -- media + , ("M-m w", myScratchpad "wallpaper") + , ("M-S-x", myScratchpad "wallpaper") + , ("M-m o", spawn "obs") + , ("M-S-o", spawn "obs") + , ("M-S-u", myScratchpad "musicplayer") + , ("M-m S-o", spawn "osu") + , ("M-m s", spawn "syncplay") + , ("M-m g", spawn "gimp") + , ("M-m k", spawn "kdenlive") + , ("M-g", spawn "gimp") + , ("M-s-g", spawn "kdenlive") + , ("M-m l", spawn "lutris") + , ("M-m v", spawn "vlc") + , ("M-m m", spawn "minecraft-launcher") + -- system apps/scratchpads + , ("M-b t", spawn myTorrentClient) + , ("M-b i", spawn myBrowser) + , ("M-S-i", spawn myBrowser) + , ("M-b d", myScratchpad "arandr") + , ("M-b c", myScratchpad "calc") + , ("M-b b", myScratchpad "blueman") + , ("M-S-b", myScratchpad "blueman") + , ("M-b p", myScratchpad "pavucontrol") + , ("M-x", myScratchpad "pavucontrol") + , ("M-b m", myScratchpad "BPYTOP") + , ("M-S-m", myScratchpad "BPYTOP") + , ("M-b n", myScratchpad "nmtui") + , ("M-S-n", myScratchpad "nmtui") + -- websites + , ("M-n y", spawn $ myBrowser ++ " https://youtube.com") + , ("M-n d", spawn $ myBrowser ++ " https://duckduckgo.com") + , ("M-n g", spawn $ myBrowser ++ " https://google.com") + , ("M-n S-g", spawn $ myBrowser ++ " https://github.com") + , ("M-n j", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWddu55nsz8CezmJJ-GRVISZ1E") + , ("M-n k", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWddvzCv02lClCfDfUo97wzX1A") + , ("M-n c", spawn $ myBrowser ++ " https://www.youtube.com/playlist?list=PL8lRJQHQWdduy2V0DQQ4Lm0P572XJFVB9") + , ("M-n v", spawn $ myBrowser ++ " https://vidhukant.xyz") + , ("M-n m", spawn $ myBrowser ++ " https://myanimelist.net/profile/0ZeroTsu") + -- other apps + , ("M-y e", spawn myTextEditor) + , ("M-d", spawn myTextEditor) + , ("M-S-d", spawn "firejail discord") + , ("M-y S-e", spawn myEmailClient) + , ("M-t", spawn myEmailClient) + , ("M-y t", spawn myTorrentClient) + , ("M-S-t", spawn myTorrentClient) + , ("M-y S-t", spawn "torbrowser-launcher") + , ("M-y i", spawn myBrowser) + , ("M-y S-i", spawn myPrivateBrowser) + , ("M-y f", spawn "firefox") + , ("M-y v", spawn "virt-manager") + , ("M-v", spawn "virt-manager") + , ("M-y b", spawn "brave") + , ("M-y p", spawn myFileManager) + , ("M-s", spawn myFileManager) + , ("M-z", spawn myPasswordManager) + , ("M-y S-p", spawn $ myTerminal' ++ " -e " ++ myFileManager') + , ("M-c", spawn myColorPicker) + -- XMonad + , ("M-q q", gridselectWindow myGridSelect >>= flip whenJust (\w -> killWindow w)) + , ("M-q S-q", killAll) + , ("M-q r", sendMessage Rotate) + , ("M-q t", sendMessage ToggleStruts) + , ("M-q s", sendMessage BSP.Swap) + , ("M-q g", goToSelected myGridSelect) + , ("M-q c", windows copyToAll) + , ("M-q S-c", killAllOtherCopies) + , ("M-q b", bringSelected myGridSelect) + -- gaps + , ("M-q x d", decWindowSpacing 3) + , ("M-q x i", incWindowSpacing 3) + , ("M-q x S-d", decScreenSpacing 3) + , ("M-q x S-i", incScreenSpacing 3) + , ("M-q x b", setSmartSpacing False) + , ("M-q x S-b", setSmartSpacing True) + , ("M-q x n", setWindowSpacingEnabled False) + , ("M-q x S-n", setWindowSpacingEnabled True) + , ("M-q x m", setScreenSpacingEnabled False) + , ("M-q x S-m", setScreenSpacingEnabled True) + -- resize windows + , ("M-q h", sendMessage $ ExpandTowards L) + , ("M-q j", sendMessage $ ExpandTowards D) + , ("M-q k", sendMessage $ ExpandTowards U) + , ("M-q l", sendMessage $ ExpandTowards R) + , ("M-q S-h", sendMessage $ ShrinkFrom L) + , ("M-q S-j", sendMessage $ ShrinkFrom D) + , ("M-q S-k", sendMessage $ ShrinkFrom U) + , ("M-q S-l", sendMessage $ ShrinkFrom R) + ] diff --git a/.config/XMonad/lib/Util.hs b/.config/XMonad/lib/Util.hs new file mode 100644 index 0000000..e3bce04 --- /dev/null +++ b/.config/XMonad/lib/Util.hs @@ -0,0 +1,5 @@ +module Util where + +wsKeys :: [a] -> [b] -> [(a, b)] +wsKeys [] [] = [] +wsKeys (w:ws) (k:ks) = [(w, k)] ++ wsKeys ws ks diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs index 8da1c12..128243a 100644 --- a/.config/XMonad/xmonad.hs +++ b/.config/XMonad/xmonad.hs @@ -9,14 +9,12 @@ import XMonad.Hooks.EwmhDesktops import XMonad.Util.EZConfig import XMonad.Util.Run - import Keybindings +--import QwertyKeybindings +import DvorakKeybindings import Defaults import Hooks -myKeybindings = myKeybindingsQWERTY -myKeybindingsP = myKeybindingsQWERTYP ++ myFnKeybindingsP - main :: IO () main = do -- myLemonbar <- statusBarPipe myLemonbarCmd (pure myLemonbarPP) @@ -27,12 +25,12 @@ main = do , terminal = myTerminal , borderWidth = myBorderWidth , modMask = myModMask - , workspaces = myWorkspaces + , workspaces = myWorkspaceNames , normalBorderColor = myBorder , focusedBorderColor = myBorder' , layoutHook = myLayoutHook , startupHook = myStartupHook , manageHook = myManageHook } `additionalKeys` myKeybindings - `additionalKeysP` myKeybindingsP + `additionalKeysP` (myKeybindingsP ++ myFnKeybindingsP) `additionalMouseBindings` myMouseKeybindings @@ -16,7 +16,7 @@ emacs --daemon & # autostart apps for both xmonad and dwm if [[ "$DESKTOP_SESSION" = "xmonad" || "$DESKTOP_SESSION" = "dwm" ]]; then - screensetup.sh + screensetup.sh & # autostart apps nitrogen --restore & |