2026-01-22 16:28:56 -05:00
|
|
|
// Stub implementation of claude-native for Linux
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
// Uses Electron's native Linux support where possible instead of no-ops
|
2026-01-22 16:28:56 -05:00
|
|
|
const KeyboardKey = { Backspace: 43, Tab: 280, Enter: 261, Shift: 272, Control: 61, Alt: 40, CapsLock: 56, Escape: 85, Space: 276, PageUp: 251, PageDown: 250, End: 83, Home: 154, LeftArrow: 175, UpArrow: 282, RightArrow: 262, DownArrow: 81, Delete: 79, Meta: 187 };
|
|
|
|
|
Object.freeze(KeyboardKey);
|
|
|
|
|
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
// Helper: get the focused BrowserWindow (lazy-loaded to avoid circular deps)
|
2026-02-16 11:30:26 -05:00
|
|
|
// Filters destroyed windows from fallback to avoid errors like
|
|
|
|
|
// flashFrame() on a destroyed window or getIsMaximized() on a popup.
|
|
|
|
|
// Note: isVisible() is intentionally NOT checked — flashFrame() must work
|
|
|
|
|
// on minimized (non-visible) windows, which is its primary use case.
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
function getWindow() {
|
|
|
|
|
try {
|
|
|
|
|
const { BrowserWindow } = require('electron');
|
2026-02-16 10:09:48 -05:00
|
|
|
const focused = BrowserWindow.getFocusedWindow();
|
|
|
|
|
if (focused) return focused;
|
2026-02-16 11:38:04 -05:00
|
|
|
// TODO: Fallback may return a popup window; callers like
|
|
|
|
|
// getIsMaximized() may behave unexpectedly on popups.
|
2026-02-16 11:30:26 -05:00
|
|
|
const win = BrowserWindow.getAllWindows().find(
|
|
|
|
|
(w) => !w.isDestroyed()
|
2026-02-16 10:09:48 -05:00
|
|
|
);
|
2026-02-16 11:30:26 -05:00
|
|
|
return win || null;
|
2026-02-16 10:09:48 -05:00
|
|
|
} catch (e) {
|
|
|
|
|
console.warn('[Claude Native Stub] getWindow() failed:', e);
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-22 16:28:56 -05:00
|
|
|
// AuthRequest stub - not available on Linux, will cause fallback to system browser
|
|
|
|
|
class AuthRequest {
|
|
|
|
|
static isAvailable() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async start(url, scheme, windowHandle) {
|
|
|
|
|
throw new Error('AuthRequest not available on Linux');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
|
// no-op
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
getWindowsVersion: () => "10.0.0",
|
|
|
|
|
setWindowEffect: () => {},
|
|
|
|
|
removeWindowEffect: () => {},
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
|
|
|
|
|
// Functional on Linux via Electron's native support
|
|
|
|
|
getIsMaximized: () => {
|
|
|
|
|
const win = getWindow();
|
|
|
|
|
return win ? win.isMaximized() : false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Fixes: #149 - KDE Plasma: Window demands attention
|
2026-02-16 10:12:53 -05:00
|
|
|
// flashFrame is natively supported on Linux Electron.
|
2026-02-16 11:25:24 -05:00
|
|
|
// frame-fix-wrapper.js auto-clears on window focus.
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
flashFrame: (flash) => {
|
|
|
|
|
const win = getWindow();
|
|
|
|
|
if (win) win.flashFrame(typeof flash === 'boolean' ? flash : true);
|
|
|
|
|
},
|
|
|
|
|
clearFlashFrame: () => {
|
|
|
|
|
const win = getWindow();
|
|
|
|
|
if (win) win.flashFrame(false);
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-22 16:28:56 -05:00
|
|
|
showNotification: () => {},
|
fix: improve Linux UX with popup detection, functional stubs, and Wayland compositor support
- frame-fix-wrapper.js: Add popup/Quick Entry window detection (#223),
CSS injection for scrollbar styling and font rendering, persistent
menu bar hiding (#172), KDE attention flash fix (#149), and content
resize fix (#84)
- claude-native-stub.js: Make getIsMaximized, flashFrame, setProgressBar
functional using Electron's native Linux support instead of no-ops
- launcher-common.sh: Auto-detect Niri/Sway/Hyprland compositors and
force native Wayland mode (#226), safe variable expansion with ${VAR:-}
Fixes #84, #149, #172, #223, #226
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:30:22 +01:00
|
|
|
|
|
|
|
|
// Progress bar is natively supported on Linux (Unity/KDE/GNOME)
|
|
|
|
|
setProgressBar: (progress) => {
|
|
|
|
|
const win = getWindow();
|
|
|
|
|
if (win && typeof progress === 'number') {
|
|
|
|
|
win.setProgressBar(Math.max(0, Math.min(1, progress)));
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
clearProgressBar: () => {
|
|
|
|
|
const win = getWindow();
|
|
|
|
|
if (win) win.setProgressBar(-1);
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-22 16:28:56 -05:00
|
|
|
setOverlayIcon: () => {},
|
|
|
|
|
clearOverlayIcon: () => {},
|
|
|
|
|
KeyboardKey,
|
|
|
|
|
AuthRequest
|
|
|
|
|
};
|