diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index 2a9184bb3..b99e205b0 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -3,7 +3,9 @@ pragma ComponentBehavior: Bound import QtQuick import Quickshell import Quickshell.Io -import qs.modules.common.functions + +import "functions" +import "config" Singleton { id: root @@ -604,26 +606,8 @@ Singleton { } } - property JsonObject waffles: JsonObject { - // Some spots are kinda janky/awkward. Setting the following to - // false will make (some) stuff also be like that for accuracy. - // Example: the right-click menu of the Start button - property JsonObject tweaks: JsonObject { - property bool switchHandlePositionFix: true - property bool smootherMenuAnimations: true - property bool smootherSearchBar: true - } - property JsonObject bar: JsonObject { - property bool bottom: true - property bool leftAlignApps: false - } - property JsonObject actionCenter: JsonObject { - property list toggles: [ "network", "bluetooth", "easyEffects", "powerProfile", "idleInhibitor", "nightLight", "darkMode", "antiFlashbang", "cloudflareWarp", "mic", "musicRecognition", "notifications", "onScreenKeyboard", "gameMode", "screenSnip", "colorPicker" ] - } - property JsonObject calendar: JsonObject { - property bool force2CharDayOfWeek: true - } - } + property JsonObject hefty: HeftyConfig {} + property JsonObject waffles: WaffleConfig {} } } } diff --git a/dots/.config/quickshell/ii/modules/common/Directories.qml b/dots/.config/quickshell/ii/modules/common/Directories.qml index 78b0a9edb..f0dcc8a30 100644 --- a/dots/.config/quickshell/ii/modules/common/Directories.qml +++ b/dots/.config/quickshell/ii/modules/common/Directories.qml @@ -20,7 +20,8 @@ Singleton { readonly property string music: StandardPaths.standardLocations(StandardPaths.MusicLocation)[0] readonly property string videos: StandardPaths.standardLocations(StandardPaths.MoviesLocation)[0] - // Other dirs used by the shell, without "file://" + /////// Stuff below are without "file://" ///////// + // General property string assetsPath: Quickshell.shellPath("assets") property string scriptPath: Quickshell.shellPath("scripts") property string favicons: FileUtils.trimFileProtocol(`${Directories.cache}/media/favicons`) @@ -30,9 +31,6 @@ Singleton { property string booruDownloads: FileUtils.trimFileProtocol(Directories.pictures + "/homework") property string booruDownloadsNsfw: FileUtils.trimFileProtocol(Directories.pictures + "/homework/🌶️") property string latexOutput: FileUtils.trimFileProtocol(`${Directories.cache}/media/latex`) - property string shellConfig: FileUtils.trimFileProtocol(`${Directories.config}/illogical-impulse`) - property string shellConfigName: "config.json" - property string shellConfigPath: `${Directories.shellConfig}/${Directories.shellConfigName}` property string todoPath: FileUtils.trimFileProtocol(`${Directories.state}/user/todo.json`) property string notesPath: FileUtils.trimFileProtocol(`${Directories.state}/user/notes.txt`) property string conflictCachePath: FileUtils.trimFileProtocol(`${Directories.cache}/conflict-killer`) @@ -43,14 +41,21 @@ Singleton { property string screenshotTemp: "/tmp/quickshell/media/screenshot" property string wallpaperSwitchScriptPath: FileUtils.trimFileProtocol(`${Directories.scriptPath}/colors/switchwall.sh`) property string defaultAiPrompts: Quickshell.shellPath("defaults/ai/prompts") - property string userAiPrompts: FileUtils.trimFileProtocol(`${Directories.shellConfig}/ai/prompts`) - property string userActions: FileUtils.trimFileProtocol(`${Directories.shellConfig}/actions`) property string aiChats: FileUtils.trimFileProtocol(`${Directories.state}/user/ai/chats`) property string aiTranslationScriptPath: FileUtils.trimFileProtocol(`${Directories.scriptPath}/ai/gemini-translate.sh`) property string recordScriptPath: FileUtils.trimFileProtocol(`${Directories.scriptPath}/videos/record.sh`) property string userAvatarPathAccountsService: FileUtils.trimFileProtocol(`/var/lib/AccountsService/icons/${SystemInfo.username}`) property string userAvatarPathRicersAndWeirdSystems: FileUtils.trimFileProtocol(`${Directories.home}.face`) property string userAvatarPathRicersAndWeirdSystems2: FileUtils.trimFileProtocol(`${Directories.home}.face.icon`) + + // User + property string shellConfig: FileUtils.trimFileProtocol(`${Directories.config}/illogical-impulse`) + property string shellConfigName: "config.json" + property string shellConfigPath: `${Directories.shellConfig}/${Directories.shellConfigName}` + property string userAiPrompts: FileUtils.trimFileProtocol(`${Directories.shellConfig}/ai/prompts`) + property string userActions: FileUtils.trimFileProtocol(`${Directories.shellConfig}/actions`) + property string userComponents: FileUtils.trimFileProtocol(`${Directories.shellConfig}/components`) + // Cleanup on init Component.onCompleted: { Quickshell.execDetached(["mkdir", "-p", `${shellConfig}`]) diff --git a/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml b/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml new file mode 100644 index 000000000..57a18fe86 --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml @@ -0,0 +1,11 @@ +import QtQuick +import Quickshell +import Quickshell.Io + +JsonObject { + property JsonObject bar: JsonObject { + property list leftWidgets: [] + property list centerWidgets: [] + property list rightWidgets: [] + } +} diff --git a/dots/.config/quickshell/ii/modules/common/config/WaffleConfig.qml b/dots/.config/quickshell/ii/modules/common/config/WaffleConfig.qml new file mode 100644 index 000000000..9509ff166 --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/config/WaffleConfig.qml @@ -0,0 +1,24 @@ +import QtQuick +import Quickshell +import Quickshell.Io + +JsonObject { + // Some spots are kinda janky/awkward. Setting the following to + // false will make (some) stuff also be like that for accuracy. + // Example: the right-click menu of the Start button + property JsonObject tweaks: JsonObject { + property bool switchHandlePositionFix: true + property bool smootherMenuAnimations: true + property bool smootherSearchBar: true + } + property JsonObject bar: JsonObject { + property bool bottom: true + property bool leftAlignApps: false + } + property JsonObject actionCenter: JsonObject { + property list toggles: [ "network", "bluetooth", "easyEffects", "powerProfile", "idleInhibitor", "nightLight", "darkMode", "antiFlashbang", "cloudflareWarp", "mic", "musicRecognition", "notifications", "onScreenKeyboard", "gameMode", "screenSnip", "colorPicker" ] + } + property JsonObject calendar: JsonObject { + property bool force2CharDayOfWeek: true + } +} diff --git a/dots/.config/quickshell/ii/modules/common/widgets/Colorizer.qml b/dots/.config/quickshell/ii/modules/common/widgets/Colorizer.qml new file mode 100644 index 000000000..032d59eb1 --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/widgets/Colorizer.qml @@ -0,0 +1,14 @@ +import QtQuick +import QtQuick.Effects +import qs.modules.common + +MultiEffect { + property color sourceColor: "black" + + colorization: 1 + brightness: 1 - sourceColor.hslLightness + + Behavior on colorizationColor { + animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this) + } +} diff --git a/dots/.config/quickshell/ii/modules/common/widgets/FadeLazyLoader.qml b/dots/.config/quickshell/ii/modules/common/widgets/FadeLazyLoader.qml new file mode 100644 index 000000000..f826a9fbc --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/widgets/FadeLazyLoader.qml @@ -0,0 +1,25 @@ +import QtQuick +import Quickshell +import qs.modules.common + +Item { + id: root + + property alias load: loader.activeAsync + property bool shown: true // By default show immediately when loaded + property alias component: loader.component + + property alias fade: opacityBehavior.enabled + property alias animation: opacityBehavior.animation + + opacity: loader.active && shown ? 1 : 0 + visible: opacity > 0 + Behavior on opacity { + id: opacityBehavior + animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) + } + + LazyLoader { + id: loader + } +} diff --git a/dots/.config/quickshell/ii/modules/common/widgets/FallbackLoader.qml b/dots/.config/quickshell/ii/modules/common/widgets/FallbackLoader.qml new file mode 100644 index 000000000..0da12fbb7 --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/widgets/FallbackLoader.qml @@ -0,0 +1,25 @@ +import QtQuick + +Loader { + id: root + + property int fallbackIndex: 0 + property list fallbacks: [] + property list fallbackComponents: [] + + onStatusChanged: { + if (status === Loader.Error && fallbackIndex < fallbacks.length) { + if (fallbacks[fallbackIndex]) { + source = fallbacks[fallbackIndex]; + if (fallbackComponents[fallbackIndex]) { + console.warn("[FallbackLoader] Both fallbacks urls and components are set, using url fallback"); + } + } else if (fallbackComponents[fallbackIndex]) { + sourceComponent = fallbackComponents[fallbackIndex]; + } else { + console.error("[FallbackLoader] Out of fallbacks, tried all", fallbackIndex); + } + fallbackIndex += 1; + } + } +} diff --git a/dots/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml b/dots/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml index e3d64027b..8802aaf69 100644 --- a/dots/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml +++ b/dots/.config/quickshell/ii/modules/common/widgets/NotificationGroup.qml @@ -85,7 +85,7 @@ MouseArea { // Notification group area automaticallyReset: false acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onPressed: { + onPressed: (mouse) => { if (mouse.button === Qt.RightButton) root.toggleExpanded(); } @@ -102,6 +102,7 @@ MouseArea { // Notification group area } onDragDiffXChanged: () => { + if (!dragging) return; root.qmlParent.dragDistance = dragDiffX; } diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml index 2dd545f96..5eb6e21aa 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml @@ -18,9 +18,11 @@ Item { property int screenWidth: QsWindow.window.width property int screenHeight: QsWindow.window.height - // Signals + // Signals & loading signal requestFocus() signal dismissed() + property bool load: true + property bool shown: true // Some info property int reservedTop: 0 diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml index 526ed653a..a96129f7f 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml @@ -10,6 +10,8 @@ import "../../common/widgets/shapes/material-shapes.js" as MaterialShapes import "../../common/widgets/shapes/shapes/corner-rounding.js" as CornerRounding import "../../common/widgets/shapes/geometry/offset.js" as Offset +import "bar" + /** * Fullscreen layer. Uses masking to not block clicks on windows n' stuff. */ @@ -35,15 +37,31 @@ PanelWindow { ///////////////// Content ////////////////// property alias roundedPolygon: backgroundShape.roundedPolygon + property bool finishedMorphing: true + onRoundedPolygonChanged: finishedMorphing = false + Connections { + target: backgroundShape + function onProgressChanged() { + // While it overshoots because of the spring animation, waiting for the bounce to finish entirely would be too slow + // ^ (totally not an excuse for my laziness) + if (backgroundShape.progress >= 1.0) { + root.finishedMorphing = true + } + } + } S.ShapeCanvas { id: backgroundShape anchors.fill: parent polygonIsNormalized: false roundedPolygon: MaterialShapes.customPolygon([new MaterialShapes.PointNRound(new Offset.Offset(root.screen.width, 0), new CornerRounding.CornerRounding(9999)),]) - animation: NumberAnimation { - duration: 500 - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.animationCurves.expressiveDefaultSpatial + // animation: NumberAnimation { + // duration: 500 + // easing.type: Easing.BezierSpline + // easing.bezierCurve: Appearance.animationCurves.expressiveDefaultSpatial + // } + animation: SpringAnimation { + spring: 3.5 + damping: 0.35 } color: Appearance.colors.colLayer0 borderWidth: (root.currentPanel === bar && Config.options.bar.cornerStyle !== 1) ? 0 : 1 @@ -60,7 +78,8 @@ PanelWindow { color: "#44000000" } - property HAbstractMorphedPanel currentPanel: bar + property HAbstractMorphedPanel currentPanel: null + Component.onCompleted: currentPanel = bar roundedPolygon: currentPanel.backgroundPolygon // Do we want to have reserved area always follow the bar or maybe differ per panel? @@ -89,10 +108,14 @@ PanelWindow { HBar { id: bar + load: root.currentPanel === this + shown: root.finishedMorphing } HOverview { id: overview + load: root.currentPanel === this + shown: root.finishedMorphing onRequestFocus: root.currentPanel = overview; onDismissed: root.dismiss(); } diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBar.qml similarity index 91% rename from dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml rename to dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBar.qml index d3ba215da..8da64c902 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBar.qml @@ -1,8 +1,11 @@ +pragma ComponentBehavior: Bound import QtQuick import qs.modules.common -import "../../common/widgets/shapes/material-shapes.js" as MaterialShapes -import "../../common/widgets/shapes/shapes/corner-rounding.js" as CornerRounding -import "../../common/widgets/shapes/geometry/offset.js" as Offset +import qs.modules.common.widgets +import "../../../common/widgets/shapes/material-shapes.js" as MaterialShapes +import "../../../common/widgets/shapes/shapes/corner-rounding.js" as CornerRounding +import "../../../common/widgets/shapes/geometry/offset.js" as Offset +import ".." HAbstractMorphedPanel { id: root @@ -131,4 +134,15 @@ HAbstractMorphedPanel { easing.bezierCurve: Appearance.animationCurves.expressiveDefaultSpatial } } + + FadeLazyLoader { + id: contentLoader + load: root.load + shown: root.shown + anchors.fill: parent + component: HBarContent { + parent: contentLoader + anchors.fill: parent + } + } } diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml new file mode 100644 index 000000000..6db44b69e --- /dev/null +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml @@ -0,0 +1,39 @@ +import QtQuick +import QtQuick.Layouts +import Quickshell +import qs.services +import qs.modules.common.widgets + +Item { + id: root + + Side { + id: leftSide + anchors.left: parent.left + width: (parent.width - centerSide.width) / 2 + } + + Side { + id: centerSide + anchors.horizontalCenter: parent.horizontalCenter + + FallbackLoader { + asynchronous: true + source: "/home/end/.config/quickshell/ii/modules/ii/bar/WrongModuleName" + fallbacks: ["/home/end/.config/quickshell/ii/modules/ii/bar/Workspaces.qml"] + } + } + + Side { + id: rightSide + anchors.right: parent.right + width: (parent.width - centerSide.width) / 2 + } + + component Side: RowLayout { + anchors { + top: parent.top + bottom: parent.bottom + } + } +} diff --git a/dots/.config/quickshell/ii/modules/ii/bar/Workspaces.qml b/dots/.config/quickshell/ii/modules/ii/bar/Workspaces.qml index 36c488730..947fa6d93 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/Workspaces.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/Workspaces.qml @@ -182,6 +182,7 @@ Item { // Workspaces - numbers Grid { + id: wsNumbers z: 3 columns: root.vertical ? 1 : root.workspacesShown @@ -210,6 +211,11 @@ Item { property var biggestWindow: HyprlandData.biggestWindowForWorkspace(button.workspaceValue) property var mainAppIconSource: Quickshell.iconPath(AppSearch.guessIcon(biggestWindow?.class), "image-missing") + property color numberColor: (monitor?.activeWorkspace?.id == button.workspaceValue) ? + Appearance.m3colors.m3onPrimary : + (workspaceOccupied[index] ? Appearance.m3colors.m3onSecondaryContainer : + Appearance.colors.colOnLayer1Inactive) + StyledText { // Workspace number text opacity: root.showNumbers || ((Config.options?.bar.workspaces.alwaysShowNumbers && (!Config.options?.bar.workspaces.showAppIcons || !workspaceButtonBackground.biggestWindow || root.showNumbers)) @@ -226,10 +232,7 @@ Item { } text: Config.options?.bar.workspaces.numberMap[button.workspaceValue - 1] || button.workspaceValue elide: Text.ElideRight - color: (root.effectiveActiveWorkspaceId == button.workspaceValue) ? - Appearance.m3colors.m3onPrimary : - (workspaceOccupied[index] ? Appearance.m3colors.m3onSecondaryContainer : - Appearance.colors.colOnLayer1Inactive) + color: workspaceButtonBackground.numberColor Behavior on opacity { animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) @@ -246,10 +249,7 @@ Item { width: workspaceButtonWidth * 0.18 height: width radius: width / 2 - color: (root.effectiveActiveWorkspaceId == button.workspaceValue) ? - Appearance.m3colors.m3onPrimary : - (workspaceOccupied[index] ? Appearance.m3colors.m3onSecondaryContainer : - Appearance.colors.colOnLayer1Inactive) + color: workspaceButtonBackground.numberColor Behavior on opacity { animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) @@ -309,12 +309,8 @@ Item { } } } - - } - } - } } diff --git a/dots/.config/quickshell/ii/modules/ii/sidebarRight/SidebarRight.qml b/dots/.config/quickshell/ii/modules/ii/sidebarRight/SidebarRight.qml index e7da61e44..73620241b 100644 --- a/dots/.config/quickshell/ii/modules/ii/sidebarRight/SidebarRight.qml +++ b/dots/.config/quickshell/ii/modules/ii/sidebarRight/SidebarRight.qml @@ -53,6 +53,7 @@ Scope { margins: Appearance.sizes.hyprlandGapsOut leftMargin: Appearance.sizes.elevationMargin } + asynchronous: true width: sidebarWidth - Appearance.sizes.hyprlandGapsOut - Appearance.sizes.elevationMargin height: parent.height - Appearance.sizes.hyprlandGapsOut * 2 diff --git a/dots/.config/quickshell/ii/services/LauncherSearch.qml b/dots/.config/quickshell/ii/services/LauncherSearch.qml index 52e783e28..787da3090 100644 --- a/dots/.config/quickshell/ii/services/LauncherSearch.qml +++ b/dots/.config/quickshell/ii/services/LauncherSearch.qml @@ -43,9 +43,9 @@ Singleton { const actionName = fileName.replace(/\.[^/.]+$/, ""); // strip extension actions.push({ action: actionName, - execute: ((path) => (args) => { - Quickshell.execDetached([path, ...(args ? args.split(" ") : [])]); - })(FileUtils.trimFileProtocol(filePath.toString())) + execute: (path => args => { + Quickshell.execDetached([path, ...(args ? args.split(" ") : [])]); + })(FileUtils.trimFileProtocol(filePath.toString())) }); } } @@ -250,8 +250,8 @@ Singleton { if (!entry.runInTerminal) entry.execute(); else { - // Probably needs more proper escaping, but this will do for now - Quickshell.execDetached(["bash", '-c', `${Config.options.apps.terminal} -e '${StringUtils.shellSingleQuoteEscape(entry.command.join(' '))}'`]); + print([...Config.options.apps.terminal, "-e", ...entry.command]) + Quickshell.execDetached([...Config.options.apps.terminal, "-e", ...entry.command]); } }, comment: entry.comment, @@ -267,7 +267,7 @@ Singleton { if (!action.runInTerminal) action.execute(); else { - Quickshell.execDetached(["bash", '-c', `${Config.options.apps.terminal} -e '${StringUtils.shellSingleQuoteEscape(action.command.join(' '))}'`]); + Quickshell.execDetached([...Config.options.apps.terminal, "-e", ...action.command]); } } });