diff --git a/common/_home_manager/mods/git.nix b/common/_home_manager/mods/git.nix index 34e6d18..5e84a6c 100644 --- a/common/_home_manager/mods/git.nix +++ b/common/_home_manager/mods/git.nix @@ -7,7 +7,7 @@ userName = "RingOfStorms (Joshua Bell)"; extraConfig = { - core.pager = "bat"; + core.pager = "cat"; core.editor = "nano"; pull.rebase = false; diff --git a/common/desktop_environment/i3/default.nix b/common/desktop_environment/i3/default.nix index 30fc456..0ff2e22 100644 --- a/common/desktop_environment/i3/default.nix +++ b/common/desktop_environment/i3/default.nix @@ -18,22 +18,25 @@ with lib; options = { } // lib.attrsets.setAttrByPath cfg_path { - enable = lib.mkEnableOption "i3 (X11) desktop environment"; + enable = lib.mkEnableOption "i3 window manager"; terminalCommand = mkOption { type = lib.types.str; - default = "foot"; + default = "kitty"; description = "The terminal command to use."; }; extraOptions = mkOption { type = lib.types.attrs; default = { }; - description = "Extra options for i3 configuration."; + description = "Extra options for i3 home manager configuration."; }; }; config = lib.mkIf cfg.enable { + # Enable for all users home-manager = { - sharedModules = [ ./home_manager ]; + sharedModules = [ + ./home_manager + ]; }; services.greetd = { @@ -47,42 +50,48 @@ with lib; }; }; - # X server - services.xserver.enable = true; - services.xserver.displayManager = { - # kept undefined to allow user selection; greetd is enabled above + # Caps Lock as Escape for console/tty + console.useXkbConfig = true; + services.xserver.xkb = { + layout = "us"; + options = "caps:escape"; }; - # Environment variables for X11 - environment.sessionVariables = { - XDG_SESSION_TYPE = "x11"; - XDG_CURRENT_DESKTOP = "i3"; - XDG_SESSION_DESKTOP = "i3"; + # 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; [ - i3 - i3status - i3lock - i3-gaps - polybar - maim - xclip - xterm - - # Enable backlight/brightness control, audio, etc., similar to sway defaults - polybar - maim - xclip - i3 - i3status - i3lock - i3-gaps - pavucontrol - btop - nemo - feh - rofi + xorg.xinit + xorg.setxkbmap + xorg.xset ]; + }; } diff --git a/common/desktop_environment/i3/home_manager/default.nix b/common/desktop_environment/i3/home_manager/default.nix index 2440ad9..ff15d2d 100644 --- a/common/desktop_environment/i3/home_manager/default.nix +++ b/common/desktop_environment/i3/home_manager/default.nix @@ -2,6 +2,5 @@ { imports = [ ./i3.nix - ./polybar.nix ]; } diff --git a/common/desktop_environment/i3/home_manager/i3.nix b/common/desktop_environment/i3/home_manager/i3.nix index c23da74..b140a7f 100644 --- a/common/desktop_environment/i3/home_manager/i3.nix +++ b/common/desktop_environment/i3/home_manager/i3.nix @@ -1,121 +1,47 @@ -{ config, lib, pkgs, ... }: +{ + config, + osConfig, + lib, + ... +}: let - ccfg = import ../../config.nix; + ccfg = import ../../../config.nix; cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "i3" ]; - cfg = lib.attrsets.getAttrFromPath cfg_path config; + cfg = lib.attrsets.getAttrFromPath cfg_path osConfig; in { - config = lib.mkIf cfg.enable { - programs.i3 = { - enable = true; - package = pkgs.i3; # i3 window manager - windowManager.command = "i3"; - extraConfig = lib.mkForce ('' -# Generated from sway configuration -set $mod Mod4 -set $term ${cfg.terminalCommand} -set $menu rofi -show drun + xsession.windowManager.i3 = { + enable = true; + config = lib.attrsets.recursiveUpdate { + startup = [ + { command = "setxkbmap -layout us -option caps:escape"; } + ]; + modifier = "Mod4"; + terminal = cfg.terminalCommand; + keybindings = + let + mod = config.xsession.windowManager.i3.config.modifier; + in + { + # Focus + "${mod}+h" = "focus left"; + "${mod}+l" = "focus right"; + "${mod}+k" = "focus up"; + "${mod}+j" = "focus down"; + # Apps + "${mod}+Return" = "exec ${cfg.terminalCommand}"; + # "${mod}+space" = "exec ${cfg.menu}"; TODO + "${mod}+q" = "kill"; + "${mod}+Shift+Escape" = "exit"; + "${mod}+Shift+q" = "exec i3lock"; + "${mod}+f" = "floating toggle"; -# Input -# Caps lock as escape is handled system-wide in NixOS - -# Focus -bindsym $mod+h focus left -bindsym $mod+l focus right -bindsym $mod+k focus up -bindsym $mod+j focus down - -# Apps -bindsym $mod+Return exec $term -bindsym $mod+space exec ${cfg.menu} -bindsym $mod+q kill -bindsym $mod+Shift+Escape exit -bindsym $mod+Shift+q exec i3lock -bindsym $mod+f floating toggle - -# Workspaces -set $ws1 "1: " -set $ws2 "2: " -set $ws3 "3: " -set $ws4 "4: " -set $ws5 "5: " -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -bindsym $mod+1 workspace $ws1 -bindsym $mod+n workspace $ws1 -bindsym $mod+2 workspace $ws2 -bindsym $mod+m workspace $ws2 -bindsym $mod+3 workspace $ws3 -bindsym $mod+comma workspace $ws3 -bindsym $mod+4 workspace $ws4 -bindsym $mod+period workspace $ws4 -bindsym $mod+5 workspace $ws5 -bindsym $mod+slash workspace $ws5 -bindsym $mod+6 workspace $ws6 -bindsym $mod+7 workspace $ws7 -bindsym $mod+8 workspace $ws8 -bindsym $mod+9 workspace $ws9 -bindsym $mod+0 workspace $ws10 - -# Move windows -bindsym $mod+Shift+h move left -bindsym $mod+Shift+l move right -bindsym $mod+Shift+k move up -bindsym $mod+Shift+j move down -bindsym $mod+Shift+1 move container to workspace $ws1 -bindsym $mod+Shift+n move container to workspace $ws1 -bindsym $mod+Shift+2 move container to workspace $ws2 -bindsym $mod+Shift+m move container to workspace $ws2 -bindsym $mod+Shift+3 move container to workspace $ws3 -bindsym $mod+Shift+comma move container to workspace $ws3 -bindsym $mod+Shift+4 move container to workspace $ws4 -bindsym $mod+Shift+period move container to workspace $ws4 -bindsym $mod+Shift+5 move container to workspace $ws5 -bindsym $mod+Shift+slash move container to workspace $ws5 -bindsym $mod+Shift+6 move container to workspace $ws6 -bindsym $mod+Shift+7 move container to workspace $ws7 -bindsym $mod+Shift+8 move container to workspace $ws8 -bindsym $mod+Shift+9 move container to workspace $ws9 -bindsym $mod+Shift+0 move container to workspace $ws10 - -# Mouse -floating_modifier $mod - -# Screenshot (uses grim/slurp on Wayland; on X11 use maim) -bindsym Print exec --no-startup-id maim -s | xclip -selection clipboard -t image/png - -# Startup -exec --no-startup-id ${pkgs.bash}/bin/sh -c '~/.config/polybar/launch.sh' - -# gaps, borders handled by i3-gaps if available -include ~/.config/i3/custom.conf -'') ; - }; - - home.file = { - ".config/i3/config" = { - text = builtins.toString (config.programs.i3.extraConfig); - }; - ".config/i3/custom.conf" = { - text = let - extra = cfg.extraOptions or {}; - mkWorkspaceAssign = ws: out: "workspace \"${ws}\" output ${out}\n"; - wsAssigns = if extra.workspaceOutputAssign == null then "" else - lib.concatStringsSep "" (lib.map (v: mkWorkspaceAssign v.workspace v.output) extra.workspaceOutputAssign); - startupLines = if extra.startup == null then "" else - lib.concatStringsSep "" (lib.map (s: "exec --no-startup-id ${s.command}\n") extra.startup); - in wsAssigns + startupLines; - }; - }; - - environment.systemPackages = with pkgs; [ i3 i3status polybar maim xclip i3lock i3-gaps ]; + }; + # See home-manager documentation for everything you can add here. + } cfg.extraOptions; }; } diff --git a/common/desktop_environment/i3/home_manager/polybar.nix b/common/desktop_environment/i3/home_manager/polybar.nix deleted file mode 100644 index 0c006da..0000000 --- a/common/desktop_environment/i3/home_manager/polybar.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, lib, pkgs, ... }: -let - ccfg = import ../../config.nix; - cfg_path = [ - ccfg.custom_config_key - "desktopEnvironment" - "i3" - "polybar" - ]; - cfg = lib.attrsets.getAttrFromPath cfg_path config; -in -{ - config = lib.mkIf cfg.enable { - home.file = { - ".config/polybar/config" = { - text = builtins.readFile ./polybar/config; - }; - ".config/polybar/launch.sh" = { - text = builtins.readFile ./polybar/launch.sh; - executable = true; - }; - }; - - home.packages = [ pkgs.polybar ]; - services.xserver.windowManager.i3.enable = true; - }; -} diff --git a/common/desktop_environment/i3/home_manager/polybar/config b/common/desktop_environment/i3/home_manager/polybar/config deleted file mode 100644 index 3145c9c..0000000 --- a/common/desktop_environment/i3/home_manager/polybar/config +++ /dev/null @@ -1,51 +0,0 @@ -[bar/top] -width = 100% -height = 28 -background = #1a1b26 -foreground = #c0caf5 -modules-left = workspace -modules-center = date cpu memory -modules-right = pulseaudio battery network - -environment = { - TERM = xterm-256color -} - -[module/workspace] -type = internal/xworkspaces -pin-workspaces = true -wrap-scroll = false -; icons for numbers -format-underline = #7dcae4 -label = %name% -label-foreground = #c0caf5 - -[module/date] -type = internal/date -interval = 5 -format = %b %d, %H:%M - -[module/cpu] -type = internal/cpu -format = 󰻠 %percentage:2.0%% - -[module/memory] -type = internal/memory -format = 󰍛 %used_percent%% - -[module/pulseaudio] -type = internal/pulseaudio -format = {volume}% - -[module/battery] -type = internal/battery -battery = BAT0 -adapter = AC -format-charging = %percentage%% -format-discharging = %percentage%% - -[module/network] -type = internal/network -interface = auto -format-connected = 󰤨 %essid% (%signal_strength%%) -format-disconnected = 󰖪 Disconnected diff --git a/common/desktop_environment/i3/home_manager/polybar/launch.sh b/common/desktop_environment/i3/home_manager/polybar/launch.sh deleted file mode 100644 index b394ebb..0000000 --- a/common/desktop_environment/i3/home_manager/polybar/launch.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# Launch polybar on each connected monitor -MONITORS=$(xrandr --query | grep " connected" | cut -d' ' -f1) -for m in $MONITORS; do - MONITOR=$m polybar --reload top & -done diff --git a/common/flake.lock b/common/flake.lock index a4cac10..78e7a15 100644 --- a/common/flake.lock +++ b/common/flake.lock @@ -85,11 +85,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1756245065, - "narHash": "sha256-aAZNbGcWrVRZgWgkQbkabSGcDVRDMgON4BipMy69gvI=", + "lastModified": 1758313341, + "narHash": "sha256-SsI6INUzWwPcRKRaxvi50RttnD9rcC4EjV+67TOEfrQ=", "owner": "rycee", "repo": "home-manager", - "rev": "54b2879ce622d44415e727905925e21b8f833a98", + "rev": "6f656618ebc71ca82d93d306a8aecb2c5f6f2ab2", "type": "github" }, "original": { diff --git a/flake.lock b/flake.lock index 28bbb05..d32edcb 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1753592768, - "narHash": "sha256-oV695RvbAE4+R9pcsT9shmp6zE/+IZe6evHWX63f2Qg=", + "lastModified": 1758313341, + "narHash": "sha256-SsI6INUzWwPcRKRaxvi50RttnD9rcC4EjV+67TOEfrQ=", "owner": "rycee", "repo": "home-manager", - "rev": "fc3add429f21450359369af74c2375cb34a2d204", + "rev": "6f656618ebc71ca82d93d306a8aecb2c5f6f2ab2", "type": "github" }, "original": { @@ -155,11 +155,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1753694789, - "narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=", + "lastModified": 1758198701, + "narHash": "sha256-7To75JlpekfUmdkUZewnT6MoBANS0XVypW6kjUOXQwc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dc9637876d0dcc8c9e5e22986b857632effeb727", + "rev": "0147c2f1d54b30b5dd6d4a8c8542e8d7edf93b5d", "type": "github" }, "original": { diff --git a/hosts/lio/flake.nix b/hosts/lio/flake.nix index 4916043..e3bbf5e 100644 --- a/hosts/lio/flake.nix +++ b/hosts/lio/flake.nix @@ -40,7 +40,8 @@ (import ./containers.nix { inherit inputs; }) # ./jails_text.nix # ./hyprland_customizations.nix - ./sway_customizations.nix + # ./sway_customizations.nix + # ./i3_customizations.nix ( { config, @@ -99,10 +100,10 @@ reporting.enable = true; disableRemoteBuildsOnLio = true; }; - desktopEnvironment.sway = { + desktopEnvironment.i3 = { enable = true; - waybar.enable = true; - swaync.enable = true; + # waybar.enable = true; + # swaync.enable = true; }; programs = { rustDev.enable = true; diff --git a/hosts/lio/i3_customizations.nix b/hosts/lio/i3_customizations.nix index b82cbc8..d53186d 100644 --- a/hosts/lio/i3_customizations.nix +++ b/hosts/lio/i3_customizations.nix @@ -1,6 +1,6 @@ { ... }: -let - i3ExtraOptions = { +{ + ringofstorms_common.desktopEnvironment.i3.extraOptions = { startup = [ { command = "exec sh -c 'sleep 0.01; i3-msg workspace 7; sleep 0.02; i3-msg workspace 1'"; @@ -9,16 +9,46 @@ let # Example: map workspaces 1–6 to DP-1 and 7–10 to DP-2 workspaceOutputAssign = [ - { workspace = "1"; output = "DP-1"; } - { workspace = "2"; output = "DP-1"; } - { workspace = "3"; output = "DP-1"; } - { workspace = "4"; output = "DP-1"; } - { workspace = "5"; output = "DP-1"; } - { workspace = "6"; output = "DP-1"; } - { workspace = "7"; output = "DP-2"; } - { workspace = "8"; output = "DP-2"; } - { workspace = "9"; output = "DP-2"; } - { workspace = "10"; output = "DP-2"; } + { + workspace = "1"; + output = "DP-1"; + } + { + workspace = "2"; + output = "DP-1"; + } + { + workspace = "3"; + output = "DP-1"; + } + { + workspace = "4"; + output = "DP-1"; + } + { + workspace = "5"; + output = "DP-1"; + } + { + workspace = "6"; + output = "DP-1"; + } + { + workspace = "7"; + output = "DP-2"; + } + { + workspace = "8"; + output = "DP-2"; + } + { + workspace = "9"; + output = "DP-2"; + } + { + workspace = "10"; + output = "DP-2"; + } ]; # Optional output settings @@ -38,13 +68,4 @@ let }; }; }; -in -{ - options = { }; - - config = { - environment.systemPackages = [ ]; - - ringofstorms_common.desktopEnvironment.i3.extraOptions = i3ExtraOptions; - }; }