diff --git a/configs/xmonad/build b/configs/xmonad/build index a2816ac..a7351da 100755 --- a/configs/xmonad/build +++ b/configs/xmonad/build @@ -1,7 +1,7 @@ #!/bin/sh # Recompile -cd "$XMONAD_CONFIG_DIR" && stack install || exit +cd "$XMONAD_CONFIG_DIR" && stack-bin install || exit # Create a hard link at the requested destination, replacing any existing one. -ln -f -T "$(stack exec -- which xmonad)" "$1" +ln -f -T "$(stack-bin exec -- which xmonad)" "$1" diff --git a/configs/xmonad/install.sh b/configs/xmonad/install.sh new file mode 100755 index 0000000..30ded28 --- /dev/null +++ b/configs/xmonad/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cd ~/.config/xmonad +./update +stack-bin setup +stack-bin install +./build diff --git a/configs/xmonad/package.yaml b/configs/xmonad/package.yaml index 0898c29..03e734b 100644 --- a/configs/xmonad/package.yaml +++ b/configs/xmonad/package.yaml @@ -1,16 +1,17 @@ -name: xmonad-scherso -version: 0.1.0 -synopsis: My XMonad configuration. -license: DBAD -author: Scherso -homepage: https://github.com/Scherso/Dotfiles +# heavily copied from github.com/scherso, all rights to him +name: zmonad +version: 0.1.0 +synopsis: xmonad but z +homepage: https://github.com/jabuxas/config-notes +author: jabuxas +maintainer: jabuxas +license: BSD4 ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -j -dynamic dependencies: - base - xmonad-contrib >= 0.16 - - dbus source-dirs: src @@ -26,3 +27,8 @@ executables: dependencies: - xmobar ghc-options: -rtsopts -threaded -with-rtsopts=-N + xmobar2: + main: xmobar2.hs + dependencies: + - xmobar + ghc-options: -rtsopts -threaded -with-rtsopts=-N diff --git a/configs/xmonad/src/original.hs b/configs/xmonad/src/original.hs deleted file mode 100644 index 1750639..0000000 --- a/configs/xmonad/src/original.hs +++ /dev/null @@ -1,273 +0,0 @@ --- ## Modules ## ------------------------------------------------------------------- -{-# LANGUAGE MultiWayIf #-} -import XMonad -import XMonad.Util.SpawnOnce -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.ManageHook -import XMonad.Util.Ungrab -import XMonad.Util.Hacks as Hacks -import XMonad.Hooks.WindowSwallowing -import XMonad.Layout.Fullscreen -import XMonad.Layout.NoBorders -import XMonad.Layout.Spacing -import XMonad.Layout.Gaps -import XMonad.Hooks.StatusBar -import XMonad.Hooks.StatusBar.PP -import System.Exit -import Control.Monad -import Data.Monoid -import Data.Maybe -import XMonad.Util.Cursor -import Graphics.X11.ExtraTypes.XF86 -import XMonad.Util.ClickableWorkspaces - -import qualified XMonad.StackSet as W -import qualified Data.Map as M - --- focus follows the mouse pointer -myFocusFollowsMouse :: Bool -myFocusFollowsMouse = True - --- clicking on a window to focus -myClickJustFocuses :: Bool -myClickJustFocuses = True - --- Width of the window border in pixels -myBorderWidth = 2 - --- Border colors for focused & unfocused windows -myFocusedBorderColor = "#de935f" -myNormalBorderColor = "#5f819d" - --- modMask : modkey you want to use --- mod1Mask : left alt Key --- mod4Mask : Windows or Super Key -myModMask = mod4Mask -myTerminal = "kitty" --- Workspaces (ewmh) -myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "music", "email", "x"] - -myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ - -- Close focused window - [ ((modm .|. shiftMask, xK_c), kill) - , ((modm, xK_Escape), spawn "mpc toggle") - , ((modm .|. shiftMask, xK_m), spawn "kitty -e ncmpcpp") - , ((modm, xK_e), spawn "pcmanfm") - , ((modm, xK_v), spawn "vscodium") - , ((modm, xK_Return), spawn myTerminal) - , ((modm .|. shiftMask, xK_Escape), spawn "/home/klein/.config/rofi/powermenu/type-6/powermenu.sh") - , ((modm .|. shiftMask, xK_Return), spawn "/home/klein/.config/rofi/launchers/type-7/launcher.sh") - , ((0 .|. shiftMask, xK_Print), unGrab >> spawn "/home/klein/.local/bin/print-select") - , ((0, xK_Print), spawn "/home/klein/.local/bin/print-fullscreen") - -- Change gaps on the fly - , ((modm .|. controlMask, xK_o), sendMessage $ IncGap 10 L) -- increment the left-hand gap - , ((modm .|. shiftMask, xK_o), sendMessage $ DecGap 10 L) -- decrement the left-hand gap - , ((modm .|. controlMask, xK_y), sendMessage $ IncGap 10 U) -- increment the top gap - , ((modm .|. shiftMask, xK_y), sendMessage $ DecGap 10 U) -- decrement the top gap - , ((modm .|. controlMask, xK_u), sendMessage $ IncGap 10 D) -- increment the bottom gap - , ((modm .|. shiftMask, xK_u), sendMessage $ DecGap 10 D) -- decrement the bottom gap - , ((modm .|. controlMask, xK_i), sendMessage $ IncGap 10 R) -- increment the right-hand gap - , ((modm .|. shiftMask, xK_i), sendMessage $ DecGap 10 R) -- decrement the right-hand gap - -- Resize viewed windows to the correct size - , ((modm, xK_r), refresh) - -- Move focus to the master window - , ((modm, xK_m), windows W.focusMaster) - -- Push window back into tiling - , ((modm, xK_t), withFocused $ windows . W.sink) - -- Rotate through the available layout algorithms - , ((modm, xK_space), sendMessage NextLayout) - -- Reset the layouts on the current workspace to default - , ((modm .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf) - -- Move focus to the next window - , ((modm, xK_Tab), windows W.focusDown) - -- Move focus to the next window - , ((modm, xK_j), windows W.focusDown) - , ((modm, xK_Left), windows W.focusDown) - -- Move focus to the previous window - , ((modm, xK_k), windows W.focusUp) - , ((modm, xK_Right), windows W.focusUp) - -- Swap the focused window with the next window - , ((modm .|. shiftMask, xK_j), windows W.swapDown) - , ((modm .|. shiftMask, xK_h), windows W.swapDown) - -- Swap the focused window with the previous window - , ((modm .|. shiftMask, xK_k), windows W.swapUp) - , ((modm .|. shiftMask, xK_l), windows W.swapUp) - -- Shrink the master area - , ((modm, xK_h), sendMessage Shrink) - , ((modm .|. controlMask, xK_Left), sendMessage Shrink) - -- Expand the master area - , ((modm, xK_l), sendMessage Expand) - , ((modm .|. controlMask, xK_Right), sendMessage Expand) - -- Increment the number of windows in the master area - , ((modm, xK_comma), sendMessage (IncMasterN 1)) - -- Deincrement the number of windows in the master area - , ((modm, xK_period), sendMessage (IncMasterN (-1))) - -- volume - , ((0,xF86XK_AudioMute), spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle") - , ((0,xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%") - , ((0,xF86XK_AudioRaiseVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%") - -- Restart xmonad - , ((controlMask .|. shiftMask, xK_r), spawn "xmonad --recompile; xmonad --restart") - -- Quit xmonad - , ((controlMask .|. shiftMask, xK_q), spawn "pkill -KILL -u $USER") - -- programs - , ((modm, xK_d), spawn "cd ~/.config && ./webcordx") - , ((modm, xK_s), spawn "spotify") - , ((modm , xK_y ), sendMessage ToggleStruts) - , ((modm .|. shiftMask, xK_b), spawn "firefox") - -- , ((modm, xK_F1), spawn "dmenu_run") - -- spotify controls, handy af - , ((modm, xK_F9), spawn "playerctl play-pause") - , ((modm, xK_F11), spawn "playerctl previous") - , ((modm, xK_F12), spawn "playerctl next") - , ((modm, xK_p), spawn "flameshot") - , ((modm, xK_F4), withFocused toggleFull) - ] - ++ - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - [ ((m .|. modm, k), windows $ f i) - | (i, k) <- zip (XMonad.workspaces conf) [xK_1,xK_2,xK_3,xK_4,xK_5,xK_6,xK_7,xK_8,xK_9,xK_0] - , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] - ] - ++ - -- mod-{q,a,z}, Switch to physical/Xinerama screens 1, 2, or 3 - -- mod-shift-{q,a,z}, Move client to screen 1, 2, or 3 - [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_comma, xK_period, xK_z] [0..] - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] - --- ## Mouse Bindings ## ------------------------------------------------------------------ -myMouseBindings :: XConfig l -> M.Map (KeyMask, Button) (Window -> X ()) -myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList - -- Set the window to floating mode and move by dragging. - [ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster) - -- Raise the window to the top of the stack. - , ((modm, button2), \w -> focus w >> windows W.shiftMaster) - -- Set the window to floating mode and resize by dragging. - , ((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster) - ] - -myLayout = - avoidStruts - $ lessBorders OnlyScreenFloat - $ gaps [(L,5), (R,5), (U,5), (D,5)] - $ spacingRaw False (Border 10 0 10 0) True (Border 0 10 0 10) True - $ tiled ||| Mirror tiled ||| Full - where - tiled = Tall nmaster delta ratio - nmaster = 1 -- Default number of windows in the master pane. - ratio = 1 / 2 -- Default proportion of screen occupied by master panes. - delta = 3 / 100 -- Percent of screen increment by when resizing panes. - -myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet) -myManageHook = manageRules - where - viewShift = doF . liftM2 (.) W.greedyView W.shift - manageRules = composeAll . concat $ - [ [ isDialog --> doCenterFloat ] - , [ className =? c --> doCenterFloat | c <- myCFloats ] - , [ title =? t --> doCenterFloat | t <- myTFloats ] - , [ resource =? r --> doFloat | r <- myRFloats ] - , [ resource =? i --> doIgnore | i <- myIgnores ] - , [ className =? "firefox" --> viewShift "web" ] - , [ className =? "firefox-esr" --> doShift "web" ] - , [ className =? "discord" --> doShift "irc" ] - , [ className =? "Spotify" --> doShift "music" ] - , [ className =? "thunderbird" --> doShift "email" ] - , [ className =? "Steam" --> doShift "x" ] - , [ className =? "leagueclientux.exe" --> doShift "gfx" <> doFloat ] - , [ className =? "Lutris" --> doShift "gfx" <> doFloat] - , [ className =? "league of legends.exe" --> doShift "gfx" <> doFloat ] - , [ className =? "riotclientux.exe" --> doShift "gfx" <> doFloat ] - , [ className =? "dauntless-win64-shipping.exe" --> doShift "gfx" ] - , [ className =? "leagueclient.exe" --> doShift "gfx" <> doFloat ] - , [ className =? "battle.net.exe" --> doShift "gfx" <> doFloat ] - , [ className =? "Pcmanfm" --> doFloat ] - , [ className =? "Pavucontrol" --> doFloat ] - , [ className =? "Nitrogen" --> doFloat ] - - ] - where - myCFloats = ["Viewnior", "Alafloat"] - myTFloats = ["Downloads", "Save As...", "Getting Started"] - myRFloats = [] - myIgnores = ["desktop_window"] - --- , [className =? "Alacritty" --> viewShift "1"] --- , [className =? "Thunar" --> viewShift "3"] --- , [className =? "Geany" --> viewShift "4"] --- , [className =? "Inkscape" --> viewShift "5"] --- , [className =? "vlc" --> viewShift "6"] --- , [className =? "Xfce4-settings-manager" --> viewShift "7"] - -toggleFull :: Window -> X () -toggleFull w = windows $ \s -> if - | M.lookup w (W.floating s) == Just fullscreen -> W.sink w s - | otherwise -> W.float w fullscreen s - where - fullscreen = W.RationalRect 0 0 1 1 - -myEventHook :: Event -> X All -myEventHook = mempty $ swallowEventHook (className =? "Alacritty" <||> className =? "kitty") (return True) -- ewmh - -myStartupHook :: X () -myStartupHook = do - setDefaultCursor xC_left_ptr - spawnOnce "nitrogen --restore &" - spawnOnce "/home/klein/scripts/xmonad.sh &" - -- spawnOnce "/home/klein/.local/bin/xmobar ~/.config/xmonad/src/xmobar.hs &" - -- spawnOnce "/home/klein/.local/bin/xmobar-2nd &" - -- spawnOnce "picom --daemon --experimental-backends --backend glx --blur-method dual_kawase --transparent-clipping" - -- spawnOnce "killall trayer; trayer --edge top --align right --widthtype request --padding 2 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x161814 --height 25 --distance 3 &" - -- spawnOnce "dunst" - -myLogHook = return () - -myXmobarPP :: PP -myXmobarPP = - def - { ppCurrent = xmobarColor "#de935f" "" . wrap "[" "]", - ppHidden = xmobarColor "#d2ba8b" "", - ppHiddenNoWindows = xmobarColor "#a3846e" "", - ppSep = " > ", - ppOrder = \(ws : l : t : ex) -> [ws] ++ map (xmobarColor "#E06C75" "") ex ++ [xmobarColor "#ABB2BF" "" t], - ppExtras = [] - } - -myConfig = - def - { focusFollowsMouse = myFocusFollowsMouse - , clickJustFocuses = myClickJustFocuses - , borderWidth = myBorderWidth - , modMask = myModMask - , workspaces = myWorkspaces - , normalBorderColor = myNormalBorderColor - , focusedBorderColor = myFocusedBorderColor - , terminal = myTerminal - -- Keybindings - , keys = myKeys - , mouseBindings = myMouseBindings - -- Hooks and layouts - , manageHook = myManageHook - , layoutHook = myLayout - , handleEventHook = myEventHook - <> Hacks.trayerAboveXmobarEventHook - , logHook = myLogHook - , startupHook = myStartupHook - } - -main :: IO () -main = - do - xmonad - . ewmhFullscreen - . docks - . ewmh - . fullscreenSupport - . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey - . withEasySB (statusBarProp "xmobar-2nd" (pure myXmobarPP)) defToggleStrutsKey - $ myConfig diff --git a/configs/xmonad/src/xmobar.hs b/configs/xmonad/src/xmobar.hs index c81108d..8be80c8 100644 --- a/configs/xmonad/src/xmobar.hs +++ b/configs/xmonad/src/xmobar.hs @@ -16,7 +16,7 @@ myConfig = pure baseConfig { template = concat $ [ " \xe0b6\ - \\xf30d \ + \\xf30d \ \\xe0b4 " ] <> @@ -57,7 +57,7 @@ myCommands = , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh" ) ["vol"] "vol" 20 , Run $ Date "\xf017 %-l:%M %p" "date" 600 , Run $ Cpu [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83" ] 50 - , Run $ Memory [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50 + , Run $ Memory [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50 -- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5 , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/trayer-padding.sh") ["trayer"] "trayer" 100 , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 20 @@ -68,19 +68,19 @@ myCommands = baseConfig :: Config baseConfig = defaultConfig - { font = "xft:mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true" - , additionalFonts = [ "xft:mononoki Nerd Font:pixelsize=10:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=13:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:pixelsize=13:antialias=true:hinting=true" + { font = "xft:UbuntuMono Nerd Font:pixelsize=12:antialias=true:hinting=true" + , additionalFonts = [ "xft:UbuntuMono Nerd Font:pixelsize=10:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=13:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=11:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=11:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:pixelsize=13:antialias=true:hinting=true" ] , textOffsets = [20, 22, 21, 21, 20] , bgColor = "#212121" , fgColor = "#c8b6b8" - , borderColor = "#a6e22e" + , borderColor = "#272727" , border = FullB - , borderWidth = 1 + , borderWidth = 0 {- , position = Static { xpos = 13, ypos = 1034, width = 1893, height = 32 } Bottom Padded , position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat diff --git a/configs/xmonad/src/2ndmonitor.hs b/configs/xmonad/src/xmobar2.hs similarity index 78% rename from configs/xmonad/src/2ndmonitor.hs rename to configs/xmonad/src/xmobar2.hs index abebd31..6c5aff4 100644 --- a/configs/xmonad/src/2ndmonitor.hs +++ b/configs/xmonad/src/xmobar2.hs @@ -16,14 +16,14 @@ myConfig = pure baseConfig { template = concat $ [ " \xe0b6\ - \\xf30d \ + \\xf30d \ \\xe0b4 " ] <> [ "@UnsafeXMonadLog@}{" ] <> [ "\xe0b6\ - \@mpc@\ + \@music@\ \\xe0b4 " ] <> @@ -46,8 +46,6 @@ myConfig = \@date@\ \\xe0b4 " ] - -- <> - -- [ "@trayer@"] , commands = myCommands } @@ -57,10 +55,10 @@ myCommands = , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/volume.sh" ) ["vol"] "vol" 20 , Run $ Date "\xf017 %-l:%M %p" "date" 600 , Run $ Cpu [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#56B6C2", "-n", "#4797a1", "-l", "#3a7b83" ] 50 - , Run $ Memory [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50 + , Run $ Memory [ "-t", "", "-f", ":", "-H", "75", "-L", "25", "-h", "#c678dd", "-n", "#9f60b1", "-l", "#855094" ] 50 -- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/gputemp.sh") ["gpu"] "gpu" 5 - -- , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/trayer-padding.sh") ["trayer"] "trayer" 100 - , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["mpc"] "mpc" 20 + , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/trayer-padding.sh") ["trayer"] "trayer" 100 + , Run $ Com (myHomeDir <> "/.config/xmonad/scripts/mpd.sh") ["music"] "music" 20 -- , Run $ Com (myHomeDir <> "/.config/xmonad/src/trayer-padding.sh") ["trayer"] "trayer" 50 -- , Run $ MPD ["-h", "127.0.0.1", "-p", "6600", "-t", " <track>/<plength> <statei>", "--", "-P", ">>", "-Z", "|", "-S", "><"] 10 ] @@ -68,19 +66,19 @@ myCommands = baseConfig :: Config baseConfig = defaultConfig - { font = "xft:mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true" - , additionalFonts = [ "xft:mononoki Nerd Font:pixelsize=10:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=13:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:size=11:antialias=true:hinting=true" - , "xft:mononoki Nerd Font:pixelsize=13:antialias=true:hinting=true" + { font = "xft:UbuntuMono Nerd Font:pixelsize=12:antialias=true:hinting=true" + , additionalFonts = [ "xft:UbuntuMono Nerd Font:pixelsize=10:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=13:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=11:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:size=11:antialias=true:hinting=true" + , "xft:UbuntuMono Nerd Font:pixelsize=13:antialias=true:hinting=true" ] , textOffsets = [20, 22, 21, 21, 20] , bgColor = "#212121" , fgColor = "#c8b6b8" - , borderColor = "#a6e22e" + , borderColor = "#272727" , border = FullB - , borderWidth = 1 + , borderWidth = 0 {- , position = Static { xpos = 13, ypos = 1034, width = 1893, height = 32 } Bottom Padded , position = Static { xpos = 0, ypos = 1048, width = 1920, height = 32 } Bottom Flat diff --git a/configs/xmonad/src/xmonad.hs b/configs/xmonad/src/xmonad.hs index bb1a78a..d7ee095 100644 --- a/configs/xmonad/src/xmonad.hs +++ b/configs/xmonad/src/xmonad.hs @@ -1,350 +1,358 @@ -{-# LANGUAGE +{-# LANGUAGE MultiWayIf -- Required for `toggleFull` in `myAdditionalKeys` , LambdaCase -- Required for `(\case)` statement in `myXmobarPP` , FlexibleContexts , OverloadedStrings -#-} -{-# OPTIONS_GHC - -Wno-missing-signatures - -Wno-orphans #-} +{-# OPTIONS_GHC -Wno-missing-signatures + -Wno-orphans #-} --- Data Imports -import qualified Data.Map as M -import Data.Functor -import Data.Monoid +-- Data Imports --- Used in io exitSuccess -import System.Exit -import System.Environment (getEnv) -import System.IO.Unsafe (unsafeDupablePerformIO) +import Data.Functor +import qualified Data.Map as M +import Data.Monoid +-- Used in io exitSuccess + +import System.Environment (getEnv) +import System.Exit +import System.IO.Unsafe (unsafeDupablePerformIO) +-- XMonad imports +import XMonad +import XMonad.Actions.NoBorders (toggleBorder) +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDebug +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.SetWMName +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP +import XMonad.Hooks.WindowSwallowing +import XMonad.Layout.Fullscreen +import XMonad.Layout.NoBorders +import XMonad.Layout.SimpleFloat +import XMonad.Layout.Spacing +import qualified XMonad.StackSet as W +import XMonad.Util.ClickableWorkspaces +import XMonad.Util.Cursor +import XMonad.Util.EZConfig +import qualified XMonad.Util.Hacks as Hacks +import XMonad.Util.NamedScratchpad +import XMonad.Util.SpawnOnce +import XMonad.Util.Ungrab --- XMonad imports -import XMonad -import XMonad.Hooks.WindowSwallowing -import XMonad.Actions.NoBorders (toggleBorder) -import XMonad.Util.Ungrab -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Hooks.SetWMName -import XMonad.Hooks.StatusBar -import XMonad.Hooks.StatusBar.PP -import XMonad.Layout.Fullscreen -import XMonad.Layout.SimpleFloat -import XMonad.Layout.NoBorders -import XMonad.Layout.Spacing -import qualified XMonad.StackSet as W -import XMonad.Util.ClickableWorkspaces -import XMonad.Util.Cursor -import XMonad.Util.EZConfig -import qualified XMonad.Util.Hacks as Hacks -import XMonad.Util.SpawnOnce -import XMonad.Util.NamedScratchpad -import XMonad.Hooks.DynamicProperty -import XMonad.Layout.PerWorkspace -import XMonad.Hooks.ManageDebug -- import qualified DBus as D -- import qualified DBus.Client as D - main :: IO () -main = do +main = + do xmonad $ debugManageHookOn "M-S-d" - . docks - . ewmhFullscreen - . fullscreenSupport - . ewmh - . Hacks.javaHack - . withEasySB xmobar toggleSB - . withSB xmobar2 + . docks + . ewmhFullscreen + . fullscreenSupport + . ewmh + . Hacks.javaHack + . withEasySB xmobar toggleSB + . withSB xmobar2 $ myConfig - where - toggleSB XConfig {modMask = modm} = (modm, xK_m) + where + toggleSB XConfig {modMask = modm} = (modm, xK_m) - -- Windows key/Super key +-- Windows key/Super key myModMask :: KeyMask -myModMask = mod4Mask +myModMask = mod4Mask - -- Default Terminal +-- Default Terminal myTerminal :: String -myTerminal = "urxvtc" +myTerminal = "kitty" - -- Default Launcher +-- Default Launcher myLauncher :: String -myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-7/launcher.sh" +myLauncher = myHomeDir ++ "/.config/rofi/launchers/type-7/launcher.sh" - -- Default Launcher +-- Default Launcher myFileManager :: String -myFileManager = "thunar" +myFileManager = "thunar" - -- Default Browser +-- Default Browser myBrowser :: String -myBrowser = "firefox" +myBrowser = "firefox" myPowerMenu :: String myPowerMenu = myHomeDir ++ "/.config/rofi/powermenu/type-6/powermenu.sh" - -- Workspaces +-- Workspaces myWorkspaces :: [String] +myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "msc", "eml", "stm"] + -- myWorkspaces = map show [1 .. 9] -myWorkspaces = ["dev", "web", "irc", "gfx", "vm", "music", "email", "x"] - -- Border Width +-- Border Width myBorderWidth :: Dimension -myBorderWidth = 2 +myBorderWidth = 1 - -- Formal Unfocused Color +-- Formal Unfocused Color myNormColor :: String -myNormColor = "#383830" +myNormColor = "#383830" - -- Focused Color +-- Focused Color myFocusColor :: String -myFocusColor = "#a6e22e" +myFocusColor = "#a2a2a2" - -- Home Directory +-- Home Directory myHomeDir :: String -myHomeDir = unsafeDupablePerformIO (getEnv "HOME") +myHomeDir = unsafeDupablePerformIO (getEnv "HOME") -- focus follows the mouse pointer myFocusFollowsMouse :: Bool -myFocusFollowsMouse = True +myFocusFollowsMouse = True -myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ +myKeys conf@(XConfig {XMonad.modMask = modm}) = + M.fromList $ [ ((m .|. modm, k), windows $ f i) - | (i, k) <- zip (XMonad.workspaces conf) [xK_1,xK_2,xK_3,xK_4,xK_5,xK_6,xK_7,xK_8,xK_9,xK_0] - , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] + | (i, k) <- zip (XMonad.workspaces conf) [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0], + (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] ] - ++ - [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_comma, xK_period, xK_z] [0..] - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] - + ++ [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_comma, xK_period, xK_z] [0 ..], + (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] myAdditionalKeys :: [(String, X ())] -myAdditionalKeys = - base - ++ window - ++ applications - ++ multimedia - where +myAdditionalKeys = + base + ++ window + ++ applications + ++ multimedia + where -- Force killing a frozen window. - forceKillWindow :: Window -> X () - forceKillWindow w = withDisplay $ \d -> - io $ void $ killClient d w + forceKillWindow :: Window -> X () + forceKillWindow w = withDisplay $ \d -> + io $ void $ killClient d w -- Making a window have a full float over a workspace. - toggleFull :: Window -> X () - toggleFull w = windows $ \s -> if - | M.lookup w (W.floating s) == Just fullscreen -> W.sink w s - | otherwise -> W.float w fullscreen s - where - fullscreen = W.RationalRect 0 0 1 1 + toggleFull :: Window -> X () + toggleFull w = windows $ \s -> + if + | M.lookup w (W.floating s) == Just fullscreen -> W.sink w s + | otherwise -> W.float w fullscreen s + where + fullscreen = W.RationalRect 0 0 1 1 -- Screenshots - screenShotSelection = myHomeDir ++ "/.local/bin/print-select" :: String - screenShotFullscreen = myHomeDir ++ "/.local/bin/print-fullscreen" :: String - screenShotTmp = myHomeDir ++ "/.local/bin/print-tmp" :: String - screenShotApp = myHomeDir ++ "/.local/bin/print-select-fr" :: String + screenShotSelection = myHomeDir ++ "/.local/bin/print-select" :: String + screenShotFullscreen = myHomeDir ++ "/.local/bin/print-fullscreen" :: String + screenShotTmp = myHomeDir ++ "/.local/bin/print-tmp" :: String + screenShotApp = myHomeDir ++ "/.local/bin/print-select-fr" :: String -- XMonad base keybinds. - base = - [ ("M-g", withFocused toggleBorder) - , ("M-S-c", kill) - , ("M-S-x", withFocused forceKillWindow) - , ("M-<Space>", sendMessage NextLayout) - , ("M-n", refresh) - , ("M-S-q", io exitSuccess) - , ("C-S-r", spawn "xmonad --recompile; killall xmobar; xmonad --restart") - , ("C-S-q", spawn "pkill -KILL -u $USER") - ] + base = + [ ("M-g", withFocused toggleBorder), + ("M-S-c", kill), + ("M-S-x", withFocused forceKillWindow), + ("M-<Space>", sendMessage NextLayout), + ("M-n", refresh), + ("M-S-q", io exitSuccess), + ("C-S-r", spawn "xmonad --recompile; xmonad --restart"), + ("C-S-q", spawn "pkill -KILL -u $USER") + ] -- Window management keybinds. - window = - [ ("M-<Tab>", windows W.focusDown) - , ("M-j", windows W.focusDown) - , ("M-k", windows W.focusUp) - , ("M-S-m", windows W.focusMaster) - , ("M-m", sendMessage ToggleStruts) - , ("M-p", windows W.swapMaster) - , ("M-S-j", windows W.swapDown) - , ("M-S-h", windows W.swapDown) - , ("M-S-k", windows W.swapUp) - , ("M-S-l", windows W.swapUp) - , ("M-h", sendMessage Shrink) - , ("M-l", sendMessage Expand) - , ("M-t", withFocused $ windows . W.sink) - , ("M-f", withFocused toggleFull) - ] + window = + [ ("M-<Tab>", windows W.focusDown), + ("M-j", windows W.focusDown), + ("M-k", windows W.focusUp), + ("M-S-m", windows W.focusMaster), + ("M-m", sendMessage ToggleStruts), + ("M-p", windows W.swapMaster), + ("M-S-j", windows W.swapDown), + ("M-S-h", windows W.swapDown), + ("M-S-k", windows W.swapUp), + ("M-S-l", windows W.swapUp), + ("M-h", sendMessage Shrink), + ("M-l", sendMessage Expand), + ("M-t", withFocused $ windows . W.sink), + ("M-f", withFocused toggleFull) + ] -- Spawning applications. - applications = - [ ("M-<Return>", spawn myTerminal) - , ("M-S-m", namedScratchpadAction myScratchpads "ncmpcpp") - , ("M-C-<Return>", namedScratchpadAction myScratchpads "terminal") - , ("M-S-<Escape>", spawn myPowerMenu) - , ("M-b", spawn myBrowser) - , ("M-v", spawn "vscodium") - , ("S-<Print>", unGrab *> spawn screenShotSelection) - , ("C-<Print>", unGrab *> spawn screenShotTmp) - , ("C-S-<Print>", unGrab *> spawn screenShotApp) - , ("<Print>", spawn screenShotFullscreen) - , ("M-S-<Return>", spawn myLauncher) - , ("M-e", spawn myFileManager) - ] + applications = + [ ("M-<Return>", spawn myTerminal), + ("M-S-m", namedScratchpadAction myScratchpads "ncmpcpp"), + ("M-C-<Return>", namedScratchpadAction myScratchpads "terminal"), + ("M-S-<Escape>", spawn myPowerMenu), + ("M-b", spawn myBrowser), + ("M-v", spawn "code"), + ("M-S-s", spawn "~/steam/steam.sh"), + ("S-<Print>", unGrab *> spawn screenShotSelection), + ("C-<Print>", unGrab *> spawn screenShotTmp), + ("C-S-<Print>", unGrab *> spawn screenShotApp), + ("<Print>", spawn screenShotFullscreen), + ("M-S-<Return>", spawn myLauncher), + ("M-e", spawn myFileManager) + ] -- Multimedia keybinds. - multimedia = - [ ("<XF86AudioPlay>", spawn "playerctl play-pause") - , ("<XF86AudioPrev>", spawn "playerctl previous") - , ("<XF86AudioNext>", spawn "playerctl next") - , ("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle") - , ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -1.5%") - , ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%") - , ("<Pause>", spawn "amixer sset Capture toggle") - , ("M-<Escape>", spawn "mpc toggle") - , ("M-<F1>", spawn "mpc prev") - , ("M-<F2>", spawn "mpc next") - ] + multimedia = + [ ("<XF86AudioPlay>", spawn "playerctl play-pause"), + ("<XF86AudioPrev>", spawn "playerctl previous"), + ("<XF86AudioNext>", spawn "playerctl next"), + ("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"), + ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -1.5%"), + ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%"), + ("<Pause>", spawn "amixer sset Capture toggle"), + ("M-<Escape>", spawn "mpc toggle"), + ("M-<F1>", spawn "mpc prev"), + ("M-<F2>", spawn "mpc next") + ] myMouseBindings :: XConfig l -> M.Map (KeyMask, Button) (Window -> X ()) -myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList - -- Set the window to floating mode and move by dragging. - [ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster) - -- Raise the window to the top of the stack. - , ((modm, button2), \w -> focus w >> windows W.shiftMaster) - -- Set the window to floating mode and resize by dragging. - , ((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster) +myMouseBindings XConfig {XMonad.modMask = modm} = + M.fromList + -- Set the window to floating mode and move by dragging. + [ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster), + -- Raise the window to the top of the stack. + ((modm, button2), \w -> focus w >> windows W.shiftMaster), + -- Set the window to floating mode and resize by dragging. + ((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster) ] myStartupHook :: X () myStartupHook = do - traverse spawnOnce - [ "sh ~/.config/conky/Regulus/start.sh" - , "sh ~/scripts/screenlayout.sh" - , "nitrogen --restore &" - , "touch ~/tmp/touchy && rm -rf ~/tmp/*" - , "lxqt-policykit-agent &" - , myHomeDir ++ "/.local/bin/picom-jonaburg --glx-no-stencil --xrender-sync-fence -b &" - , "xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.1" - , "setxkbmap br abnt2" - , "nm-applet" - , "trayer-srg -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0xFF181814 --height 27 --transparent false --distance 2 --margin 1 --alpha 0 --monitor 0 &" - , "nvidia-settings --load-config-only" - , "mpd &" - , "dunst -config $HOME/.config/dunst/base16-nord.dunstrc &" - , "lxqt-policykit-agent &" - , "xrdb -load ~/.Xresources" - , "urxvtd --opendisplay --quiet --fork" - , "/usr/bin/emacs --daemon &" - -- , "redshift -l -23.591672:-46.561005 -t 5700:3600 &" - ] - setDefaultCursor xC_left_ptr - setWMName "jay's sin" + _ <- traverse + spawnOnce + [ "sh ~/scripts/screenlayout.sh", + "nitrogen --restore &", + "touch ~/tmp/touchy && rm -rf ~/tmp/*", + -- , myHomeDir ++ "/.local/bin/picom-jonaburg --glx-no-stencil --xrender-sync-fence -b &" + "picom --config ~/.config/picom/vander.conf", + "xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Profile Enabled' 0, 1 && xinput --set-prop 'pointer:''Gaming Mouse' 'libinput Accel Speed' 0.1", + "setxkbmap br abnt2", + "nm-applet", + "trayer-srg -l --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --tint 0xFF181814 --height 27 --transparent false --distance 2 --margin 1 --alpha 0 --monitor 0 &", + "mpd &", + "dunst &", + "lxqt-policykit-agent &", + "xrdb -load ~/.Xresources", + "redshift -t 5700:3600 -l -23.5475:-46.63611 -b 0.9:0.5" + ] + setDefaultCursor xC_left_ptr + setWMName "zmonad" isInstance (ClassApp c _) = className =? c isInstance (TitleApp t _) = title =? t -isInstance (NameApp n _) = appName =? n +isInstance (NameApp n _) = appName =? n + +type AppName = String + +type AppTitle = String -type AppName = String -type AppTitle = String type AppClassName = String -type AppCommand = String + +type AppCommand = String data App = ClassApp AppClassName AppCommand | TitleApp AppTitle AppCommand | NameApp AppName AppCommand - deriving Show + deriving (Show) -gimp = ClassApp "Gimp" "gimp" -gimp2 = ClassApp "Gimp-2.99" "gimp-2.99" -multimc = ClassApp "MultiMC" "MultiMC" -about = TitleApp "About Mozilla Firefox" "About Mozilla Firefox" -message = ClassApp "Xmessage" "Xmessage" +gimp = ClassApp "Gimp" "gimp" + +gimp2 = ClassApp "Gimp-2.99" "gimp-2.99" + +multimc = ClassApp "MultiMC" "MultiMC" + +about = TitleApp "About Mozilla Firefox" "About Mozilla Firefox" + +message = ClassApp "Xmessage" "Xmessage" myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet) myManageHook = manageRules - where + where -- Hides windows without ignoring it, see doHideIgnore in XMonad contrib. - doHide = ask >>= doF . W.delete :: ManageHook + doHide = ask >>= doF . W.delete :: ManageHook -- WM_WINDOW_ROLE will be parsed with the role variable. - isRole = stringProperty "WM_WINDOW_ROLE" + isRole = stringProperty "WM_WINDOW_ROLE" -- To match multiple properties with one operator. - anyOf = foldl (<||>) (pure False) :: [Query Bool] -> Query Bool + anyOf = foldl (<||>) (pure False) :: [Query Bool] -> Query Bool -- To match multiple classNames with one operator. - match = anyOf . fmap isInstance :: [App] -> Query Bool + match = anyOf . fmap isInstance :: [App] -> Query Bool -- Checking for splash dialogs. - isSplash = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_SPLASH" + isSplash = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_SPLASH" -- Checking for pop-ups. - isPopup = isRole =? "pop-up" + isPopup = isRole =? "pop-up" -- Checking for file chooser dialog. - isFileChooserDialog = isRole =? "GtkFileChooserDialog" + isFileChooserDialog = isRole =? "GtkFileChooserDialog" -- Managing rules for applications. - manageRules = composeOne - [ transience - , isDialog -?> doCenterFloat - , isFullscreen -?> (doF W.focusDown <> doFullFloat) - , match [ gimp - , gimp2 - , about - , message - ] -?> doFloat - , match [ - multimc - ] -?> doCenterFloat - , anyOf [ isFileChooserDialog - , isDialog - , isPopup - , isSplash - ] -?> doCenterFloat - ] <> composeAll - [ manageDocks <> namedScratchpadManageHook myScratchpads - , className =? "firefox" <&&> title =? "File Upload" --> doFloat - , className =? "firefox" <&&> title =? "Library" --> doCenterFloat - , className =? "firefox" <&&> title ^? "Save" --> doFloat - , className =? "firefox" <&&> resource =? "Toolkit" --> doFloat - , className =? "firefox" <&&> title ^? "Sign in" --> doFloat - , className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat - , className ^? "jetbrains-" <&&> title =? "splash" --> doFloat - , className ^? "Visual " <&&> isDialog --> doCenterFloat - , className =? "firefox-esr" --> doShift "web" - , className =? "Virt-manager" --> doShift "vm" - , className =? "steam_app_1172620" --> doShift "gfx" - , className =? "discord" --> doShift "irc" - , className =? "discord-screenaudio" --> doShift "irc" - , className =? "Spotify" --> doShift "music" - , className =? "thunderbird" --> doShift "email" - , className =? "Steam" --> doShift "x" - , className =? "Lutris" --> doShift "gfx" <> doFloat - , className =? "leagueclientux.exe" --> doShift "gfx" - , className =? "league of legends.exe" --> doShift "gfx" - , className =? "leagueclient.exe" --> doShift "gfx" - , className =? "riotclientux.exe" --> doShift "gfx" - , className =? "dauntless-win64-shipping.exe" --> doShift "gfx" - , className =? "battle.net.exe" --> doShift "gfx" <> doFloat - , className =? "Pcmanfm" --> doFloat - , className =? "Thunar" --> doFloat - , className =? "Pavucontrol" --> doFloat - , className =? "Nitrogen" --> doFloat - , className =? "Wrapper-2.0" --> doFloat - , className =? "TeamSpeak 3" --> doFloat <> doShift "irc" - , className =? "easyeffects" --> doFloat <> doShift "vm" - , className =? "Arandr" --> doFloat - , resource =? "desktop_window" --> doIgnore - , resource =? "kdesktop" --> doIgnore - , className =? "Conky" --> doIgnore - , isRole ^? "About" <||> isRole ^? "about" --> doFloat - , "_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise - -- Steam Game Fixes - , className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide -- Prevents black screen when fullscreening. - -- , title =? "Wine System Tray" --> doHide -- Prevents Wine System Trays from taking input focus. - -- , title ^? "Steam - News" --> doHide -- I don't like the Steam news menu + manageRules = + composeOne + [ transience, + isDialog -?> doCenterFloat, + isFullscreen -?> (doF W.focusDown <> doFullFloat), + match + [ gimp, + gimp2, + about, + message ] + -?> doFloat, + match + [ multimc + ] + -?> doCenterFloat, + anyOf + [ isFileChooserDialog, + isDialog, + isPopup, + isSplash + ] + -?> doCenterFloat + ] + <> composeAll + [ manageDocks <> namedScratchpadManageHook myScratchpads, + className =? "firefox" <&&> title =? "File Upload" --> doFloat, + className =? "firefox" <&&> title =? "Library" --> doCenterFloat, + className =? "firefox" <&&> title ^? "Save" --> doFloat, + className =? "firefox" <&&> resource =? "Toolkit" --> doFloat, + className =? "firefox" <&&> title ^? "Sign in" --> doFloat, + className ^? "jetbrains-" <&&> title ^? "Welcome to " --> doCenterFloat, + className ^? "jetbrains-" <&&> title =? "splash" --> doFloat, + className ^? "Visual " <&&> isDialog --> doCenterFloat, + className =? "firefox-esr" --> doShift "web", + className =? "Virt-manager" --> doShift "vm", + className =? "steam_app_1172620" --> doShift "gfx", + className =? "steam_app_1063730" --> doShift "gfx", + className =? "steam_app_632360" --> doShift "gfx", + className =? "discord" --> doShift "irc", + className =? "discord-screenaudio" --> doShift "irc", + className =? "Spotify" --> doShift "msc", + className =? "thunderbird" --> doShift "eml", + className =? "Steam" --> doShift "stm", + className =? "Lutris" --> doShift "vm" <> doFloat, + className =? "leagueclientux.exe" --> doShift "gfx", + className =? "league of legends.exe" --> doShift "gfx", + className =? "leagueclient.exe" --> doShift "gfx", + className =? "explorer.exe" --> doShift "gfx", + className =? "riotclientux.exe" --> doShift "gfx", + className =? "dauntless-win64-shipping.exe" --> doShift "gfx", + className =? "battle.net.exe" --> doShift "gfx" <> doFloat, + className =? "Pcmanfm" --> doFloat, + className =? "Thunar" --> doFloat, + className =? "Pavucontrol" --> doFloat, + className =? "Nitrogen" --> doFloat, + className =? "Wrapper-2.0" --> doFloat, + className =? "TeamSpeak 3" --> doFloat <> doShift "irc", + className =? "easyeffects" --> doFloat <> doShift "vm", + className =? "Arandr" --> doFloat, + resource =? "desktop_window" --> doIgnore, + resource =? "kdesktop" --> doIgnore, + className =? "Conky" --> doIgnore, + isRole ^? "About" <||> isRole ^? "about" --> doFloat, + "_NET_WM_WINDOW_TYPE" `isInProperty` "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE" --> doIgnore <> doRaise, + -- Steam Game Fixes + className =? "steam_app_1551360" <&&> title /=? "Forza Horizon 5" --> doHide -- Prevents black screen when fullscreening. + -- , title =? "Wine System Tray" --> doHide -- Prevents Wine System Trays from taking input focus. + -- , title ^? "Steam - News" --> doHide -- I don't like the Steam news menu + ] -myDynHook :: ManageHook -myDynHook = - composeAll - [ title=? "Riot Client Main" --> doFloat - ] - -{- May be useful one day +{- May be useful one day doClose = ask >>= liftX . killWindow >> mempty :: ManageHook doForceKill = ask >>= liftX . forceKillWindow >> mempty :: ManageHook -} @@ -353,101 +361,103 @@ myEventHook :: Event -> X All myEventHook _ = return (All True) myLayoutHook = - avoidStruts - -- $ onWorkspace "gfx" simpleFloat - $ lessBorders OnlyScreenFloat - $ spacingRaw False(Border w w w w) True(Border w w w w) True - $ tiled ||| simpleFloat ||| Mirror tiled ||| Full - where - tiled = Tall nmaster delta ratio - nmaster = 1 -- Default number of windows in the master pane. - ratio = 1 / 2 -- Default proportion of screen occupied by master panes. - delta = 3 / 100 -- Percent of screen increment by when resizing panes. - w = 5 -- Width of pixel size between windows while tiled. + avoidStruts $ + lessBorders OnlyScreenFloat $ + spacingRaw False (Border w w w w) True (Border w w w w) True $ + tiled ||| simpleFloat ||| Mirror tiled ||| Full + where + tiled = Tall nmaster delta ratio + nmaster = 1 -- Default number of windows in the master pane. + ratio = 1 / 2 -- Default proportion of screen occupied by master panes. + delta = 3 / 100 -- Percent of screen increment by when resizing panes. + w = 5 -- Width of pixel size between windows while tiled. myXmobarPP :: X PP myXmobarPP = - clickablePP $ filterOutWsPP ["NSP"] $ def - { ppCurrent = xmobarColor "#a6e22e" "" . xmobarFont 5 . wrap "[" "]" - , ppVisibleNoWindows = Just (xmobarColor "#cc6666" "") - , ppHidden = xmobarColor "#a1efe4" "" - , ppHiddenNoWindows = xmobarColor "#ae81ff" "" - , ppUrgent = xmobarColor "#F7768E" "" . wrap "!" "!" - , ppTitle = xmobarColor "#a6e22e" "" . shorten 49 - , ppSep = wrapSep " " - , ppTitleSanitize = xmobarStrip - , ppWsSep = xmobarColor "" "#212121" " " - , ppLayout = xmobarColor "#212121" "" - . (\case - "Spacing Tall" -> "<icon=tiled.xpm/>" - "Spacing Mirror Tall" -> "<icon=mirrortiled.xpm/>" - "Spacing Full" -> "<icon=full.xpm/>" - "Spacing Simple Float"-> "<icon=floating.xpm/>" - "Simple Float" -> "<icon=floating.xpm/>" - ) + clickablePP $ + filterOutWsPP ["NSP"] $ + def + { ppCurrent = xmobarColor "#d5d5d5" "" . xmobarFont 5 . wrap "[" "]", + ppVisibleNoWindows = Just (xmobarColor "#ff5151" ""), + ppHidden = xmobarColor "#ac5858" "", + ppHiddenNoWindows = xmobarColor "#595959" "", + ppUrgent = xmobarColor "#F7768E" "" . wrap "!" "!", + ppTitle = xmobarColor "#d5d5d5" "" . shorten 49, + ppSep = wrapSep " ", + ppTitleSanitize = xmobarStrip, + ppWsSep = xmobarColor "" "#212121" " ", + ppLayout = + xmobarColor "#212121" "" + . ( \case + "Spacing Tall" -> "<icon=tiled.xpm/>" + "Spacing Mirror Tall" -> "<icon=mirrortiled.xpm/>" + "Spacing Full" -> "<icon=full.xpm/>" + "Spacing Simple Float" -> "<icon=floating.xpm/>" + "Simple Float" -> "<icon=floating.xpm/>" + ) } - where - wrapSep :: String -> String - wrapSep = - wrap - (xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b4")) - (xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b6")) - -xmobar :: StatusBarConfig -xmobar = statusBarProp myXmobar myXmobarPP + where + wrapSep :: String -> String + wrapSep = + wrap + (xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b4")) + (xmobarColor "#212121" "#212121:7" (xmobarFont 2 "\xe0b6")) myXmobar :: String myXmobar = (myHomeDir ++ "/.local/bin/xmobar " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs") +xmobar :: StatusBarConfig +xmobar = statusBarProp myXmobar myXmobarPP + +myXmobar2 :: String +myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar2 " ++ myHomeDir ++ "/.config/xmonad/src/xmobar.hs") + xmobar2 :: StatusBarConfig xmobar2 = statusBarProp myXmobar2 myXmobarPP -myXmobar2 :: String -myXmobar2 = (myHomeDir ++ "/.local/bin/xmobar-2nd ") +myConfig = + def + { modMask = myModMask, + focusFollowsMouse = myFocusFollowsMouse, + terminal = myTerminal, + mouseBindings = myMouseBindings, + borderWidth = myBorderWidth, + normalBorderColor = myNormColor, + focusedBorderColor = myFocusColor, + layoutHook = myLayoutHook, + startupHook = myStartupHook, + manageHook = myManageHook, + handleEventHook = + Hacks.windowedFullscreenFixEventHook + <> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True) + <> Hacks.trayerPaddingXmobarEventHook + <> myEventHook, + workspaces = myWorkspaces, + keys = myKeys + } + `additionalKeysP` myAdditionalKeys -myConfig = - def - { modMask = myModMask - , focusFollowsMouse = myFocusFollowsMouse - , terminal = myTerminal - , mouseBindings = myMouseBindings - , borderWidth = myBorderWidth - , normalBorderColor = myNormColor - , focusedBorderColor = myFocusColor - , layoutHook = myLayoutHook - , startupHook = myStartupHook - , manageHook = myManageHook - , handleEventHook = Hacks.windowedFullscreenFixEventHook - <> swallowEventHook (className =? "Alacritty" <||> className =? "kitty" <||> className =? "XTerm") (return True) - <> Hacks.trayerPaddingXmobarEventHook - <> dynamicPropertyChange "WM_CLASS" myDynHook - <> myEventHook - , workspaces = myWorkspaces - , keys = myKeys - } - `additionalKeysP` myAdditionalKeys - - -myScratchpads = [ NS "terminal" spawnTerm findTerm manageTerm - , NS "ncmpcpp" spawnncmpcpp findncmpcpp managencmpcpp - ] +myScratchpads = + [ NS "terminal" spawnTerm findTerm manageTerm, + NS "ncmpcpp" spawnncmpcpp findncmpcpp managencmpcpp + ] + where + spawnTerm = myTerminal ++ " --name scratchpad" + findTerm = resource =? "scratchpad" + manageTerm = customFloating $ W.RationalRect l t w h where - spawnTerm = myTerminal ++ " --name scratchpad" - findTerm = resource =? "scratchpad" - manageTerm = customFloating $ W.RationalRect l t w h - where - h = 0.9 - w = 0.9 - t = 0.95 -h - l = 0.95 -w - spawnncmpcpp = myTerminal ++ " --name ncmpcpp -e ncmpcpp" - findncmpcpp = resource =? "ncmpcpp" - managencmpcpp = customFloating $ W.RationalRect l t w h - where - h = 0.9 - w = 0.9 - t = 0.95 -h - l = 0.95 -w + h = 0.9 + w = 0.9 + t = 0.95 - h + l = 0.95 - w + spawnncmpcpp = myTerminal ++ " --name ncmpcpp -e ncmpcpp" + findncmpcpp = resource =? "ncmpcpp" + managencmpcpp = customFloating $ W.RationalRect l t w h + where + h = 0.9 + w = 0.9 + t = 0.95 - h + l = 0.95 - w -- I GIVE UP ON DBUS. @@ -499,4 +509,3 @@ myScratchpads = [ NS "terminal" spawnTerm findTerm manageTerm -- -- show a string with highlight -- pangoBold :: String -> String -- pangoBold s = "<span weight=\"bold\" foreground=\"#ff2f2f\">" ++ unPango s ++ "</span>" - diff --git a/configs/xmonad/stack.yaml b/configs/xmonad/stack.yaml index 671bce9..a19adf9 100644 --- a/configs/xmonad/stack.yaml +++ b/configs/xmonad/stack.yaml @@ -5,13 +5,12 @@ packages: extra-deps: - github: xmonad/x11 - commit: d91b15fd8bfe78fe2865976bd357d70381fd85ab + commit: 8a33c4ebe7d0a1be96073d8c019f1f3901bbf344 - github: xmonad/xmonad - commit: cf4d6f31b1751318309ddcc1c5fd8aa71a6a453a + commit: 57c3a131253720e542fb399b229b697614642b53 - github: xmonad/xmonad-contrib - commit: 6373dc41fa4dfb2a12c20e431976ceee6fd03837 + commit: 6117a867d984f97fb689eca986eff2989b2fe069 - xmobar-0.44.2 - - dbus-1.2.22 flags: xmobar: @@ -19,7 +18,6 @@ flags: with_threaded: true with_xft: true with_rtsopts: true - with_dbus: true with_mpd: true arch: x86_64 diff --git a/configs/xmonad/stack.yaml.lock b/configs/xmonad/stack.yaml.lock new file mode 100644 index 0000000..a8abc28 --- /dev/null +++ b/configs/xmonad/stack.yaml.lock @@ -0,0 +1,52 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + size: 163242 + url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz + name: X11 + version: 1.10.3.9 + sha256: a2dd0ebb6fb469f1cfc0c3dfbbeeb38061b2d7cdcef21245ee9f6f555bbb3163 + pantry-tree: + size: 3651 + sha256: 3ad2be290f2328541a46748dd3332aec04d9b5d089ac13d7eed9cb6e514d013d + original: + url: https://github.com/xmonad/x11/archive/8a33c4ebe7d0a1be96073d8c019f1f3901bbf344.tar.gz +- completed: + size: 107338 + url: https://github.com/xmonad/xmonad/archive/57c3a131253720e542fb399b229b697614642b53.tar.gz + name: xmonad + version: 0.17.1.9 + sha256: 3ad4fa2e31e227284d3bd5d20786cd3c960e5e56de716e9a3e8b5efa1c23a2e7 + pantry-tree: + size: 3917 + sha256: 56c75bff3591f9f448c730d109f16002d2b91c60a695ef3783415a1f7dc60602 + original: + url: https://github.com/xmonad/xmonad/archive/57c3a131253720e542fb399b229b697614642b53.tar.gz +- completed: + size: 668025 + url: https://github.com/xmonad/xmonad-contrib/archive/6117a867d984f97fb689eca986eff2989b2fe069.tar.gz + name: xmonad-contrib + version: 0.17.1.9 + sha256: f6ab8b33c936175f164cbe4add5c20e975e292a9d8f89e7d300f856eea157e05 + pantry-tree: + size: 24163 + sha256: adcdf6221b8e60f8b3138f0e88da01a4434ae923c9f9be35d3a1b4aa53d67fd7 + original: + url: https://github.com/xmonad/xmonad-contrib/archive/6117a867d984f97fb689eca986eff2989b2fe069.tar.gz +- completed: + hackage: xmobar-0.44.2@sha256:a2eed5f8833194babd60e45520023cd5698ccb8d40976d1f41a9b53b350297d0,14895 + pantry-tree: + size: 9498 + sha256: c7714be550d267369496c484ba727847f50e941d66009d2f8a8268629fe953f8 + original: + hackage: xmobar-0.44.2 +snapshots: +- completed: + size: 619399 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/23.yaml + sha256: f5d9002479d87103fd070f17cfe71fcd2147676f1e47a2dabca5ab91a42b846d + original: lts-19.23 diff --git a/configs/xmonad/tutorial b/configs/xmonad/tutorial deleted file mode 100644 index fb86c48..0000000 --- a/configs/xmonad/tutorial +++ /dev/null @@ -1,5 +0,0 @@ -cd ~/.config/xmonad - -stack setup -stack install -./build diff --git a/configs/xmonad/xmonad-scherso.cabal b/configs/xmonad/zmonad.cabal similarity index 54% rename from configs/xmonad/xmonad-scherso.cabal rename to configs/xmonad/zmonad.cabal index f562609..f0374cf 100644 --- a/configs/xmonad/xmonad-scherso.cabal +++ b/configs/xmonad/zmonad.cabal @@ -1,22 +1,34 @@ +-- heavily copied from github.com/scherso, all rights to him + cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. --- --- see: https://github.com/sol/hpack - -name: xmonad-scherso +name: zmonad version: 0.1.0 -synopsis: My XMonad configuration. -homepage: https://github.com/Scherso/Dotfiles -author: Scherso -maintainer: Scherso -license: DBAD +synopsis: xmonad but z +homepage: https://github.com/jabuxas/config-notes +author: jabuxas +maintainer: jabuxas +license: BSD4 build-type: Simple executable xmobar main-is: xmobar.hs other-modules: - Paths_xmonad_scherso + Paths_zmonad + hs-source-dirs: + src + ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -j -dynamic -rtsopts -threaded -with-rtsopts=-N + build-depends: + base + , dbus + , xmobar + , xmonad-contrib >=0.16 + default-language: Haskell2010 + +executable xmobar2 + main-is: xmobar2.hs + other-modules: + Paths_zmonad hs-source-dirs: src ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -j -dynamic -rtsopts -threaded -with-rtsopts=-N @@ -30,7 +42,7 @@ executable xmobar executable xmonad main-is: xmonad.hs other-modules: - Paths_xmonad_scherso + Paths_zmonad hs-source-dirs: src ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -O2 -j -dynamic