From daaf48fda36372e0206e8bd2b8a96fdd67d45007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Wed, 30 Mar 2022 10:54:54 +0200 Subject: [PATCH] :rocket: add xmonad --- modules/desktop/default.nix | 4 +-- modules/desktop/xmonad/default.nix | 40 ++++++++++++++++++++++++++++++ modules/desktop/xmonad/xmonad.hs | 39 +++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 modules/desktop/xmonad/default.nix create mode 100644 modules/desktop/xmonad/xmonad.hs diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 880172c..74b25bc 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,12 +1,12 @@ { config, lib, pkgs, ... }: let cfg = config.modules.desktop; in { - imports = [ ./apps ./bspwm ./gtk.nix ]; + imports = [ ./apps ./bspwm ./gtk.nix ./xmonad ]; options.modules.desktop = { name = lib.mkOption { default = "bspwm"; - type = lib.types.enum [ "bspwm" ]; + type = lib.types.enum [ "bspwm" "xmonad" ]; }; }; diff --git a/modules/desktop/xmonad/default.nix b/modules/desktop/xmonad/default.nix new file mode 100644 index 0000000..7ad9965 --- /dev/null +++ b/modules/desktop/xmonad/default.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +let cfg = config.modules.desktop; +in { + config = lib.mkIf (cfg.name == "xmonad") { + services = { + xserver = { + enable = true; + layout = "de"; + + displayManager = { + defaultSession = "none+xmonad"; + autoLogin = { + enable = true; + user = "moritz"; + }; + lightdm.enable = true; + }; + windowManager.xmonad.enable = true; + }; + }; + console.keyMap = "de"; + home-manager.users.moritz = let + xmonadPackages = haskellPackages: [ + haskellPackages.xmonad-contrib + haskellPackages.xmonad-extras + haskellPackages.xmonad + haskellPackages.xmobar + ]; + in { + xsession.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + config = ./xmonad.hs; + # extraPackages = xmonadPackages; + }; + programs.xmobar.enable = true; + }; + }; +} diff --git a/modules/desktop/xmonad/xmonad.hs b/modules/desktop/xmonad/xmonad.hs new file mode 100644 index 0000000..5c27ff3 --- /dev/null +++ b/modules/desktop/xmonad/xmonad.hs @@ -0,0 +1,39 @@ +import XMonad + ( Choose, + Default (def), + Full, + KeyMask, + Mirror, + Tall, + X, + XConfig (modMask, terminal), + mod4Mask, + spawn, + xmonad, + ) +import XMonad.Hooks.EwmhDesktops (ewmh) +import XMonad.Util.EZConfig (additionalKeysP) + +myModMask :: KeyMask +myModMask = mod4Mask + +myTerminal :: String +myTerminal = "kitty" + +myKeys :: [(String, X ())] +myKeys = + [ ("M-d", spawn "rofi -show combi"), + ("M-e", spawn "emacsclient -c -a emacs"), + ("M-f", spawn "firefox") + ] + +myConfig :: (XConfig (Choose Tall (Choose (Mirror Tall) Full))) +myConfig = + def + { modMask = myModMask, + terminal = myTerminal + } + `additionalKeysP` myKeys + +main :: IO () +main = xmonad $ ewmh $ ewmhFullscreen myConfig