Skip to content

wmouton/nanowm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NanoWM

NanoWM is an ultra-minimalist, macro-driven tiling window manager for X11. Written in C, it is designed to be as small and fast as possible by utilizing the Tiny C Compiler (tcc) and a "header-less" design philosophy.

It implements a "monocle-style" tiling approach where every window is automatically resized to fill the current monitor's dimensions.

⚡ Features

  • Automatic Fullscreen Tiling: No manual resizing needed; windows automatically adapt to the screen/monitor dimensions.
  • Xinerama Multi-Monitor Support: Seamlessly jump focus between screens and move windows across monitors.
  • Macro-Powered Config: Centralized keybinding table for easy customization.
  • Ultra-Lightweight: Compiled with tcc for a tiny binary and near-instant execution.
  • Pointer Warping: Automatically centers the mouse when switching monitors to maintain a "focus-follows-mouse" workflow.

⌨️ Default Keybindings

The Mod Key is Alt (Mod1). Hardware/Special controls use the Super (Mod4) or Shift combinations.

System & Navigation

Key Combo Action
Alt + ; Launch Terminal (st)
Alt + u Cycle focus/windows up
Alt + ' Kill current window
Alt + i Focus next monitor (Warp pointer)
Alt + o Send current window to next monitor
Alt + Esc Exit NanoWM

Launchers & Scripts

Key Combo Action
Alt + d Rofi (Command Run)
Alt + m Rofi (All Scripts)
Alt + p Power Menu
Alt + k Keybindings Help Script
Alt + f File Manager (nnn in st)
Alt + e File Manager (Thunar)
Alt + b Browser (Chromium)
Alt + Shift + b Browser (Librewolf)
Alt + Shift + t Date/Time Script

Environment & Hardware

Key Combo Action
Super + [ Decrease Brightness
Super + ] Increase Brightness
Alt + [ Redshift: Night Mode (3500K)
Alt + ] Redshift: Reset
Alt + , WiFi On
Alt + . WiFi Off

🛠 Installation

1. Prerequisites

You need the X11 and Xinerama development headers, plus the Tiny C Compiler.

  • NixOS (Imperative): ```bash nix-env -iA nixos.tinycc nixos.libX11 nixos.libXinerama

  • NixOS (Declarative): Add tinycc, libX11, and libXinerama to your environment.systemPackages.
  • Arch Linux: sudo pacman -S libx11 libxinerama tcc
  • Debian/Ubuntu: sudo apt install libx11-dev libxinerama-dev tcc

2. Build and Install

The install.sh script compiles the source and moves the binary to /usr/local/bin/.

git clone https://github.com/wmouton/nanowm.git
cd nanowm
chmod +x install.sh
./install.sh

⚙️ Configuration

NanoWM is configured by editing nanowm.c directly:

  1. Main Bindings: Edit the TBL(x) macro to change keys and shell commands.
  2. Special Grabs: Modify the XGrabKey calls in main() for combinations involving Shift or Super.
  3. Wallpaper: Update the system("feh ...") path in main().
  4. Recompile: Simply run ./install.sh again to apply changes.

🚀 Starting NanoWM

Add the following to your .xinitrc:

exec nanowm

External Dependencies

The default configuration relies on:

  • st, nnn, thunar, chromium, librewolf
  • rofi, brightnessctl, nmcli, redshift, feh
  • Custom scripts located in ~/dotfiles/

Flake Example

{
  description = "NanoWM - A minimalist, ultra-lightweight tiling window manager";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
      nixpkgsFor = system: import nixpkgs { inherit system; };
    in
    {
      packages = forAllSystems (system:
        let
          pkgs = nixpkgsFor system;
        in
        {
          default = pkgs.stdenv.mkDerivation {
            pname = "nanowm";
            version = "0.1.0";
            src = ./.;

            # Runtime dependencies (libraries)
            buildInputs = with pkgs; [
              xorg.libX11
              xorg.libXinerama
            ];

            # Build tools
            nativeBuildInputs = with pkgs; [
              tinycc
            ];

            buildPhase = ''
              tcc -lX11 -lXinerama nanowm.c -o nanowm
            '';

            installPhase = ''
              mkdir -p $out/bin
              cp nanowm $out/bin/
            '';

            meta = with pkgs.lib; {
              description = "A minimalist tiling window manager for X11";
              license = licenses.mit;
              platforms = platforms.linux;
            };
          };
        });

      # Development shell for 'nix develop'
      devShells = forAllSystems (system:
        let pkgs = nixpkgsFor system;
        in {
          default = pkgs.mkShell {
            buildInputs = with pkgs; [
              tinycc
              xorg.libX11
              xorg.libXinerama
              xorg.xinit
            ];
          };
        });
    };
}

About

An ultra-minimal window manager written using the C programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors