From 912b77c295d54fda42557d6655b08df828d55f34 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Mon, 18 Sep 2023 16:03:15 +0100 Subject: [PATCH] Updated Xmonad look --- .config/fish/fish_variables | 1 + .config/nvim/lua/plugins/lazy.lua | 28 ++-- .config/picom/picom.conf | 5 +- .config/xmobar/xmobarrc0 | 2 +- .config/xmonad/lib/Colors/Teal.hi | Bin 2203 -> 2201 bytes .config/xmonad/lib/Colors/Teal.o | Bin 8368 -> 8368 bytes .config/xmonad/xmonad.hs | 207 ++++++++++++++++++++++++++++++ .config/xmonad/xmonad.norg | 11 +- 8 files changed, 231 insertions(+), 23 deletions(-) create mode 100644 .config/xmonad/xmonad.hs diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index dba7242..9dd5c62 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -40,6 +40,7 @@ SETUVAR fish_color_status:e78284 SETUVAR fish_color_user:81c8be SETUVAR fish_color_valid_path:\x2d\x2dunderline SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell +SETUVAR fish_key_bindings:fish_default_key_bindings SETUVAR fish_pager_color_background:\x1d SETUVAR fish_pager_color_completion:c6d0f5 SETUVAR fish_pager_color_description:737994 diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index 542e843..05b35b3 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -68,12 +68,12 @@ lazy.setup({ }) end }, -{ - 'laytan/tailwind-sorter.nvim', - dependencies = {'nvim-treesitter/nvim-treesitter', 'nvim-lua/plenary.nvim'}, - build = 'cd formatter && bun i && bun run build', - config = true, - }, + { + 'laytan/tailwind-sorter.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-lua/plenary.nvim' }, + build = 'cd formatter && bun i && bun run build', + config = true, + }, --Database integration -- 'tpope/vim-dadbod', -- { @@ -246,13 +246,15 @@ lazy.setup({ { "nvim-neorg/neorg", build = ":Neorg sync-parsers", - opts = { - load = { - ["core.defaults"] = {}, -- Loads default behaviour - ["core.concealer"] = {} -- Adds pretty icons to your documents - }, - }, - dependencies = { { "nvim-lua/plenary.nvim" } }, + config = function() + require("neorg").setup { + load = { + ["core.defaults"] = {}, -- Loads default behaviour + ["core.concealer"] = {} -- Adds pretty icons to your documents + }, + } + end, + dependencies = { "nvim-lua/plenary.nvim" }, }, -- 'kmonad/kmonad-vim', diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index 38a61cf..9c960f7 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -15,11 +15,12 @@ size-transition = true # Corners # ################################# # requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom -corner-radius = 4.0; +corner-radius = 16.0; rounded-corners-exclude = [ #"window_type = 'normal'", "class_g = 'Rofi'", "class_g = 'TelegramDesktop'", + "class_g = 'Dunst'" ]; round-borders = 1; round-borders-exclude = [ @@ -200,7 +201,7 @@ opacity-rule = [ "100:class_g = 'slop'", # maim "100:class_g = 'XTerm'", "100:class_g = 'URxvt'", - "100:class_g = 'kitty'", + "85:class_g = 'kitty'", "100:class_g = 'Alacritty'", "80:class_g = 'Polybar'", "100:class_g = 'code-oss'", diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 index 888dbde..2588de1 100644 --- a/.config/xmobar/xmobarrc0 +++ b/.config/xmobar/xmobarrc0 @@ -15,7 +15,7 @@ Config {font = "Ubuntu bold 10" -- an integer for the percentage width, so 100 would be 100%. -- an integer for the minimum pixel height for xmobar, so 24 would force a height of at least 24 pixels. -- NOTE: The height should be the same as the trayer (system tray) height. - , position = TopSize L 100 36 + , position = TopHM 36 4 4 4 0 , lowerOnStart = True , hideOnStart = False , allDesktops = True diff --git a/.config/xmonad/lib/Colors/Teal.hi b/.config/xmonad/lib/Colors/Teal.hi index 5645fbb107f88af53c4ba0acf459f80f1f4b3098..b3cc7789007a74b7f225af72a90c15c6a982fd52 100644 GIT binary patch delta 311 zcmbO&I8)Gp@z=Q&7E1#oa|Q+mju{LLEWtp`#K6GFz;I>ZzFVhu&+E(H@%7G%C+p`t z-OYIW^~`C9KQ6kjb!YRA-jC2(stFsQhJH_~B(YJGlH=S8J%Gwq{mg%$%G6 xWcN;P0kStuUdgO1bd9yAq2U?O89={-0Q23+_n4))e}I^OfdmWFW@eTdEC5u1eLw&J delta 313 zcmbO!I9t$x@z=Q&7E1#oQw9bGj#&&0ETKTm!oa}Dz;OJ*oTuL(AD$?8|Nfgv?Qfg^ zsvqchv+Hl)#)<0~|1A1At@ZcI#|9G}t{ZwW0reQ}+q|o5@!~rRzcNnQeX4y`&jmv=7gnC#AIU^VAa_rGa(Pj7k2xU}uq>%QerwpIg` zGcZm95z`q24o`TxqVv_3MK>5Pc3*n+ZsFr8PZ=5bfpU8%Z(vkrd^q_EqY5M2zlP#H57_%qG y0onbNn}F;slb16q3*BJtX=r%H0row}EzI{P-(i;G{sm(G2NEnSn;BVVumAum0eTex diff --git a/.config/xmonad/lib/Colors/Teal.o b/.config/xmonad/lib/Colors/Teal.o index 31a2abac9fa197ca19ccac557da5d4e7dadb2be9..3a5be9df2ed1259fcfaa9daf0ae78ba4b8c7d59e 100644 GIT binary patch delta 147 zcmdnsxWRG5bPh)I%`-SsSnDn0i%W_ak_~eTU<@}HBMi#OO@c9sUN} YVGMsLBi{tZ$c8Z-VT{1d)qJKx0NfZdVgLXD diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs new file mode 100644 index 0000000..d0a6e25 --- /dev/null +++ b/.config/xmonad/xmonad.hs @@ -0,0 +1,207 @@ +{-# OPTIONS_GHC -Wno-deprecations #-} + + +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 + + + +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..] + + +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))] + +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 + , 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 &") + 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)) + + +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 + + +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 + } + + +main :: IO () +main = xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys \ No newline at end of file diff --git a/.config/xmonad/xmonad.norg b/.config/xmonad/xmonad.norg index ac8f833..7b4bb54 100644 --- a/.config/xmonad/xmonad.norg +++ b/.config/xmonad/xmonad.norg @@ -164,15 +164,12 @@ myStartupHook = do spawnOnce "nitrogen --restore &" spawnOnce "playerctld" spawnOnce "picom &" - spawnOnce "optimus-manager-qt" setWMName "LG3D" spawnOnce "nm-applet" - spawnOnce "mailspring" spawnOnce("xsetroot -cursor_name left_ptr") - spawn ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --widthtype request --padding 7 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 26 --distance 5 &") - spawnOn "web" myWebBrowser - spawnOn "main" myTerminalTmux - spawnOn "monitoring" (myTerminal ++ " -e btop") + 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 &") + spawnOnOnce "web" myWebBrowser + spawnOnOnce "main" myTerminalTmux @end * XMobar Config @code haskell @@ -223,7 +220,7 @@ myConfig = def workspaces = myWorkspaces, normalBorderColor = myNormalBorderColor, focusedBorderColor = myFocusedBorderColor, - layoutHook = smartBorders . spacingWithEdge 5 $ myLayout, + layoutHook = smartBorders . spacingWithEdge 15 $ myLayout, manageHook = manageSpawn <+> myManageHook <+> manageHook def, handleEventHook = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True), startupHook = myStartupHook