eh it is not working

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-09-20 10:18:30 -05:00
parent e3689e5b26
commit 9a7fa1be4d
11 changed files with 137 additions and 265 deletions

View file

@ -7,7 +7,7 @@
userName = "RingOfStorms (Joshua Bell)"; userName = "RingOfStorms (Joshua Bell)";
extraConfig = { extraConfig = {
core.pager = "bat"; core.pager = "cat";
core.editor = "nano"; core.editor = "nano";
pull.rebase = false; pull.rebase = false;

View file

@ -18,22 +18,25 @@ with lib;
options = options =
{ } { }
// lib.attrsets.setAttrByPath cfg_path { // lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "i3 (X11) desktop environment"; enable = lib.mkEnableOption "i3 window manager";
terminalCommand = mkOption { terminalCommand = mkOption {
type = lib.types.str; type = lib.types.str;
default = "foot"; default = "kitty";
description = "The terminal command to use."; description = "The terminal command to use.";
}; };
extraOptions = mkOption { extraOptions = mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { }; default = { };
description = "Extra options for i3 configuration."; description = "Extra options for i3 home manager configuration.";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Enable for all users
home-manager = { home-manager = {
sharedModules = [ ./home_manager ]; sharedModules = [
./home_manager
];
}; };
services.greetd = { services.greetd = {
@ -47,42 +50,48 @@ with lib;
}; };
}; };
# X server # Caps Lock as Escape for console/tty
services.xserver.enable = true; console.useXkbConfig = true;
services.xserver.displayManager = { services.xserver.xkb = {
# kept undefined to allow user selection; greetd is enabled above layout = "us";
options = "caps:escape";
}; };
# Environment variables for X11 # flatpaks need this TODO remove flatpaks?
environment.sessionVariables = { xdg.portal = {
XDG_SESSION_TYPE = "x11"; enable = true;
XDG_CURRENT_DESKTOP = "i3"; extraPortals = lib.mkForce [
XDG_SESSION_DESKTOP = "i3"; pkgs.xdg-desktop-portal-gtk
}; ];
config.common.default = [
environment.systemPackages = with pkgs; [ "gtk"
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
]; ];
}; };
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
];
};
} }

View file

@ -2,6 +2,5 @@
{ {
imports = [ imports = [
./i3.nix ./i3.nix
./polybar.nix
]; ];
} }

View file

@ -1,121 +1,47 @@
{ config, lib, pkgs, ... }: {
config,
osConfig,
lib,
...
}:
let let
ccfg = import ../../config.nix; ccfg = import ../../../config.nix;
cfg_path = [ cfg_path = [
ccfg.custom_config_key ccfg.custom_config_key
"desktopEnvironment" "desktopEnvironment"
"i3" "i3"
]; ];
cfg = lib.attrsets.getAttrFromPath cfg_path config; cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in in
{ {
config = lib.mkIf cfg.enable { xsession.windowManager.i3 = {
programs.i3 = {
enable = true; enable = true;
package = pkgs.i3; # i3 window manager config = lib.attrsets.recursiveUpdate {
windowManager.command = "i3"; startup = [
extraConfig = lib.mkForce ('' { command = "setxkbmap -layout us -option caps:escape"; }
# Generated from sway configuration ];
set $mod Mod4 modifier = "Mod4";
set $term ${cfg.terminalCommand} terminal = cfg.terminalCommand;
set $menu rofi -show drun keybindings =
let
# Input mod = config.xsession.windowManager.i3.config.modifier;
# Caps lock as escape is handled system-wide in NixOS in
{
# Focus # Focus
bindsym $mod+h focus left "${mod}+h" = "focus left";
bindsym $mod+l focus right "${mod}+l" = "focus right";
bindsym $mod+k focus up "${mod}+k" = "focus up";
bindsym $mod+j focus down "${mod}+j" = "focus down";
# Apps # Apps
bindsym $mod+Return exec $term "${mod}+Return" = "exec ${cfg.terminalCommand}";
bindsym $mod+space exec ${cfg.menu} # "${mod}+space" = "exec ${cfg.menu}"; TODO
bindsym $mod+q kill "${mod}+q" = "kill";
bindsym $mod+Shift+Escape exit "${mod}+Shift+Escape" = "exit";
bindsym $mod+Shift+q exec i3lock "${mod}+Shift+q" = "exec i3lock";
bindsym $mod+f floating toggle "${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
'') ;
}; };
# See home-manager documentation for everything you can add here.
home.file = { } cfg.extraOptions;
".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 ];
}; };
} }

View file

@ -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;
};
}

View file

@ -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

View file

@ -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

6
common/flake.lock generated
View file

@ -85,11 +85,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1756245065, "lastModified": 1758313341,
"narHash": "sha256-aAZNbGcWrVRZgWgkQbkabSGcDVRDMgON4BipMy69gvI=", "narHash": "sha256-SsI6INUzWwPcRKRaxvi50RttnD9rcC4EjV+67TOEfrQ=",
"owner": "rycee", "owner": "rycee",
"repo": "home-manager", "repo": "home-manager",
"rev": "54b2879ce622d44415e727905925e21b8f833a98", "rev": "6f656618ebc71ca82d93d306a8aecb2c5f6f2ab2",
"type": "github" "type": "github"
}, },
"original": { "original": {

12
flake.lock generated
View file

@ -85,11 +85,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1753592768, "lastModified": 1758313341,
"narHash": "sha256-oV695RvbAE4+R9pcsT9shmp6zE/+IZe6evHWX63f2Qg=", "narHash": "sha256-SsI6INUzWwPcRKRaxvi50RttnD9rcC4EjV+67TOEfrQ=",
"owner": "rycee", "owner": "rycee",
"repo": "home-manager", "repo": "home-manager",
"rev": "fc3add429f21450359369af74c2375cb34a2d204", "rev": "6f656618ebc71ca82d93d306a8aecb2c5f6f2ab2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -155,11 +155,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1753694789, "lastModified": 1758198701,
"narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=", "narHash": "sha256-7To75JlpekfUmdkUZewnT6MoBANS0XVypW6kjUOXQwc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "dc9637876d0dcc8c9e5e22986b857632effeb727", "rev": "0147c2f1d54b30b5dd6d4a8c8542e8d7edf93b5d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -40,7 +40,8 @@
(import ./containers.nix { inherit inputs; }) (import ./containers.nix { inherit inputs; })
# ./jails_text.nix # ./jails_text.nix
# ./hyprland_customizations.nix # ./hyprland_customizations.nix
./sway_customizations.nix # ./sway_customizations.nix
# ./i3_customizations.nix
( (
{ {
config, config,
@ -99,10 +100,10 @@
reporting.enable = true; reporting.enable = true;
disableRemoteBuildsOnLio = true; disableRemoteBuildsOnLio = true;
}; };
desktopEnvironment.sway = { desktopEnvironment.i3 = {
enable = true; enable = true;
waybar.enable = true; # waybar.enable = true;
swaync.enable = true; # swaync.enable = true;
}; };
programs = { programs = {
rustDev.enable = true; rustDev.enable = true;

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
let {
i3ExtraOptions = { ringofstorms_common.desktopEnvironment.i3.extraOptions = {
startup = [ startup = [
{ {
command = "exec sh -c 'sleep 0.01; i3-msg workspace 7; sleep 0.02; i3-msg workspace 1'"; 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 16 to DP-1 and 710 to DP-2 # Example: map workspaces 16 to DP-1 and 710 to DP-2
workspaceOutputAssign = [ workspaceOutputAssign = [
{ workspace = "1"; output = "DP-1"; } {
{ workspace = "2"; output = "DP-1"; } workspace = "1";
{ workspace = "3"; output = "DP-1"; } output = "DP-1";
{ workspace = "4"; output = "DP-1"; } }
{ workspace = "5"; output = "DP-1"; } {
{ workspace = "6"; output = "DP-1"; } workspace = "2";
{ workspace = "7"; output = "DP-2"; } output = "DP-1";
{ workspace = "8"; output = "DP-2"; } }
{ workspace = "9"; output = "DP-2"; } {
{ workspace = "10"; output = "DP-2"; } 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 # Optional output settings
@ -38,13 +68,4 @@ let
}; };
}; };
}; };
in
{
options = { };
config = {
environment.systemPackages = [ ];
ringofstorms_common.desktopEnvironment.i3.extraOptions = i3ExtraOptions;
};
} }