diff --git a/.config/xmonad/hie.yaml b/.config/xmonad/hie.yaml new file mode 100644 index 0000000..6c02501 --- /dev/null +++ b/.config/xmonad/hie.yaml @@ -0,0 +1,8 @@ +cradle: + stack: + - path: ./xmonad.hs + component: ./xmonad.hs + - path: ./xmonad-git/ + component: xmonad:lib + - path: ./xmonad-contrib-git/ + component: xmonad-contrib:lib diff --git a/.config/xmonad/lib/Colors/Teal.hi b/.config/xmonad/lib/Colors/Teal.hi index 5645fbb..fe0b1d1 100644 Binary files a/.config/xmonad/lib/Colors/Teal.hi and b/.config/xmonad/lib/Colors/Teal.hi differ diff --git a/.config/xmonad/lib/Colors/Teal.o b/.config/xmonad/lib/Colors/Teal.o index 31a2aba..c933d59 100644 Binary files a/.config/xmonad/lib/Colors/Teal.o and b/.config/xmonad/lib/Colors/Teal.o differ diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs index 299e38b..d5ece24 100644 --- a/.config/xmonad/xmonad.hs +++ b/.config/xmonad/xmonad.hs @@ -59,10 +59,10 @@ myClickJustFocuses = False windowCount :: X (Maybe String) windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset -myNormalBorderColor = "#008080" +myNormalBorderColor = "#534783" myFocusedBorderColor = "#01F9C6" -myBorderWidth = 2 +myBorderWidth = 1 myWorkspaces = ["main","web","text","code","social","monitoring"] myWorkspaceIndices = zip myWorkspaces [1..] @@ -112,18 +112,11 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))] -myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full) - where - tiled = Tall nmaster delta ratio - nmaster = 1 - ratio = 1/2 - delta = 3/100 - myManageHook = composeAll [ className =? "MPlayer" --> doFloat , className =? "Gimp" --> doFloat , resource =? "desktop_window" --> doIgnore - , className =? "QjackCtl" --> doFloat + , className =? "QjackCtl" --> doFloat , resource =? "kdesktop" --> doIgnore , className =? "firefox" --> doShift (myWorkspaces !! 1) , className =? "Code" --> doShift (myWorkspaces !! 3) @@ -146,65 +139,47 @@ myStartupHook = do spawnOnce "picom &" setWMName "LG3D" spawnOnce "nm-applet" - spawnOnce ("xsetroot -cursor_name left_ptr") - spawnOnce ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --margin 4 --widthtype request --padding 8 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 30 --distance 5 &") - spawnOnce ("slimbookbattery --minimize") - spawnOnce ("slimbookintelcontroller") - spawnOnce ("nextcloud") + spawnOnce "xsetroot -cursor_name left_ptr" + spawnOnce "killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --margin 4 --widthtype request --padding 8 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 30 --distance 5 &" + spawnOnce "slimbookbattery --minimize" + spawnOnce "slimbookintelcontroller" + spawnOnce "nextcloud" spawnOnOnce "web" myWebBrowser spawnOnOnce "main" myTerminalTmux -myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig -myStatusBarSpawner (S s) = do - pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s) - ("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s) - (pure $ myXmobarPP (S s)) +mySB = statusBarProp "/home/afonso/.local/bin/xmobar /home/afonso/.config/xmobar/xmobarrc" (pure myXmobarPP) - -myXmobarPP :: ScreenId -> PP -myXmobarPP s = def - { ppSep = "" - , ppWsSep = "" - , ppCurrent = xmobarColor cyan "" . const wsIconFull - , ppVisible = xmobarColor grey4 "" . const wsIconFull - , ppVisibleNoWindows = Just (xmobarColor grey4 "" . const wsIconFull) - , ppHidden = xmobarColor grey2 "" . const wsIconHidden - , ppHiddenNoWindows = xmobarColor grey2 "" . const wsIconEmpty - , ppUrgent = xmobarColor orange "" . const wsIconFull - , ppOrder = \(ws : _ : _ : extras) -> ws : extras - , ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s) - ,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s) - ] - } +myXmobarPP :: PP +myXmobarPP = def + { ppSep = "" + , ppWsSep = "" + , ppCurrent = xmobarColor cyan "" . const wsIconFull + , ppVisible = xmobarColor grey4 "" . const wsIconFull + , ppHidden = xmobarColor grey4 "" . const wsIconFull + , ppHiddenNoWindows = xmobarColor grey4 "" . const wsIconFull + , ppOrder = \(ws : _ : _ : extras) -> ws : extras + } where wsIconFull = " \xf111 " - wsIconHidden = " \xf111 " - wsIconEmpty = " \xf10c " - titleColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l - layoutColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then wrapL "" l else wrapL "" l myConfig = def { terminal = myTerminal, - focusFollowsMouse = myFocusFollowsMouse, - clickJustFocuses = myClickJustFocuses, + focusFollowsMouse = True, + clickJustFocuses = False, borderWidth = myBorderWidth, modMask = myModMask, workspaces = myWorkspaces, normalBorderColor = myNormalBorderColor, focusedBorderColor = myFocusedBorderColor, - layoutHook = smartBorders . spacingWithEdge 15 $ myLayout, + layoutHook = avoidStruts $ smartBorders . smartSpacingWithEdge 5 $ layoutHook def, manageHook = manageSpawn <+> myManageHook <+> manageHook def, - handleEventHook = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True), + handleEventHook = myEventHook <+> fullscreenEventHook, startupHook = myStartupHook } main :: IO () -main = xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys \ No newline at end of file +main = xmonad . ewmh . ewmhFullscreen . withSB mySB . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys diff --git a/.config/xmonad/xmonad.norg b/.config/xmonad/xmonad.norg deleted file mode 100644 index 7bb4474..0000000 --- a/.config/xmonad/xmonad.norg +++ /dev/null @@ -1,237 +0,0 @@ -@document.meta -title: Xmonad Config -authors: Afonso Franco -categories: configs -tangle: /home/afonso/.config/xmonad/xmonad.hs -@end - -* Overrides -@code haskell -{-# OPTIONS_GHC -Wno-deprecations #-} -@end -* Imports -@code haskell - -import XMonad - ---Utils -import XMonad.Util.EZConfig (additionalKeysP,removeKeysP) -import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL) -import XMonad.Util.Run -import XMonad.Util.SpawnOnce - ---Hooks -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.SetWMName -import XMonad.Hooks.StatusBar -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Hooks.WindowSwallowing - ---Actions -import XMonad.Actions.SpawnOn -import XMonad.Actions.UpdateFocus (focusUnderPointer) - ---Layouts -import XMonad.Layout.NoBorders -import XMonad.Layout.Spacing - - --- MultiMonitorFocusHook -import Control.Monad (when) -import Data.Foldable (find) -import Foreign.C (CInt) -import Data.Maybe (fromMaybe) -import Data.Monoid (All (All)) - ---Miscellaneous -import qualified XMonad.StackSet as W -import qualified Data.Map as M -import System.Exit - ---Color Scheme -import Colors.Teal - -@end -* Variables -@code haskell - -myTerminal = "kitty" -myTerminalTmux = myTerminal ++ " -e tmux a" -myTextEditor = "nvim" -myWebBrowser = "firefox" -myModMask = mod4Mask - -myFocusFollowsMouse :: Bool -myFocusFollowsMouse = True - -myClickJustFocuses :: Bool -myClickJustFocuses = False - -windowCount :: X (Maybe String) -windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset - -myNormalBorderColor = "#008080" -myFocusedBorderColor = "#01F9C6" - -myBorderWidth = 2 - -myWorkspaces = ["main","web","text","code","social","monitoring"] -myWorkspaceIndices = zip myWorkspaces [1..] - - @end - -* Keybinds -@code haskell -myKeys :: [(String, X ())] -myKeys = - [ ("M-x" ,spawn myTerminalTmux ) - , ("M-p", spawn "rofi -show drun -show-icons") - , ("M-S-p", spawn "rofi -show p -modi p:rofi-power-menu") - , ("M-s", spawn "selected=$(ls ~/scripts/|rofi -dmenu -p \"Run: \") && bash ~/.config/rofi/scripts/$selected") - , ("M-b", spawn myWebBrowser) - , ("", spawn "flameshot gui") - , ("", spawn "pamixer set --toggle-mute") - , ("", spawn "pamixer -d 5") - , ("", spawn "pamixer -i 5") - , ("", spawn "lux -a 10%") - , ("", spawn "lux -s 10%") - , ("M-n", spawn $ myTerminal ++ " -e nmtui") - , ("M-q", kill) - , ("M-S-", sendMessage NextLayout) - , ("M-", windows W.focusDown) - , ("M-", windows W.focusUp ) - , ("M-m", windows W.focusMaster ) - , ("M-", windows W.swapMaster) - , ("M-h", sendMessage Shrink) - , ("M-l", sendMessage Expand) - , ("M-t", withFocused $ windows . W.sink) - , ("M-S-u", io (exitWith ExitSuccess)) - , ("M-u", spawn "xmonad --recompile; xmonad --restart") - ] - ++ - [("M-" ++ m ++ (show k), windows $ f i) - | (i, k) <- myWorkspaceIndices - , (f, m) <- [(W.greedyView, "0"), (W.shift, "S-")]] - ++ - [("M-" ++ m ++ key, screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip ["w", "e", "r"] [0..] - , (f, m) <- [(W.view, "0"), (W.shift, "S-")]] - -myRemoveKeys = ["M-S-","M-S-p","M-S-c","M-","M-n","M-S-q"] - -myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ - [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w - >> windows W.shiftMaster)) - , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) - , ((modm, button3), (\w -> focus w >> mouseResizeWindow w - >> windows W.shiftMaster))] - @end -* Layouts -@code haskell -myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full) - where - tiled = Tall nmaster delta ratio - nmaster = 1 - ratio = 1/2 - delta = 3/100 -@end -* Hooks -@code haskell -myManageHook = composeAll - [ className =? "MPlayer" --> doFloat - , className =? "Gimp" --> doFloat - , resource =? "desktop_window" --> doIgnore - , className =? "QjackCtl" --> doFloat - , resource =? "kdesktop" --> doIgnore - , className =? "firefox" --> doShift (myWorkspaces !! 1) - , className =? "Code" --> doShift (myWorkspaces !! 3) - , className =? "discord" --> doShift (myWorkspaces !! 4) - , title =? "JetBrains Toolbox" --> doShift (myWorkspaces !! 3) - , className =? "main" --> doFloat - , className =? "Mailspring" --> doShift (myWorkspaces !! 5) - , className =? "Xmessage" --> doFloat - , title =? "Steam - News" --> doFloat - , title =? "Friends List" --> doFloat - , isFullscreen --> doFullFloat] - - -myEventHook = ewmhDesktopsEventHook - -myStartupHook = do - spawnOnce "pasystray" - spawnOnce "nitrogen --restore &" - spawnOnce "playerctld" - spawnOnce "picom &" - setWMName "LG3D" - spawnOnce "nm-applet" - spawnOnce ("xsetroot -cursor_name left_ptr") - spawnOnce ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --margin 4 --widthtype request --padding 8 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 30 --distance 5 &") - spawnOnce ("slimbookbattery --minimize") - spawnOnce ("slimbookintelcontroller") - spawnOnce ("nextcloud") - spawnOnOnce "web" myWebBrowser - spawnOnOnce "main" myTerminalTmux -@end -* XMobar Config -@code haskell - -myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig -myStatusBarSpawner (S s) = do - pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s) - ("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s) - (pure $ myXmobarPP (S s)) - - -myXmobarPP :: ScreenId -> PP -myXmobarPP s = def - { ppSep = "" - , ppWsSep = "" - , ppCurrent = xmobarColor cyan "" . const wsIconFull - , ppVisible = xmobarColor grey4 "" . const wsIconFull - , ppVisibleNoWindows = Just (xmobarColor grey4 "" . const wsIconFull) - , ppHidden = xmobarColor grey2 "" . const wsIconHidden - , ppHiddenNoWindows = xmobarColor grey2 "" . const wsIconEmpty - , ppUrgent = xmobarColor orange "" . const wsIconFull - , ppOrder = \(ws : _ : _ : extras) -> ws : extras - , ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s) - ,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s) - ] - } - where - wsIconFull = " \xf111 " - wsIconHidden = " \xf111 " - wsIconEmpty = " \xf10c " - titleColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l - layoutColorIsActive n l = do - c <- withWindowSet $ return . W.screen . W.current - if n == c then wrapL "" l else wrapL "" l - @end -* Config Variables binding -@code haskell - -myConfig = def - { - terminal = myTerminal, - focusFollowsMouse = myFocusFollowsMouse, - clickJustFocuses = myClickJustFocuses, - borderWidth = myBorderWidth, - modMask = myModMask, - workspaces = myWorkspaces, - normalBorderColor = myNormalBorderColor, - focusedBorderColor = myFocusedBorderColor, - layoutHook = smartBorders . spacingWithEdge 15 $ myLayout, - manageHook = manageSpawn <+> myManageHook <+> manageHook def, - handleEventHook = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True), - startupHook = myStartupHook - } -@end -* Main -@code haskell - -main :: IO () -main = xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys -@end