mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-18 01:34:00 -05:00
feat: Implement toggleTheme and toggleFullscreen keyboard shortcuts
Add Ctrl+Shift+T to toggle between themes and F11 to toggle fullscreen mode. Extends the shortcut system to support action-based shortcuts alongside app launchers.
This commit is contained in:
@@ -33,7 +33,9 @@ class BootLoader {
|
|||||||
this.shortcuts = [
|
this.shortcuts = [
|
||||||
{ key: 'P', ctrl: true, shift: true, app: 'prism', description: 'Open Prism Console' },
|
{ key: 'P', ctrl: true, shift: true, app: 'prism', description: 'Open Prism Console' },
|
||||||
{ key: 'M', ctrl: true, shift: true, app: 'miners', description: 'Open Miners Dashboard' },
|
{ key: 'M', ctrl: true, shift: true, app: 'miners', description: 'Open Miners Dashboard' },
|
||||||
{ key: 'E', ctrl: true, shift: true, app: 'engineering', description: 'Open Engineering DevTools' }
|
{ key: 'E', ctrl: true, shift: true, app: 'engineering', description: 'Open Engineering DevTools' },
|
||||||
|
{ key: 'T', ctrl: true, shift: true, action: 'toggleTheme', description: 'Toggle Theme' },
|
||||||
|
{ key: 'F11', action: 'toggleFullscreen', description: 'Toggle Fullscreen' }
|
||||||
// TODO v0.2.0: Make shortcuts customizable via Settings app
|
// TODO v0.2.0: Make shortcuts customizable via Settings app
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -326,7 +328,13 @@ class BootLoader {
|
|||||||
|
|
||||||
if (ctrlMatch && shiftMatch && altMatch && keyMatch) {
|
if (ctrlMatch && shiftMatch && altMatch && keyMatch) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
launchApp(shortcut.app);
|
|
||||||
|
// Handle action-based shortcuts
|
||||||
|
if (shortcut.action) {
|
||||||
|
this.executeShortcutAction(shortcut.action);
|
||||||
|
} else if (shortcut.app) {
|
||||||
|
launchApp(shortcut.app);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -334,6 +342,51 @@ class BootLoader {
|
|||||||
console.log(`⌨️ Registered ${this.shortcuts.length} keyboard shortcuts`);
|
console.log(`⌨️ Registered ${this.shortcuts.length} keyboard shortcuts`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a shortcut action
|
||||||
|
* @param {string} action - Action identifier
|
||||||
|
*/
|
||||||
|
executeShortcutAction(action) {
|
||||||
|
switch (action) {
|
||||||
|
case 'toggleTheme':
|
||||||
|
if (window.ThemeManager) {
|
||||||
|
window.ThemeManager.toggleTheme();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'toggleFullscreen':
|
||||||
|
this.toggleFullscreen();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.warn(`Unknown shortcut action: ${action}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle browser fullscreen mode
|
||||||
|
*/
|
||||||
|
toggleFullscreen() {
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
// Enter fullscreen
|
||||||
|
document.documentElement.requestFullscreen().then(() => {
|
||||||
|
if (window.OS) {
|
||||||
|
window.OS.showNotification({
|
||||||
|
type: 'info',
|
||||||
|
title: 'Fullscreen Mode',
|
||||||
|
message: 'Press F11 to exit fullscreen',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.warn(`Fullscreen request failed: ${err.message}`);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Exit fullscreen
|
||||||
|
document.exitFullscreen().catch((err) => {
|
||||||
|
console.warn(`Exit fullscreen failed: ${err.message}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show welcome notification on boot
|
* Show welcome notification on boot
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ const Config = {
|
|||||||
openMiners: 'Ctrl+Shift+M',
|
openMiners: 'Ctrl+Shift+M',
|
||||||
openEngineering: 'Ctrl+Shift+E',
|
openEngineering: 'Ctrl+Shift+E',
|
||||||
closeWindow: 'Escape',
|
closeWindow: 'Escape',
|
||||||
toggleTheme: 'Ctrl+Shift+T', // TODO: Implement
|
toggleTheme: 'Ctrl+Shift+T',
|
||||||
toggleFullscreen: 'F11' // TODO: Implement
|
toggleFullscreen: 'F11'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user