Skyler Grey | b43ac6b | 2022-10-31 00:48:34 +0000 | [diff] [blame] | 1 | -- spell-checker:words xmonad |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 2 | import XMonad |
Skyler Grey | b43ac6b | 2022-10-31 00:48:34 +0000 | [diff] [blame] | 3 | |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 4 | import System.Exit |
| 5 | import XMonad.Util.EZConfig |
Skyler Grey | b43ac6b | 2022-10-31 00:48:34 +0000 | [diff] [blame] | 6 | |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 7 | import XMonad.Config.Desktop |
| 8 | import XMonad.Hooks.EwmhDesktops |
| 9 | import XMonad.Hooks.ManageDocks |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 10 | |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 11 | import qualified DBus.Client as D |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 12 | import XMonad.Hooks.DynamicLog |
| 13 | import XMonadLog |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 14 | |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 15 | import Blaze.ByteString.Builder (toByteString) |
| 16 | import Foreign.C |
| 17 | import XMonad |
| 18 | import XMonad.Hooks.DynamicProperty (dynamicPropertyChange) |
| 19 | import XMonad.Hooks.ManageHelpers (doFullFloat, doLower, |
| 20 | isInProperty, doRectFloat) |
| 21 | import XMonad.Hooks.UrgencyHook |
| 22 | import XMonad.Layout.Drawer (propertyToQuery) |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 23 | import XMonad.Layout.Gaps |
| 24 | import XMonad.Layout.Spacing |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 25 | import qualified XMonad.StackSet as W |
| 26 | import XMonad.Util.Hacks |
| 27 | import qualified XMonad as W |
| 28 | import XMonad.Util.PureX (curScreenId, curScreen) |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 29 | |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 30 | terminal = "kitty" -- Kitty, my beloved <3 |
| 31 | launcher = "pkill rofi; rofi -show combi" |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 32 | networkManager = "wpa_cli select_network $(wpa_cli list_networks | tail -n +3 | awk '!seen[$2]++' | rofi -dmenu -window-title 'Select Network' | awk '{print $1;}')" |
| 33 | |
| 34 | screenshot = "mkdir -p ~/Screenshots && maim | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | xclip -select clipboard -t image/png" |
| 35 | selectScreenshot = "mkdir -p ~/Screenshots && maim -s | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | xclip -select clipboard -t image/png" |
| 36 | |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 37 | modifierKey = mod4Mask -- Use Super as our mod key |
| 38 | |
Skyler Grey | 34021e3 | 2022-11-04 09:28:03 +0000 | [diff] [blame] | 39 | statusBar = "pkill polybar; polybar" |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 40 | compositor = "pkill picom; picom" |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 41 | background = "pkill show; show ~/.xmonad/wallpaper.glsl > /dev/null" |
Skyler Grey | 9db914a | 2023-02-19 23:50:59 +0000 | [diff] [blame] | 42 | colorSelection = "xcolor | xclip -sel clip" |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 43 | keybindings = "setxkbmap -option caps:none && xmodmap ~/.Xmodmap" |
Skyler Grey | 34021e3 | 2022-11-04 09:28:03 +0000 | [diff] [blame] | 44 | |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 45 | shift = shiftMask |
| 46 | |
Skyler Grey | 34021e3 | 2022-11-04 09:28:03 +0000 | [diff] [blame] | 47 | startupHook = do |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 48 | spawn Main.statusBar |
| 49 | spawn Main.compositor |
| 50 | spawn background |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 51 | spawn keybindings |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 52 | |
Skyler Grey | 34021e3 | 2022-11-04 09:28:03 +0000 | [diff] [blame] | 53 | |
Skyler Grey | b43ac6b | 2022-10-31 00:48:34 +0000 | [diff] [blame] | 54 | main :: IO () |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 55 | main = XMonadLog.xmonadLog >>= main' |
| 56 | |
| 57 | main' :: D.Client -> IO () |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 58 | main' dbus = xmonad |
| 59 | $ javaHack |
| 60 | $ ewmh . setEwmhActivateHook doAskUrgent |
| 61 | $ docks |
| 62 | $ def |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 63 | { modMask = modifierKey -- Use Super as our mod key |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 64 | , borderWidth = 0 |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 65 | , XMonad.terminal = Main.terminal |
Skyler Grey | 51a0c61 | 2022-11-05 09:59:04 +0000 | [diff] [blame] | 66 | , XMonad.startupHook = Main.startupHook |
| 67 | , XMonad.logHook = dynamicLogWithPP (polybarHook dbus) |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 68 | , XMonad.layoutHook = avoidStruts |
| 69 | $ smartSpacing 5 |
| 70 | $ gaps [(U, 5), (D, 5), (L, 5), (R, 5)] |
| 71 | $ layoutHook def |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 72 | , XMonad.manageHook = composeAll |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 73 | [ isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DESKTOP" |
| 74 | --> doIgnore <+> doLower <+> doLower |
Skyler Grey | f2c55ae | 2022-11-05 17:48:02 +0000 | [diff] [blame] | 75 | ] <+> manageHook def |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 76 | , XMonad.handleEventHook = composeAll |
| 77 | [ windowedFullscreenFixEventHook |
| 78 | , dynamicPropertyChange "_NET_WM_WINDOW_TYPE" |
| 79 | (isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DESKTOP" |
| 80 | --> doLower |
| 81 | <+> (ask >>= \w -> liftX (modifyWindowSet (W.delete w)) |
| 82 | >> mempty) |
| 83 | <+> (ask >>= \w -> liftX (withDisplay $ \dpy -> io (moveResizeWindow dpy w 0 0 (fromIntegral $ displayWidth dpy $ defaultScreen dpy) (fromIntegral $ displayHeight dpy $ defaultScreen dpy))) >> mempty)) |
| 84 | ] |
| 85 | <+> handleEventHook def |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 86 | } `additionalKeys` |
| 87 | [ ((modifierKey, xK_d), spawn launcher) |
| 88 | , ((modifierKey, xK_n), spawn networkManager) |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 89 | , ((modifierKey .|. Main.shift, xK_q), kill) |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 90 | , ((modifierKey, xK_q), spawn "xmonad --restart") |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 91 | , ((modifierKey .|. Main.shift, xK_c), io exitSuccess) |
| 92 | , ((modifierKey .|. Main.shift, xK_s), spawn selectScreenshot) |
Skyler Grey | 9db914a | 2023-02-19 23:50:59 +0000 | [diff] [blame] | 93 | , ((modifierKey .|. Main.shift, xK_h), spawn colorSelection) |
Skyler Grey | 0808276 | 2023-01-26 00:35:19 +0000 | [diff] [blame] | 94 | , ((0, xK_Print), spawn screenshot) |
Skyler Grey | e2ec0de | 2022-11-02 08:07:25 +0000 | [diff] [blame] | 95 | ] |