{ config, lib, pkgs, ... }: let ccfg = import ../../config.nix; cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "i3" ]; cfg = lib.attrsets.getAttrFromPath cfg_path config; in with lib; { options = { } // lib.attrsets.setAttrByPath cfg_path { enable = lib.mkEnableOption "i3 window manager"; terminalCommand = mkOption { type = lib.types.str; default = "kitty"; description = "The terminal command to use."; }; extraOptions = mkOption { type = lib.types.attrs; default = { }; description = "Extra options for i3 home manager configuration."; }; }; config = lib.mkIf cfg.enable { # Enable for all users home-manager = { sharedModules = [ ./home_manager ]; }; services.greetd = { enable = true; vt = 2; settings = { default_session = { command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${pkgs.xorg.xinit}/bin/xinit ${pkgs.i3}/bin/i3'}"; user = "greeter"; }; }; }; # Caps Lock as Escape for console/tty console.useXkbConfig = true; services.xserver.xkb = { layout = "us"; options = "caps:escape"; }; # flatpaks need this TODO remove flatpaks? xdg.portal = { enable = true; extraPortals = lib.mkForce [ pkgs.xdg-desktop-portal-gtk ]; config.common.default = [ "gtk" ]; }; services.xserver = { enable = true; # desktopManager = { # xterm.enable = false; # }; windowManager.i3 = { enable = true; extraPackages = with pkgs; [ # dmenu # application launcher most people use # i3status # gives you the default i3 status bar # i3blocks # if you are planning on using i3blocks over i3status ]; }; }; services.displayManager.defaultSession = "none+i3"; # programs.i3lock.enable = true; # default i3 screen locker environment.systemPackages = with pkgs; [ xorg.xinit xorg.setxkbmap xorg.xset ]; }; }