mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
General code cleanups
This commit is contained in:
@@ -7,79 +7,22 @@ import Quickshell
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Durations match M3 token tiers: short4/medium4/long4
|
||||
readonly property int durShort: 200
|
||||
readonly property int durMed: 450
|
||||
readonly property int durLong: 600
|
||||
|
||||
readonly property int slidePx: 80
|
||||
|
||||
// Material Design 3 motion curves (for QML BezierSpline)
|
||||
// Use groups of: [cx1, cy1, cx2, cy2, endX, endY, ...]
|
||||
// Single-segment cubics end with 1,1.
|
||||
|
||||
// Emphasized (multi-segment) – for on-screen-to-on-screen moves
|
||||
readonly property var emphasized: [
|
||||
0.05, 0.00, 0.133333, 0.06, 0.166667, 0.40,
|
||||
0.208333, 0.82, 0.25, 1.00, 1.00, 1.00
|
||||
]
|
||||
|
||||
// Emphasized decelerate – entering
|
||||
readonly property var emphasizedDecel: [ 0.05, 0.70, 0.10, 1.00, 1.00, 1.00 ]
|
||||
|
||||
// Emphasized accelerate – exiting
|
||||
readonly property var emphasizedAccel: [ 0.30, 0.00, 0.80, 0.15, 1.00, 1.00 ]
|
||||
|
||||
// Standard set – for small/subtle transitions
|
||||
readonly property var standard: [ 0.20, 0.00, 0.00, 1.00, 1.00, 1.00 ]
|
||||
readonly property var standardDecel: [ 0.00, 0.00, 0.00, 1.00, 1.00, 1.00 ]
|
||||
readonly property var standardAccel: [ 0.30, 0.00, 1.00, 1.00, 1.00, 1.00 ]
|
||||
|
||||
// readonly property QtObject direction: QtObject {
|
||||
// readonly property int fromLeft: 0
|
||||
// readonly property int fromRight: 1
|
||||
// readonly property int fadeOnly: 2
|
||||
// }
|
||||
|
||||
// // Slide transitions (surface/large moves)
|
||||
// // Enter = emphasizedDecel, Exit = emphasizedAccel
|
||||
// readonly property Component slideInLeft: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "x"; from: -root.slidePx; to: 0; duration: root.durMed
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.emphasizedDecel
|
||||
// }
|
||||
// }
|
||||
// readonly property Component slideOutLeft: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "x"; to: -root.slidePx; duration: root.durShort
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.emphasizedAccel
|
||||
// }
|
||||
// }
|
||||
// readonly property Component slideInRight: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "x"; from: root.slidePx; to: 0; duration: root.durMed
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.emphasizedDecel
|
||||
// }
|
||||
// }
|
||||
// readonly property Component slideOutRight: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "x"; to: root.slidePx; duration: root.durShort
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.emphasizedAccel
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Fade transitions (small/subtle moves)
|
||||
// // Enter = standardDecel, Exit = standardAccel
|
||||
// readonly property Component fadeIn: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "opacity"; from: 0.0; to: 1.0; duration: root.durMed
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.standardDecel
|
||||
// }
|
||||
// }
|
||||
// readonly property Component fadeOut: Transition {
|
||||
// NumberAnimation {
|
||||
// properties: "opacity"; to: 0.0; duration: root.durShort
|
||||
// easing.type: Easing.BezierSpline; easing.bezierCurve: root.standardAccel
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -52,20 +52,16 @@ Singleton {
|
||||
|
||||
function onLightModeChanged() {
|
||||
if (matugenColors && Object.keys(matugenColors).length > 0) {
|
||||
console.log("Light mode changed - updating dynamic colors");
|
||||
colorUpdateTrigger++;
|
||||
colorsUpdated();
|
||||
|
||||
// If dynamic theme is active, regenerate system themes with new light/dark mode
|
||||
if (typeof Theme !== "undefined" && Theme.isDynamicTheme) {
|
||||
console.log("Regenerating system themes for new light/dark mode");
|
||||
generateSystemThemes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function extractColors() {
|
||||
console.log("Colors.extractColors() called, matugenAvailable:", matugenAvailable);
|
||||
extractionRequested = true;
|
||||
if (matugenAvailable)
|
||||
fileChecker.running = true;
|
||||
@@ -91,7 +87,6 @@ Singleton {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("Colors.qml → home =", homeDir);
|
||||
matugenCheck.running = true;
|
||||
checkGtkThemingAvailability();
|
||||
checkQtThemingAvailability();
|
||||
@@ -105,15 +100,12 @@ Singleton {
|
||||
command: ["which", "matugen"]
|
||||
onExited: (code) => {
|
||||
matugenAvailable = (code === 0);
|
||||
console.log("Matugen in PATH:", matugenAvailable);
|
||||
if (!matugenAvailable) {
|
||||
console.warn("Matugen missing → dynamic theme disabled");
|
||||
ToastService.wallpaperErrorStatus = "matugen_missing";
|
||||
ToastService.showWarning("matugen not found - dynamic theming disabled");
|
||||
return ;
|
||||
}
|
||||
if (extractionRequested) {
|
||||
console.log("Continuing with color extraction");
|
||||
fileChecker.running = true;
|
||||
}
|
||||
}
|
||||
@@ -127,8 +119,6 @@ Singleton {
|
||||
if (code === 0) {
|
||||
matugenProcess.running = true;
|
||||
} else {
|
||||
console.error("code", code);
|
||||
console.error("Wallpaper not found:", wallpaperPath);
|
||||
ToastService.wallpaperErrorStatus = "error";
|
||||
ToastService.showError("Wallpaper processing failed");
|
||||
}
|
||||
@@ -146,7 +136,6 @@ Singleton {
|
||||
onStreamFinished: {
|
||||
const out = matugenCollector.text;
|
||||
if (!out.length) {
|
||||
console.error("matugen produced zero bytes\nstderr:", matugenProcess.stderr);
|
||||
ToastService.wallpaperErrorStatus = "error";
|
||||
ToastService.showError("Wallpaper Processing Failed");
|
||||
return ;
|
||||
@@ -158,7 +147,6 @@ Singleton {
|
||||
generateAppConfigs();
|
||||
ToastService.clearWallpaperError();
|
||||
} catch (e) {
|
||||
console.error("JSON parse failed:", e);
|
||||
ToastService.wallpaperErrorStatus = "error";
|
||||
ToastService.showError("Wallpaper Processing Failed");
|
||||
}
|
||||
@@ -173,7 +161,6 @@ Singleton {
|
||||
|
||||
function generateAppConfigs() {
|
||||
if (!matugenColors || !matugenColors.colors) {
|
||||
console.warn("No matugen colors available for app config generation");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,8 +184,7 @@ Singleton {
|
||||
var secondary = dark.secondary || "#8ab4f8";
|
||||
var inverse = dark.inverse_primary || "#6200ea";
|
||||
|
||||
var content = `// AUTO-GENERATED on ${new Date().toISOString()}
|
||||
layout {
|
||||
var content = `layout {
|
||||
border {
|
||||
active-color "${primary}"
|
||||
inactive-color "${secondary}"
|
||||
@@ -209,8 +195,7 @@ layout {
|
||||
background-color "${bg}"
|
||||
}`;
|
||||
|
||||
niriConfigWriter.command = ["bash", "-c", `echo '${content}' > niri-colors.generated.kdl`];
|
||||
niriConfigWriter.running = true;
|
||||
Quickshell.execDetached(["bash", "-c", `echo '${content}' > niri-colors.generated.kdl`]);
|
||||
}
|
||||
|
||||
function generateGhosttyConfig() {
|
||||
@@ -236,8 +221,7 @@ layout {
|
||||
var error_b = light.error || "#b00020";
|
||||
var inverse_b = light.inverse_primary || "#bb86fc";
|
||||
|
||||
var content = `# AUTO-GENERATED on ${new Date().toISOString()}
|
||||
background = ${bg}
|
||||
var content = `background = ${bg}
|
||||
foreground = ${fg}
|
||||
cursor-color = ${inverse}
|
||||
selection-background = ${secondary}
|
||||
@@ -259,8 +243,10 @@ palette = 13=${tertiary_ctr_b}
|
||||
palette = 14=${inverse_b}
|
||||
palette = 15=${fg_b}`;
|
||||
|
||||
ghosttyConfigWriter.command = ["bash", "-c", `echo '${content}' > ghostty-colors.generated.conf`];
|
||||
ghosttyConfigWriter.running = true;
|
||||
var ghosttyConfigDir = configDir + "/ghostty";
|
||||
var ghosttyConfigPath = ghosttyConfigDir + "/config-colors";
|
||||
|
||||
Quickshell.execDetached(["bash", "-c", `mkdir -p '${ghosttyConfigDir}' && echo '${content}' > '${ghosttyConfigPath}'`]);
|
||||
}
|
||||
|
||||
function checkGtkThemingAvailability() {
|
||||
@@ -273,97 +259,49 @@ palette = 15=${fg_b}`;
|
||||
|
||||
function generateSystemThemes() {
|
||||
if (systemThemeGenerationInProgress) {
|
||||
console.log("System theme generation already in progress, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!matugenAvailable) {
|
||||
console.warn("Matugen not available, cannot generate system themes");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wallpaperPath || wallpaperPath === "") {
|
||||
console.warn("No wallpaper path set, cannot generate system themes");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Generating system themes using matugen templates");
|
||||
console.log("Wallpaper:", wallpaperPath);
|
||||
console.log("Shell directory:", shellDir);
|
||||
|
||||
// Get current theme preferences
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
|
||||
console.log("Theme mode:", isLight === "true" ? "light" : "dark");
|
||||
console.log("Icon theme:", iconTheme);
|
||||
console.log("GTK theming enabled:", gtkTheming);
|
||||
console.log("Qt theming enabled:", qtTheming);
|
||||
|
||||
systemThemeGenerationInProgress = true;
|
||||
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
|
||||
systemThemeGenerator.running = true;
|
||||
}
|
||||
|
||||
function generateGtkThemes() {
|
||||
console.log("Generating GTK themes using matugen templates");
|
||||
generateSystemThemes();
|
||||
}
|
||||
|
||||
function generateQtThemes() {
|
||||
console.log("Generating Qt themes using matugen templates");
|
||||
generateSystemThemes();
|
||||
}
|
||||
|
||||
function restoreSystemThemes() {
|
||||
console.log("Restoring original system themes");
|
||||
|
||||
const shellDir = root.shellDir;
|
||||
if (!shellDir) {
|
||||
console.warn("Shell directory not available, cannot restore system themes");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get current theme preferences
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
|
||||
console.log("Restoring to theme mode:", isLight === "true" ? "light" : "dark");
|
||||
console.log("Icon theme:", iconTheme);
|
||||
console.log("GTK theming enabled:", gtkTheming);
|
||||
console.log("Qt theming enabled:", qtTheming);
|
||||
|
||||
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, configDir, "restore", isLight, iconTheme, gtkTheming, qtTheming];
|
||||
systemThemeRestoreProcess.running = true;
|
||||
}
|
||||
|
||||
Process {
|
||||
id: niriConfigWriter
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
console.log("Generated niri-colors.generated.kdl");
|
||||
} else {
|
||||
console.warn("Failed to generate niri config, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: ghosttyConfigWriter
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
console.log("Generated ghostty-colors.generated.conf");
|
||||
} else {
|
||||
console.warn("Failed to generate ghostty config, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: gtkAvailabilityChecker
|
||||
@@ -371,7 +309,6 @@ palette = 15=${fg_b}`;
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
gtkThemingEnabled = (exitCode === 0);
|
||||
console.log("GTK theming available:", gtkThemingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +318,6 @@ palette = 15=${fg_b}`;
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
qtThemingEnabled = (exitCode === 0);
|
||||
console.log("Qt theming available:", qtThemingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,21 +333,10 @@ palette = 15=${fg_b}`;
|
||||
id: systemThemeStderr
|
||||
}
|
||||
|
||||
onStarted: {
|
||||
console.log("System theme generation process started with command:", command);
|
||||
}
|
||||
|
||||
onExited: (exitCode) => {
|
||||
systemThemeGenerationInProgress = false;
|
||||
console.log("System theme generation process exited with code:", exitCode);
|
||||
|
||||
if (exitCode === 0) {
|
||||
console.log("System themes generated successfully");
|
||||
console.log("stdout:", systemThemeStdout.text);
|
||||
} else {
|
||||
console.error("System theme generation failed, exit code:", exitCode);
|
||||
console.error("stdout:", systemThemeStdout.text);
|
||||
console.error("stderr:", systemThemeStderr.text);
|
||||
if (exitCode !== 0) {
|
||||
ToastService.showError("Failed to generate system themes: " + systemThemeStderr.text);
|
||||
}
|
||||
}
|
||||
@@ -429,21 +354,10 @@ palette = 15=${fg_b}`;
|
||||
id: restoreThemeStderr
|
||||
}
|
||||
|
||||
onStarted: {
|
||||
console.log("System theme restoration process started with command:", command);
|
||||
}
|
||||
|
||||
onExited: (exitCode) => {
|
||||
console.log("System theme restoration process exited with code:", exitCode);
|
||||
|
||||
if (exitCode === 0) {
|
||||
console.log("System themes restored successfully");
|
||||
console.log("stdout:", restoreThemeStdout.text);
|
||||
ToastService.showInfo("System themes restored to default");
|
||||
} else {
|
||||
console.error("System theme restoration failed, exit code:", exitCode);
|
||||
console.error("stdout:", restoreThemeStdout.text);
|
||||
console.error("stderr:", restoreThemeStderr.text);
|
||||
ToastService.showWarning("Failed to restore system themes: " + restoreThemeStderr.text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,10 @@ Singleton {
|
||||
property var topBarCenterWidgets: ["clock", "music", "weather"]
|
||||
property var topBarRightWidgets: ["systemTray", "clipboard", "systemResources", "notificationButton", "battery", "controlCenterButton"]
|
||||
|
||||
// Reactive ListModel properties for TopBar
|
||||
property alias topBarLeftWidgetsModel: leftWidgetsModel
|
||||
property alias topBarCenterWidgetsModel: centerWidgetsModel
|
||||
property alias topBarRightWidgetsModel: rightWidgetsModel
|
||||
|
||||
// Signal to force immediate TopBar layout refresh
|
||||
signal forceTopBarLayoutRefresh()
|
||||
|
||||
ListModel {
|
||||
@@ -108,7 +106,6 @@ Singleton {
|
||||
|
||||
if (missingFonts.length > 0) {
|
||||
var message = "Missing fonts: " + missingFonts.join(", ") + ". Using system defaults."
|
||||
console.warn("Prefs: " + message)
|
||||
ToastService.showWarning(message)
|
||||
}
|
||||
}
|
||||
@@ -162,7 +159,6 @@ Singleton {
|
||||
showWorkspaceIndex = settings.showWorkspaceIndex !== undefined ? settings.showWorkspaceIndex : false;
|
||||
showWorkspacePadding = settings.showWorkspacePadding !== undefined ? settings.showWorkspacePadding : false;
|
||||
if (settings.topBarWidgetOrder) {
|
||||
// Migrate from old single list to new three-list system
|
||||
topBarLeftWidgets = settings.topBarWidgetOrder.filter(w => ["launcherButton", "workspaceSwitcher", "focusedWindow"].includes(w));
|
||||
topBarCenterWidgets = settings.topBarWidgetOrder.filter(w => ["clock", "music", "weather"].includes(w));
|
||||
topBarRightWidgets = settings.topBarWidgetOrder.filter(w => ["systemTray", "clipboard", "systemResources", "notificationButton", "battery", "controlCenterButton"].includes(w));
|
||||
@@ -497,7 +493,6 @@ Singleton {
|
||||
function updateListModel(listModel, order) {
|
||||
listModel.clear();
|
||||
for (var i = 0; i < order.length; i++) {
|
||||
// Handle both old string format and new object format
|
||||
var widgetId = typeof order[i] === "string" ? order[i] : order[i].id;
|
||||
var enabled = typeof order[i] === "string" ? true : order[i].enabled;
|
||||
var size = typeof order[i] === "string" ? undefined : order[i].size;
|
||||
@@ -577,21 +572,16 @@ Singleton {
|
||||
updateQtIconTheme(themeName);
|
||||
saveSettings();
|
||||
|
||||
// If dynamic theme is active, regenerate system themes with new icon theme
|
||||
if (typeof Theme !== "undefined" && Theme.isDynamicTheme && typeof Colors !== "undefined") {
|
||||
console.log("Icon theme changed during dynamic theming - regenerating system themes");
|
||||
Colors.generateSystemThemes();
|
||||
}
|
||||
}
|
||||
|
||||
function updateGtkIconTheme(themeName) {
|
||||
console.log("Updating GTK icon theme to:", themeName);
|
||||
var gtkThemeName = (themeName === "System Default") ? systemDefaultIconTheme : themeName;
|
||||
|
||||
// Update icon theme via dconf/gsettings AND settings.ini files
|
||||
if (gtkThemeName !== "System Default" && gtkThemeName !== "") {
|
||||
var script =
|
||||
"# Update dconf/gsettings with multiple fallbacks for Fedora\n" +
|
||||
var script =
|
||||
"if command -v gsettings >/dev/null 2>&1 && gsettings list-schemas | grep -q org.gnome.desktop.interface; then\n" +
|
||||
" gsettings set org.gnome.desktop.interface icon-theme '" + gtkThemeName + "'\n" +
|
||||
" echo 'Updated via gsettings'\n" +
|
||||
@@ -635,7 +625,6 @@ Singleton {
|
||||
}
|
||||
|
||||
function updateQtIconTheme(themeName) {
|
||||
console.log("Updating Qt icon theme to:", themeName);
|
||||
var qtThemeName = (themeName === "System Default") ? "" : themeName;
|
||||
|
||||
var home = _shq(root._homeUrl.replace("file://", ""));
|
||||
@@ -743,7 +732,6 @@ Singleton {
|
||||
wallpaperPath = path;
|
||||
saveSettings();
|
||||
|
||||
// Trigger dynamic theming if enabled
|
||||
if (wallpaperDynamicTheming && path && typeof Theme !== "undefined") {
|
||||
Theme.switchTheme(themeIndex, true, true);
|
||||
}
|
||||
@@ -753,7 +741,6 @@ Singleton {
|
||||
wallpaperDynamicTheming = enabled;
|
||||
saveSettings();
|
||||
|
||||
// If enabled and we have a wallpaper, trigger dynamic theming
|
||||
if (enabled && wallpaperPath && typeof Theme !== "undefined") {
|
||||
Theme.switchTheme(themeIndex, true, true);
|
||||
}
|
||||
@@ -763,7 +750,6 @@ Singleton {
|
||||
wallpaperPath = imagePath;
|
||||
saveSettings();
|
||||
|
||||
// Trigger color extraction if dynamic theming is enabled
|
||||
if (wallpaperDynamicTheming && typeof Colors !== "undefined") {
|
||||
Colors.extractColors();
|
||||
}
|
||||
@@ -799,7 +785,6 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
// Helper to safely single-quote shell strings
|
||||
function _shq(s) {
|
||||
return "'" + String(s).replace(/'/g, "'\\''") + "'";
|
||||
}
|
||||
@@ -819,64 +804,7 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: gtk3Process
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
} else {
|
||||
console.warn("Failed to update GTK 3 settings, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: gtk4Process
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
} else {
|
||||
console.warn("Failed to update GTK 4 settings, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: reloadThemeProcess
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode === 0) {
|
||||
} else {
|
||||
console.log("GTK theme reload failed (this is normal if gsettings is not available), exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: qtThemeProcess
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
// Qt theme reload signal sent
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: envCheckProcess
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Environment check failed, exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process {
|
||||
id: envSetProcess
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process {
|
||||
id: systemDefaultDetectionProcess
|
||||
|
||||
@@ -9,7 +9,6 @@ import Quickshell.Services.UPower
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Theme definitions with complete Material 3 expressive color palettes
|
||||
property var themes: [{
|
||||
"name": "Blue",
|
||||
"primary": "#42a5f5",
|
||||
@@ -171,7 +170,6 @@ Singleton {
|
||||
"surfaceContainer": "#201a19",
|
||||
"surfaceContainerHigh": "#2b2221"
|
||||
}]
|
||||
// Light theme variants
|
||||
property var lightThemes: [{
|
||||
"name": "Blue Light",
|
||||
"primary": "#1976d2",
|
||||
@@ -333,11 +331,9 @@ Singleton {
|
||||
"surfaceContainer": "#f3f3f3",
|
||||
"surfaceContainerHigh": "#ececec"
|
||||
}]
|
||||
// Current theme index (10 = Auto/Dynamic)
|
||||
property int currentThemeIndex: 0
|
||||
property bool isDynamicTheme: false
|
||||
property bool isLightMode: false
|
||||
// Dynamic color properties that change based on current theme
|
||||
property color primary: isDynamicTheme ? Colors.accentHi : getCurrentTheme().primary
|
||||
property color primaryText: isDynamicTheme ? Colors.primaryText : getCurrentTheme().primaryText
|
||||
property color primaryContainer: isDynamicTheme ? Colors.primaryContainer : getCurrentTheme().primaryContainer
|
||||
@@ -352,25 +348,20 @@ Singleton {
|
||||
property color outline: isDynamicTheme ? Colors.outline : getCurrentTheme().outline
|
||||
property color surfaceContainer: isDynamicTheme ? Colors.surfaceContainer : getCurrentTheme().surfaceContainer
|
||||
property color surfaceContainerHigh: isDynamicTheme ? Colors.surfaceContainerHigh : getCurrentTheme().surfaceContainerHigh
|
||||
// Static colors that don't change with themes
|
||||
property color archBlue: "#1793D1"
|
||||
property color success: "#4CAF50"
|
||||
property color warning: "#FF9800"
|
||||
property color info: "#2196F3"
|
||||
property color error: "#F2B8B5"
|
||||
|
||||
// Common alpha color variants for consistency
|
||||
// Primary colors with alpha
|
||||
property color primaryHover: Qt.rgba(primary.r, primary.g, primary.b, 0.12)
|
||||
property color primaryHoverLight: Qt.rgba(primary.r, primary.g, primary.b, 0.08)
|
||||
property color primaryPressed: Qt.rgba(primary.r, primary.g, primary.b, 0.16)
|
||||
property color primarySelected: Qt.rgba(primary.r, primary.g, primary.b, 0.3)
|
||||
property color primaryBackground: Qt.rgba(primary.r, primary.g, primary.b, 0.04)
|
||||
|
||||
// Secondary colors with alpha
|
||||
property color secondaryHover: Qt.rgba(secondary.r, secondary.g, secondary.b, 0.08)
|
||||
|
||||
// Surface colors with alpha
|
||||
property color surfaceHover: Qt.rgba(surfaceVariant.r, surfaceVariant.g, surfaceVariant.b, 0.08)
|
||||
property color surfacePressed: Qt.rgba(surfaceVariant.r, surfaceVariant.g, surfaceVariant.b, 0.12)
|
||||
property color surfaceSelected: Qt.rgba(surfaceVariant.r, surfaceVariant.g, surfaceVariant.b, 0.15)
|
||||
@@ -382,7 +373,6 @@ Singleton {
|
||||
property color surfaceTextLight: Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.06)
|
||||
property color surfaceTextMedium: Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.7)
|
||||
|
||||
// Outline colors with alpha
|
||||
property color outlineLight: Qt.rgba(outline.r, outline.g, outline.b, 0.05)
|
||||
property color outlineMedium: Qt.rgba(outline.r, outline.g, outline.b, 0.08)
|
||||
property color outlineStrong: Qt.rgba(outline.r, outline.g, outline.b, 0.12)
|
||||
@@ -390,14 +380,11 @@ Singleton {
|
||||
property color outlineHeavy: Qt.rgba(outline.r, outline.g, outline.b, 0.3)
|
||||
property color outlineButton: Qt.rgba(outline.r, outline.g, outline.b, 0.5)
|
||||
|
||||
// Error colors with alpha
|
||||
property color errorHover: Qt.rgba(error.r, error.g, error.b, 0.12)
|
||||
property color errorPressed: Qt.rgba(error.r, error.g, error.b, 0.9)
|
||||
|
||||
// Warning colors with alpha
|
||||
property color warningHover: Qt.rgba(warning.r, warning.g, warning.b, 0.12)
|
||||
|
||||
// Shadow colors
|
||||
property color shadowLight: Qt.rgba(0, 0, 0, 0.05)
|
||||
property color shadowMedium: Qt.rgba(0, 0, 0, 0.08)
|
||||
property color shadowDark: Qt.rgba(0, 0, 0, 0.1)
|
||||
@@ -429,80 +416,51 @@ Singleton {
|
||||
property real opacityMedium: 0.6
|
||||
property real opacityHigh: 0.87
|
||||
property real opacityFull: 1
|
||||
// Transparency system - can be overridden by Prefs
|
||||
property real panelTransparency: 0.85
|
||||
property real widgetTransparency: 0.85
|
||||
property real popupTransparency: 0.92
|
||||
|
||||
// Handle successful color extraction
|
||||
function onColorsUpdated() {
|
||||
console.log("Colors updated successfully - switching to dynamic theme");
|
||||
// Only switch to dynamic theme if we're already in dynamic mode
|
||||
if (isDynamicTheme) {
|
||||
currentThemeIndex = 10;
|
||||
isDynamicTheme = true;
|
||||
console.log("Dynamic theme activated. Theme.primary should now be:", primary);
|
||||
// Save preference after successful switch
|
||||
if (typeof Prefs !== "undefined")
|
||||
Prefs.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
|
||||
} else {
|
||||
console.log("Color extraction completed, but staying with static theme");
|
||||
}
|
||||
}
|
||||
|
||||
// Function to switch themes
|
||||
function switchTheme(themeIndex, isDynamic = false, savePrefs = true) {
|
||||
console.log("Theme.switchTheme called:", themeIndex, isDynamic, "savePrefs:", savePrefs);
|
||||
if (isDynamic && themeIndex === 10) {
|
||||
console.log("Attempting to switch to dynamic theme - checking colors first");
|
||||
// Set dynamic theme flag immediately so onColorsUpdated works
|
||||
isDynamicTheme = true;
|
||||
// Don't change theme index yet - wait for color extraction to succeed
|
||||
if (typeof Colors !== "undefined") {
|
||||
console.log("Calling Colors.extractColors()");
|
||||
Colors.extractColors();
|
||||
} else {
|
||||
console.error("Colors singleton not available");
|
||||
}
|
||||
} else if (themeIndex >= 0 && themeIndex < themes.length) {
|
||||
// If switching away from dynamic theme, restore system themes
|
||||
if (isDynamicTheme && typeof Colors !== "undefined") {
|
||||
console.log("Switching away from dynamic theme, restoring system themes");
|
||||
Colors.restoreSystemThemes();
|
||||
}
|
||||
currentThemeIndex = themeIndex;
|
||||
isDynamicTheme = false;
|
||||
}
|
||||
// Save preference (unless this is a startup restoration)
|
||||
if (savePrefs && typeof Prefs !== "undefined")
|
||||
Prefs.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
|
||||
}
|
||||
|
||||
// Function to toggle light/dark mode
|
||||
function toggleLightMode(savePrefs = true) {
|
||||
console.log("Theme.toggleLightMode called, current isLightMode:", isLightMode);
|
||||
isLightMode = !isLightMode;
|
||||
console.log("Light mode toggled to:", isLightMode);
|
||||
// Save preference
|
||||
if (savePrefs && typeof Prefs !== "undefined")
|
||||
Prefs.setLightMode(isLightMode);
|
||||
|
||||
}
|
||||
|
||||
// Helper function to get current theme array
|
||||
function getCurrentThemeArray() {
|
||||
return isLightMode ? lightThemes : themes;
|
||||
}
|
||||
|
||||
// Helper function to get current theme
|
||||
function getCurrentTheme() {
|
||||
var themeArray = getCurrentThemeArray();
|
||||
return currentThemeIndex < themeArray.length ? themeArray[currentThemeIndex] : themeArray[0];
|
||||
}
|
||||
|
||||
// Smart transparency functions for content-aware backgrounds
|
||||
function getPopupBackgroundAlpha() {
|
||||
return popupTransparency;
|
||||
}
|
||||
@@ -511,7 +469,6 @@ Singleton {
|
||||
return popupTransparency;
|
||||
}
|
||||
|
||||
// Convenience functions for themed backgrounds with transparency
|
||||
function popupBackground() {
|
||||
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, popupTransparency);
|
||||
}
|
||||
@@ -606,7 +563,6 @@ Singleton {
|
||||
}
|
||||
|
||||
function getPowerProfileLabel(profile) {
|
||||
console.log("Theme.getPowerProfileLabel called with profile:", profile);
|
||||
switch (profile) {
|
||||
case PowerProfile.PowerSaver:
|
||||
return "Power Saver";
|
||||
@@ -632,14 +588,10 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize theme system
|
||||
Component.onCompleted: {
|
||||
console.log("Theme Component.onCompleted");
|
||||
// Connect to Colors signal
|
||||
if (typeof Colors !== "undefined")
|
||||
Colors.colorsUpdated.connect(root.onColorsUpdated);
|
||||
|
||||
// Initialize transparency values from Prefs
|
||||
if (typeof Prefs !== "undefined") {
|
||||
if (Prefs.popupTransparency !== undefined)
|
||||
root.popupTransparency = Prefs.popupTransparency;
|
||||
@@ -647,23 +599,18 @@ Singleton {
|
||||
if (Prefs.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = Prefs.topBarWidgetTransparency;
|
||||
|
||||
// Connect to transparency changes
|
||||
if (Prefs.popupTransparencyChanged)
|
||||
Prefs.popupTransparencyChanged.connect(function() {
|
||||
if (typeof Prefs !== "undefined" && Prefs.popupTransparency !== undefined)
|
||||
root.popupTransparency = Prefs.popupTransparency;
|
||||
|
||||
});
|
||||
|
||||
if (Prefs.topBarWidgetTransparencyChanged)
|
||||
Prefs.topBarWidgetTransparencyChanged.connect(function() {
|
||||
if (typeof Prefs !== "undefined" && Prefs.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = Prefs.topBarWidgetTransparency;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
console.log("Theme initialized, waiting for Prefs to load settings and apply theme");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
DankModal {
|
||||
// Don't hide the interface, just show toast
|
||||
|
||||
id: clipboardHistoryModal
|
||||
|
||||
@@ -18,8 +17,6 @@ DankModal {
|
||||
property bool showClearConfirmation: false
|
||||
property var clipboardEntries: []
|
||||
property string searchText: ""
|
||||
property bool imagemagickAvailable: false
|
||||
property string thumbnailCacheDir: ""
|
||||
|
||||
function updateFilteredModel() {
|
||||
filteredClipboardModel.clear();
|
||||
@@ -52,7 +49,7 @@ DankModal {
|
||||
clipboardHistoryModal.isVisible = true;
|
||||
initializeThumbnailSystem();
|
||||
refreshClipboard();
|
||||
console.log("ClipboardHistoryModal: Opening and refreshing");
|
||||
|
||||
}
|
||||
|
||||
function hide() {
|
||||
@@ -62,34 +59,17 @@ DankModal {
|
||||
}
|
||||
|
||||
function initializeThumbnailSystem() {
|
||||
getCacheDirProcess.running = true;
|
||||
// No initialization needed - using direct image display
|
||||
}
|
||||
|
||||
function cleanupTempFiles() {
|
||||
cleanupProcess.command = ["sh", "-c", "rm -f /tmp/clipboard_preview_*.png"];
|
||||
cleanupProcess.running = true;
|
||||
Quickshell.execDetached(["sh", "-c", "rm -f /tmp/clipboard_*.png"]);
|
||||
}
|
||||
|
||||
function generateThumbnails() {
|
||||
if (!imagemagickAvailable)
|
||||
return ;
|
||||
|
||||
for (let i = 0; i < clipboardModel.count; i++) {
|
||||
const entry = clipboardModel.get(i).entry;
|
||||
const entryType = getEntryType(entry);
|
||||
if (entryType === "image") {
|
||||
const entryId = entry.split('\t')[0];
|
||||
const thumbnailPath = `${thumbnailCacheDir}/${entryId}.png`;
|
||||
thumbnailGenProcess.command = ["sh", "-c", `mkdir -p "${thumbnailCacheDir}" && cliphist decode ${entryId} | magick - -resize '128x128>' "${thumbnailPath}"`];
|
||||
thumbnailGenProcess.running = true;
|
||||
}
|
||||
}
|
||||
// No thumbnail generation needed - using direct image display
|
||||
}
|
||||
|
||||
function getThumbnailPath(entry) {
|
||||
const entryId = entry.split('\t')[0];
|
||||
return `${thumbnailCacheDir}/${entryId}.png`;
|
||||
}
|
||||
|
||||
function refreshClipboard() {
|
||||
clipboardProcess.running = true;
|
||||
@@ -97,15 +77,14 @@ DankModal {
|
||||
|
||||
function copyEntry(entry) {
|
||||
const entryId = entry.split('\t')[0];
|
||||
copyProcess.command = ["sh", "-c", `cliphist decode ${entryId} | wl-copy`];
|
||||
copyProcess.running = true;
|
||||
console.log("ClipboardHistoryModal: Entry copied, showing toast");
|
||||
Quickshell.execDetached(["sh", "-c", `cliphist decode ${entryId} | wl-copy`]);
|
||||
|
||||
ToastService.showInfo("Copied to clipboard");
|
||||
clipboardHistoryModal.hide();
|
||||
}
|
||||
|
||||
function deleteEntry(entry) {
|
||||
console.log("Deleting entry:", entry);
|
||||
|
||||
deleteProcess.command = ["sh", "-c", `echo '${entry.replace(/'/g, "'\\''")}' | cliphist delete`];
|
||||
deleteProcess.running = true;
|
||||
}
|
||||
@@ -143,7 +122,7 @@ DankModal {
|
||||
return "text";
|
||||
}
|
||||
|
||||
// DankModal configuration
|
||||
|
||||
visible: isVisible
|
||||
width: 650
|
||||
height: 550
|
||||
@@ -157,7 +136,6 @@ DankModal {
|
||||
hide();
|
||||
}
|
||||
|
||||
// Clear confirmation dialog
|
||||
DankModal {
|
||||
id: clearConfirmDialog
|
||||
|
||||
@@ -264,7 +242,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Data models
|
||||
ListModel {
|
||||
id: clipboardModel
|
||||
}
|
||||
@@ -273,7 +250,6 @@ DankModal {
|
||||
id: filteredClipboardModel
|
||||
}
|
||||
|
||||
// Processes
|
||||
Process {
|
||||
id: clipboardProcess
|
||||
|
||||
@@ -292,23 +268,11 @@ DankModal {
|
||||
|
||||
}
|
||||
updateFilteredModel();
|
||||
generateThumbnails();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Process {
|
||||
id: copyProcess
|
||||
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.error("Copy failed with exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: deleteProcess
|
||||
|
||||
@@ -317,10 +281,11 @@ DankModal {
|
||||
if (exitCode === 0)
|
||||
refreshClipboard();
|
||||
else
|
||||
console.error("Delete failed with exit code:", exitCode);
|
||||
console.warn("Failed to delete clipboard entry");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process {
|
||||
id: clearProcess
|
||||
|
||||
@@ -332,71 +297,31 @@ DankModal {
|
||||
filteredClipboardModel.clear();
|
||||
totalCount = 0;
|
||||
} else {
|
||||
console.error("Clear failed with exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: cleanupProcess
|
||||
|
||||
running: false
|
||||
}
|
||||
|
||||
Process {
|
||||
id: getCacheDirProcess
|
||||
|
||||
command: ["sh", "-c", "echo ${XDG_CACHE_HOME:-$HOME/.cache}/cliphist/thumbs"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
thumbnailCacheDir = text.trim();
|
||||
checkImageMagickProcess.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Process {
|
||||
id: checkImageMagickProcess
|
||||
|
||||
command: ["which", "magick"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
imagemagickAvailable = (exitCode === 0);
|
||||
if (!imagemagickAvailable)
|
||||
console.warn("ClipboardHistoryModal: ImageMagick not available, thumbnails disabled");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: thumbnailGenProcess
|
||||
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("ClipboardHistoryModal: Thumbnail generation failed with exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open() {
|
||||
console.log("ClipboardHistoryModal: IPC open() called");
|
||||
|
||||
clipboardHistoryModal.show();
|
||||
return "CLIPBOARD_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close() {
|
||||
console.log("ClipboardHistoryModal: IPC close() called");
|
||||
|
||||
clipboardHistoryModal.hide();
|
||||
return "CLIPBOARD_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
console.log("ClipboardHistoryModal: IPC toggle() called");
|
||||
|
||||
clipboardHistoryModal.toggle();
|
||||
return "CLIPBOARD_TOGGLE_SUCCESS";
|
||||
}
|
||||
@@ -559,7 +484,6 @@ DankModal {
|
||||
anchors.rightMargin: Theme.spacingS // Reduced right margin
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Index number
|
||||
Rectangle {
|
||||
width: 24
|
||||
height: 24
|
||||
@@ -577,63 +501,49 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Content thumbnail/icon and text
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width - 68 // Account for index (24) + spacing (16) + delete button (32) - small margin
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Thumbnail or icon container
|
||||
Item {
|
||||
width: entryType === "image" ? 48 : Theme.iconSize
|
||||
height: entryType === "image" ? 48 : Theme.iconSize
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
// Image thumbnail
|
||||
CachingImage {
|
||||
id: thumbnailImageSource
|
||||
|
||||
anchors.fill: parent
|
||||
source: entryType === "image" && imagemagickAvailable ? "file://" + getThumbnailPath(model.entry) : ""
|
||||
property string entryId: model.entry.split('\t')[0]
|
||||
source: entryType === "image" && imageLoader.imageData ? `data:image/png;base64,${imageLoader.imageData}` : ""
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
smooth: true
|
||||
cache: true
|
||||
visible: false
|
||||
visible: false // Hide the original image
|
||||
asynchronous: true
|
||||
// Handle loading errors gracefully and retry once
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error && source !== "") {
|
||||
// Clear source to prevent repeated error attempts
|
||||
const originalSource = source;
|
||||
source = "";
|
||||
// Retry once after 2 seconds to allow thumbnail generation
|
||||
retryTimer.originalSource = originalSource;
|
||||
retryTimer.start();
|
||||
|
||||
Process {
|
||||
id: imageLoader
|
||||
property string imageData: ""
|
||||
|
||||
command: ["sh", "-c", `cliphist decode ${thumbnailImageSource.entryId} | base64 -w 0`]
|
||||
running: entryType === "image"
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
imageLoader.imageData = text.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: retryTimer
|
||||
|
||||
property string originalSource: ""
|
||||
|
||||
interval: 2000
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (originalSource !== "" && thumbnailImageSource.source === "")
|
||||
thumbnailImageSource.source = originalSource;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
source: thumbnailImageSource
|
||||
maskEnabled: true
|
||||
maskSource: clipboardCircularMask
|
||||
visible: entryType === "image" && imagemagickAvailable && thumbnailImageSource.status === Image.Ready
|
||||
visible: entryType === "image" && thumbnailImageSource.status === Image.Ready
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1
|
||||
}
|
||||
@@ -641,8 +551,8 @@ DankModal {
|
||||
Item {
|
||||
id: clipboardCircularMask
|
||||
|
||||
width: 48
|
||||
height: 48
|
||||
width: 48 - 4
|
||||
height: 48 - 4
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
visible: false
|
||||
@@ -656,9 +566,8 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Fallback icon
|
||||
DankIcon {
|
||||
visible: !(entryType === "image" && imagemagickAvailable && thumbnailImageSource.status === Image.Ready)
|
||||
visible: !(entryType === "image" && thumbnailImageSource.status === Image.Ready)
|
||||
name: {
|
||||
if (entryType === "image")
|
||||
return "image";
|
||||
@@ -716,7 +625,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Delete button
|
||||
DankActionButton {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
@@ -726,12 +634,11 @@ DankModal {
|
||||
iconColor: Theme.error
|
||||
hoverColor: Theme.errorHover
|
||||
onClicked: {
|
||||
console.log("Delete clicked for entry:", model.entry);
|
||||
|
||||
deleteEntry(model.entry);
|
||||
}
|
||||
}
|
||||
|
||||
// Main click area - explicitly excludes delete button area
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
|
||||
@@ -7,44 +7,31 @@ import qs.Common
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
// Core properties
|
||||
property alias content: contentLoader.sourceComponent
|
||||
// Sizing - can use fixed or relative to screen
|
||||
property real width: 400
|
||||
property real height: 300
|
||||
// Screen-relative sizing helpers
|
||||
readonly property real screenWidth: screen ? screen.width : 1920
|
||||
readonly property real screenHeight: screen ? screen.height : 1080
|
||||
// Background behavior
|
||||
property bool showBackground: true
|
||||
property real backgroundOpacity: 0.5
|
||||
// Positioning
|
||||
property string positioning: "center"
|
||||
// "center", "top-right", "custom"
|
||||
property point customPosition: Qt.point(0, 0)
|
||||
// Focus management
|
||||
property string keyboardFocus: "ondemand"
|
||||
// "ondemand", "exclusive", "none"
|
||||
property bool closeOnEscapeKey: true
|
||||
property bool closeOnBackgroundClick: true
|
||||
// Animation
|
||||
property string animationType: "scale"
|
||||
// "scale", "slide", "fade"
|
||||
property int animationDuration: Theme.mediumDuration
|
||||
property var animationEasing: Theme.emphasizedEasing
|
||||
// Styling
|
||||
property color backgroundColor: Theme.surfaceContainer
|
||||
property color borderColor: Theme.outlineMedium
|
||||
property real borderWidth: 1
|
||||
property real cornerRadius: Theme.cornerRadiusLarge
|
||||
property bool enableShadow: false
|
||||
|
||||
// Signals
|
||||
signal opened()
|
||||
signal dialogClosed()
|
||||
signal backgroundClicked()
|
||||
|
||||
// Convenience functions
|
||||
function open() {
|
||||
visible = true;
|
||||
}
|
||||
@@ -57,8 +44,6 @@ PanelWindow {
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
// PanelWindow configuration
|
||||
// visible property is inherited from PanelWindow
|
||||
color: "transparent"
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
@@ -76,7 +61,6 @@ PanelWindow {
|
||||
if (root.visible) {
|
||||
opened();
|
||||
} else {
|
||||
// Properly cleanup text input surfaces
|
||||
if (Qt.inputMethod) {
|
||||
Qt.inputMethod.hide();
|
||||
Qt.inputMethod.reset();
|
||||
@@ -92,7 +76,6 @@ PanelWindow {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
// Background overlay
|
||||
Rectangle {
|
||||
id: background
|
||||
|
||||
@@ -122,13 +105,11 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Main content container
|
||||
Rectangle {
|
||||
id: contentContainer
|
||||
|
||||
width: root.width
|
||||
height: root.height
|
||||
// Positioning
|
||||
anchors.centerIn: positioning === "center" ? parent : undefined
|
||||
x: {
|
||||
if (positioning === "top-right")
|
||||
@@ -149,7 +130,6 @@ PanelWindow {
|
||||
border.color: root.borderColor
|
||||
border.width: root.borderWidth
|
||||
layer.enabled: root.enableShadow
|
||||
// Animation properties
|
||||
opacity: root.visible ? 1 : 0
|
||||
scale: {
|
||||
if (root.animationType === "scale")
|
||||
@@ -157,7 +137,6 @@ PanelWindow {
|
||||
|
||||
return 1;
|
||||
}
|
||||
// Transform for slide animation
|
||||
transform: root.animationType === "slide" ? slideTransform : null
|
||||
|
||||
Translate {
|
||||
@@ -167,7 +146,6 @@ PanelWindow {
|
||||
y: root.visible ? 0 : -30
|
||||
}
|
||||
|
||||
// Content area
|
||||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
@@ -176,7 +154,6 @@ PanelWindow {
|
||||
asynchronous: false
|
||||
}
|
||||
|
||||
// Animations
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: root.animationDuration
|
||||
@@ -195,7 +172,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Shadow effect
|
||||
layer.effect: MultiEffect {
|
||||
shadowEnabled: true
|
||||
shadowHorizontalOffset: 0
|
||||
@@ -207,7 +183,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Keyboard handling
|
||||
FocusScope {
|
||||
id: focusScope
|
||||
|
||||
|
||||
@@ -44,9 +44,7 @@ DankModal {
|
||||
lastPath = Prefs.profileLastPath;
|
||||
}
|
||||
|
||||
// Check if last path exists, otherwise use home
|
||||
if (lastPath && lastPath !== "") {
|
||||
// TODO: Could add directory existence check here
|
||||
return lastPath;
|
||||
}
|
||||
return homeDir;
|
||||
@@ -81,13 +79,11 @@ DankModal {
|
||||
}
|
||||
|
||||
onCurrentPathChanged: {
|
||||
// Path changed, model will update automatically
|
||||
}
|
||||
|
||||
function navigateUp() {
|
||||
var path = currentPath;
|
||||
|
||||
// Don't go above home directory
|
||||
if (path === homeDir) {
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +91,6 @@ DankModal {
|
||||
var lastSlash = path.lastIndexOf('/');
|
||||
if (lastSlash > 0) {
|
||||
var newPath = path.substring(0, lastSlash);
|
||||
// Don't go above home directory
|
||||
if (newPath.length < homeDir.length) {
|
||||
currentPath = homeDir;
|
||||
saveLastPath(homeDir);
|
||||
@@ -117,7 +112,6 @@ DankModal {
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Header
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 40
|
||||
@@ -142,7 +136,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Close button positioned at right
|
||||
DankActionButton {
|
||||
circular: false
|
||||
iconName: "close"
|
||||
@@ -155,7 +148,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Current path display and navigation
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
@@ -197,7 +189,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// File grid
|
||||
GridView {
|
||||
id: fileGrid
|
||||
|
||||
@@ -251,7 +242,6 @@ DankModal {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
// Image preview or folder icon
|
||||
Item {
|
||||
width: 80
|
||||
height: 60
|
||||
@@ -282,7 +272,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// File name
|
||||
StyledText {
|
||||
text: delegateRoot.fileName || ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
|
||||
@@ -53,7 +53,6 @@ DankModal {
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
|
||||
@@ -90,7 +89,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Network Details
|
||||
Flickable {
|
||||
property real wheelMultiplier: 1.8
|
||||
property int wheelBaseStep: 160
|
||||
@@ -148,7 +146,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Close Button
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 40
|
||||
|
||||
@@ -13,7 +13,7 @@ DankModal {
|
||||
property string powerConfirmMessage: ""
|
||||
|
||||
function executePowerAction(action) {
|
||||
console.log("Executing power action:", action);
|
||||
|
||||
let command = [];
|
||||
switch (action) {
|
||||
case "logout":
|
||||
@@ -30,12 +30,10 @@ DankModal {
|
||||
break;
|
||||
}
|
||||
if (command.length > 0) {
|
||||
powerActionProcess.command = command;
|
||||
powerActionProcess.running = true;
|
||||
Quickshell.execDetached(command);
|
||||
}
|
||||
}
|
||||
|
||||
// DankModal configuration
|
||||
visible: powerConfirmVisible
|
||||
width: 350
|
||||
height: 160
|
||||
@@ -45,17 +43,6 @@ DankModal {
|
||||
powerConfirmVisible = false;
|
||||
}
|
||||
|
||||
Process {
|
||||
id: powerActionProcess
|
||||
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.error("Power action failed with exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
content: Component {
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
@@ -65,7 +52,6 @@ DankModal {
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Title
|
||||
StyledText {
|
||||
text: powerConfirmTitle
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
@@ -84,7 +70,6 @@ DankModal {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
// Message
|
||||
StyledText {
|
||||
text: powerConfirmMessage
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
@@ -98,12 +83,10 @@ DankModal {
|
||||
height: Theme.spacingS
|
||||
}
|
||||
|
||||
// Buttons
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Cancel button
|
||||
Rectangle {
|
||||
width: 120
|
||||
height: 40
|
||||
@@ -131,7 +114,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Confirm button
|
||||
Rectangle {
|
||||
width: 120
|
||||
height: 40
|
||||
|
||||
@@ -24,7 +24,6 @@ DankModal {
|
||||
|
||||
function hide() {
|
||||
processListModal.visible = false;
|
||||
// Close any open context menus
|
||||
if (processContextMenu.visible)
|
||||
processContextMenu.close();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ DankModal {
|
||||
closingModal();
|
||||
|
||||
}
|
||||
// DankModal configuration
|
||||
visible: settingsVisible
|
||||
width: 750
|
||||
height: 750
|
||||
@@ -28,7 +27,6 @@ DankModal {
|
||||
settingsVisible = false;
|
||||
}
|
||||
|
||||
// Keyboard focus and shortcuts
|
||||
FocusScope {
|
||||
anchors.fill: parent
|
||||
focus: settingsModal.settingsVisible
|
||||
@@ -41,7 +39,6 @@ DankModal {
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -66,7 +63,6 @@ DankModal {
|
||||
height: 1
|
||||
}
|
||||
|
||||
// Close button
|
||||
DankActionButton {
|
||||
circular: false
|
||||
iconName: "close"
|
||||
@@ -78,7 +74,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Tabbed Settings
|
||||
Column {
|
||||
width: parent.width
|
||||
height: parent.height - 50
|
||||
@@ -102,13 +97,11 @@ DankModal {
|
||||
width: parent.width
|
||||
height: parent.height - settingsTabBar.height
|
||||
|
||||
// Content container with proper padding
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
color: "transparent"
|
||||
|
||||
// Personalization Tab
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 0
|
||||
@@ -119,7 +112,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Time & Weather Tab
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 1
|
||||
@@ -130,7 +122,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Widgets Tab
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 2
|
||||
@@ -141,7 +132,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Launcher Tab
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 3
|
||||
@@ -152,7 +142,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
// Appearance Tab
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 4
|
||||
@@ -172,19 +161,19 @@ DankModal {
|
||||
|
||||
IpcHandler {
|
||||
function open() {
|
||||
console.log("SettingsModal: IPC open() called");
|
||||
|
||||
settingsModal.settingsVisible = true;
|
||||
return "SETTINGS_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close() {
|
||||
console.log("SettingsModal: IPC close() called");
|
||||
|
||||
settingsModal.settingsVisible = false;
|
||||
return "SETTINGS_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
console.log("SettingsModal: IPC toggle() called");
|
||||
|
||||
settingsModal.settingsVisible = !settingsModal.settingsVisible;
|
||||
return "SETTINGS_TOGGLE_SUCCESS";
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ DankModal {
|
||||
property bool spotlightOpen: false
|
||||
|
||||
function show() {
|
||||
console.log("SpotlightModal: show() called");
|
||||
|
||||
spotlightOpen = true;
|
||||
console.log("SpotlightModal: spotlightOpen set to", spotlightOpen);
|
||||
|
||||
appLauncher.searchQuery = "";
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ DankModal {
|
||||
show();
|
||||
}
|
||||
|
||||
// DankModal configuration
|
||||
visible: spotlightOpen
|
||||
width: 550
|
||||
height: 600
|
||||
@@ -45,7 +44,7 @@ DankModal {
|
||||
borderWidth: 1
|
||||
enableShadow: true
|
||||
onVisibleChanged: {
|
||||
console.log("SpotlightModal visibility changed to:", visible);
|
||||
|
||||
if (visible && !spotlightOpen)
|
||||
show();
|
||||
|
||||
@@ -54,10 +53,9 @@ DankModal {
|
||||
spotlightOpen = false;
|
||||
}
|
||||
Component.onCompleted: {
|
||||
console.log("SpotlightModal: Component.onCompleted called - component loaded successfully!");
|
||||
|
||||
}
|
||||
|
||||
// App launcher logic
|
||||
AppLauncher {
|
||||
id: appLauncher
|
||||
|
||||
@@ -71,19 +69,19 @@ DankModal {
|
||||
|
||||
IpcHandler {
|
||||
function open() {
|
||||
console.log("SpotlightModal: IPC open() called");
|
||||
|
||||
spotlightModal.show();
|
||||
return "SPOTLIGHT_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close() {
|
||||
console.log("SpotlightModal: IPC close() called");
|
||||
|
||||
spotlightModal.hide();
|
||||
return "SPOTLIGHT_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
console.log("SpotlightModal: IPC toggle() called");
|
||||
|
||||
spotlightModal.toggle();
|
||||
return "SPOTLIGHT_TOGGLE_SUCCESS";
|
||||
}
|
||||
@@ -97,7 +95,6 @@ DankModal {
|
||||
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
// Handle keyboard shortcuts
|
||||
Keys.onPressed: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
hide();
|
||||
@@ -153,7 +150,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Search field with view toggle buttons
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -211,13 +207,11 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// View mode toggle buttons next to search bar
|
||||
Row {
|
||||
spacing: Theme.spacingXS
|
||||
visible: appLauncher.model.count > 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
// List view button
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
@@ -246,7 +240,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Grid view button
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
|
||||
@@ -25,7 +25,6 @@ DankModal {
|
||||
wifiPasswordInput = "";
|
||||
}
|
||||
|
||||
// Auto-reopen dialog on invalid password
|
||||
Connections {
|
||||
function onPasswordDialogShouldReopenChanged() {
|
||||
if (NetworkService.passwordDialogShouldReopen && NetworkService.connectingSSID !== "") {
|
||||
@@ -48,7 +47,6 @@ DankModal {
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
|
||||
@@ -86,7 +84,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Password input
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
@@ -133,7 +130,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Show password checkbox
|
||||
Row {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
@@ -177,7 +173,6 @@ DankModal {
|
||||
|
||||
}
|
||||
|
||||
// Buttons
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 40
|
||||
|
||||
@@ -31,7 +31,6 @@ PanelWindow {
|
||||
show();
|
||||
}
|
||||
|
||||
// Proper layer shell configuration
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
@@ -39,7 +38,6 @@ PanelWindow {
|
||||
visible: isVisible
|
||||
color: "transparent"
|
||||
|
||||
// Full screen overlay setup for proper focus
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
@@ -47,7 +45,6 @@ PanelWindow {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
// App launcher logic
|
||||
AppLauncher {
|
||||
id: appLauncher
|
||||
|
||||
@@ -59,12 +56,10 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Background click to close (no visual background)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: appDrawerPopout.isVisible
|
||||
onClicked: function(mouse) {
|
||||
// Only close if click is outside the launcher panel
|
||||
var localPos = mapToItem(launcherLoader, mouse.x, mouse.y);
|
||||
if (localPos.x < 0 || localPos.x > launcherLoader.width || localPos.y < 0 || localPos.y > launcherLoader.height)
|
||||
appDrawerPopout.hide();
|
||||
@@ -72,7 +67,6 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Main launcher panel with asynchronous loading
|
||||
Loader {
|
||||
id: launcherLoader
|
||||
|
||||
@@ -108,11 +102,9 @@ PanelWindow {
|
||||
|
||||
color: Theme.popupBackground()
|
||||
radius: Theme.cornerRadiusXLarge
|
||||
// Remove layer rendering for better performance
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
|
||||
// Material 3 elevation with multiple layers
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -3
|
||||
@@ -142,7 +134,6 @@ PanelWindow {
|
||||
z: -1
|
||||
}
|
||||
|
||||
// Content with focus management
|
||||
Item {
|
||||
id: keyHandler
|
||||
|
||||
@@ -153,7 +144,6 @@ PanelWindow {
|
||||
forceActiveFocus();
|
||||
|
||||
}
|
||||
// Handle keyboard shortcuts
|
||||
Keys.onPressed: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
appDrawerPopout.hide();
|
||||
@@ -174,7 +164,6 @@ PanelWindow {
|
||||
appLauncher.launchSelected();
|
||||
event.accepted = true;
|
||||
} else if (!searchField.activeFocus && event.text && event.text.length > 0 && event.text.match(/[a-zA-Z0-9\\s]/)) {
|
||||
// User started typing, focus search field and pass the character
|
||||
searchField.forceActiveFocus();
|
||||
searchField.insertText(event.text);
|
||||
event.accepted = true;
|
||||
@@ -214,7 +203,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Enhanced search field
|
||||
DankTextField {
|
||||
id: searchField
|
||||
|
||||
@@ -333,7 +321,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// App grid/list container with enhanced styling
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: {
|
||||
@@ -347,7 +334,6 @@ PanelWindow {
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
|
||||
border.width: 1
|
||||
|
||||
// List view
|
||||
DankListView {
|
||||
id: appList
|
||||
|
||||
@@ -372,7 +358,6 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Grid view
|
||||
DankGridView {
|
||||
id: appGrid
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import qs.Widgets
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// Public interface
|
||||
property string searchQuery: ""
|
||||
property string selectedCategory: "All"
|
||||
property string viewMode: "list" // "list" or "grid"
|
||||
@@ -18,7 +17,6 @@ Item {
|
||||
property bool debounceSearch: true
|
||||
property int debounceInterval: 50
|
||||
property bool keyboardNavigationActive: false
|
||||
// Categories (computed from AppSearchService)
|
||||
property var categories: {
|
||||
var allCategories = AppSearchService.getAllCategories().filter((cat) => {
|
||||
return cat !== "Education" && cat !== "Science";
|
||||
@@ -28,18 +26,13 @@ Item {
|
||||
return cat !== "All";
|
||||
}));
|
||||
}
|
||||
// Category icons (computed from AppSearchService)
|
||||
property var categoryIcons: categories.map((category) => {
|
||||
return AppSearchService.getCategoryIcon(category);
|
||||
})
|
||||
// App usage ranking helper
|
||||
property var appUsageRanking: Prefs.appUsageRanking
|
||||
// Internal model
|
||||
property alias model: filteredModel
|
||||
// Watch AppSearchService.applications changes via property binding
|
||||
property var _watchApplications: AppSearchService.applications
|
||||
|
||||
// Signals
|
||||
signal appLaunched(var app)
|
||||
signal categorySelected(string category)
|
||||
signal viewModeSelected(string mode)
|
||||
@@ -50,7 +43,6 @@ Item {
|
||||
keyboardNavigationActive = false;
|
||||
var apps = [];
|
||||
if (searchQuery.length === 0) {
|
||||
// Show apps from category
|
||||
if (selectedCategory === "All") {
|
||||
apps = AppSearchService.applications || [];
|
||||
} else {
|
||||
@@ -58,7 +50,6 @@ Item {
|
||||
apps = categoryApps.slice(0, maxResults);
|
||||
}
|
||||
} else {
|
||||
// Search with category filter
|
||||
if (selectedCategory === "All") {
|
||||
apps = AppSearchService.searchApplications(searchQuery);
|
||||
} else {
|
||||
@@ -88,7 +79,6 @@ Item {
|
||||
return (a.name || "").localeCompare(b.name || "");
|
||||
});
|
||||
|
||||
// Convert to model format and populate
|
||||
apps.forEach((app) => {
|
||||
if (app)
|
||||
filteredModel.append({
|
||||
@@ -103,7 +93,6 @@ Item {
|
||||
});
|
||||
}
|
||||
|
||||
// Keyboard navigation functions
|
||||
function selectNext() {
|
||||
if (filteredModel.count > 0) {
|
||||
keyboardNavigationActive = true;
|
||||
@@ -142,7 +131,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// App launching
|
||||
function launchSelected() {
|
||||
if (filteredModel.count > 0 && selectedIndex >= 0 && selectedIndex < filteredModel.count) {
|
||||
var selectedApp = filteredModel.get(selectedIndex);
|
||||
@@ -151,28 +139,24 @@ Item {
|
||||
}
|
||||
|
||||
function launchApp(appData) {
|
||||
if (!appData) {
|
||||
console.warn("AppLauncher: No app data provided");
|
||||
if (!appData)
|
||||
return ;
|
||||
}
|
||||
|
||||
appData.desktopEntry.execute();
|
||||
appLaunched(appData);
|
||||
Prefs.addAppUsage(appData.desktopEntry);
|
||||
}
|
||||
|
||||
// Category management
|
||||
function setCategory(category) {
|
||||
selectedCategory = category;
|
||||
categorySelected(category);
|
||||
}
|
||||
|
||||
// View mode management
|
||||
function setViewMode(mode) {
|
||||
viewMode = mode;
|
||||
viewModeSelected(mode);
|
||||
}
|
||||
|
||||
// Watch for changes
|
||||
onSearchQueryChanged: {
|
||||
if (debounceSearch)
|
||||
searchDebounceTimer.restart();
|
||||
@@ -182,7 +166,6 @@ Item {
|
||||
onSelectedCategoryChanged: updateFilteredModel()
|
||||
onAppUsageRankingChanged: updateFilteredModel()
|
||||
on_WatchApplicationsChanged: updateFilteredModel()
|
||||
// Initialize
|
||||
Component.onCompleted: {
|
||||
updateFilteredModel();
|
||||
}
|
||||
@@ -191,7 +174,6 @@ Item {
|
||||
id: filteredModel
|
||||
}
|
||||
|
||||
// Search debouncing
|
||||
Timer {
|
||||
id: searchDebounceTimer
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ Item {
|
||||
|
||||
height: compact ? 36 : (72 + Theme.spacingS) // Single row vs two rows
|
||||
|
||||
// Compact single-row layout (for SpotlightModal style)
|
||||
Row {
|
||||
visible: compact
|
||||
width: parent.width
|
||||
@@ -55,13 +54,11 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
// Two-row layout (for SpotlightModal organized style)
|
||||
Column {
|
||||
visible: !compact
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Top row: All, Development, Graphics, Games (4 items)
|
||||
Row {
|
||||
property var topRowCategories: ["All", "Development", "Graphics", "Games"]
|
||||
|
||||
@@ -105,7 +102,6 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
// Bottom row: Internet, Media, Office, Settings, System (5 items)
|
||||
Row {
|
||||
property var bottomRowCategories: ["Internet", "Media", "Office", "Settings", "System"]
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ Column {
|
||||
if (!CalendarService || !CalendarService.khalAvailable)
|
||||
return ;
|
||||
|
||||
// Calculate date range with padding
|
||||
let firstDay = new Date(displayDate.getFullYear(), displayDate.getMonth(), 1);
|
||||
let dayOfWeek = firstDay.getDay();
|
||||
let startDate = new Date(firstDay);
|
||||
@@ -27,7 +26,6 @@ Column {
|
||||
}
|
||||
|
||||
spacing: Theme.spacingM
|
||||
// Load events when display date changes
|
||||
onDisplayDateChanged: {
|
||||
loadEventsForMonth();
|
||||
}
|
||||
@@ -35,7 +33,6 @@ Column {
|
||||
loadEventsForMonth();
|
||||
}
|
||||
|
||||
// Load events when calendar service becomes available
|
||||
Connections {
|
||||
function onKhalAvailableChanged() {
|
||||
if (CalendarService && CalendarService.khalAvailable)
|
||||
@@ -47,7 +44,6 @@ Column {
|
||||
enabled: CalendarService !== null
|
||||
}
|
||||
|
||||
// Month navigation header
|
||||
Row {
|
||||
width: parent.width
|
||||
height: 40
|
||||
@@ -121,7 +117,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Days of week header
|
||||
Row {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -148,7 +143,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Calendar grid
|
||||
Grid {
|
||||
property date firstDay: {
|
||||
let date = new Date(displayDate.getFullYear(), displayDate.getMonth(), 1);
|
||||
@@ -196,7 +190,6 @@ Column {
|
||||
font.weight: isToday || isSelected ? Font.Medium : Font.Normal
|
||||
}
|
||||
|
||||
// Event indicator - bottom fill effect
|
||||
Rectangle {
|
||||
id: eventIndicator
|
||||
|
||||
|
||||
@@ -21,10 +21,7 @@ PanelWindow {
|
||||
if (calendarVisible) {
|
||||
internalVisible = true;
|
||||
Qt.callLater(() => {
|
||||
// This ensures opacity changes after window is visible
|
||||
internalVisible = true;
|
||||
// Force re-trigger if needed
|
||||
// Ensure events are loaded for current display month
|
||||
calendarGrid.loadEventsForMonth();
|
||||
});
|
||||
} else {
|
||||
@@ -51,8 +48,6 @@ PanelWindow {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
// Animation finished, now we can safely resize
|
||||
|
||||
id: mainContainer
|
||||
|
||||
readonly property real targetWidth: Math.min(Screen.width * 0.9, 600)
|
||||
@@ -67,21 +62,16 @@ PanelWindow {
|
||||
|
||||
function calculateHeight() {
|
||||
let contentHeight = Theme.spacingM * 2; // margins
|
||||
// Main row with widgets and calendar
|
||||
let widgetHeight = 160;
|
||||
// Media widget always present
|
||||
widgetHeight += 140 + Theme.spacingM;
|
||||
// Weather widget always present
|
||||
let calendarHeight = 300;
|
||||
let mainRowHeight = Math.max(widgetHeight, calendarHeight);
|
||||
contentHeight += mainRowHeight + Theme.spacingM;
|
||||
// Add events widget height - use calculated height instead of actual
|
||||
if (CalendarService && CalendarService.khalAvailable) {
|
||||
let hasEvents = events.selectedDateEvents && events.selectedDateEvents.length > 0;
|
||||
let eventsHeight = hasEvents ? Math.min(300, 80 + events.selectedDateEvents.length * 60) : 120;
|
||||
contentHeight += eventsHeight;
|
||||
} else {
|
||||
// When no khal, reduce bottom margin to match top
|
||||
contentHeight -= Theme.spacingM;
|
||||
}
|
||||
return Math.min(contentHeight, parent.height * 0.9);
|
||||
@@ -98,7 +88,6 @@ PanelWindow {
|
||||
scale: calendarVisible ? 1 : 0.9
|
||||
x: (Screen.width - targetWidth) / 2
|
||||
y: Theme.barHeight + 4
|
||||
// Only resize after animation is complete
|
||||
onOpacityChanged: {
|
||||
if (opacity === 1)
|
||||
Qt.callLater(() => {
|
||||
@@ -165,7 +154,6 @@ PanelWindow {
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Main row with widgets and calendar - improved spacing and proportions
|
||||
Row {
|
||||
width: parent.width
|
||||
height: {
|
||||
@@ -176,7 +164,6 @@ PanelWindow {
|
||||
}
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Left section for widgets - improved visual hierarchy
|
||||
Column {
|
||||
id: leftWidgets
|
||||
|
||||
@@ -200,7 +187,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Right section for calendar - enhanced container
|
||||
Rectangle {
|
||||
width: leftWidgets.hasAnyWidgets ? parent.width * 0.55 - Theme.spacingM : parent.width
|
||||
height: parent.height
|
||||
@@ -263,7 +249,6 @@ PanelWindow {
|
||||
z: -1
|
||||
enabled: calendarVisible
|
||||
onClicked: function(mouse) {
|
||||
// Only close if click is outside the main container
|
||||
var localPos = mapToItem(mainContainer, mouse.x, mouse.y);
|
||||
if (localPos.x < 0 || localPos.x > mainContainer.width || localPos.y < 0 || localPos.y > mainContainer.height)
|
||||
calendarVisible = false;
|
||||
|
||||
@@ -5,7 +5,6 @@ import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
// Events widget for selected date - Material Design 3 style
|
||||
Rectangle {
|
||||
id: events
|
||||
|
||||
@@ -17,7 +16,6 @@ Rectangle {
|
||||
function updateSelectedDateEvents() {
|
||||
if (CalendarService && CalendarService.khalAvailable) {
|
||||
let events = CalendarService.getEventsForDate(selectedDate);
|
||||
console.log("Events: Updating events for", Qt.formatDate(selectedDate, "yyyy-MM-dd"), "found", events.length, "events");
|
||||
selectedDateEvents = events;
|
||||
} else {
|
||||
selectedDateEvents = [];
|
||||
@@ -25,7 +23,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
onSelectedDateEventsChanged: {
|
||||
console.log("Events: selectedDateEvents changed, count:", selectedDateEvents.length);
|
||||
eventsList.model = selectedDateEvents;
|
||||
}
|
||||
width: parent.width
|
||||
@@ -35,7 +32,6 @@ Rectangle {
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
visible: shouldShow
|
||||
// Material elevation shadow
|
||||
layer.enabled: true
|
||||
Component.onCompleted: {
|
||||
updateSelectedDateEvents();
|
||||
@@ -44,7 +40,6 @@ Rectangle {
|
||||
updateSelectedDateEvents();
|
||||
}
|
||||
|
||||
// Update events when selected date or events change
|
||||
Connections {
|
||||
function onEventsByDateChanged() {
|
||||
updateSelectedDateEvents();
|
||||
@@ -58,7 +53,6 @@ Rectangle {
|
||||
enabled: CalendarService !== null
|
||||
}
|
||||
|
||||
// Header - always visible when widget is shown
|
||||
Row {
|
||||
id: headerRow
|
||||
|
||||
@@ -85,7 +79,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// No events placeholder - centered in entire widget (not just content area)
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
@@ -108,7 +101,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Events list - positioned below header when there are events
|
||||
ListView {
|
||||
id: eventsList
|
||||
|
||||
@@ -157,7 +149,6 @@ Rectangle {
|
||||
}
|
||||
border.width: 1
|
||||
|
||||
// Event indicator strip
|
||||
Rectangle {
|
||||
width: 4
|
||||
height: parent.height - 8
|
||||
@@ -270,7 +261,7 @@ Rectangle {
|
||||
onClicked: {
|
||||
if (modelData.url && modelData.url !== "") {
|
||||
if (Qt.openUrlExternally(modelData.url) === false)
|
||||
console.warn("Couldn't open", modelData.url);
|
||||
console.warn("Failed to open URL: " + modelData.url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ Rectangle {
|
||||
property string lastValidArtUrl: ""
|
||||
property real currentPosition: 0
|
||||
|
||||
// Simple progress ratio calculation
|
||||
function ratio() {
|
||||
return activePlayer && activePlayer.length > 0 ? currentPosition / activePlayer.length : 0;
|
||||
}
|
||||
@@ -41,26 +40,22 @@ Rectangle {
|
||||
|
||||
interval: 2000
|
||||
running: {
|
||||
// Run when no active player (for cache clearing) OR when playing (for position updates)
|
||||
return (!activePlayer) || (activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing && activePlayer.length > 0 && !progressMouseArea.isSeeking);
|
||||
}
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (!activePlayer) {
|
||||
// Clear cache when no player
|
||||
lastValidTitle = "";
|
||||
lastValidArtist = "";
|
||||
lastValidAlbum = "";
|
||||
lastValidArtUrl = "";
|
||||
stop(); // Stop after clearing cache
|
||||
} else if (activePlayer.playbackState === MprisPlaybackState.Playing && !progressMouseArea.isSeeking) {
|
||||
// Update position when playing
|
||||
currentPosition = activePlayer.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Backend events
|
||||
Connections {
|
||||
function onPositionChanged() {
|
||||
if (!progressMouseArea.isSeeking)
|
||||
@@ -83,7 +78,6 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
|
||||
// Placeholder when no media - centered in entire widget
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
@@ -105,19 +99,16 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Active content in a column
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
spacing: Theme.spacingS
|
||||
visible: activePlayer && activePlayer.trackTitle !== "" || lastValidTitle !== ""
|
||||
|
||||
// Normal media info when playing
|
||||
Row {
|
||||
width: parent.width
|
||||
height: 60
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Album Art
|
||||
Rectangle {
|
||||
width: 60
|
||||
height: 60
|
||||
@@ -161,7 +152,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Track Info
|
||||
Column {
|
||||
width: parent.width - 60 - Theme.spacingM
|
||||
height: parent.height
|
||||
@@ -218,7 +208,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Progress bar
|
||||
Item {
|
||||
id: progressBarContainer
|
||||
|
||||
@@ -252,7 +241,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Drag handle
|
||||
Rectangle {
|
||||
id: progressHandle
|
||||
|
||||
@@ -318,7 +306,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Global mouse area for drag tracking
|
||||
MouseArea {
|
||||
id: progressGlobalMouseArea
|
||||
|
||||
@@ -345,7 +332,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Control buttons - always visible
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -356,7 +342,6 @@ Rectangle {
|
||||
spacing: Theme.spacingM
|
||||
height: parent.height
|
||||
|
||||
// Previous button
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
@@ -380,7 +365,6 @@ Rectangle {
|
||||
if (!activePlayer)
|
||||
return ;
|
||||
|
||||
// >8 s → jump to start, otherwise previous track
|
||||
if (currentPosition > 8 && activePlayer.canSeek) {
|
||||
activePlayer.position = 0;
|
||||
currentPosition = 0;
|
||||
@@ -392,7 +376,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Play/Pause button
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: 32
|
||||
@@ -415,7 +398,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Next button
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
|
||||
@@ -20,7 +20,6 @@ Rectangle {
|
||||
service: WeatherService
|
||||
}
|
||||
|
||||
// Placeholder when no weather - centered in entire widget
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
@@ -42,14 +41,12 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Weather content when available - original Column structure
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingS
|
||||
visible: WeatherService.weather.available && WeatherService.weather.temp !== 0
|
||||
|
||||
// Weather header info
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 60
|
||||
@@ -58,7 +55,6 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Weather icon
|
||||
DankIcon {
|
||||
name: WeatherService.getWeatherIcon(WeatherService.weather.wCode)
|
||||
size: Theme.iconSize + 8
|
||||
@@ -103,7 +99,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Weather details grid
|
||||
Grid {
|
||||
columns: 2
|
||||
spacing: Theme.spacingM
|
||||
|
||||
@@ -23,13 +23,10 @@ PanelWindow {
|
||||
|
||||
visible: controlCenterVisible
|
||||
onVisibleChanged: {
|
||||
// Enable/disable WiFi auto-refresh based on control center visibility
|
||||
NetworkService.autoRefreshEnabled = visible && NetworkService.wifiEnabled;
|
||||
// Stop bluetooth scanning when control center is closed
|
||||
if (!visible && BluetoothService.adapter && BluetoothService.adapter.discovering)
|
||||
BluetoothService.adapter.discovering = false;
|
||||
|
||||
// Refresh uptime when opened
|
||||
if (visible && UserInfoService)
|
||||
UserInfoService.getUptime();
|
||||
|
||||
@@ -59,7 +56,6 @@ PanelWindow {
|
||||
height: root.powerOptionsExpanded ? 570 : 500
|
||||
y: Theme.barHeight + Theme.spacingXS
|
||||
x: Math.max(Theme.spacingL, Screen.width - targetWidth - Theme.spacingL)
|
||||
// GPU-accelerated scale + opacity animation
|
||||
opacity: controlCenterVisible ? 1 : 0
|
||||
scale: controlCenterVisible ? 1 : 0.9
|
||||
|
||||
@@ -86,7 +82,6 @@ PanelWindow {
|
||||
radius: Theme.cornerRadiusLarge
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
// Remove layer rendering for better performance
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
|
||||
@@ -95,7 +90,6 @@ PanelWindow {
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Elegant User Header
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
@@ -115,7 +109,6 @@ PanelWindow {
|
||||
anchors.rightMargin: Theme.spacingL
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Profile Picture Container
|
||||
Item {
|
||||
id: avatarContainer
|
||||
|
||||
@@ -124,7 +117,6 @@ PanelWindow {
|
||||
width: 64
|
||||
height: 64
|
||||
|
||||
// This rectangle provides the themed ring via its border.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: width / 2
|
||||
@@ -134,7 +126,6 @@ PanelWindow {
|
||||
visible: parent.hasImage
|
||||
}
|
||||
|
||||
// Hidden Image loader. Its only purpose is to load the texture.
|
||||
Image {
|
||||
id: profileImageLoader
|
||||
|
||||
@@ -183,7 +174,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Fallback for when there is no image.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: width / 2
|
||||
@@ -199,7 +189,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Error icon for when the image fails to load.
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "warning"
|
||||
@@ -210,7 +199,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// User Info Text
|
||||
Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
@@ -233,14 +221,12 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Action Buttons - Lock, Power and Settings
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.rightMargin: Theme.spacingL
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Lock Button
|
||||
DankActionButton {
|
||||
buttonSize: 40
|
||||
iconName: "lock"
|
||||
@@ -254,7 +240,6 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// Power Button
|
||||
Rectangle {
|
||||
width: 40
|
||||
height: 40
|
||||
@@ -278,7 +263,6 @@ PanelWindow {
|
||||
color: powerButton.containsMouse || root.powerOptionsExpanded ? Theme.error : Theme.surfaceText
|
||||
|
||||
Behavior on name {
|
||||
// Smooth icon transition
|
||||
SequentialAnimation {
|
||||
NumberAnimation {
|
||||
target: dankIcon
|
||||
@@ -330,7 +314,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Settings Button
|
||||
DankActionButton {
|
||||
buttonSize: 40
|
||||
iconName: "settings"
|
||||
@@ -348,7 +331,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Animated Collapsible Power Options (optimized)
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: root.powerOptionsExpanded ? 60 : 0
|
||||
@@ -364,7 +346,6 @@ PanelWindow {
|
||||
spacing: Theme.spacingL
|
||||
visible: root.powerOptionsExpanded
|
||||
|
||||
// Logout
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: 34
|
||||
@@ -414,7 +395,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Reboot
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: 34
|
||||
@@ -464,7 +444,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Suspend
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: 34
|
||||
@@ -514,7 +493,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Shutdown
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: 34
|
||||
@@ -566,7 +544,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Single coordinated animation for power options
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
@@ -689,7 +666,6 @@ PanelWindow {
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: root.currentTab === "display"
|
||||
spacing: Theme.spacingL
|
||||
// Brightness Control
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
@@ -765,7 +741,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Power menu height animation
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration // Faster for height changes
|
||||
@@ -778,12 +753,10 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Click outside to close
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
onClicked: function(mouse) {
|
||||
// Only close if click is outside the content loader
|
||||
var localPos = mapToItem(contentLoader, mouse.x, mouse.y);
|
||||
if (localPos.x < 0 || localPos.x > contentLoader.width || localPos.y < 0 || localPos.y > contentLoader.height)
|
||||
controlCenterVisible = false;
|
||||
|
||||
@@ -19,7 +19,7 @@ ScrollView {
|
||||
interval: BrightnessService.ddcAvailable ? 500 : 50 // 500ms for slow DDC (i2c), 50ms for fast laptop backlight
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
console.log("Debounce timer fired, setting brightness to:", pendingValue);
|
||||
|
||||
BrightnessService.setBrightness(pendingValue);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ ScrollView {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Brightness Control
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -49,12 +48,12 @@ ScrollView {
|
||||
rightIcon: "brightness_high"
|
||||
enabled: BrightnessService.brightnessAvailable
|
||||
onSliderValueChanged: function(newValue) {
|
||||
console.log("Slider changed to:", newValue);
|
||||
|
||||
brightnessDebounceTimer.pendingValue = newValue;
|
||||
brightnessDebounceTimer.restart();
|
||||
}
|
||||
onSliderDragFinished: function(finalValue) {
|
||||
console.log("Drag finished, immediate set:", finalValue);
|
||||
|
||||
brightnessDebounceTimer.stop();
|
||||
BrightnessService.setBrightness(finalValue);
|
||||
}
|
||||
@@ -70,7 +69,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Display settings
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -82,12 +80,10 @@ ScrollView {
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
// Mode toggles row (Night Mode + Light/Dark Mode)
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Night mode toggle
|
||||
Rectangle {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: 80
|
||||
@@ -125,11 +121,9 @@ ScrollView {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (Prefs.nightModeEnabled) {
|
||||
// Disable night mode - kill any running color temperature processes
|
||||
nightModeDisableProcess.running = true;
|
||||
Prefs.setNightModeEnabled(false);
|
||||
} else {
|
||||
// Enable night mode using wlsunset or redshift
|
||||
nightModeEnableProcess.running = true;
|
||||
Prefs.setNightModeEnabled(true);
|
||||
}
|
||||
@@ -138,7 +132,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Light/Dark mode toggle
|
||||
Rectangle {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: 80
|
||||
@@ -195,7 +188,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Night mode processes
|
||||
Process {
|
||||
id: nightModeEnableProcess
|
||||
|
||||
@@ -203,7 +195,7 @@ ScrollView {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to enable night mode");
|
||||
|
||||
Prefs.setNightModeEnabled(false);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +208,7 @@ ScrollView {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("Failed to disable night mode");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Loading spinner for preference changes
|
||||
DankIcon {
|
||||
id: ethernetLoadingSpinner
|
||||
|
||||
@@ -86,7 +85,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Ethernet toggle switch (matching WiFi style)
|
||||
DankToggle {
|
||||
id: ethernetToggle
|
||||
|
||||
@@ -100,7 +98,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea for network preference (excluding toggle area)
|
||||
MouseArea {
|
||||
id: ethernetPreferenceArea
|
||||
|
||||
@@ -111,7 +108,7 @@ Rectangle {
|
||||
enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled && NetworkService.networkStatus !== "ethernet" && !NetworkService.changingNetworkPreference
|
||||
onClicked: {
|
||||
if (NetworkService.ethernetConnected && NetworkService.wifiEnabled) {
|
||||
console.log("Ethernet card clicked for preference");
|
||||
|
||||
if (NetworkService.networkStatus !== "ethernet")
|
||||
NetworkService.setNetworkPreference("ethernet");
|
||||
else
|
||||
|
||||
@@ -100,7 +100,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Loading spinner for preference changes
|
||||
DankIcon {
|
||||
id: wifiLoadingSpinner
|
||||
|
||||
@@ -125,7 +124,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// WiFi toggle switch
|
||||
DankToggle {
|
||||
id: wifiToggle
|
||||
|
||||
@@ -137,7 +135,6 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: {
|
||||
if (NetworkService.wifiEnabled) {
|
||||
// When turning WiFi off, clear all cached WiFi data
|
||||
NetworkService.currentWifiSSID = "";
|
||||
NetworkService.wifiSignalStrength = "excellent";
|
||||
NetworkService.wifiNetworks = [];
|
||||
@@ -154,7 +151,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea for network preference (excluding toggle area)
|
||||
MouseArea {
|
||||
id: wifiPreferenceArea
|
||||
|
||||
@@ -165,7 +161,7 @@ Rectangle {
|
||||
enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled && NetworkService.networkStatus !== "wifi" && !NetworkService.changingNetworkPreference
|
||||
onClicked: {
|
||||
if (NetworkService.ethernetConnected && NetworkService.wifiEnabled) {
|
||||
console.log("WiFi card clicked for preference");
|
||||
|
||||
if (NetworkService.networkStatus !== "wifi")
|
||||
NetworkService.setNetworkPreference("wifi");
|
||||
else
|
||||
|
||||
@@ -57,7 +57,6 @@ Rectangle {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
// Drop shadow
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
@@ -76,7 +75,6 @@ Rectangle {
|
||||
anchors.margins: Theme.spacingS
|
||||
spacing: 1
|
||||
|
||||
// Connect/Disconnect option
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -145,7 +143,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Separator
|
||||
Rectangle {
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 5
|
||||
@@ -161,7 +158,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Forget Network option (only for saved networks)
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -217,7 +213,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Network Info option
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
|
||||
@@ -37,7 +37,6 @@ Column {
|
||||
visible: NetworkService.wifiEnabled
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Available Networks Section with refresh button (spanning version)
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
@@ -55,7 +54,6 @@ Column {
|
||||
height: 1
|
||||
}
|
||||
|
||||
// WiFi refresh button (spanning version)
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
@@ -99,7 +97,6 @@ Column {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (!NetworkService.isScanning) {
|
||||
// Immediate visual feedback
|
||||
refreshIconSpan.rotation += 30;
|
||||
NetworkService.scanWifi();
|
||||
}
|
||||
@@ -110,7 +107,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Scrollable networks container
|
||||
Flickable {
|
||||
width: parent.width
|
||||
height: parent.height - 40
|
||||
@@ -143,7 +139,6 @@ Column {
|
||||
anchors.margins: Theme.spacingXS
|
||||
anchors.rightMargin: Theme.spacingM // Extra right margin for scrollbar
|
||||
|
||||
// Signal strength icon
|
||||
DankIcon {
|
||||
id: signalIcon2
|
||||
|
||||
@@ -154,7 +149,6 @@ Column {
|
||||
color: modelData.connected ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
// Network info
|
||||
Column {
|
||||
anchors.left: signalIcon2.right
|
||||
anchors.leftMargin: Theme.spacingXS
|
||||
@@ -204,7 +198,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Right side icons
|
||||
Row {
|
||||
id: rightIcons2
|
||||
|
||||
@@ -212,7 +205,6 @@ Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
// Lock icon (if secured)
|
||||
DankIcon {
|
||||
name: "lock"
|
||||
size: Theme.iconSize - 8
|
||||
@@ -221,7 +213,6 @@ Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
// Context menu button
|
||||
Rectangle {
|
||||
id: wifiMenuButton
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@ Item {
|
||||
property var wifiPasswordModalRef: wifiPasswordModal
|
||||
property var networkInfoModalRef: networkInfoModal
|
||||
|
||||
// Properly sorted WiFi networks with connected networks first
|
||||
property var sortedWifiNetworks: {
|
||||
if (!NetworkService.wifiAvailable || !NetworkService.wifiEnabled) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Explicitly reference both arrays to ensure reactivity
|
||||
var allNetworks = NetworkService.wifiNetworks;
|
||||
var savedNetworks = NetworkService.savedWifiNetworks;
|
||||
var currentSSID = NetworkService.currentWifiSSID;
|
||||
@@ -29,32 +27,25 @@ Item {
|
||||
|
||||
var networks = [...allNetworks];
|
||||
|
||||
// Update connected status, saved status and signal strength based on current state
|
||||
networks.forEach(function(network) {
|
||||
network.connected = (network.ssid === currentSSID);
|
||||
// Update saved status based on savedWifiNetworks
|
||||
network.saved = savedNetworks.some(function(saved) {
|
||||
return saved.ssid === network.ssid;
|
||||
});
|
||||
// Use current connection's signal strength for connected network
|
||||
if (network.connected && signalStrength) {
|
||||
network.signalStrength = signalStrength;
|
||||
}
|
||||
});
|
||||
|
||||
// Sort: connected networks first, then by signal strength
|
||||
networks.sort(function(a, b) {
|
||||
// Connected networks always come first
|
||||
if (a.connected && !b.connected) return -1;
|
||||
if (!a.connected && b.connected) return 1;
|
||||
// If both connected or both not connected, sort by signal strength
|
||||
return b.signal - a.signal;
|
||||
});
|
||||
|
||||
return networks;
|
||||
}
|
||||
|
||||
// Force refresh of sortedWifiNetworks when networks are updated
|
||||
property int forceRefresh: 0
|
||||
|
||||
Connections {
|
||||
@@ -64,13 +55,11 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-enable WiFi auto-refresh when network tab is visible
|
||||
Component.onCompleted: {
|
||||
NetworkService.addRef();
|
||||
NetworkService.autoRefreshEnabled = true;
|
||||
if (NetworkService.wifiEnabled)
|
||||
NetworkService.scanWifi();
|
||||
// Start smart monitoring
|
||||
wifiMonitorTimer.start();
|
||||
}
|
||||
|
||||
@@ -79,18 +68,15 @@ Item {
|
||||
NetworkService.autoRefreshEnabled = false;
|
||||
}
|
||||
|
||||
// Two-column layout for WiFi and Ethernet (WiFi on left, Ethernet on right)
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// WiFi Column (left side)
|
||||
Column {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: parent.height
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// WiFi Content in Flickable
|
||||
Flickable {
|
||||
width: parent.width
|
||||
height: parent.height - 30
|
||||
@@ -106,7 +92,6 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Current WiFi connection status card
|
||||
WiFiCard {
|
||||
refreshTimer: refreshTimer
|
||||
}
|
||||
@@ -118,13 +103,11 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Ethernet Column (right side)
|
||||
Column {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: parent.height
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Ethernet Content in Flickable
|
||||
Flickable {
|
||||
width: parent.width
|
||||
height: parent.height - 30
|
||||
@@ -140,7 +123,6 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Ethernet connection status card (matching WiFi height)
|
||||
EthernetCard {
|
||||
}
|
||||
}
|
||||
@@ -152,7 +134,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi disabled message spanning across both columns
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 100
|
||||
@@ -190,14 +171,12 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi networks spanning across both columns when WiFi is enabled
|
||||
WiFiNetworksList {
|
||||
wifiContextMenuWindow: wifiContextMenuWindow
|
||||
sortedWifiNetworks: networkTab.sortedWifiNetworks
|
||||
wifiPasswordModalRef: networkTab.wifiPasswordModalRef
|
||||
}
|
||||
|
||||
// Timer for refreshing network status after WiFi toggle
|
||||
Timer {
|
||||
id: refreshTimer
|
||||
interval: 2000
|
||||
@@ -212,18 +191,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-refresh when WiFi state changes
|
||||
Connections {
|
||||
target: NetworkService
|
||||
function onWifiEnabledChanged() {
|
||||
if (NetworkService.wifiEnabled && visible) {
|
||||
// When WiFi is enabled, scan and update info (only if tab is visible)
|
||||
// Add a small delay to ensure WiFi service is ready
|
||||
wifiScanDelayTimer.start();
|
||||
// Start monitoring when WiFi comes back on
|
||||
wifiMonitorTimer.start();
|
||||
} else {
|
||||
// When WiFi is disabled, clear all cached WiFi data
|
||||
NetworkService.currentWifiSSID = "";
|
||||
NetworkService.wifiSignalStrength = "excellent";
|
||||
NetworkService.wifiNetworks = [];
|
||||
@@ -232,13 +206,11 @@ Item {
|
||||
NetworkService.connectingSSID = "";
|
||||
NetworkService.isScanning = false;
|
||||
NetworkService.refreshNetworkStatus();
|
||||
// Stop monitoring when WiFi is off
|
||||
wifiMonitorTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delayed WiFi scan timer to ensure service is ready
|
||||
Timer {
|
||||
id: wifiScanDelayTimer
|
||||
interval: 1500
|
||||
@@ -249,14 +221,12 @@ Item {
|
||||
if (!NetworkService.isScanning) {
|
||||
NetworkService.scanWifi();
|
||||
} else {
|
||||
// If still scanning, try again in a bit
|
||||
wifiRetryTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retry timer for when WiFi is still scanning
|
||||
Timer {
|
||||
id: wifiRetryTimer
|
||||
interval: 2000
|
||||
@@ -271,7 +241,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Smart WiFi monitoring - only runs when tab visible and conditions met
|
||||
Timer {
|
||||
id: wifiMonitorTimer
|
||||
interval: 8000 // Check every 8 seconds
|
||||
@@ -279,21 +248,17 @@ Item {
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (!visible || !NetworkService.wifiEnabled) {
|
||||
// Stop monitoring when not needed
|
||||
running = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Monitor connection changes and refresh networks when disconnected
|
||||
var shouldScan = false;
|
||||
var reason = "";
|
||||
|
||||
// Always scan if not connected to WiFi
|
||||
if (NetworkService.networkStatus !== "wifi") {
|
||||
shouldScan = true;
|
||||
reason = "not connected to WiFi";
|
||||
}
|
||||
// Also scan occasionally even when connected to keep networks fresh
|
||||
else if (NetworkService.wifiNetworks.length === 0) {
|
||||
shouldScan = true;
|
||||
reason = "no networks cached";
|
||||
@@ -305,7 +270,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Monitor tab visibility to start/stop smart monitoring
|
||||
onVisibleChanged: {
|
||||
if (visible && NetworkService.wifiEnabled) {
|
||||
wifiMonitorTimer.start();
|
||||
@@ -314,7 +278,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi Context Menu Window
|
||||
WiFiContextMenu {
|
||||
id: wifiContextMenuWindow
|
||||
parentItem: networkTab
|
||||
@@ -322,7 +285,6 @@ Item {
|
||||
networkInfoModalRef: networkTab.networkInfoModalRef
|
||||
}
|
||||
|
||||
// Background MouseArea to close the context menu
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
visible: wifiContextMenuWindow.visible
|
||||
@@ -336,7 +298,6 @@ Item {
|
||||
width: wifiContextMenuWindow.width
|
||||
height: wifiContextMenuWindow.height
|
||||
onClicked: {
|
||||
// Prevent clicks on menu from closing it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ PanelWindow {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
// Click outside to dismiss overlay
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
@@ -51,9 +50,7 @@ PanelWindow {
|
||||
opacity: powerMenuVisible ? 1 : 0
|
||||
scale: powerMenuVisible ? 1 : 0.85
|
||||
|
||||
// Prevent click-through to background
|
||||
MouseArea {
|
||||
// Consume the click to prevent it from reaching the background
|
||||
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
@@ -65,7 +62,6 @@ PanelWindow {
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
|
||||
@@ -94,12 +90,10 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Power options
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Log Out
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
@@ -146,7 +140,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Suspend
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
@@ -193,7 +186,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Reboot
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
@@ -240,7 +232,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Power Off
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 50
|
||||
|
||||
@@ -66,7 +66,7 @@ PanelWindow {
|
||||
onScreenYChanged: margins.top = Theme.barHeight + 4 + screenY
|
||||
onHasValidDataChanged: {
|
||||
if (!hasValidData && !exiting && !_isDestroying) {
|
||||
console.warn("NotificationPopup: Data became invalid, forcing exit");
|
||||
|
||||
forceExit();
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ PanelWindow {
|
||||
return enterX.restart();
|
||||
});
|
||||
} else {
|
||||
console.warn("NotificationPopup created with invalid data");
|
||||
|
||||
forceExit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,7 @@ QtObject {
|
||||
property int baseNotificationHeight: 120
|
||||
property int maxTargetNotifications: 3
|
||||
property var popupWindows: [] // strong refs to windows (live until exitFinished)
|
||||
// Track destroying windows to prevent duplicate cleanup
|
||||
property var destroyingWindows: new Set()
|
||||
// Factory
|
||||
property Component popupComponent
|
||||
|
||||
popupComponent: Component {
|
||||
@@ -34,7 +32,6 @@ QtObject {
|
||||
target: NotificationService
|
||||
}
|
||||
|
||||
// Smart sweeper that only runs when needed
|
||||
property Timer sweeper
|
||||
|
||||
sweeper: Timer {
|
||||
@@ -48,24 +45,21 @@ QtObject {
|
||||
toRemove.push(p);
|
||||
continue;
|
||||
}
|
||||
// Check for various zombie conditions
|
||||
const isZombie = p.status === Component.Null || (!p.visible && !p.exiting) || (!p.notificationData && !p._isDestroying) || (!p.hasValidData && !p._isDestroying);
|
||||
if (isZombie) {
|
||||
console.warn("Sweeper found zombie window, cleaning up");
|
||||
|
||||
toRemove.push(p);
|
||||
// Try to force cleanup
|
||||
if (p.forceExit) {
|
||||
p.forceExit();
|
||||
} else if (p.destroy) {
|
||||
try {
|
||||
p.destroy();
|
||||
} catch (e) {
|
||||
console.warn("Error destroying zombie:", e);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove all zombies from array
|
||||
if (toRemove.length > 0) {
|
||||
for (let zombie of toRemove) {
|
||||
const i = popupWindows.indexOf(zombie);
|
||||
@@ -74,7 +68,6 @@ QtObject {
|
||||
|
||||
}
|
||||
popupWindows = popupWindows.slice();
|
||||
// Recompact after cleanup
|
||||
const survivors = _active().sort((a, b) => {
|
||||
return a.screenY - b.screenY;
|
||||
});
|
||||
@@ -82,7 +75,6 @@ QtObject {
|
||||
survivors[k].screenY = topMargin + k * baseNotificationHeight;
|
||||
}
|
||||
}
|
||||
// Stop the timer if no windows remain
|
||||
if (popupWindows.length === 0)
|
||||
sweeper.stop();
|
||||
|
||||
@@ -91,7 +83,6 @@ QtObject {
|
||||
|
||||
function _hasWindowFor(w) {
|
||||
return popupWindows.some((p) => {
|
||||
// More robust check for valid windows
|
||||
return p && p.notificationData === w && !p._isDestroying && p.status !== Component.Null;
|
||||
});
|
||||
}
|
||||
@@ -101,13 +92,11 @@ QtObject {
|
||||
}
|
||||
|
||||
function _sync(newWrappers) {
|
||||
// Add new notifications
|
||||
for (let w of newWrappers) {
|
||||
if (w && !_hasWindowFor(w))
|
||||
insertNewestAtTop(w);
|
||||
|
||||
}
|
||||
// Remove old notifications
|
||||
for (let p of popupWindows.slice()) {
|
||||
if (!_isValidWindow(p))
|
||||
continue;
|
||||
@@ -119,13 +108,11 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Insert newest at top
|
||||
function insertNewestAtTop(wrapper) {
|
||||
if (!wrapper) {
|
||||
console.warn("insertNewestAtTop: wrapper is null");
|
||||
|
||||
return ;
|
||||
}
|
||||
// Shift live, non-exiting windows down *now*
|
||||
for (let p of popupWindows) {
|
||||
if (!_isValidWindow(p))
|
||||
continue;
|
||||
@@ -135,7 +122,6 @@ QtObject {
|
||||
|
||||
p.screenY = p.screenY + baseNotificationHeight;
|
||||
}
|
||||
// Create the new top window at fixed Y
|
||||
const notificationId = wrapper && wrapper.notification ? wrapper.notification.id : "";
|
||||
const win = popupComponent.createObject(null, {
|
||||
"notificationData": wrapper,
|
||||
@@ -144,24 +130,21 @@ QtObject {
|
||||
"screen": manager.modelData
|
||||
});
|
||||
if (!win) {
|
||||
console.warn("Popup create failed");
|
||||
|
||||
return ;
|
||||
}
|
||||
// Validate the window was created properly
|
||||
if (!win.hasValidData) {
|
||||
console.warn("Popup created with invalid data, destroying");
|
||||
|
||||
win.destroy();
|
||||
return ;
|
||||
}
|
||||
popupWindows.push(win);
|
||||
// Start sweeper if it's not running
|
||||
if (!sweeper.running)
|
||||
sweeper.start();
|
||||
|
||||
_maybeStartOverflow();
|
||||
}
|
||||
|
||||
// Overflow: keep one extra (slot #4), then ask bottom to exit gracefully
|
||||
function _active() {
|
||||
return popupWindows.filter((p) => {
|
||||
return _isValidWindow(p) && p.notificationData && p.notificationData.popup && !p.exiting;
|
||||
@@ -186,55 +169,46 @@ QtObject {
|
||||
|
||||
const b = _bottom();
|
||||
if (b && !b.exiting) {
|
||||
// Tell the popup to animate out (don't destroy here)
|
||||
b.notificationData.removedByLimit = true;
|
||||
b.notificationData.popup = false;
|
||||
}
|
||||
}
|
||||
|
||||
// After entrance, you may kick overflow (optional)
|
||||
function _onPopupEntered(p) {
|
||||
if (_isValidWindow(p))
|
||||
_maybeStartOverflow();
|
||||
|
||||
}
|
||||
|
||||
// Primary cleanup path (after the popup finishes its exit)
|
||||
function _onPopupExitFinished(p) {
|
||||
if (!p)
|
||||
return ;
|
||||
|
||||
// Prevent duplicate cleanup
|
||||
const windowId = p.toString();
|
||||
if (destroyingWindows.has(windowId))
|
||||
return ;
|
||||
|
||||
destroyingWindows.add(windowId);
|
||||
// Remove from popupWindows
|
||||
const i = popupWindows.indexOf(p);
|
||||
if (i !== -1) {
|
||||
popupWindows.splice(i, 1);
|
||||
popupWindows = popupWindows.slice();
|
||||
}
|
||||
// Release the wrapper
|
||||
if (NotificationService.releaseWrapper && p.notificationData)
|
||||
NotificationService.releaseWrapper(p.notificationData);
|
||||
|
||||
// Schedule destruction
|
||||
Qt.callLater(() => {
|
||||
if (p && p.destroy) {
|
||||
try {
|
||||
p.destroy();
|
||||
} catch (e) {
|
||||
console.warn("Error destroying popup:", e);
|
||||
|
||||
}
|
||||
}
|
||||
// Clean up tracking after a delay
|
||||
Qt.callLater(() => {
|
||||
destroyingWindows.delete(windowId);
|
||||
});
|
||||
});
|
||||
// Compact survivors (only live, non-exiting)
|
||||
const survivors = _active().sort((a, b) => {
|
||||
return a.screenY - b.screenY;
|
||||
});
|
||||
@@ -244,7 +218,6 @@ QtObject {
|
||||
_maybeStartOverflow();
|
||||
}
|
||||
|
||||
// Emergency cleanup function
|
||||
function cleanupAllWindows() {
|
||||
sweeper.stop();
|
||||
for (let p of popupWindows.slice()) {
|
||||
@@ -255,7 +228,7 @@ QtObject {
|
||||
else if (p.destroy)
|
||||
p.destroy();
|
||||
} catch (e) {
|
||||
console.warn("Error during emergency cleanup:", e);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,7 +236,6 @@ QtObject {
|
||||
destroyingWindows.clear();
|
||||
}
|
||||
|
||||
// Watch for changes to popup windows array
|
||||
onPopupWindowsChanged: {
|
||||
if (popupWindows.length > 0 && !sweeper.running)
|
||||
sweeper.start();
|
||||
|
||||
@@ -19,7 +19,6 @@ PanelWindow {
|
||||
|
||||
function hide() {
|
||||
isVisible = false;
|
||||
// Close any open context menus
|
||||
if (processContextMenu.visible)
|
||||
processContextMenu.close();
|
||||
|
||||
@@ -58,7 +57,6 @@ PanelWindow {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: function(mouse) {
|
||||
// Only close if click is outside the content loader
|
||||
var localPos = mapToItem(contentLoader, mouse.x, mouse.y);
|
||||
if (localPos.x < 0 || localPos.x > contentLoader.width || localPos.y < 0 || localPos.y > contentLoader.height)
|
||||
processListPopout.hide();
|
||||
@@ -78,7 +76,6 @@ PanelWindow {
|
||||
height: targetHeight
|
||||
y: Theme.barHeight + Theme.spacingXS
|
||||
x: Math.max(Theme.spacingL, Screen.width - targetWidth - Theme.spacingL)
|
||||
// GPU-accelerated scale + opacity animation
|
||||
opacity: processListPopout.isVisible ? 1 : 0
|
||||
scale: processListPopout.isVisible ? 1 : 0.9
|
||||
|
||||
@@ -108,7 +105,6 @@ PanelWindow {
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
clip: true
|
||||
// Remove layer rendering for better performance
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
|
||||
|
||||
@@ -294,7 +294,6 @@ Column {
|
||||
}
|
||||
onModelChanged: {
|
||||
if (model && model.length > 0 && !isUserScrolling && stableY > 40)
|
||||
// Preserve scroll position when model updates
|
||||
Qt.callLater(function() {
|
||||
contentY = stableY;
|
||||
});
|
||||
|
||||
@@ -20,7 +20,6 @@ ScrollView {
|
||||
topPadding: Theme.spacingL
|
||||
bottomPadding: Theme.spacingXL
|
||||
|
||||
// Display Settings Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: displaySection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -91,7 +90,6 @@ ScrollView {
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: {
|
||||
// Force refresh of icon themes to prevent stale data
|
||||
Prefs.detectAvailableIconThemes();
|
||||
return Prefs.availableIconThemes;
|
||||
}
|
||||
@@ -108,7 +106,6 @@ ScrollView {
|
||||
text: "Font Family"
|
||||
description: "Select system font family"
|
||||
currentValue: {
|
||||
// Always show the font name in parentheses for clarity
|
||||
if (Prefs.fontFamily === Prefs.defaultFontFamily)
|
||||
return "Default (" + Prefs.defaultFontFamily + ")";
|
||||
else
|
||||
@@ -122,19 +119,15 @@ ScrollView {
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
var rootFamilies = [];
|
||||
var seenFamilies = new Set();
|
||||
// Filter to root family names by removing common weight/style suffixes
|
||||
for (var i = 0; i < availableFonts.length; i++) {
|
||||
var fontName = availableFonts[i];
|
||||
// Skip fonts beginning with . (like .AppleSystem)
|
||||
if (fontName.startsWith("."))
|
||||
continue;
|
||||
|
||||
// Skip the default font since we already added it as recommended
|
||||
if (fontName === Prefs.defaultFontFamily)
|
||||
continue;
|
||||
|
||||
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) {
|
||||
// Keep these suffixes as they're part of the family name
|
||||
return match;
|
||||
}).trim();
|
||||
if (!seenFamilies.has(rootName) && rootName !== "") {
|
||||
@@ -237,18 +230,14 @@ ScrollView {
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
var monoFamilies = [];
|
||||
var seenFamilies = new Set();
|
||||
// Filter to likely monospace fonts
|
||||
for (var i = 0; i < availableFonts.length; i++) {
|
||||
var fontName = availableFonts[i];
|
||||
// Skip fonts beginning with .
|
||||
if (fontName.startsWith("."))
|
||||
continue;
|
||||
|
||||
// Skip the default mono font since we already added it as recommended
|
||||
if (fontName === Prefs.defaultMonoFontFamily)
|
||||
continue;
|
||||
|
||||
// Look for common monospace indicators
|
||||
var lowerName = fontName.toLowerCase();
|
||||
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("dejavu sans mono") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("ubuntu mono") || lowerName.includes("cascadia")) {
|
||||
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").trim();
|
||||
@@ -272,7 +261,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Transparency Settings Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: transparencySection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -391,7 +379,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Theme Picker Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: themeSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -458,12 +445,10 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Theme Grid
|
||||
Column {
|
||||
spacing: Theme.spacingS
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
// First row - Blue, Deep Blue, Purple, Green, Orange
|
||||
Row {
|
||||
spacing: Theme.spacingM
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -480,7 +465,6 @@ ScrollView {
|
||||
border.width: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 2 : 1
|
||||
scale: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 1.1 : 1
|
||||
|
||||
// Theme name tooltip
|
||||
Rectangle {
|
||||
width: nameText.contentWidth + Theme.spacingS * 2
|
||||
height: nameText.contentHeight + Theme.spacingXS * 2
|
||||
@@ -537,7 +521,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Second row - Red, Cyan, Pink, Amber, Coral
|
||||
Row {
|
||||
spacing: Theme.spacingM
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -557,7 +540,6 @@ ScrollView {
|
||||
visible: themeIndex < Theme.themes.length
|
||||
scale: Theme.currentThemeIndex === themeIndex ? 1.1 : 1
|
||||
|
||||
// Theme name tooltip
|
||||
Rectangle {
|
||||
width: nameText2.contentWidth + Theme.spacingS * 2
|
||||
height: nameText2.contentHeight + Theme.spacingXS * 2
|
||||
@@ -616,13 +598,11 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Spacer
|
||||
Item {
|
||||
width: 1
|
||||
height: Theme.spacingM
|
||||
}
|
||||
|
||||
// Auto theme button
|
||||
Rectangle {
|
||||
width: 120
|
||||
height: 40
|
||||
@@ -704,7 +684,6 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
// Tooltip for Auto button
|
||||
Rectangle {
|
||||
width: autoTooltipText.contentWidth + Theme.spacingM * 2
|
||||
height: autoTooltipText.contentHeight + Theme.spacingS * 2
|
||||
@@ -768,7 +747,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// System App Theming Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: systemThemingSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -840,17 +818,15 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Night mode processes
|
||||
Process {
|
||||
id: nightModeEnableProcess
|
||||
|
||||
command: ["bash", "-c", "if command -v wlsunset > /dev/null; then pkill wlsunset; wlsunset -t 3000 & elif command -v redshift > /dev/null; then pkill redshift; redshift -P -O 3000 & else echo 'No night mode tool available'; fi"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to enable night mode");
|
||||
Prefs.setNightModeEnabled(false);
|
||||
}
|
||||
if (exitCode !== 0)
|
||||
Prefs.setNightModeEnabled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,7 +837,7 @@ ScrollView {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("Failed to disable night mode");
|
||||
Prefs.setNightModeEnabled(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ ScrollView {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
// Profile Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: profileSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -63,7 +62,6 @@ ScrollView {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Circular profile image preview
|
||||
Item {
|
||||
id: avatarContainer
|
||||
|
||||
@@ -264,7 +262,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Wallpaper Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: wallpaperSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -305,7 +302,6 @@ ScrollView {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Wallpaper Preview
|
||||
StyledRect {
|
||||
width: 160
|
||||
height: 90
|
||||
@@ -463,7 +459,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Dynamic Theming Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2
|
||||
|
||||
@@ -22,7 +22,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Section header
|
||||
MouseArea {
|
||||
width: parent.width
|
||||
height: headerRow.height
|
||||
@@ -85,7 +84,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Divider
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
@@ -93,7 +91,6 @@ Column {
|
||||
visible: expanded || !collapsible
|
||||
}
|
||||
|
||||
// Content
|
||||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ ScrollView {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
// Time Settings Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: timeSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -66,7 +65,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Weather Settings Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: weatherSection.implicitHeight + Theme.spacingL * 2
|
||||
|
||||
@@ -91,7 +91,6 @@ ScrollView {
|
||||
"icon": "remove",
|
||||
"enabled": true
|
||||
}]
|
||||
// Default widget configurations for each section (with enabled states)
|
||||
property var defaultLeftWidgets: [{
|
||||
"id": "launcherButton",
|
||||
"enabled": true
|
||||
@@ -295,7 +294,6 @@ ScrollView {
|
||||
if (!Prefs.topBarRightWidgets || Prefs.topBarRightWidgets.length === 0)
|
||||
Prefs.setTopBarRightWidgets(defaultRightWidgets);
|
||||
|
||||
// Ensure existing spacers have default sizes
|
||||
["left", "center", "right"].forEach((sectionId) => {
|
||||
var widgets = [];
|
||||
if (sectionId === "left")
|
||||
@@ -334,7 +332,6 @@ ScrollView {
|
||||
topPadding: Theme.spacingL
|
||||
bottomPadding: Theme.spacingXL
|
||||
|
||||
// Header section
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -446,12 +443,10 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Widget sections
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
// Left Section
|
||||
DankSections {
|
||||
width: parent.width
|
||||
title: "Left Section"
|
||||
@@ -478,7 +473,6 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
// Center Section
|
||||
DankSections {
|
||||
width: parent.width
|
||||
title: "Center Section"
|
||||
@@ -505,7 +499,6 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
// Right Section
|
||||
DankSections {
|
||||
width: parent.width
|
||||
title: "Right Section"
|
||||
@@ -534,7 +527,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Workspace Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: workspaceSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -597,7 +589,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Tooltip for reset button (positioned above the button)
|
||||
Rectangle {
|
||||
width: tooltipText.contentWidth + Theme.spacingM * 2
|
||||
height: tooltipText.contentHeight + Theme.spacingS * 2
|
||||
@@ -630,7 +621,6 @@ ScrollView {
|
||||
|
||||
}
|
||||
|
||||
// Widget selection popup
|
||||
DankWidgetSelectionPopup {
|
||||
id: widgetSelectionPopup
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Makes the background transparent to mouse events
|
||||
mask: Region {
|
||||
item: toast
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ Item {
|
||||
interval: 256
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
// Generate fake audio levels when cava is unavailable
|
||||
CavaService.values = [Math.random() * 40 + 10, Math.random() * 60 + 20, Math.random() * 50 + 15, Math.random() * 35 + 20, Math.random() * 45 + 15, Math.random() * 55 + 25];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Tooltip on hover
|
||||
Rectangle {
|
||||
id: batteryTooltip
|
||||
|
||||
|
||||
@@ -46,11 +46,9 @@ PanelWindow {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
// Click outside to dismiss overlay
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: function(mouse) {
|
||||
// Only close if click is outside the content loader
|
||||
var localPos = mapToItem(contentLoader, mouse.x, mouse.y);
|
||||
if (localPos.x < 0 || localPos.x > contentLoader.width || localPos.y < 0 || localPos.y > contentLoader.height)
|
||||
batteryPopupVisible = false;
|
||||
@@ -70,7 +68,6 @@ PanelWindow {
|
||||
height: targetHeight
|
||||
x: Math.max(Theme.spacingL, Screen.width - targetWidth - Theme.spacingL)
|
||||
y: Theme.barHeight + Theme.spacingS
|
||||
// GPU-accelerated scale + opacity animation
|
||||
opacity: batteryPopupVisible ? 1 : 0
|
||||
scale: batteryPopupVisible ? 1 : 0.9
|
||||
|
||||
@@ -97,11 +94,9 @@ PanelWindow {
|
||||
radius: Theme.cornerRadiusLarge
|
||||
border.color: Theme.outlineMedium
|
||||
border.width: 1
|
||||
// Remove layer rendering for better performance
|
||||
antialiasing: true
|
||||
smooth: true
|
||||
|
||||
// Material 3 elevation with multiple layers
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -3
|
||||
@@ -273,7 +268,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// No battery info card
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 80
|
||||
@@ -317,7 +311,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Battery details
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -334,7 +327,6 @@ PanelWindow {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
// Health
|
||||
Column {
|
||||
spacing: 2
|
||||
width: (parent.width - Theme.spacingXL) / 2
|
||||
@@ -360,7 +352,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Capacity
|
||||
Column {
|
||||
spacing: 2
|
||||
width: (parent.width - Theme.spacingXL) / 2
|
||||
@@ -384,7 +375,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Power profiles
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -465,7 +455,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Degradation reason warning
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 60
|
||||
|
||||
@@ -10,7 +10,6 @@ Rectangle {
|
||||
|
||||
signal clicked()
|
||||
|
||||
// Helper function for consistent WiFi signal icons
|
||||
function getWiFiSignalIcon(signalStrength) {
|
||||
switch (signalStrength) {
|
||||
case "excellent":
|
||||
@@ -40,7 +39,6 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
// Network Status Icon
|
||||
DankIcon {
|
||||
name: {
|
||||
if (NetworkService.networkStatus === "ethernet")
|
||||
@@ -56,7 +54,6 @@ Rectangle {
|
||||
visible: true
|
||||
}
|
||||
|
||||
// Bluetooth Icon (when available and enabled) - moved next to network
|
||||
DankIcon {
|
||||
name: "bluetooth"
|
||||
size: Theme.iconSize - 8
|
||||
@@ -65,7 +62,6 @@ Rectangle {
|
||||
visible: BluetoothService.available && BluetoothService.enabled
|
||||
}
|
||||
|
||||
// Audio Icon with scroll wheel support
|
||||
Rectangle {
|
||||
width: audioIcon.implicitWidth + 4
|
||||
height: audioIcon.implicitHeight + 4
|
||||
@@ -82,9 +78,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
// Scroll up - increase volume
|
||||
// Scroll down - decrease volume
|
||||
|
||||
id: audioWheelArea
|
||||
|
||||
anchors.fill: parent
|
||||
@@ -108,7 +101,6 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
// Microphone Icon (when active)
|
||||
DankIcon {
|
||||
name: "mic"
|
||||
size: Theme.iconSize - 8
|
||||
|
||||
@@ -16,7 +16,6 @@ Rectangle {
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
// Only show background when there's content to display
|
||||
if (!FocusedWindowService.focusedAppName && !FocusedWindowService.focusedWindowTitle)
|
||||
return "transparent";
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ Rectangle {
|
||||
color: Prefs.doNotDisturb ? Theme.error : (notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText)
|
||||
}
|
||||
|
||||
// Notification dot indicator
|
||||
Rectangle {
|
||||
width: 8
|
||||
height: 8
|
||||
|
||||
@@ -13,7 +13,6 @@ Rectangle {
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
// Only show background when there are system tray items to display
|
||||
if (SystemTray.items.values.length === 0)
|
||||
return "transparent";
|
||||
|
||||
|
||||
@@ -39,11 +39,9 @@ PanelWindow {
|
||||
radius: Theme.cornerRadiusLarge
|
||||
border.color: Theme.outlineMedium
|
||||
border.width: 1
|
||||
// Material 3 animations
|
||||
opacity: showContextMenu ? 1 : 0
|
||||
scale: showContextMenu ? 1 : 0.85
|
||||
|
||||
// Material 3 drop shadow
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
@@ -65,11 +63,9 @@ PanelWindow {
|
||||
menu: currentTrayItem && currentTrayItem.hasMenu ? currentTrayItem.menu : null
|
||||
}
|
||||
|
||||
// Custom menu styling using ListView
|
||||
ListView {
|
||||
id: menuList
|
||||
|
||||
// Calculate maximum text width for dynamic menu sizing
|
||||
property real maxTextWidth: {
|
||||
let maxWidth = 0;
|
||||
if (model && model.values) {
|
||||
@@ -101,7 +97,6 @@ PanelWindow {
|
||||
radius: modelData.isSeparator ? 0 : Theme.cornerRadiusSmall
|
||||
color: modelData.isSeparator ? "transparent" : (menuItemArea.containsMouse ? Theme.primaryHover : "transparent")
|
||||
|
||||
// Separator line
|
||||
Rectangle {
|
||||
visible: modelData.isSeparator
|
||||
anchors.centerIn: parent
|
||||
@@ -110,7 +105,6 @@ PanelWindow {
|
||||
color: Theme.surfaceVariantAlpha
|
||||
}
|
||||
|
||||
// Menu item content
|
||||
Row {
|
||||
visible: !modelData.isSeparator
|
||||
anchors.left: parent.left
|
||||
@@ -176,7 +170,6 @@ PanelWindow {
|
||||
|
||||
}
|
||||
|
||||
// Click outside to close
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
|
||||
@@ -125,7 +125,6 @@ PanelWindow {
|
||||
id: topBarContent
|
||||
|
||||
readonly property int availableWidth: width
|
||||
// Use estimated fixed widths to break circular dependencies
|
||||
readonly property int launcherButtonWidth: 40
|
||||
readonly property int workspaceSwitcherWidth: 120 // Approximate
|
||||
readonly property int focusedAppMaxWidth: 456 // Fixed width since we don't have focusedApp reference
|
||||
@@ -228,7 +227,6 @@ PanelWindow {
|
||||
anchors.bottomMargin: Theme.spacingXS
|
||||
clip: true
|
||||
|
||||
// Dynamic left section
|
||||
Row {
|
||||
id: leftSection
|
||||
|
||||
@@ -357,8 +355,8 @@ PanelWindow {
|
||||
item.onWidthChanged.connect(centerSection.updateLayout);
|
||||
if (model.widgetId === "spacer")
|
||||
item.spacerSize = Qt.binding(() => {
|
||||
return model.size || 20;
|
||||
});
|
||||
return model.size || 20;
|
||||
});
|
||||
|
||||
Qt.callLater(centerSection.updateLayout);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ Rectangle {
|
||||
|
||||
signal clicked()
|
||||
|
||||
// Visibility is now controlled by TopBar.qml
|
||||
width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
@@ -83,10 +83,8 @@ Rectangle {
|
||||
target: NiriService
|
||||
}
|
||||
|
||||
// Force update when padding preference changes
|
||||
Connections {
|
||||
function onShowWorkspacePaddingChanged() {
|
||||
// Force re-evaluation by updating the property
|
||||
var baseList = root.getDisplayWorkspaces();
|
||||
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(baseList) : baseList;
|
||||
}
|
||||
@@ -128,7 +126,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Show index for placeholders if Prefs.showWorkspaceIndex is true, otherwise show a subtle dot
|
||||
StyledText {
|
||||
visible: Prefs.showWorkspaceIndex
|
||||
anchors.centerIn: parent
|
||||
|
||||
@@ -12,28 +12,6 @@ Singleton {
|
||||
|
||||
property var applications: DesktopEntries.applications.values
|
||||
|
||||
property var applicationsByName: {
|
||||
var byName = {}
|
||||
for (var i = 0; i < applications.length; i++) {
|
||||
var app = applications[i]
|
||||
byName[app.name.toLowerCase()] = app
|
||||
}
|
||||
return byName
|
||||
}
|
||||
|
||||
property var applicationsByExec: {
|
||||
var byExec = {}
|
||||
for (var i = 0; i < applications.length; i++) {
|
||||
var app = applications[i]
|
||||
var execProp = app.execString || ""
|
||||
var cleanExec = execProp ? execProp.replace(/%[fFuU]/g, "").trim() : ""
|
||||
if (cleanExec) {
|
||||
byExec[cleanExec] = app
|
||||
}
|
||||
}
|
||||
return byExec
|
||||
}
|
||||
|
||||
property var preppedApps: applications.map(app => ({
|
||||
name: Fuzzy.prepare(app.name || ""),
|
||||
comment: Fuzzy.prepare(app.comment || ""),
|
||||
@@ -89,14 +67,7 @@ Singleton {
|
||||
return results.map(r => r.obj.entry)
|
||||
}
|
||||
|
||||
function getAppByName(name) {
|
||||
return applicationsByName[name.toLowerCase()] || null
|
||||
}
|
||||
|
||||
function getAppByExec(exec) {
|
||||
var cleanExec = exec.replace(/%[fFuU]/g, "").trim()
|
||||
return applicationsByExec[cleanExec] || null
|
||||
}
|
||||
|
||||
|
||||
function getCategoriesForApp(app) {
|
||||
if (!app || !app.categories) return []
|
||||
|
||||
@@ -77,35 +77,7 @@ Singleton {
|
||||
return "bluetooth";
|
||||
}
|
||||
|
||||
function getDeviceType(device) {
|
||||
if (!device)
|
||||
return "bluetooth";
|
||||
|
||||
var name = (device.name || device.deviceName || "").toLowerCase();
|
||||
var icon = (device.icon || "").toLowerCase();
|
||||
if (icon.includes("headset") || icon.includes("audio") || name.includes("headphone") || name.includes("airpod") || name.includes("headset") || name.includes("arctis"))
|
||||
return "headset";
|
||||
|
||||
if (icon.includes("mouse") || name.includes("mouse"))
|
||||
return "mouse";
|
||||
|
||||
if (icon.includes("keyboard") || name.includes("keyboard"))
|
||||
return "keyboard";
|
||||
|
||||
if (icon.includes("phone") || name.includes("phone") || name.includes("iphone") || name.includes("android") || name.includes("samsung"))
|
||||
return "phone";
|
||||
|
||||
if (icon.includes("watch") || name.includes("watch"))
|
||||
return "watch";
|
||||
|
||||
if (icon.includes("speaker") || name.includes("speaker"))
|
||||
return "speaker";
|
||||
|
||||
if (icon.includes("display") || name.includes("tv"))
|
||||
return "tv";
|
||||
|
||||
return "bluetooth";
|
||||
}
|
||||
|
||||
function canConnect(device) {
|
||||
if (!device)
|
||||
|
||||
@@ -22,7 +22,7 @@ Singleton {
|
||||
laptopBrightnessProcess.command = ["brightnessctl", "set", brightnessLevel + "%"];
|
||||
laptopBrightnessProcess.running = true;
|
||||
} else if (ddcAvailable) {
|
||||
console.log("Setting DDC brightness to:", brightnessLevel);
|
||||
|
||||
Quickshell.execDetached(["ddcutil", "setvcp", "10", brightnessLevel.toString()]);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ Singleton {
|
||||
|
||||
onExited: function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to set laptop brightness, exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ Singleton {
|
||||
|
||||
onExited: function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to get laptop brightness, exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ Singleton {
|
||||
|
||||
onExited: function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to get max laptop brightness, exit code:", exitCode);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ Singleton {
|
||||
|
||||
onExited: function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Failed to get DDC brightness, exit code:", exitCode);
|
||||
|
||||
brightnessLevel = 75;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,27 +45,18 @@ Singleton {
|
||||
|
||||
function addRef() {
|
||||
refCount++;
|
||||
console.log("NetworkService: addRef, refCount now:", refCount);
|
||||
// Reference counting affects WiFi scanning operations only
|
||||
// Basic network status monitoring always runs
|
||||
}
|
||||
|
||||
function removeRef() {
|
||||
refCount = Math.max(0, refCount - 1);
|
||||
console.log("NetworkService: removeRef, refCount now:", refCount);
|
||||
// Stop intensive WiFi operations when no consumers
|
||||
if (refCount === 0) {
|
||||
autoRefreshTimer.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Load saved preference on startup
|
||||
Component.onCompleted: {
|
||||
// Load preference from Prefs system
|
||||
root.userPreference = Prefs.networkPreference
|
||||
console.log("NetworkService: Loaded network preference from Prefs:", root.userPreference)
|
||||
|
||||
// Trigger immediate WiFi info update if WiFi is connected and enabled
|
||||
if (root.networkStatus === "wifi" && root.wifiEnabled) {
|
||||
updateCurrentWifiInfo()
|
||||
}
|
||||
@@ -582,7 +573,7 @@ Singleton {
|
||||
return b.signal - a.signal;
|
||||
});
|
||||
root.wifiNetworks = networks;
|
||||
console.log("Found", networks.length, "WiFi networks");
|
||||
|
||||
// Stop scanning once we have results
|
||||
if (networks.length > 0) {
|
||||
root.isScanning = false;
|
||||
@@ -615,7 +606,7 @@ Singleton {
|
||||
|
||||
}
|
||||
root.savedWifiNetworks = saved;
|
||||
console.log("Found", saved.length, "saved WiFi networks");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -902,14 +893,14 @@ Singleton {
|
||||
|
||||
root.networkInfoDetails = details;
|
||||
root.networkInfoLoading = false;
|
||||
console.log("Network info fetched for:", root.networkInfoSSID);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onExited: (exitCode) => {
|
||||
root.networkInfoLoading = false;
|
||||
if (exitCode !== 0) {
|
||||
console.log("Failed to fetch network info, exit code:", exitCode);
|
||||
|
||||
root.networkInfoDetails = "Failed to fetch network information";
|
||||
}
|
||||
}
|
||||
@@ -917,7 +908,7 @@ Singleton {
|
||||
stderr: SplitParser {
|
||||
splitMarker: "\\n"
|
||||
onRead: (data) => {
|
||||
console.log("WiFi info stderr:", data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ Singleton {
|
||||
try {
|
||||
data = JSON.parse(text);
|
||||
} catch (error) {
|
||||
console.error("SysMonitorService: Failed to parse JSON:", error, "Raw text:", text.slice(0, 300));
|
||||
|
||||
isUpdating = false;
|
||||
return;
|
||||
}
|
||||
@@ -535,7 +535,7 @@ printf "}\\n"`
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("Unified stats process failed with exit code:", exitCode);
|
||||
|
||||
isUpdating = false;
|
||||
}
|
||||
}
|
||||
@@ -545,7 +545,7 @@ printf "}\\n"`
|
||||
const fullText = text.trim();
|
||||
const lastBraceIndex = fullText.lastIndexOf('}');
|
||||
if (lastBraceIndex === -1) {
|
||||
console.error("SysMonitorService: No JSON object found in output.", fullText);
|
||||
|
||||
isUpdating = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ Singleton {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("UserInfoService: Failed to get user info");
|
||||
|
||||
root.username = "User";
|
||||
root.fullName = "User";
|
||||
root.hostname = "System";
|
||||
@@ -55,7 +55,7 @@ Singleton {
|
||||
root.username = parts[0] || "";
|
||||
root.fullName = parts[1] || parts[0] || "";
|
||||
root.hostname = parts[2] || "";
|
||||
console.log("UserInfoService: User info loaded -", root.username, root.fullName, root.hostname);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ Singleton {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("UserInfoService: Failed to get uptime");
|
||||
|
||||
root.uptime = "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ Singleton {
|
||||
|
||||
function addRef() {
|
||||
refCount++;
|
||||
console.log("WeatherService: addRef, refCount now:", refCount);
|
||||
|
||||
if (refCount === 1 && !weather.available) {
|
||||
// Start fetching when first consumer appears
|
||||
fetchWeather();
|
||||
@@ -109,13 +109,13 @@ Singleton {
|
||||
|
||||
function removeRef() {
|
||||
refCount = Math.max(0, refCount - 1);
|
||||
console.log("WeatherService: removeRef, refCount now:", refCount);
|
||||
|
||||
}
|
||||
|
||||
function fetchWeather() {
|
||||
// Only fetch if someone is consuming the data
|
||||
if (root.refCount === 0) {
|
||||
console.log("WeatherService: Skipping fetch - no consumers");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ Image {
|
||||
}
|
||||
onCachePathChanged: {
|
||||
if (imageHash && cachePath) {
|
||||
// Ensure cache directory exists before trying to load from cache
|
||||
Paths.mkdir(Paths.imagecache);
|
||||
source = cachePath;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
// Force recreate popup when component becomes visible
|
||||
|
||||
id: root
|
||||
|
||||
property string text: ""
|
||||
@@ -26,7 +24,6 @@ Rectangle {
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceHover
|
||||
Component.onCompleted: {
|
||||
// Force a small delay to ensure proper initialization
|
||||
forceRecreateTimer.start();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
@@ -104,7 +101,6 @@ Rectangle {
|
||||
popup.close();
|
||||
} else if (popup) {
|
||||
var pos = dropdown.mapToItem(Overlay.overlay, 0, dropdown.height + 4);
|
||||
// Center the wider popup over the dropdown button
|
||||
popup.x = pos.x - (root.popupWidthOffset / 2);
|
||||
popup.y = pos.y;
|
||||
popup.open();
|
||||
@@ -112,7 +108,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Use a Row for the left-aligned content (icon + text)
|
||||
Row {
|
||||
id: contentRow
|
||||
|
||||
@@ -135,14 +130,12 @@ Rectangle {
|
||||
text: root.currentValue
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
// Constrain width for proper eliding
|
||||
width: dropdown.width - contentRow.x - expandIcon.width - Theme.spacingM - Theme.spacingS
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Anchor the expand icon to the right, outside of the Row
|
||||
DankIcon {
|
||||
id: expandIcon
|
||||
|
||||
@@ -163,7 +156,6 @@ Rectangle {
|
||||
|
||||
active: true
|
||||
onRecreateFlagChanged: {
|
||||
// Force recreation by toggling active
|
||||
active = false;
|
||||
active = true;
|
||||
}
|
||||
@@ -241,7 +233,6 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
|
||||
// Search field
|
||||
Rectangle {
|
||||
id: searchContainer
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ GridView {
|
||||
signal itemClicked(int index, var modelData)
|
||||
signal itemHovered(int index)
|
||||
|
||||
// Ensure the current item is visible
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= gridView.count)
|
||||
return ;
|
||||
@@ -157,7 +156,6 @@ GridView {
|
||||
itemHovered(index);
|
||||
}
|
||||
onPositionChanged: {
|
||||
// Signal parent to reset keyboard navigation flag when mouse moves
|
||||
keyboardNavigationReset();
|
||||
}
|
||||
onClicked: {
|
||||
|
||||
@@ -18,7 +18,6 @@ StyledText {
|
||||
color: Theme.surfaceText
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
// Material Icons variable font axes support
|
||||
font.variableAxes: ({
|
||||
"FILL": fill.toFixed(1),
|
||||
"GRAD": grade,
|
||||
@@ -26,7 +25,6 @@ StyledText {
|
||||
"wght": weight
|
||||
})
|
||||
|
||||
// Smooth transitions for variable axes
|
||||
Behavior on fill {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.quick
|
||||
|
||||
@@ -20,7 +20,6 @@ ListView {
|
||||
signal itemClicked(int index, var modelData)
|
||||
signal itemHovered(int index)
|
||||
|
||||
// Ensure the current item is visible
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= count)
|
||||
return ;
|
||||
@@ -156,7 +155,6 @@ ListView {
|
||||
itemHovered(index);
|
||||
}
|
||||
onPositionChanged: {
|
||||
// Signal parent to reset keyboard navigation flag when mouse moves
|
||||
keyboardNavigationReset();
|
||||
}
|
||||
onClicked: {
|
||||
|
||||
@@ -21,7 +21,6 @@ Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -48,7 +47,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Widget Items
|
||||
Column {
|
||||
id: itemsList
|
||||
|
||||
@@ -252,7 +250,6 @@ Column {
|
||||
|
||||
}
|
||||
|
||||
// Add Widget Control
|
||||
Rectangle {
|
||||
width: 200
|
||||
height: 40
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Column {
|
||||
id: root
|
||||
|
||||
property var items: []
|
||||
property var allWidgets: []
|
||||
property string title: ""
|
||||
property string titleIcon: "widgets"
|
||||
property string sectionId: ""
|
||||
|
||||
signal itemEnabledChanged(string itemId, bool enabled)
|
||||
signal itemOrderChanged(var newOrder)
|
||||
signal addWidget(string sectionId)
|
||||
signal removeLastWidget(string sectionId)
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
name: root.titleIcon
|
||||
size: Theme.iconSize
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.title
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width - 60
|
||||
height: 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Widget Items
|
||||
Column {
|
||||
id: itemsList
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Repeater {
|
||||
model: root.items
|
||||
|
||||
delegate: Item {
|
||||
id: delegateItem
|
||||
|
||||
property int visualIndex: index
|
||||
property bool held: dragArea.pressed
|
||||
property string itemId: modelData.id
|
||||
|
||||
width: itemsList.width
|
||||
height: 70
|
||||
z: held ? 2 : 1
|
||||
|
||||
Rectangle {
|
||||
id: itemBackground
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.8)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
border.width: 1
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Drag handle
|
||||
Rectangle {
|
||||
width: 40
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
DankIcon {
|
||||
name: "drag_indicator"
|
||||
size: Theme.iconSize - 4
|
||||
color: Theme.outline
|
||||
anchors.centerIn: parent
|
||||
opacity: 0.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Widget icon
|
||||
DankIcon {
|
||||
name: modelData.icon
|
||||
size: Theme.iconSize
|
||||
color: modelData.enabled ? Theme.primary : Theme.outline
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
// Widget info
|
||||
Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
width: parent.width - 200 // Leave space for toggle
|
||||
|
||||
StyledText {
|
||||
text: modelData.text
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: modelData.enabled ? Theme.surfaceText : Theme.outline
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.description
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: modelData.enabled ? Theme.outline : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.6)
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Spacer to push toggle to right
|
||||
Item {
|
||||
width: parent.width - 280 // Dynamic width
|
||||
height: 1
|
||||
}
|
||||
|
||||
// Toggle - positioned at right edge
|
||||
DankToggle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 48
|
||||
height: 24
|
||||
hideText: true
|
||||
checked: modelData.enabled
|
||||
onToggled: (checked) => {
|
||||
root.itemEnabledChanged(modelData.id, checked);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Drag functionality
|
||||
MouseArea {
|
||||
id: dragArea
|
||||
|
||||
property bool validDragStart: false
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
drag.target: held && validDragStart ? delegateItem : undefined
|
||||
drag.axis: Drag.YAxis
|
||||
drag.minimumY: -delegateItem.height
|
||||
drag.maximumY: itemsList.height
|
||||
onPressed: (mouse) => {
|
||||
// Only allow dragging from the drag handle area (first 60px)
|
||||
if (mouse.x <= 60) {
|
||||
validDragStart = true;
|
||||
delegateItem.z = 2;
|
||||
} else {
|
||||
validDragStart = false;
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
delegateItem.z = 1;
|
||||
if (drag.active && validDragStart) {
|
||||
// Calculate new index based on position
|
||||
var newIndex = Math.round(delegateItem.y / (delegateItem.height + itemsList.spacing));
|
||||
newIndex = Math.max(0, Math.min(newIndex, root.items.length - 1));
|
||||
if (newIndex !== index) {
|
||||
var newItems = root.items.slice();
|
||||
var draggedItem = newItems.splice(index, 1)[0];
|
||||
newItems.splice(newIndex, 0, draggedItem);
|
||||
root.itemOrderChanged(newItems.map((item) => {
|
||||
return item.id;
|
||||
}));
|
||||
}
|
||||
}
|
||||
// Reset position
|
||||
delegateItem.x = 0;
|
||||
delegateItem.y = 0;
|
||||
validDragStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Animations for drag
|
||||
Behavior on y {
|
||||
enabled: !dragArea.held && !dragArea.drag.active
|
||||
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add/Remove Controls
|
||||
Rectangle {
|
||||
width: parent.width * 0.5
|
||||
height: 40
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
border.width: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingL
|
||||
|
||||
StyledText {
|
||||
text: "Add or remove widgets"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.outline
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
// Add button
|
||||
DankActionButton {
|
||||
iconName: "add"
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.primary
|
||||
hoverColor: Theme.primaryContainer
|
||||
onClicked: {
|
||||
root.addWidget(root.sectionId);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove button
|
||||
DankActionButton {
|
||||
iconName: "remove"
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.error
|
||||
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.1)
|
||||
enabled: root.items.length > 0
|
||||
opacity: root.items.length > 0 ? 1 : 0.5
|
||||
onClicked: {
|
||||
if (root.items.length > 0)
|
||||
root.removeLastWidget(root.sectionId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,13 +19,11 @@ StyledRect {
|
||||
property alias validator: textInput.validator
|
||||
property alias inputMethodHints: textInput.inputMethodHints
|
||||
property alias maximumLength: textInput.maximumLength
|
||||
// Icon properties
|
||||
property string leftIconName: ""
|
||||
property int leftIconSize: Theme.iconSize
|
||||
property color leftIconColor: Theme.surfaceVariantText
|
||||
property color leftIconFocusedColor: Theme.primary
|
||||
property bool showClearButton: false
|
||||
// Custom properties
|
||||
property color backgroundColor: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.9)
|
||||
property color focusedBorderColor: Theme.primary
|
||||
property color normalBorderColor: Theme.outlineStrong
|
||||
@@ -33,22 +31,18 @@ StyledRect {
|
||||
property int borderWidth: 1
|
||||
property int focusedBorderWidth: 2
|
||||
property real cornerRadius: Theme.cornerRadius
|
||||
// Internal padding calculations
|
||||
readonly property real leftPadding: Theme.spacingM + (leftIconName ? leftIconSize + Theme.spacingM : 0)
|
||||
readonly property real rightPadding: Theme.spacingM + (showClearButton && text.length > 0 ? 24 + Theme.spacingM : 0)
|
||||
property real topPadding: Theme.spacingM
|
||||
property real bottomPadding: Theme.spacingM
|
||||
// Behavior control
|
||||
property bool ignoreLeftRightKeys: false
|
||||
property var keyForwardTargets: []
|
||||
|
||||
// Signals
|
||||
signal textEdited()
|
||||
signal editingFinished()
|
||||
signal accepted()
|
||||
signal focusStateChanged(bool hasFocus)
|
||||
|
||||
// Access to inner TextInput properties via functions
|
||||
function getActiveFocus() {
|
||||
return textInput.activeFocus;
|
||||
}
|
||||
@@ -61,7 +55,6 @@ StyledRect {
|
||||
textInput.focus = value;
|
||||
}
|
||||
|
||||
// Functions
|
||||
function forceActiveFocus() {
|
||||
textInput.forceActiveFocus();
|
||||
}
|
||||
@@ -94,7 +87,6 @@ StyledRect {
|
||||
textInput.focus = false;
|
||||
}
|
||||
|
||||
// Default styling
|
||||
width: 200
|
||||
height: 48
|
||||
radius: cornerRadius
|
||||
@@ -102,7 +94,6 @@ StyledRect {
|
||||
border.color: textInput.activeFocus ? focusedBorderColor : normalBorderColor
|
||||
border.width: textInput.activeFocus ? focusedBorderWidth : borderWidth
|
||||
|
||||
// Left icon
|
||||
DankIcon {
|
||||
id: leftIcon
|
||||
|
||||
@@ -153,7 +144,6 @@ StyledRect {
|
||||
|
||||
}
|
||||
|
||||
// Clear button
|
||||
StyledRect {
|
||||
id: clearButton
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ Popup {
|
||||
|
||||
signal widgetSelected(string widgetId, string targetSection)
|
||||
|
||||
// Prevent multiple openings
|
||||
function safeOpen() {
|
||||
if (!isOpening && !visible) {
|
||||
isOpening = true;
|
||||
@@ -29,7 +28,6 @@ Popup {
|
||||
}
|
||||
onClosed: {
|
||||
isOpening = false;
|
||||
// Clear references to prevent memory leaks
|
||||
allWidgets = [];
|
||||
targetSection = "";
|
||||
}
|
||||
@@ -44,7 +42,6 @@ Popup {
|
||||
contentItem: Item {
|
||||
anchors.fill: parent
|
||||
|
||||
// Close button in top-right
|
||||
DankActionButton {
|
||||
iconName: "close"
|
||||
iconSize: Theme.iconSize - 2
|
||||
@@ -65,7 +62,6 @@ Popup {
|
||||
anchors.margins: Theme.spacingL
|
||||
anchors.topMargin: Theme.spacingL + 30 // Space for close button
|
||||
|
||||
// Header
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -95,7 +91,6 @@ Popup {
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
// Widget List
|
||||
ScrollView {
|
||||
width: parent.width
|
||||
height: parent.height - 120 // Leave space for header and description
|
||||
@@ -120,7 +115,6 @@ Popup {
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
// Widget icon
|
||||
DankIcon {
|
||||
name: modelData.icon
|
||||
size: Theme.iconSize
|
||||
@@ -128,7 +122,6 @@ Popup {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
// Widget info
|
||||
Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
@@ -154,7 +147,6 @@ Popup {
|
||||
|
||||
}
|
||||
|
||||
// Add icon
|
||||
DankIcon {
|
||||
name: "add"
|
||||
size: Theme.iconSize - 4
|
||||
|
||||
@@ -10,18 +10,14 @@ Text {
|
||||
color: Theme.surfaceText
|
||||
font.pixelSize: Appearance.fontSize.normal
|
||||
font.family: {
|
||||
// Use system default
|
||||
|
||||
var requestedFont = isMonospace ? Prefs.monoFontFamily : Prefs.fontFamily;
|
||||
var defaultFont = isMonospace ? Prefs.defaultMonoFontFamily : Prefs.defaultFontFamily;
|
||||
// If user hasn't overridden the font and we're using the default
|
||||
if (requestedFont === defaultFont) {
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
if (!availableFonts.includes(requestedFont))
|
||||
return isMonospace ? "Monospace" : "DejaVu Sans";
|
||||
|
||||
}
|
||||
// Either user overrode it, or default font is available
|
||||
return requestedFont;
|
||||
}
|
||||
font.weight: Prefs.fontWeight
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//@ pragma UseQApplication
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
@@ -30,7 +29,6 @@ ShellRoot {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
// Multi-monitor support using Variants
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
@@ -103,7 +101,6 @@ ShellRoot {
|
||||
id: settingsModal
|
||||
}
|
||||
|
||||
// Application and clipboard components
|
||||
AppDrawerPopout {
|
||||
id: appDrawerPopout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user