added compatibility with sway

This commit is contained in:
Jürg Hallenbarter
2026-02-09 11:42:36 +00:00
parent 91b07e4589
commit 1a8b6dc83b
12 changed files with 341 additions and 132 deletions

184
README.md
View File

@@ -1,66 +1,33 @@
# MyI3Repo
# MyI3Config
This repository contains a very minimal and practical **i3 window manager** configuration.
It is designed to stay close to upstream i3 behavior while adding a few convenience features
for daily use.
The goal is:
- Predictable tiling behavior
- Keyboard-driven workflow
- Minimal visual noise
- Easy extensibility via simple shell scripts
No external theming frameworks or heavy abstractions are used.
---
## Concept: Application Settings
All user-configurable applications are defined inside the `settings/` directory.
Each file contains **only the binary name**, for example:
```sh
firefox
```
The i3 config itself handles the `exec` logic and simply reads these files.
This keeps configuration clean and avoids hardcoding application names.
If an application does not exist on the system, the installer will warn the user.
A minimal, practical window manager configuration that supports both **i3 (X11)** and **Sway (Wayland)**. The configuration is designed to stay close to upstream behavior while adding convenience features for daily use.
---
## Features
- i3 (X11) based setup
- Focus follows mouse
- Simple, readable keybindings
- Keyboard layout switching (e.g. `ch_de``us_workman`)
- Keyboard-driven window movement and resizing
- Minimal logout / power overlay
- Multi-monitor friendly (`xrandr`)
- No hidden logic or frameworks
- **Dual compatibility**: Works with both i3 (X11) and Sway (Wayland)
- **Focus follows mouse**: Natural window focus behavior
- **Keyboard-driven workflow**: All common actions accessible via keyboard
- **Minimal visual noise**: No bars, no bloat, just windows
- **Environment-aware scripts**: Auto-detect i3 vs Sway and use appropriate tools
- **Easy extensibility**: Simple shell scripts for customization
- **Unified configuration**: One config file for both window managers
---
## Required Packages (Arch Linux)
## Structure
### Core
- `i3-wm`
- `xorg-server`
- `xorg-xinit`
- `dmenu` or `rofi`
### Utilities
- `xrandr`
- `setxkbmap`
- `picom` (optional)
- `feh` (optional)
- `playerctl` (optional)
- `brightnessctl` (optional)
---
```
MyI3Config/
├── i3/ # i3-specific configuration and scripts
├── scripts/ # Environment-aware scripts (work in both i3/Sway)
├── settings/ # User application preferences
├── install.sh # Smart installer with i3/Sway detection
├── packages-common.txt # Packages shared by both i3 and Sway
├── packages-i3.txt # i3-specific packages (X11)
└── packages-sway.txt # Sway-specific packages (Wayland)
```
## Installation
@@ -71,8 +38,6 @@ git clone https://github.com/JGH0/MyI3Config.git
cd MyI3Config
```
---
### 2. Run the installer
```bash
@@ -81,40 +46,101 @@ cd MyI3Config
The installer will:
- Ask if you want to install the i3 configuration
- Copy the config to `~/.config/i3`
- Ask which terminal, browser, file manager, and calculator you want to use
- Validate that the chosen applications exist
- Write the selected application names into `settings/*.sh`
1. **Detect your environment**: Auto-detects if you're running i3 or Sway (or lets you choose)
2. **Install packages**: Installs only the necessary packages for your chosen window manager
3. **Configure applications**: Lets you choose your preferred terminal, browser, file manager, and calculator
4. **Set up configuration**: Copies files to `~/.config/MyI3Config` and creates appropriate symlinks
If an application is not found, you will be asked again.
## Package Management
---
The repository uses three package lists for clean dependency management:
### 3. Log into i3
- **`packages-common.txt`**: Applications that work on both i3 and Sway
- `rofi`, `brightnessctl`, `playerctl`, etc.
- **`packages-i3.txt`**: i3/X11 specific packages
- `i3-wm`, `xorg-server`, `maim`, `xclip`, `i3lock`, etc.
- **`packages-sway.txt`**: Sway/Wayland specific packages
- `sway`, `grim`, `slurp`, `wl-clipboard`, `swaylock`, etc.
When starting i3 for the first time:
- **Do NOT generate a new config**
- Use the installed configuration
## Environment-Aware Scripts
---
The `scripts/` directory contains smart scripts that detect whether they're running under i3 or Sway and use the appropriate tools:
## packages.txt
- **`screenshot.sh`**: Uses `maim` + `xclip` on i3, `grim` + `wl-copy` on Sway
- **`display-tool.sh`**: Launches `arandr` on i3, `wdisplays` on Sway
- **`lock.sh`**: Uses `i3lock` on i3, `swaylock` on Sway
- **`keyboard-setup.sh`**: Uses `setxkbmap` on i3, `swaymsg input` on Sway
- **`startup.sh`**: Runs appropriate startup commands for each environment
The `packages.txt` file contains a suggested list of packages you may want to install.
It is intentionally not installed automatically to keep full user control.
## Application Settings
Example:
All user-configurable applications are defined in the `settings/` directory. Each file contains only the binary name, for example:
```bash
sudo pacman -S --needed - < packages.txt
```sh
# settings/terminal.sh
kitty
```
The configuration reads these files, keeping your app choices separate from keybindings.
## Switching Between i3 and Sway
If you want to use both window managers:
1. **Run the installer twice**: Once selecting i3, once selecting Sway
2. **Both configs will be installed**: The installer creates symlinks to the same config file
3. **Log out and switch**: Choose your window manager from your display manager
**Note**: The configuration file is written in i3 syntax but uses environment-aware scripts to handle differences between i3 and Sway.
## Keybindings (Common to Both)
| Key Combination | Action |
|----------------|--------|
| `Super + Return` | Terminal |
| `Super + b` | Browser |
| `Super + e` | File manager |
| `Super + Ctrl + c` | Calculator |
| `Super + Ctrl + Return` | Application launcher (rofi) |
| `Super + 1-0` | Switch workspaces |
| `Super + Shift + 1-0` | Move window to workspace |
| `Super + q` | Close window |
| `Super + f` | Toggle fullscreen |
| `Super + Shift + s` | Take screenshot |
| `Super + l` | Lock screen |
| `Super + space` | Toggle keyboard layout |
| `Super + Shift + c` | Reload configuration |
| `Super + Shift + r` | Restart window manager |
## Customization
1. **Application preferences**: Edit files in `~/.config/MyI3Config/settings/`
2. **Keybindings**: Edit `~/.config/MyI3Config/i3/config`
3. **Scripts**: Modify `~/.config/MyI3Config/scripts/` for custom behavior
4. **Package lists**: Update the `packages-*.txt` files to add/remove packages
## Troubleshooting
### i3 Issues
- Ensure X11 packages are installed (`packages-i3.txt`)
- Check that `~/.config/i3/config` is symlinked correctly
- Verify X server is running (`startx` or display manager)
### Sway Issues
- Ensure Wayland packages are installed (`packages-sway.txt`)
- Check that `~/.config/sway/config` is symlinked correctly
- Make sure to select Sway from your display manager
- Some applications may need Wayland flags (e.g., `--enable-features=WaylandWindowDecorations`)
### General Issues
- Run `install.sh` again to reinstall
- Check script permissions: `chmod +x ~/.config/MyI3Config/scripts/*.sh`
- Reload configuration: `Super + Shift + c`
## License
This configuration is licensed under the MIT License. See [LICENSE](LICENSE) for details.
---
## Notes
- This configuration is intentionally minimal
- Everything is plain text and easy to understand
- No magic, no hidden behavior
- You are encouraged to fork and modify this setup to your needs
**Goal**: Predictable tiling behavior with keyboard-driven workflow, minimal visual noise, and easy extensibility via simple shell scripts.