Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit c9d5fd4

Browse files
committed
docs: update project documentation and structure
1. Renamed project from "rwlogouts" to "rwlogout" for consistency 2. Completely restructured README with modern documentation standards 3. Added detailed sections for features, installation, configuration, and architecture 4. Included comprehensive technical details about the Rust/GTK4 implementation 5. Updated flake.nix with correct project homepage URL 6. Added KDL configuration examples and environment variable support documentation 7. Enhanced styling and theming information 8. Expanded development and contribution guidelines The changes improve user experience by providing clear documentation, better organization, and more comprehensive technical details about the GTK4-based logout application. docs: 更新项目文档和结构 1. 将项目名称从 "rwlogouts" 重命名为 "rwlogout" 以保持一致性 2. 完全重构了 README 文件,采用现代文档标准 3. 添加了功能特性、安装、配置和架构的详细章节 4. 包含关于 Rust/GTK4 实现的详尽技术细节 5. 在 flake.nix 中更新了正确的项目主页 URL 6. 添加了 KDL 配置示例和环境变量支持文档 7. 增强了
1 parent 14cba49 commit c9d5fd4

File tree

2 files changed

+187
-23
lines changed

2 files changed

+187
-23
lines changed

README.md

Lines changed: 186 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,203 @@
1-
# rwlogouts
1+
# rwlogout
22

3-
wlougout2 is a software to help wm users shut down.
3+
A modern logout/shutdown dialog for Linux desktop environments, built with Rust and GTK4. This application provides a clean interface for system power management operations.
44

5-
## BUILD
5+
## Features
66

7-
Use Cargo:
7+
**Modern UI Framework**: Built with [relm4](https://github.com/Relm4/Relm4) and GTK4
8+
🔧 **Configurable**: KDL-based configuration for easy customization
9+
⌨️ **Keyboard Support**: Configurable keybindings for all actions
10+
🖱️ **Mouse Friendly**: Hover-to-focus and click interactions
11+
🏷️ **Layer Shell**: Uses gtk4-layer-shell for proper overlay display
12+
🎨 **Themeable**: CSS-based styling support
13+
14+
## Supported Operations
15+
16+
- **Lock** - Lock the current session
17+
- **Logout** - Terminate user session
18+
- **Shutdown** - Power off the system
19+
- **Reboot** - Restart the system
20+
- **Suspend** - Suspend to RAM
21+
- **Hibernate** - Suspend to disk
22+
23+
## Installation
24+
25+
### Using Cargo
26+
27+
```bash
28+
# Install dependencies (Debian/Ubuntu)
29+
sudo apt install libgtk-4-dev libglib2.0-dev pkg-config
30+
31+
# Install dependencies (Arch Linux)
32+
sudo pacman -S gtk4 glib2 pkg-config
33+
34+
# Clone and build
35+
git clone https://github.com/dwapp/rwlogout.git
36+
cd rwlogout
37+
cargo build --release
38+
```
39+
40+
### Using Nix
41+
42+
```bash
43+
# Build with Nix
44+
nix build
45+
46+
# Or run directly
47+
nix run
48+
```
49+
50+
### Development Environment
51+
52+
```bash
53+
# Enter development shell (Nix)
54+
nix develop
55+
56+
# Or use traditional method
57+
nix-shell -p glib.dev pkg-config zlib cargo pango gdk-pixbuf gtk4 gtk4-layer-shell
58+
```
59+
60+
## Configuration
61+
62+
The application is configured via the `layout.kdl` file using the [KDL](https://kdl.dev/) format:
63+
64+
```kdl
65+
// Layout configuration for rwlogout
66+
button "lock" {
67+
action "loginctl lock-session"
68+
text "Lock"
69+
keybind "l"
70+
}
71+
72+
button "shutdown" {
73+
action "systemctl poweroff"
74+
text "Shutdown"
75+
keybind "s"
76+
}
77+
78+
// Add more buttons as needed...
79+
```
80+
81+
### Configuration Fields
82+
83+
- **`label`**: Internal identifier for the button
84+
- **`action`**: System command to execute
85+
- **`text`**: Display text shown on the button
86+
- **`keybind`**: Single character keyboard shortcut
87+
88+
### Environment Variables
89+
90+
Commands support environment variable expansion:
91+
- `$USER` - Current username
92+
- Standard shell environment variables
93+
94+
## Usage
95+
96+
### Running the Application
897

998
```bash
10-
nix-shell -p glib.dev pkg-config zlib cargo pango gdk-pixbuf gtk4
99+
# Run directly
11100
cargo run
101+
102+
# Or run the built binary
103+
./target/release/rwlogout
12104
```
13-
Use Nix:
105+
106+
### Keyboard Shortcuts
107+
108+
- **L** - Lock screen
109+
- **E** - Logout
110+
- **S** - Shutdown
111+
- **R** - Reboot
112+
- **U** - Suspend
113+
- **H** - Hibernate
114+
- **Escape** - Exit application
115+
116+
### Mouse Interaction
117+
118+
- **Click** - Execute the button's action
119+
- **Hover** - Automatically focus the button
120+
- **Background Click** - Exit application
121+
122+
## Architecture
123+
124+
The application uses a modern Rust architecture:
125+
126+
- **relm4**: Reactive GUI framework built on GTK4
127+
- **KDL**: Human-friendly configuration format
128+
- **gtk4-layer-shell**: Wayland layer shell support for overlay display
129+
- **Dynamic UI**: Buttons generated from configuration file
130+
131+
### Key Components
14132

15133
```
16-
nix build --no-update-lock-file
134+
src/
135+
├── main.rs # Main application and UI logic
136+
├── config.rs # Configuration parsing and command execution
137+
└── style.css # UI styling
138+
layout.kdl # Button configuration
17139
```
18140

19-
## TODO
141+
## Styling
142+
143+
The application supports CSS-based theming via `src/style.css`. You can customize:
144+
145+
- Button appearance and colors
146+
- Layout spacing and sizing
147+
- Hover and focus effects
148+
- Font and typography
149+
150+
## Wayland Support
151+
152+
The application uses gtk4-layer-shell for proper integration with Wayland compositors. It will:
153+
154+
- Display as an overlay on all screens
155+
- Grab keyboard focus when shown
156+
- Handle layer shell protocols correctly
157+
158+
On X11 systems, it falls back to standard fullscreen window behavior.
159+
160+
## Development
161+
162+
### Architecture Overview
163+
164+
The application follows the Model-View-Update (MVU) pattern via relm4:
165+
166+
1. **Model**: Application state and configuration
167+
2. **View**: Declarative UI definition
168+
3. **Update**: Message handling for user interactions
169+
170+
### Key Features
171+
172+
- **Dynamic UI Generation**: Buttons are created based on configuration
173+
- **Message-Driven**: All interactions go through the message system
174+
- **Automatic Cleanup**: Application exits after executing commands
175+
176+
### Contributing
177+
178+
1. Fork the repository
179+
2. Create a feature branch
180+
3. Make your changes
181+
4. Test thoroughly
182+
5. Submit a pull request
183+
184+
## Similar Projects
185+
186+
- [wlogout](https://github.com/ArtsyMacaw/wlogout) - Original inspiration
187+
- [wleave](https://github.com/AMNatty/wleave) - Alternative Wayland logout menu
188+
- [pwrmenu](https://github.com/kamilernerd/pwrmenu) - Power menu for window managers
189+
- [rlogout](https://github.com/MarcusBoay/rlogout) - Rust-based logout utility
20190

21-
- [x] shutdown
22-
- [x] logout
23-
- [x] reboot
24-
- [x] hibernate
25-
- [x] sleep
26-
- [ ] optimize GUI
27-
- [ ] systemd unit
191+
## License
28192

29-
[info](https://www.reddit.com/r/rust/comments/ec59eg/new_rust_library_to_shut_down_reboot_or_log_out/)
193+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
30194

195+
## Acknowledgments
31196

32-
## Similar projects
197+
- Built with [relm4](https://github.com/Relm4/Relm4) reactive GUI framework
198+
- Uses [KDL](https://kdl.dev/) for configuration
199+
- Inspired by the original [wlogout](https://github.com/ArtsyMacaw/wlogout) project
33200

34-
- [wlogout](https://github.com/ArtsyMacaw/wlogout)
35-
- [wleave](https://github.com/AMNatty/wleave)
36-
- [pwrmenu](https://github.com/kamilernerd/pwrmenu)
37-
- [rlogout](https://github.com/MarcusBoay/rlogout)
201+
---
38202

39-
> This project is only used as a practice for learning rust and gtk
203+
> This project serves as both a practical utility and a learning exercise for Rust and modern GTK4 development.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ rec {
4848
CFG_RELEASE = "git-${rev}";
4949

5050
meta = {
51-
homepage = "https://github.com/dwapp/wlogout2";
51+
homepage = "https://github.com/dwapp/rwlogout";
5252
license = with lib.licenses; [
5353
mit
5454
];

0 commit comments

Comments
 (0)