Skip to content

Commit a323094

Browse files
Coldaineclaude
andcommitted
feat(config): Add configurable window title capture
Introduces config.toml for centralized configuration with focus on enabling better suggestions through richer context. Key changes: - New config.toml with comprehensive settings (privacy, engine, overlay, logging) - KWin script now always sends window titles to daemon - Daemon config controls whether titles are used/logged (not yet implemented) - Documentation updated to emphasize functionality over privacy Window title capture benefits: - More targeted, context-aware suggestions - Better pattern matching (e.g., file types, web pages) - Improved suggestion quality and relevance Privacy controls are opt-in restrictions that may reduce suggestion accuracy. Recommended: enable capture_window_titles for best results. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent deca973 commit a323094

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ bash scripts/install-kwin-script.sh
5959

6060
Create your config files in `~/.config/shortcut-sage/`:
6161

62+
**config.toml**: Global settings (optional, uses defaults if not present)
63+
```toml
64+
[privacy]
65+
# Enable window title capture for better context-aware suggestions
66+
# Recommended: true for best results, false if privacy is a concern
67+
capture_window_titles = false
68+
69+
# Optionally redact titles from logs (reduces audit trail quality)
70+
redact_titles_from_logs = true
71+
72+
[engine]
73+
buffer_size_seconds = 3
74+
default_cooldown_seconds = 300
75+
max_suggestions = 3
76+
77+
[overlay]
78+
position = "top-left"
79+
opacity = 0.9
80+
```
81+
82+
See [config.toml](config.toml) for all available options.
83+
6284
**shortcuts.yaml**: Define your shortcuts
6385
```yaml
6486
version: "1.0"
@@ -152,9 +174,12 @@ See [implementation-plan.md](implementation-plan.md) for full roadmap.
152174

153175
- **No keylogging**: Only symbolic events (window focus, desktop switch)
154176
- **Local processing**: No cloud, no telemetry
155-
- **Redacted by default**: Window titles not logged
177+
- **Flexible data capture**: Window titles configurable via config.toml for improved suggestions
178+
- **Optional redaction**: Separate control for logging vs. suggestion logic (if privacy preferred)
156179
- **Open source**: Audit the code yourself
157180

181+
> **Note**: For best results, enable `capture_window_titles = true` in config.toml. This allows more targeted, context-aware suggestions. Privacy controls are available but may reduce suggestion quality.
182+
158183
## Contributing
159184

160185
Contributions welcome! Please read our [Contributing Guide](CONTRIBUTING.md) first.

config.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Shortcut Sage Configuration
2+
# Place this file in your config directory (default: ~/.config/shortcut-sage/)
3+
4+
[general]
5+
# Enable debug logging (verbose output)
6+
debug = false
7+
8+
[privacy]
9+
# Capture and use window titles (captions) in suggestion logic
10+
# - true: Full window titles sent to daemon (e.g., "Mozilla Firefox - Stack Overflow")
11+
# RECOMMENDED for better, more context-aware suggestions
12+
# - false: Only application resource class sent (e.g., "firefox")
13+
# Limits suggestion accuracy for privacy
14+
#
15+
# Window titles enable more targeted suggestions based on:
16+
# - Document names (suggest Kate shortcuts when editing *.py files)
17+
# - Web page context (suggest browser shortcuts on specific sites)
18+
# - More nuanced workflow understanding
19+
capture_window_titles = false
20+
21+
# Redact window titles from persistent logs (even if capture_window_titles = true)
22+
# Set to false if you want full audit trails for debugging/improvement
23+
redact_titles_from_logs = true
24+
25+
[engine]
26+
# Ring buffer size in seconds (how far back to look for patterns)
27+
buffer_size_seconds = 3
28+
29+
# Default cooldown in seconds (can be overridden per-rule in rules.yaml)
30+
default_cooldown_seconds = 300
31+
32+
# Maximum number of suggestions to show simultaneously
33+
max_suggestions = 3
34+
35+
[overlay]
36+
# Show the suggestion overlay
37+
enabled = true
38+
39+
# Overlay position (top-left, top-right, bottom-left, bottom-right)
40+
position = "top-left"
41+
42+
# Overlay offset from screen edge in pixels
43+
offset_x = 20
44+
offset_y = 20
45+
46+
# Auto-hide overlay after N seconds (0 = never auto-hide)
47+
auto_hide_seconds = 0
48+
49+
# Overlay transparency (0.0 = invisible, 1.0 = opaque)
50+
opacity = 0.9
51+
52+
[logging]
53+
# Log format: "json" or "ndjson"
54+
format = "ndjson"
55+
56+
# Log rotation: maximum file size in MB before rotation
57+
max_log_size_mb = 10
58+
59+
# Number of rotated log files to keep
60+
max_log_files = 5
61+
62+
# Log level: "debug", "info", "warning", "error"
63+
level = "info"

kwin/event-monitor.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
*
66
* Events monitored:
77
* - Desktop/workspace switches
8-
* - Window focus changes
8+
* - Window focus changes (including window titles for better context)
99
* - Show desktop state changes
1010
*
1111
* Dev shortcut: Meta+Shift+S sends a test event
1212
*
13-
* Privacy: Window titles are NOT captured by default - only resource classes
14-
* (application IDs) are sent to maintain user privacy.
13+
* Window titles are sent to improve suggestion accuracy. The daemon's
14+
* config.toml controls whether titles are used for suggestions and/or
15+
* logged. Configure privacy.capture_window_titles to balance accuracy
16+
* vs. privacy based on your preferences.
1517
*/
1618

1719
// DBus connection to Shortcut Sage daemon
@@ -138,7 +140,7 @@ workspace.clientActivated.connect(function(client) {
138140
"window_focus",
139141
"window_activated",
140142
{
141-
// caption: client.caption, // Uncomment to include window titles (privacy trade-off)
143+
caption: client.caption,
142144
resourceClass: client.resourceClass || "unknown"
143145
}
144146
);

0 commit comments

Comments
 (0)