Skip to content
Closed
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
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `get_azure_best_practices` tool if available.c
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove, unnecessary change

38 changes: 32 additions & 6 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,16 @@ function hideMainWindow(): void {
const bounds = state.mainWindow.getBounds();
state.windowPosition = { x: bounds.x, y: bounds.y };
state.windowSize = { width: bounds.width, height: bounds.height };

// Linux-specific fix: Hide the window completely rather than just setting opacity
if (process.platform === 'linux') {
state.mainWindow.hide();
}

Comment on lines +389 to +393
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is only for linux, where is the state.mainWindow.hide() for the other OS?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is that on Linux we straight up hide the window, but Windows and Mac we just set opacity to 0, so no need to hide the window on non-Linux platforms.

state.mainWindow.setIgnoreMouseEvents(true, { forward: true });
state.mainWindow.setOpacity(0);
state.isWindowVisible = false;
console.log('Window hidden, opacity set to 0');
console.log('Window hidden, opacity set to 0, platform:', process.platform);
}
}

Expand All @@ -400,27 +406,47 @@ function showMainWindow(): void {
...state.windowSize
});
}

state.mainWindow.setIgnoreMouseEvents(false);
state.mainWindow.setAlwaysOnTop(true, "screen-saver", 1);
state.mainWindow.setVisibleOnAllWorkspaces(true, {
visibleOnFullScreen: true
});
state.mainWindow.setContentProtection(true);
state.mainWindow.setOpacity(0); // Set opacity to 0 before showing
state.mainWindow.showInactive(); // Use showInactive instead of show+focus
state.mainWindow.setOpacity(1); // Then set opacity to 1 after showing

// Linux-specific show logic
if (process.platform === 'linux') {
state.mainWindow.show();
state.mainWindow.focus();
// Set opacity after showing to ensure the window is visible
state.mainWindow.setOpacity(configHelper.getOpacity());
} else {
// Mac/Windows behavior
state.mainWindow.setOpacity(0); // Set opacity to 0 before showing
state.mainWindow.showInactive(); // Use showInactive instead of show+focus
state.mainWindow.setOpacity(1); // Then set opacity to 1 after showing
}

Comment on lines +418 to +429
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is working for other OS?
Since you are tweaking the opacity not the window itself

state.isWindowVisible = true;
console.log('Window shown with showInactive(), opacity set to 1');
console.log('Window shown, platform:', process.platform);
}
}

function toggleMainWindow(): void {
console.log(`Toggling window. Current state: ${state.isWindowVisible ? 'visible' : 'hidden'}`);
console.log(`Toggling window. Current state: ${state.isWindowVisible ? 'visible' : 'hidden'}, platform: ${process.platform}`);

if (state.isWindowVisible) {
hideMainWindow();
} else {
showMainWindow();
}

// Additional logging to verify state
if (state.mainWindow && !state.mainWindow.isDestroyed()) {
setTimeout(() => {
console.log(`After toggle: isVisible=${state.isWindowVisible}, actual opacity=${state.mainWindow?.getOpacity()}`);
}, 100);
}
}

// Window movement functions
Expand Down
40 changes: 32 additions & 8 deletions electron/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,56 @@ import { configHelper } from "./ConfigHelper"

export class ShortcutsHelper {
private deps: IShortcutsHelperDeps
// Track opacity locally to avoid getOpacity() inconsistency
private currentOpacity: number

constructor(deps: IShortcutsHelperDeps) {
this.deps = deps
// Initialize from stored config
this.currentOpacity = configHelper.getOpacity()
}

private adjustOpacity(delta: number): void {
const mainWindow = this.deps.getMainWindow();
if (!mainWindow) return;

let currentOpacity = mainWindow.getOpacity();
let newOpacity = Math.max(0.1, Math.min(1.0, currentOpacity + delta));
console.log(`Adjusting opacity from ${currentOpacity} to ${newOpacity}`);
// Use our tracked opacity value instead of getOpacity()
let newOpacity = Math.max(0.1, Math.min(1.0, this.currentOpacity + delta));
console.log(`Adjusting opacity from ${this.currentOpacity} to ${newOpacity}`);

// Linux-specific handling for opacity changes
if (process.platform === 'linux') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, streamlining the implementation for Linux OS still needs verification that it is not breaking other OS

// If we're going from visible to invisible, hide the window completely
if (this.currentOpacity > 0.1 && newOpacity <= 0.1) {
console.log('Linux: Opacity too low, hiding window completely');
this.deps.toggleMainWindow(); // This will call hideMainWindow() which hides the window
return; // Skip further processing
}

// If we're already hidden, but increasing opacity to a visible level, show the window
if (!this.deps.isVisible() && newOpacity > 0.1) {
console.log('Linux: Window hidden but opacity increasing, showing window');
this.deps.toggleMainWindow(); // This will call showMainWindow() which shows the window
// Don't return, let it also set the opacity below
}
}

// Apply the opacity
mainWindow.setOpacity(newOpacity);

// Save the opacity setting to config without re-initializing the client
// Update our tracked opacity value
this.currentOpacity = newOpacity;

// Save the opacity setting to config
try {
const config = configHelper.loadConfig();
config.opacity = newOpacity;
configHelper.saveConfig(config);
configHelper.setOpacity(newOpacity);
} catch (error) {
console.error('Error saving opacity to config:', error);
}

// If we're making the window visible, also make sure it's shown and interaction is enabled
if (newOpacity > 0.1 && !this.deps.isVisible()) {
// Only do this for non-Linux platforms (Linux handled above)
if (process.platform !== 'linux' && newOpacity > 0.1 && !this.deps.isVisible()) {
this.deps.toggleMainWindow();
}
}
Expand Down
Empty file modified stealth-run.sh
100644 → 100755
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove, unnecessary change.
Added due to permission changes in linux

Empty file.