From f42d37102dc15d4bb4e6eab9c9efb6f59066899e Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 29 Nov 2021 01:20:55 +0530 Subject: created the ultimate treeselect config --- .config/XMonad/xmonad.hs | 187 ++++++++++++++++++++++++----------------------- 1 file changed, 97 insertions(+), 90 deletions(-) (limited to '.config/XMonad') diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs index 99710d7..4561748 100644 --- a/.config/XMonad/xmonad.hs +++ b/.config/XMonad/xmonad.hs @@ -40,15 +40,9 @@ import XMonad.Util.NamedScratchpad myModMask = mod4Mask altMask = mod1Mask myLockscreen = "notify-send 'to be set up!' 'to be set up!'" -myScreenshot = "scrot /home/zt/Media/Screenshots/Screenshot-%m-%d-%Y-%T.png" myColorPicker = "colorpicker --short --one-shot --preview | xsel -b" myFont = "xft:Hack:style=Regular:size=14" --- volume -myVolUp = "pamixer -i 2" -myVolDown = "pamixer -d 2" -myVolMute = "pamixer -m" - myExtraWorkspaces = [(xK_0, "十")] -- , (xK_comma, " 十一 "), (xK_period, " 十二 "), (xK_slash, " 十三 ")] myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", "九"] ++ (map snd myExtraWorkspaces) @@ -56,8 +50,10 @@ 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 "OBS" "obs" (className =? "obs") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8)) + , NS "OBS" "obs" (className =? "obs") (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 "calc" "kcalc" (className =? "kcalc") defaultFloating + , NS "arandr" "arandr" (className =? "Arandr") defaultFloating , NS "BPYTOP" "alacritty -t 'BPYTOP' -e 'bpytop'" (title =? "BPYTOP") (customFloating $ W.RationalRect (1/16) (1/16) (7/8) (7/8)) ] where role = stringProperty "WM_WINDOW_ROLE" @@ -86,61 +82,96 @@ myTSConfig = TS.TSConfig { TS.ts_hidechildren = False , TS.ts_navigate = TS.defaultNavigation } -myTreeMenu :: TS.TSConfig (X ()) -> X () -myTreeMenu a = TS.treeselectAction a - [ Node (TS.TSNode "Utilities" "" (return())) - [ Node (TS.TSNode "Pavucontrol" "" (spawn "pavucontrol")) [] - , Node (TS.TSNode "OBS" "" (spawn "obs")) [] - , Node (TS.TSNode "Arandr" "" (spawn "arandr")) [] - , Node (TS.TSNode "System Monitor" "" (spawn "alacritty -e bpytop")) [] - ] - , Node (TS.TSNode "XMonad" "" (return())) - [ Node (TS.TSNode "Scratchpads" "" (return())) - [ 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 "OBS" "" (namedScratchpadAction myScratchpads "OBS")) [] - , Node (TS.TSNode "lf" "" (namedScratchpadAction myScratchpads "lf")) [] - , Node (TS.TSNode "BPYTOP" "" (namedScratchpadAction myScratchpads "BPYTOP")) [] - ] - , Node (TS.TSNode "Go To Window" "" (goToSelected defaultGSConfig)) [] - , Node (TS.TSNode "Bring Window" "" (bringSelected defaultGSConfig)) [] - ] - , Node (TS.TSNode "Virtual Machines" "" (return())) - [ Node (TS.TSNode "Virt Manager" "" (spawn "virt-manager")) [] - , Node (TS.TSNode "VirtualBox" "" (spawn "virtualbox")) [] - ] - , Node (TS.TSNode "Development" "" (return())) - [ Node (TS.TSNode "Android Studio" "" (spawn "android-studio")) [] - , Node (TS.TSNode "VSCodium" "" (spawn "code")) [] - ] - , Node (TS.TSNode "Networking" "" (return())) - [ Node (TS.TSNode "KTorrent" "" (spawn "ktorrent")) [] - , Node (TS.TSNode "TOR" "" (spawn "torbrowser-launcher")) [] - , Node (TS.TSNode "Discord" "" (spawn "discord")) [] - , Node (TS.TSNode "Icecat" "" (spawn "icecat")) [] - , Node (TS.TSNode "Librewolf" "" (spawn "librewolf")) [] - , Node (TS.TSNode "Brave" "" (spawn "brave")) [] - , Node (TS.TSNode "Firefox" "" (spawn "firefox")) [] - ] - , Node (TS.TSNode "Gaming" "" (return())) - [ Node (TS.TSNode "Minecraft" "" (spawn "minecraft-launcher")) [] - , Node (TS.TSNode "osu!lazer" "" (spawn "env LUTRIS_SKIP_INIT=1 lutris lutris:rungameid/3")) [] - , Node (TS.TSNode "Steam" "" (spawn "steam")) [] - , Node (TS.TSNode "Lutris" "" (spawn "lutris")) [] - ] - , Node (TS.TSNode "Media" "" (return())) - [ Node (TS.TSNode "VLC" "" (spawn "vlc")) [] - , Node (TS.TSNode "GIMP" "" (spawn "gimp")) [] - , Node (TS.TSNode "Kdenlive" "" (spawn "kdenlive")) [] - ] - , Node (TS.TSNode "Section Screenshot" "" (spawn "spectacle")) [] - , Node (TS.TSNode "Secreenshot" "" (spawn "scrot /home/zt/Media/Screenshots/Screenshot-%m-%d-%Y-%T.png")) [] - , Node (TS.TSNode "Power" "" (return())) - [ Node (TS.TSNode "Shutdown" "" (spawn "shutdown now")) [] - , Node (TS.TSNode "Restart" "" (spawn "reboot")) [] - ] +networkingTS = + [ Node (TS.TSNode "KTorrent" "" (spawn "ktorrent")) [] + , Node (TS.TSNode "TOR" "" (spawn "torbrowser-launcher")) [] + , Node (TS.TSNode "Discord" "" (spawn "discord")) [] + , Node (TS.TSNode "Icecat" "" (spawn "icecat")) [] + , Node (TS.TSNode "Librewolf" "" (spawn "librewolf")) [] + , Node (TS.TSNode "Brave" "" (spawn "brave")) [] + , Node (TS.TSNode "Firefox" "" (spawn "firefox")) [] + ] +myNetworkingTS a = TS.treeselectAction a networkingTS + +powerTS = + [ Node (TS.TSNode "Shutdown" "" (spawn "shutdown now")) [] + , Node (TS.TSNode "Restart" "" (spawn "reboot")) [] + ] +myPowerTS a = TS.treeselectAction a powerTS + +mediaTS = + [ Node (TS.TSNode "VLC" "" (spawn "vlc")) [] + , Node (TS.TSNode "GIMP" "" (spawn "gimp")) [] + , Node (TS.TSNode "Kdenlive" "" (spawn "kdenlive")) [] + , Node (TS.TSNode "OBS" "" (spawn "OBS")) [] + ] +myMediaTS a = TS.treeselectAction a mediaTS + +gamingTS = + [ Node (TS.TSNode "Minecraft" "" (spawn "minecraft-launcher")) [] + , Node (TS.TSNode "osu!lazer" "" (spawn "env LUTRIS_SKIP_INIT=1 lutris lutris:rungameid/3")) [] + , Node (TS.TSNode "Steam" "" (spawn "steam")) [] + , Node (TS.TSNode "Lutris" "" (spawn "lutris")) [] + ] +myGamingTS a = TS.treeselectAction a gamingTS + +xmonadTS = + [ Node (TS.TSNode "Scratchpads" "" (return())) + [ 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 "OBS" "" (namedScratchpadAction myScratchpads "OBS")) [] + , Node (TS.TSNode "lf" "" (namedScratchpadAction myScratchpads "lf")) [] + , Node (TS.TSNode "BPYTOP" "" (namedScratchpadAction myScratchpads "BPYTOP")) [] + , Node (TS.TSNode "Calculator" "" (namedScratchpadAction myScratchpads "calc")) [] + , Node (TS.TSNode "Arandr" "" (namedScratchpadAction myScratchpads "arandr")) [] ] + , Node (TS.TSNode "Window/Layout" "" (return())) + [ 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 "Sticky Window" "" (windows copyToAll)) [] + , Node (TS.TSNode "Un-sticky Window" "" (killAllOtherCopies)) [] + ] + ] +myXmonadTS a = TS.treeselectAction a xmonadTS + +devTS = + [ Node (TS.TSNode "Android Studio" "" (spawn "android-studio")) [] + , Node (TS.TSNode "VSCodium" "" (spawn "code")) [] + ] +myDevTS a = TS.treeselectAction a (devTS ++ vmTS) + +vmTS = + [ Node (TS.TSNode "Virt Manager" "" (spawn "virt-manager")) [] + , Node (TS.TSNode "VirtualBox" "" (spawn "virtualbox")) [] + ] +myVmTS a = TS.treeselectAction a vmTS + +utilTS = + [ Node (TS.TSNode "Pavucontrol" "" (spawn "pavucontrol")) [] + , Node (TS.TSNode "OBS" "" (spawn "obs")) [] + , Node (TS.TSNode "Arandr" "" (spawn "arandr")) [] + , Node (TS.TSNode "System Monitor" "" (spawn "alacritty -e bpytop")) [] + , Node (TS.TSNode "File Manager" "" (spawn "dolphin")) [] + , Node (TS.TSNode "Calculator" "" (spawn "kcalc")) [] + ] +myUtilTS a = TS.treeselectAction a utilTS + +myTreeMenu a = TS.treeselectAction a + ([Node (TS.TSNode "Utilities" "" (return())) utilTS + , Node (TS.TSNode "Networking" "" (return())) networkingTS + , Node (TS.TSNode "Development" "" (return())) devTS + , Node (TS.TSNode "Virtual Machines" "" (return())) vmTS + , Node (TS.TSNode "XMonad" "" (return())) xmonadTS + , 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 @@ -159,9 +190,7 @@ main = do , focusedBorderColor = "#BF00FF" , layoutHook = avoidStruts $ maximize $ windowNavigation $ smartBorders $ myGap $ ( emptyBSP ||| tabbed shrinkText myTabTheme ||| emptyBSP ||| Grid) - , manageHook = namedScratchpadManageHook myScratchpads <+> manageDocks <+> composeAll - [ className =? "plasmashell" --> doIgnore - , className =? "ksmserver" --> doIgnore + , manageHook = namedScratchpadManageHook myScratchpads <+> manageDocks <+> composeAll [ className =? "plasmashell" --> doIgnore , className =? "ksmserver" --> doIgnore , className =? "kcalc" --> doFloat , className =? "systemsettings" --> doFloat , className =? "confirm" --> doFloat @@ -174,24 +203,10 @@ main = do , className =? "toolbar" --> doFloat ] } `additionalMouseBindings` [ - ((altMask, 2), \w -> kill1) - , ((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) - , ((myModMask, xK_a), withFocused $ windows . W.sink) -- unfloat windows - - -- launch apps/execute scripts - , ((myModMask, xK_o), spawn ("dolphin")) - , ((myModMask, xK_y), spawn ("gimp")) - , ((myModMask, xK_e), spawn ("thunderbird")) - , ((myModMask, xK_b), spawn ("konqueror")) - , ((myModMask, xK_r), spawn ("alacritty -e lf")) - - -- scratchpad keybindings - , ((myModMask, xK_t), namedScratchpadAction myScratchpads "Term 0") -- modify gaps on runtime , ((myModMask, xK_equal), incWindowSpacing 1) @@ -202,7 +217,7 @@ main = do -- view prev/next workspaces , ((altMask, xK_h), prevWS) , ((altMask, xK_l), nextWS) - -- do the same without the evil alt key (might remove either pair later) + -- do the same without the evil alt key , ((myModMask, xK_comma), prevWS) , ((myModMask, xK_period), nextWS) @@ -227,6 +242,7 @@ main = do , ((myModMask, xK_backslash), sendMessage ToggleStruts) -- toggle both bars , ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) -- toggle maximize + , ((myModMask .|. shiftMask, xK_f), withFocused $ windows . W.sink) -- unfloat windows -- cycle through windows , ((altMask, xK_j), windows W.focusDown) @@ -254,25 +270,19 @@ main = do , ((myModMask .|. mod1Mask .|. shiftMask , xK_j ), sendMessage $ ShrinkFrom D) , ((myModMask .|. mod1Mask .|. shiftMask , xK_k ), sendMessage $ ShrinkFrom U) - -- other bsp-only actions - , ((myModMask, xK_d ), sendMessage Rotate) - , ((myModMask, xK_s ), sendMessage BSP.Swap) ] ++ [ -- for extra workspace(s) ((myModMask, key), (windows $ W.greedyView ws)) | (key,ws) <- myExtraWorkspaces ] ++ [ -- also for extra workspaces ((myModMask .|. shiftMask, key), (windows $ W.shift ws)) | (key,ws) <- myExtraWorkspaces - ] ++ [ -- to swap workspaces + ] ++ [ -- to swap workspace ((mod1Mask .|. shiftMask, 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] ] ++ [ -- 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] , (f, m) <- [(copy, shiftMask .|. altMask)] - ] ++ [ -- sticky-ing windows - ((myModMask, xK_v), windows copyToAll) -- make window visible on all screens - , ((myModMask .|. shiftMask, xK_v), killAllOtherCopies) ] ++ [ -- 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] @@ -287,7 +297,4 @@ main = do -- Launchers , ("M-p", myTreeMenu myTSConfig) , ("M-S-p", spawn "dmenu_run") - -- GridSelect + other apps - , ("M-g g", goToSelected defaultGSConfig) - , ("M-g b", bringSelected defaultGSConfig) ] -- cgit v1.2.3