tony / oxwm

updated flake and readme Browse files
tonybtw committed 2025-10-10 parent 8abb99f commit 0c465fb1e24d50837481f9faee343ca49bc52c72
Showing 2 changed files with 152 additions and 51 deletions. UnifiedSplit
+46 −23 flake.nix
@@ -1,19 +1,22 @@
1 { 1 {
2 - description = "oxwm - A dynamic window manager written in Rust"; 2 + description = "oxwm - A dynamic window manager.";
3 3
4 inputs = { 4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 flake-utils.url = "github:numtide/flake-utils"; 6 flake-utils.url = "github:numtide/flake-utils";
7 }; 7 };
8 8
9 - outputs = { self, nixpkgs, flake-utils }: 9 + outputs = {
10 - flake-utils.lib.eachDefaultSystem (system: 10 + self,
11 - let 11 + nixpkgs,
12 - pkgs = import nixpkgs { inherit system; }; 12 + flake-utils,
13 - in 13 + }:
14 - { 14 + flake-utils.lib.eachDefaultSystem (
15 + system: let
16 + pkgs = import nixpkgs {inherit system;};
17 + in {
15 packages = { 18 packages = {
16 - default = pkgs.callPackage ./default.nix { }; 19 + default = pkgs.callPackage ./default.nix {};
17 oxwm = self.packages.${system}.default; 20 oxwm = self.packages.${system}.default;
18 }; 21 };
19 22
@@ -40,16 +43,33 @@
40 43
41 formatter = pkgs.alejandra; 44 formatter = pkgs.alejandra;
42 } 45 }
43 - ) // { 46 + )
44 - # NixOS module 47 + // {
45 - nixosModules.default = { config, lib, pkgs, ... }: 48 + nixosModules.default = {
46 - with lib; 49 + config,
47 - let 50 + lib,
51 + pkgs,
52 + ...
53 + }:
54 + with lib; let
48 cfg = config.services.xserver.windowManager.oxwm; 55 cfg = config.services.xserver.windowManager.oxwm;
49 - in 56 +
50 - { 57 + oxwmDesktopItem = pkgs.writeTextFile {
58 + name = "oxwm.desktop";
59 + destination = "/share/xsessions/oxwm.desktop";
60 + text = ''
61 + [Desktop Entry]
62 + Name=OXWM
63 + Comment=A dynamic window manager written in Rust
64 + Exec=${cfg.package}/bin/oxwm
65 + Type=Application
66 + DesktopNames=OXWM
67 + '';
68 + };
69 + in {
51 options.services.xserver.windowManager.oxwm = { 70 options.services.xserver.windowManager.oxwm = {
52 enable = mkEnableOption "oxwm window manager"; 71 enable = mkEnableOption "oxwm window manager";
72 +
53 package = mkOption { 73 package = mkOption {
54 type = types.package; 74 type = types.package;
55 default = self.packages.${pkgs.system}.default; 75 default = self.packages.${pkgs.system}.default;
@@ -58,15 +78,18 @@
58 }; 78 };
59 79
60 config = mkIf cfg.enable { 80 config = mkIf cfg.enable {
61 - services.xserver.windowManager.session = [{ 81 + services.xserver.windowManager.session = [
62 - name = "oxwm"; 82 + {
63 - start = '' 83 + name = "oxwm";
64 - ${cfg.package}/bin/oxwm & 84 + start = ''
65 - waitPID=$! 85 + ${cfg.package}/bin/oxwm &
66 - ''; 86 + waitPID=$!
67 - }]; 87 + '';
88 + }
89 + ];
68 90
69 - environment.systemPackages = [ cfg.package ]; 91 + services.displayManager.sessionPackages = [oxwmDesktopItem];
92 + environment.systemPackages = [cfg.package];
70 }; 93 };
71 }; 94 };
72 }; 95 };
+106 −28 readme.org
@@ -4,6 +4,7 @@
4 * Table of Contents :toc: 4 * Table of Contents :toc:
5 - [[#oxwm][OXWM]] 5 - [[#oxwm][OXWM]]
6 - [[#installation][Installation]] 6 - [[#installation][Installation]]
7 + - [[#nixos-with-flakes][NixOS (with Flakes)]]
7 - [[#arch-linux][Arch Linux]] 8 - [[#arch-linux][Arch Linux]]
8 - [[#building-from-source][Building from Source]] 9 - [[#building-from-source][Building from Source]]
9 - [[#setting-up-oxwm][Setting up OXWM]] 10 - [[#setting-up-oxwm][Setting up OXWM]]
@@ -24,6 +25,88 @@ philosophy of *"edit + recompile."*, but with sane defaults and no arbitrary eli
24 enforcing bad variable names and bad file structure topology. 25 enforcing bad variable names and bad file structure topology.
25 26
26 * Installation 27 * Installation
28 +** NixOS (with Flakes)
29 +
30 +*** Adding OXWM to your flake inputs
31 +Add oxwm to your =flake.nix= inputs:
32 +
33 +#+begin_src nix
34 +{
35 + inputs = {
36 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
37 + oxwm.url = "github:tonybanters/oxwm";
38 + oxwm.inputs.nixpkgs.follows = "nixpkgs";
39 + };
40 +
41 + outputs = { self, nixpkgs, oxwm, ... }: {
42 + nixosConfigurations.yourhost = nixpkgs.lib.nixosSystem {
43 + system = "x86_64-linux";
44 + modules = [
45 + ./configuration.nix
46 + oxwm.nixosModules.default
47 + ];
48 + };
49 + };
50 +}
51 +#+end_src
52 +
53 +*** Enabling OXWM in configuration.nix
54 +Add this to your =configuration.nix=:
55 +
56 +#+begin_src nix
57 +{ config, pkgs, ... }:
58 +
59 +{
60 + services.xserver = {
61 + enable = true;
62 +
63 + windowManager.oxwm.enable = true;
64 + };
65 +
66 + # Recommended: Install a display manager
67 + services.xserver.displayManager.lightdm.enable = true;
68 + # Or use another display manager like sddm, gdm, etc.
69 +}
70 +#+end_src
71 +
72 +*** Initialize your config
73 +After rebuilding your system with =sudo nixos-rebuild switch=, log in via your display manager, then run:
74 +
75 +#+begin_src sh
76 +oxwm --init
77 +#+end_src
78 +
79 +This creates your personal config at =~/.config/oxwm/config.rs=. Edit it and reload with =Mod+Shift+R=.
80 +
81 +*** Advanced: Using a specific oxwm version
82 +If you want to pin or customize the oxwm package:
83 +
84 +#+begin_src nix
85 +{
86 + services.xserver.windowManager.oxwm = {
87 + enable = true;
88 + # Use a specific version or build with custom options
89 + package = oxwm.packages.${pkgs.system}.default;
90 + };
91 +}
92 +#+end_src
93 +
94 +*** Development setup with Nix
95 +For development, use the provided dev shell:
96 +
97 +#+begin_src sh
98 +# Clone the repository
99 +git clone https://github.com/tonybanters/oxwm
100 +cd oxwm
101 +
102 +# Enter the development environment
103 +nix develop
104 +
105 +# Build and test
106 +cargo build
107 +just test
108 +#+end_src
109 +
27 ** Arch Linux 110 ** Arch Linux
28 Install dependencies: 111 Install dependencies:
29 #+begin_src sh 112 #+begin_src sh
@@ -44,6 +127,7 @@ just install
44 #+end_src 127 #+end_src
45 128
46 ** Setting up OXWM 129 ** Setting up OXWM
130 +*** Without a display manager (startx)
47 Add the following to your =~/.xinitrc=: 131 Add the following to your =~/.xinitrc=:
48 #+begin_src sh 132 #+begin_src sh
49 exec oxwm 133 exec oxwm
@@ -54,35 +138,28 @@ Then start X with:
54 startx 138 startx
55 #+end_src 139 #+end_src
56 140
141 +*** With a display manager
142 +If using a display manager (LightDM, GDM, SDDM), OXWM should appear in the session list after installation.
143 +
57 * Configuration 144 * Configuration
58 -OXWM follows the suckless philosophy: configuration is done by editing =src/config.rs= and recompiling. 145 +OXWM follows the suckless philosophy: configuration is done by editing =~/.config/oxwm/config.rs= and recompiling.
59 146
60 -On first build, =config.rs= is automatically created from =src/default_config.rs=. Your =config.rs= is gitignored, so you can customize it without worrying about merge conflicts. 147 +On first run with =oxwm --init=, your config is automatically created from the template. Your =config.rs= is gitignored, so you can customize it without worrying about merge conflicts.
61 148
62 -To reset your config to defaults: 149 +Edit =~/.config/oxwm/config.rs= to customize:
63 -#+begin_src sh
64 -just reset-config
65 -#+end_src
66 -
67 -Edit =src/config.rs= to customize:
68 - Keybindings 150 - Keybindings
69 - Colors and appearance 151 - Colors and appearance
70 - Status bar blocks 152 - Status bar blocks
71 - Gaps and borders 153 - Gaps and borders
72 - Terminal and applications 154 - Terminal and applications
73 155
74 -After making changes: 156 +After making changes, reload OXWM with =Mod+Shift+R= (auto-recompiles if needed).
75 -#+begin_src sh
76 -just install
77 -#+end_src
78 -
79 -Then reload OXWM with Alt+Shift+R.
80 157
81 * Contributing 158 * Contributing
82 When contributing to OXWM: 159 When contributing to OXWM:
83 160
84 -1. Never commit your personal =src/config.rs= (it's gitignored) 161 +1. Never commit your personal =~/.config/oxwm/config.rs=
85 -2. Only modify =src/default_config.rs= if adding new configuration options 162 +2. Only modify =templates/config.rs= if adding new configuration options
86 3. Test your changes with =just test= using Xephyr 163 3. Test your changes with =just test= using Xephyr
87 4. Document any new features or keybindings 164 4. Document any new features or keybindings
88 165
@@ -91,17 +168,17 @@ Default keybindings (customizable in config.rs):
91 168
92 | Binding | Action | 169 | Binding | Action |
93 |-----------------+-------------------------| 170 |-----------------+-------------------------|
94 -| Alt+Return | Spawn terminal | 171 +| Super+Return | Spawn terminal |
95 -| Alt+J/K | Cycle focus down/up | 172 +| Super+J/K | Cycle focus down/up |
96 -| Alt+Q | Kill focused window | 173 +| Super+Q | Kill focused window |
97 -| Alt+Shift+Q | Quit WM | 174 +| Super+Shift+Q | Quit WM |
98 -| Alt+Shift+R | Hot reload WM | 175 +| Super+Shift+R | Hot reload WM |
99 -| Alt+1-9 | View tag 1-9 | 176 +| Super+1-9 | View tag 1-9 |
100 -| Alt+Shift+1-9 | Move window to tag 1-9 | 177 +| Super+Shift+1-9 | Move window to tag 1-9 |
101 -| Alt+S | Screenshot (maim) | 178 +| Super+S | Screenshot (maim) |
102 -| Alt+D | dmenu launcher | 179 +| Super+D | dmenu launcher |
103 -| Alt+A | Toggle gaps | 180 +| Super+A | Toggle gaps |
104 -| Alt+Shift+F | Toggle fullscreen | 181 +| Super+Shift+F | Toggle fullscreen |
105 182
106 * Features 183 * Features
107 - Dynamic tiling layout with master/stack 184 - Dynamic tiling layout with master/stack
@@ -217,7 +294,7 @@ src/
217 └── layout/ 294 └── layout/
218 ├── mod.rs [Layout trait definition] 295 ├── mod.rs [Layout trait definition]
219 └── tiling.rs 296 └── tiling.rs
220 - └── TilingLayout::arrange() [Calculate window positions]c 297 + └── TilingLayout::arrange() [Calculate window positions]
221 #+end_src 298 #+end_src
222 299
223 * Architecture Notes 300 * Architecture Notes
@@ -251,3 +328,4 @@ The tiling layout divides the screen into a master area (left half) and stack ar
251 328
252 * License 329 * License
253 [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPL v3]] 330 [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPL v3]]
331 +