Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "imposter",
"name": "system-utility",
"version": "1.0.0",
"description": "Imposter: Beating a Broken System",
"description": "System Utility: System performance evaluation tool",
"author": "Puskar Roy",
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,8 +37,8 @@
"prettier": "^3.2.5"
},
"build": {
"appId": "com.imposter.app",
"productName": "Imposter",
"appId": "com.system-utility.app",
"productName": "System Utility",
"directories": {
"output": "dist"
},
Expand Down
8 changes: 8 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ const { app, session, BrowserWindow } = require('electron');
const path = require('path');
require('dotenv').config();

if (app.isPackaged) {
console.log = () => {};
console.debug = () => {};
console.info = () => {};
console.warn = () => {};
console.error = () => {};
}

const { createMainWindow, getMainWindow } = require('./window-manager');
const { registerShortcuts, unregisterShortcuts } = require('./shortcuts');
const { registerIpcHandlers } = require('./ipc-handlers');
Expand Down
23 changes: 23 additions & 0 deletions src/main/ipc-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ function registerIpcHandlers() {
console.error('[IPC] minimize error:', err);
}
});

ipcMain.on('maximize-app', () => {
try {
const mainWindow = getMainWindow();
if (mainWindow && !mainWindow.isDestroyed()) {
if (mainWindow.isMaximized()) {
mainWindow.unmaximize();
} else {
mainWindow.maximize();
}
}
} catch (err) {
console.error('[IPC] maximize error:', err);
}
});

ipcMain.on('close-app', () => {
try { app.quit(); } catch (err) {
Expand Down Expand Up @@ -197,6 +212,14 @@ function registerIpcHandlers() {
}
});

ipcMain.on('register-window-listeners', (event) => {
const win = getMainWindow();
if (win && !win.isDestroyed()) {
win.on('maximize', () => safeSendToWindow(win, 'window-state', 'maximized'));
win.on('unmaximize', () => safeSendToWindow(win, 'window-state', 'normal'));
}
});

ipcMain.on('send-ai-to-island', (event, text) => {
try {
const { getIslandWindow } = require('./window-manager');
Expand Down
5 changes: 4 additions & 1 deletion src/main/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
// Basic App Controls
minimizeApp: () => ipcRenderer.send('minimize-app'),
maximizeApp: () => ipcRenderer.send('maximize-app'),
closeApp: () => ipcRenderer.send('close-app'),
restartApp: () => ipcRenderer.send('restart-app'),
setAppMode: (mode) => ipcRenderer.send('set-app-mode', mode),
Expand Down Expand Up @@ -38,5 +39,7 @@ contextBridge.exposeInMainWorld('electronAPI', {

// Window Management
openIslandWindow: () => ipcRenderer.send('open-island-window'),
closeIslandWindow: () => ipcRenderer.send('close-island-window')
closeIslandWindow: () => ipcRenderer.send('close-island-window'),
registerWindowListeners: () => ipcRenderer.send('register-window-listeners'),
onWindowState: (callback) => ipcRenderer.on('window-state', (event, state) => callback(state))
});
31 changes: 24 additions & 7 deletions src/main/shortcuts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { globalShortcut, app, screen, desktopCapturer } = require('electron');
const { getMainWindow, createSnipperWindow } = require('./window-manager');
const { getMainWindow, createSnipperWindow, getIslandWindow, getSnipperWindow } = require('./window-manager');
const path = require('path');

function safeRegister(accelerator, callback) {
Expand All @@ -21,8 +21,30 @@ function safeSend(channel, ...args) {
}
}

let isAppHidden = false;

function toggleVisibility() {
isAppHidden = !isAppHidden;
const mainWin = getMainWindow();
const islandWin = getIslandWindow();
const snipperWin = getSnipperWindow();

const windows = [mainWin, islandWin, snipperWin];

windows.forEach(win => {
if (win && !win.isDestroyed()) {
if (isAppHidden) {
win.hide();
} else {
win.show();
if (win === mainWin) win.focus();
}
}
});
}

function registerShortcuts() {
safeRegister('CommandOrControl+Shift+Q', () => app.quit());
safeRegister('CommandOrControl+Shift+Q', () => toggleVisibility());

const moveAmount = 15;
const move = (dx, dy) => {
Expand Down Expand Up @@ -78,11 +100,6 @@ function registerShortcuts() {
console.error('[SHORTCUT] Snipping error:', err);
}
});

safeRegister('CommandOrControl+Shift+D', () => {
const win = getMainWindow();
if (win && !win.isDestroyed()) win.webContents.toggleDevTools();
});
}

function unregisterShortcuts() {
Expand Down
12 changes: 8 additions & 4 deletions src/main/window-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ function createMainWindow(preloadPath) {
skipTaskbar: true,
alwaysOnTop: true,
hasShadow: false,
resizable: false,
resizable: true,
maximizable: true,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: preloadPath
preload: preloadPath,
devTools: false
}
});

Expand Down Expand Up @@ -96,7 +98,8 @@ function createIslandWindow(preloadPath) {
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: preloadPath
preload: preloadPath,
devTools: false
}
});

Expand Down Expand Up @@ -137,7 +140,8 @@ function createSnipperWindow(preloadPath, screenSource) {
enableLargerThanScreen: true,
webPreferences: {
preload: preloadPath,
contextIsolation: true
contextIsolation: true,
devTools: false
}
});

Expand Down
69 changes: 69 additions & 0 deletions src/renderer/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,72 @@ body {
::-webkit-scrollbar-thumb:hover {
background: #666;
}

/* Custom HUD Notifications */
.notification-container {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 10000;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
pointer-events: none;
}

.notification {
background: rgba(30, 30, 30, 0.95);
color: var(--text-primary);
padding: 12px 20px;
border-radius: 12px;
font-size: 13px;
font-weight: 500;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
border: 1px solid var(--border-color);
backdrop-filter: blur(8px);
display: flex;
align-items: center;
gap: 12px;
animation: slideDownIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
pointer-events: auto;
max-width: 400px;
width: max-content;
}

.notification.error {
border-left: 4px solid #ff4d4d;
}

.notification.success {
border-left: 4px solid var(--accent-color);
}

.notification-icon {
display: flex;
align-items: center;
justify-content: center;
}

@keyframes slideDownIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.notification.fade-out {
animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
to {
opacity: 0;
transform: translateY(-10px);
}
}
Loading
Loading