Skip to content

Commit 9efd3c8

Browse files
committed
Update Screenkey app with major improvements and documentation
- Revise and expand README.md for better clarity and usage instructions - Enhance main.rs with new features and refactoring - Update Cargo.toml with additional dependencies and config tweaks - Remove unused CSS rule in App.css
1 parent 7d566ed commit 9efd3c8

4 files changed

Lines changed: 305 additions & 35 deletions

File tree

screenkey-app/README.md

Lines changed: 143 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ A modern, cross-platform screencast tool to display keyboard inputs on screen. P
77

88
## Features
99

10-
- 🎯 **Global Keyboard Capture** - Captures keypresses from any application
11-
- 🔄 **Dual Layout Modes** - Switch between vertical and horizontal display
10+
- 🎯 **Global Keyboard Capture** - Captures keypresses from any application (all platforms)
11+
- 🔄 **Three Layout Modes** - Switch between vertical, horizontal, and wrapped display
1212
- 📜 **Scrollable History** - View complete command sequences
1313
- 🎨 **Modern UI** - Transparent overlay with smooth animations
1414
- 🖱️ **Draggable Window** - Position anywhere on screen
15-
- ⌨️ **Modifier Keys** - Shows Ctrl, Shift, Alt, Super combinations
15+
- ⌨️ **Modifier Keys** - Shows Ctrl, Shift, Alt, Super/Cmd/Win combinations
1616
- 🧹 **Clear History** - Reset display between tutorial sections
1717
- 🪟 **Always On Top** - Stays visible over all applications
18+
- 🎨 **Customizable Themes** - 6 presets + custom theme creator
19+
- ⚙️ **Advanced Settings** - Auto-hide duration, opacity, font size control
1820

1921
## Perfect For
2022

@@ -27,6 +29,7 @@ A modern, cross-platform screencast tool to display keyboard inputs on screen. P
2729
## Prerequisites
2830

2931
### Linux (Debian/Ubuntu)
32+
3033
```bash
3134
sudo apt update
3235
sudo apt install libwebkit2gtk-4.1-dev \
@@ -44,18 +47,22 @@ sudo apt install libwebkit2gtk-4.1-dev \
4447
```
4548

4649
### macOS
50+
4751
```bash
4852
xcode-select --install
4953
```
5054

5155
### Windows
56+
5257
Install Microsoft Visual Studio C++ Build Tools
5358

5459
### Common Requirements
60+
5561
- **Node.js** (v16 or later)
5662
- **Rust** (latest stable version)
5763

5864
Install Rust:
65+
5966
```bash
6067
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
6168
source $HOME/.cargo/env
@@ -65,6 +72,7 @@ source $HOME/.cargo/env
6572

6673
1. Clone or navigate to this directory
6774
2. Install dependencies:
75+
6876
```bash
6977
npm install
7078
```
@@ -73,17 +81,38 @@ npm install
7381

7482
### Development Mode
7583

76-
**Important:** On Linux, the app requires elevated permissions to capture global keyboard events:
84+
#### Linux
85+
86+
On Linux, the app requires elevated permissions to capture global keyboard events:
7787

7888
```bash
7989
sudo npm run tauri dev
8090
```
8191

82-
On macOS/Windows:
92+
#### macOS
93+
94+
On macOS, you'll need to grant Accessibility permissions:
95+
96+
1. Run the app:
97+
98+
```bash
99+
npm run tauri dev
100+
```
101+
102+
2. When prompted, go to **System Preferences → Security & Privacy → Privacy → Accessibility**
103+
3. Add your terminal app (Terminal.app, iTerm2, etc.) to the allowed list
104+
4. Restart the terminal and run again
105+
106+
#### Windows
107+
108+
On Windows, administrator privileges may be required:
109+
83110
```bash
84111
npm run tauri dev
85112
```
86113

114+
If keyboard capture doesn't work, try running your terminal/IDE as Administrator.
115+
87116
### Building for Production
88117

89118
```bash
@@ -94,11 +123,31 @@ The built application will be in `src-tauri/target/release/`.
94123

95124
### Running the Built App
96125

97-
On Linux:
126+
#### Linux
127+
98128
```bash
99129
sudo ./src-tauri/target/release/screenkey-app
100130
```
101131

132+
#### macOS
133+
134+
```bash
135+
./src-tauri/target/release/screenkey-app
136+
# Or open the .app bundle from src-tauri/target/release/bundle/macos/
137+
open src-tauri/target/release/bundle/macos/ScreenKey.app
138+
```
139+
140+
Grant Accessibility permissions when prompted (same as development mode).
141+
142+
#### Windows
143+
144+
```cmd
145+
.\src-tauri\target\release\screenkey-app.exe
146+
# Or run the installer from src-tauri/target/release/bundle/msi/
147+
```
148+
149+
Run as Administrator if keyboard capture doesn't work.
150+
102151
## Controls
103152

104153
- **Drag Header** - Click and hold the "ScreenKey" title to move the window
@@ -108,49 +157,84 @@ sudo ./src-tauri/target/release/screenkey-app
108157

109158
## Layout Modes
110159

111-
### Vertical Mode (Default)
160+
### Vertical Mode
161+
112162
- Keys displayed top to bottom
113163
- Auto-scrolls to show latest key at bottom
114164
- Perfect for side-of-screen placement
115165

116166
### Horizontal Mode
167+
117168
- Keys displayed left to right
118169
- Auto-scrolls to show latest key on right
119170
- Perfect for bottom-of-screen placement
120171

172+
### Wrapped Mode (Default)
173+
174+
- Keys wrap naturally like typing
175+
- Auto-scrolls when needed
176+
- Most natural reading flow
177+
121178
## Permissions
122179

123180
### Linux
181+
124182
The app reads from `/dev/input/` devices to capture keyboard events globally. This requires root permissions.
125183

126184
**Alternative:** Add your user to the input group (requires logout):
185+
127186
```bash
128187
sudo usermod -a -G input $USER
129188
```
130189

131-
### Wayland Support
132-
✅ Fully supported via `evdev` - works on both X11 and Wayland sessions
190+
**Wayland Support:** ✅ Fully supported via `evdev` - works on both X11 and Wayland sessions
191+
192+
### macOS
193+
194+
Requires **Accessibility** permissions to capture global keyboard events.
195+
196+
**How to grant:**
197+
198+
1. Open **System Preferences → Security & Privacy → Privacy → Accessibility**
199+
2. Click the lock icon to make changes
200+
3. Add your terminal app or the ScreenKey.app to the allowed list
201+
4. Restart the app
202+
203+
### Windows
204+
205+
May require **Administrator** privileges to capture global keyboard events.
206+
207+
**How to run as Administrator:**
208+
209+
- Right-click the app/shortcut → "Run as administrator"
210+
- Or run your terminal/IDE as Administrator before launching
133211

134212
## Customization
135213

136214
### Window Settings
215+
137216
Edit `src-tauri/tauri.conf.json`:
217+
138218
```json
139219
{
140-
"windows": [{
141-
"width": 350,
142-
"height": 500,
143-
"x": 50,
144-
"y": 50
145-
}]
220+
"windows": [
221+
{
222+
"width": 350,
223+
"height": 500,
224+
"x": 50,
225+
"y": 50
226+
}
227+
]
146228
}
147229
```
148230

149231
### Styling
232+
150233
- `src/App.css` - Main app styles
151234
- `src/components/KeyDisplay.css` - Key display styling
152235

153236
### Color Scheme
237+
154238
- Modifiers: `#fbbf24` (amber)
155239
- Keys: `#60a5fa` (blue)
156240
- Background: `rgba(0, 0, 0, 0.9)` (dark transparent)
@@ -159,30 +243,51 @@ Edit `src-tauri/tauri.conf.json`:
159243

160244
- **Frontend:** React + TypeScript + Vite
161245
- **Backend:** Rust + Tauri
162-
- **Keyboard Capture:** evdev (Linux), platform-specific APIs (macOS/Windows)
246+
- **Keyboard Capture:**
247+
- Linux: evdev (direct /dev/input access)
248+
- macOS/Windows: rdev (cross-platform keyboard hooks)
163249
- **IPC:** Tauri events for frontend-backend communication
164250

165251
## Troubleshooting
166252

167-
### "No keyboard devices found"
168-
- Make sure you're running with `sudo` on Linux
169-
- Check that `/dev/input/` contains event devices
253+
### Linux: "No keyboard devices found"
254+
255+
- Make sure you're running with `sudo`
256+
- Check that `/dev/input/` contains event devices: `ls -l /dev/input/event*`
257+
- Add user to input group: `sudo usermod -a -G input $USER` (requires logout)
258+
259+
### macOS: Keys not appearing
260+
261+
- Grant Accessibility permissions (System Preferences → Security & Privacy → Privacy → Accessibility)
262+
- Add your terminal app or ScreenKey.app to the allowed list
263+
- Restart the app after granting permissions
264+
265+
### Windows: Keys not appearing
266+
267+
- Run the app as Administrator
268+
- Check Windows Defender/antivirus isn't blocking keyboard hooks
269+
- Ensure no other keyboard monitoring software is interfering
170270

171-
### Keys not appearing
172-
- Verify the app is running with proper permissions
173-
- Check browser console (F12) for errors
174-
- Ensure event listener is set up (check terminal logs)
271+
### General: Keys not appearing
272+
273+
- Check terminal/console for error messages
274+
- Verify the app window is visible and not minimized
275+
- Try restarting the app
175276

176277
### Window not draggable
278+
177279
- Make sure you're clicking on the header text "ScreenKey"
178-
- Buttons don't trigger drag - only the title area
280+
- Buttons don't trigger drag - only the header area
179281

180-
### Permission denied on build
181-
- Fix ownership: `sudo chown -R $USER:$USER src-tauri/target`
282+
### Build errors
283+
284+
- Fix ownership (Linux): `sudo chown -R $USER:$USER src-tauri/target`
285+
- Clear build cache: `rm -rf src-tauri/target && npm run tauri build`
182286

183287
## Development
184288

185289
### Project Structure
290+
186291
```
187292
screenkey-app/
188293
├── src/ # React frontend
@@ -199,11 +304,13 @@ screenkey-app/
199304
### Key Components
200305

201306
**Frontend:**
307+
202308
- `App.tsx` - Main logic, event listener, layout toggle
203309
- `KeyDisplay.tsx` - Renders key history with scroll
204310

205311
**Backend:**
206-
- `main.rs` - evdev integration, key capture, event emission
312+
313+
- `main.rs` - Platform-specific key capture (evdev for Linux, rdev for macOS/Windows), event emission
207314

208315
## Contributing
209316

@@ -218,16 +325,21 @@ This project is open source and available under the MIT License.
218325
Inspired by [screenkey](https://github.com/scs3jb/screenkey) by Pablo Seminario.
219326

220327
Built with:
328+
221329
- [Tauri](https://tauri.app/) - Desktop app framework
222330
- [React](https://react.dev/) - UI framework
223331
- [evdev](https://crates.io/crates/evdev) - Linux input device access
332+
- [rdev](https://crates.io/crates/rdev) - Cross-platform keyboard/mouse hook
224333

225334
## Roadmap
226335

227-
- [ ] Configurable key display duration
228-
- [ ] Custom color themes
229-
- [ ] Font size adjustment
230-
- [ ] Opacity control
336+
- [x] ~~Configurable key display duration~~ ✅ (v0.0.7)
337+
- [x] ~~Custom color themes~~ ✅ (v0.0.7)
338+
- [x] ~~Font size adjustment~~ ✅ (v0.0.7)
339+
- [x] ~~Opacity control~~ ✅ (v0.0.7)
340+
- [x] ~~Cross-platform support (macOS/Windows)~~ ✅ (v0.0.9)
231341
- [ ] Key filtering (hide specific keys)
232342
- [ ] Recording mode (save keypress history)
233343
- [ ] Multi-monitor support improvements
344+
- [ ] Click/mouse event display
345+
- [ ] Customizable key combinations display

screenkey-app/src-tauri/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ custom-protocol = ["tauri/custom-protocol"]
2121
[target.'cfg(target_os = "linux")'.dependencies]
2222
evdev = "0.12"
2323
x11 = { version = "2.21", features = ["xlib"] }
24+
25+
[target.'cfg(target_os = "macos")'.dependencies]
26+
rdev = "0.5"
27+
28+
[target.'cfg(target_os = "windows")'.dependencies]
29+
rdev = "0.5"

0 commit comments

Comments
 (0)