From c7069236cf18d4485cad86829994588e987ba264 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Sun, 19 Apr 2020 20:26:10 +0300
Subject: [PATCH] feat: xmonad!!!

---
 .vscode/settings.json                   | 16 ++++++++
 modules/applications/default.nix        |  1 +
 modules/applications/misc.nix           |  1 +
 modules/applications/xmonad/default.nix | 21 +++++++++++
 modules/applications/xmonad/xmonad.hs   | 49 +++++++++++++++++++++++++
 modules/xserver.nix                     |  2 -
 6 files changed, 88 insertions(+), 2 deletions(-)
 create mode 100644 .vscode/settings.json
 create mode 100644 modules/applications/xmonad/default.nix
 create mode 100644 modules/applications/xmonad/xmonad.hs

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..93c15e4
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,16 @@
+{
+    "cSpell.words": [
+        "Kmix",
+        "alacritty",
+        "concat",
+        "foldl",
+        "foldr",
+        "keymap",
+        "krunner",
+        "ksplashqml",
+        "ksplashsimple",
+        "ksplashx",
+        "rofi",
+        "xmonad"
+    ]
+}
\ No newline at end of file
diff --git a/modules/applications/default.nix b/modules/applications/default.nix
index 7ecac81..4229468 100644
--- a/modules/applications/default.nix
+++ b/modules/applications/default.nix
@@ -3,6 +3,7 @@
     ./git
     ./shells
     ./wakatime
+    ./xmonad
 
     ./misc.nix
     ./locale.nix
diff --git a/modules/applications/misc.nix b/modules/applications/misc.nix
index 5e4bf8d..879aa16 100644
--- a/modules/applications/misc.nix
+++ b/modules/applications/misc.nix
@@ -13,6 +13,7 @@
     # chat apps
     discord
     slack
+    zoom-us # for online classes / church and stuff
 
     # browsers
     google-chrome
diff --git a/modules/applications/xmonad/default.nix b/modules/applications/xmonad/default.nix
new file mode 100644
index 0000000..ad448d5
--- /dev/null
+++ b/modules/applications/xmonad/default.nix
@@ -0,0 +1,21 @@
+{ ... }: {
+  home-manager.users.adrielus = {
+    xsession.windowManager.xmonad = {
+      enable = true;
+      enableContribAndExtras = true;
+      config = ./xmonad.hs;
+    };
+
+    programs.rofi = {
+      enable = true;
+      font = "Source Code Pro 16";
+      location = "center";
+      padding = 10;
+      lines = 7;
+      fullscreen = false;
+    };
+
+    home.file.".config/plasma-workspace/env/set_window_manager.sh".text =
+      "export KDEWM=/home/adrielus/.nix-profile/bin/xmonad";
+  };
+}
diff --git a/modules/applications/xmonad/xmonad.hs b/modules/applications/xmonad/xmonad.hs
new file mode 100644
index 0000000..47a36f5
--- /dev/null
+++ b/modules/applications/xmonad/xmonad.hs
@@ -0,0 +1,49 @@
+import           Data.Function                  ( (&) )
+import           Control.Monad                  ( join )
+
+import           XMonad
+import           XMonad.Config.Kde
+import           XMonad.Layout.Spacing
+import           XMonad.Util.EZConfig
+import           XMonad.Actions.SpawnOn
+import           XMonad.Hooks.ManageDocks
+
+main =
+  xmonad
+    $ docks
+    $ kdeConfig { modMask    = mod4Mask
+                , layoutHook = myLayoutHook
+                , manageHook = myManagerHook <+> manageHook kdeConfig
+                , terminal   = myTerminal
+                }
+    `additionalKeys` keymap
+ where
+  kdeFloats =
+    [ "yakuake"
+    , "Yakuake"
+    , "Kmix"
+    , "kmix"
+    , "plasma"
+    , "Plasma"
+    , "plasma-desktop"
+    , "Plasma-desktop"
+    , "krunner"
+    , "ksplashsimple"
+    , "ksplashqml"
+    , "ksplashx"
+    ]
+
+  myManagerHook =
+    composeAll [ className =? name --> doFloat | name <- kdeFloats ]
+
+  myTerminal    = "alacritty"
+  keymap        = [((mod4Mask, xK_P), spawn "rofi -show run")]
+
+  uniformBorder = join $ join $ join Border
+  border        = uniformBorder 4
+  spacingHook   = spacingRaw True border True border True
+
+  layouts       = Tall 1 (3 / 100) (1 / 2) ||| Full
+  myLayoutHook  = desktopLayoutModifiers $ spacingHook layouts
+
+
diff --git a/modules/xserver.nix b/modules/xserver.nix
index be79b65..e33aa73 100644
--- a/modules/xserver.nix
+++ b/modules/xserver.nix
@@ -2,7 +2,6 @@
   services.xserver = {
     # Enable the X11 windowing system.
     enable = true;
-    layout = "us";
     xkbOptions = "eurosign:e";
 
     # Enable the KDE Desktop Environment.
@@ -16,7 +15,6 @@
       naturalScrolling = true;
       accelSpeed = "3.5";
 
-      # who thought letting this be true by default was a good idea
       tappingDragLock = false;
     };
   };