Added xp-overlay feature

This commit is contained in:
Nate Anderson
2025-06-17 20:08:39 -06:00
parent 4c07690e85
commit dda6bfff42
9 changed files with 246 additions and 22 deletions
+36 -2
View File
@@ -185,8 +185,15 @@ Requirements:
break;
case 'test':
if (parts.length > 1) {
final level = int.tryParse(parts[1]) ?? 1;
_monitor.testTheme(level);
final levelOrCommand = parts[1].toLowerCase();
if (levelOrCommand == 'overlay') {
_testOverlay(parts.length > 2 ? int.tryParse(parts[2]) : null);
} else {
final level = int.tryParse(levelOrCommand) ?? 1;
_monitor.testTheme(level);
}
} else {
print('Usage: test [level|overlay] - Specify a level number or "overlay" to test XP overlay');
}
break;
case 'restore':
@@ -203,6 +210,7 @@ Requirements:
Available commands:
- stats: Show current productivity stats
- test [level]: Test theme for specific level
- test overlay [value]: Test XP overlay at cursor position
- restore: Restore desktop backup
- refresh: Refresh base config from current system config
- build: Build Flutter dashboard and copy to static files
@@ -246,6 +254,32 @@ void _handleBuildCommand() async {
}
}
/// Test the XP overlay with an optional XP value
Future<void> _testOverlay(int? xpValue) async {
print('🧪 Testing XP overlay system...');
final windowManager = WindowManagerDetector.instance.detect();
if (windowManager == WindowManager.unknown) {
print('❌ No supported window manager detected');
return;
}
final overlayManager = _monitor.cursorOverlayManager;
if (overlayManager == null) {
print('❌ Overlay manager not initialized');
return;
}
final available = await overlayManager.isAvailable();
if (!available) {
print('❌ Overlay system is not available. Check logs for details.');
return;
}
print('✅ Overlay system is available, showing test overlay...');
await overlayManager.testOverlay(testXP: xpValue ?? 42);
}
Future<void> _quit() async {
_monitor.stop();
await _dashboardServer.stop();