From 72f2aa5c2f7387cae826694555230b267e4ec98d Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 17 Jun 2025 12:21:22 +0200 Subject: [PATCH] welcome: weeb & ai policy --- .../quickshell/modules/common/Appearance.qml | 2 +- .../modules/common/widgets/GroupButton.qml | 38 +- .config/quickshell/welcome.qml | 369 +++++++++++------- 3 files changed, 260 insertions(+), 149 deletions(-) diff --git a/.config/quickshell/modules/common/Appearance.qml b/.config/quickshell/modules/common/Appearance.qml index 694c3af8e..b496f4d17 100644 --- a/.config/quickshell/modules/common/Appearance.qml +++ b/.config/quickshell/modules/common/Appearance.qml @@ -107,7 +107,7 @@ Singleton { property color colLayer1: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainerLow, m3colors.m3background, 0.8), root.contentTransparency); property color colOnLayer1: m3colors.m3onSurfaceVariant; property color colOnLayer1Inactive: ColorUtils.mix(colOnLayer1, colLayer1, 0.45); - property color colLayer2: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainer, m3colors.m3surfaceContainerHigh, 0.7), root.contentTransparency) + property color colLayer2: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainer, m3colors.m3surfaceContainerHigh, 0.1), root.contentTransparency) property color colOnLayer2: m3colors.m3onSurface; property color colOnLayer2Disabled: ColorUtils.mix(colOnLayer2, m3colors.m3background, 0.4); property color colLayer3: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainerHigh, m3colors.m3onSurface, 0.96), root.contentTransparency) diff --git a/.config/quickshell/modules/common/widgets/GroupButton.qml b/.config/quickshell/modules/common/widgets/GroupButton.qml index bfa887b68..362ae39e9 100644 --- a/.config/quickshell/modules/common/widgets/GroupButton.qml +++ b/.config/quickshell/modules/common/widgets/GroupButton.qml @@ -16,8 +16,8 @@ Button { id: root property bool toggled property string buttonText - property real buttonRadius: Appearance?.rounding?.small ?? 4 - property real buttonRadiusPressed: buttonRadius + property real buttonRadius: Appearance?.rounding?.small ?? 8 + property real buttonRadiusPressed: Appearance?.rounding?.small ?? 6 property var downAction // When left clicking (down) property var releaseAction // When left clicking (release) property var altAction // When right clicking @@ -34,18 +34,6 @@ Button { Layout.fillHeight: (clickIndex - 1 <= parentGroup.children.indexOf(root) && parentGroup.children.indexOf(root) <= clickIndex + 1) implicitWidth: (root.down && bounce) ? clickedWidth : baseWidth implicitHeight: (root.down && bounce) ? clickedHeight : baseHeight - - Behavior on implicitWidth { - animation: Appearance.animation.clickBounce.numberAnimation.createObject(this) - } - - Behavior on implicitHeight { - animation: Appearance.animation.clickBounce.numberAnimation.createObject(this) - } - - Behavior on radius { - animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) - } property color colBackground: ColorUtils.transparentize(Appearance?.colors.colLayer1Hover, 1) || "transparent" property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED" @@ -55,6 +43,8 @@ Button { property color colBackgroundToggledActive: Appearance?.colors.colPrimaryActive ?? "#D6CEE2" property real radius: root.down ? root.buttonRadiusPressed : root.buttonRadius + property real leftRadius: root.down ? root.buttonRadiusPressed : root.buttonRadius + property real rightRadius: root.down ? root.buttonRadiusPressed : root.buttonRadius property color color: root.enabled ? (root.toggled ? (root.down ? colBackgroundToggledActive : root.hovered ? colBackgroundToggledHover : @@ -71,6 +61,21 @@ Button { } } + Behavior on implicitWidth { + animation: Appearance.animation.clickBounce.numberAnimation.createObject(this) + } + + Behavior on implicitHeight { + animation: Appearance.animation.clickBounce.numberAnimation.createObject(this) + } + + Behavior on leftRadius { + animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) + } + Behavior on rightRadius { + animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) + } + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -100,7 +105,10 @@ Button { background: Rectangle { id: buttonBackground - radius: root.radius + topLeftRadius: root.leftRadius + topRightRadius: root.rightRadius + bottomLeftRadius: root.leftRadius + bottomRightRadius: root.rightRadius implicitHeight: 50 color: root.color diff --git a/.config/quickshell/welcome.qml b/.config/quickshell/welcome.qml index 55cfdef99..2935414b7 100644 --- a/.config/quickshell/welcome.qml +++ b/.config/quickshell/welcome.qml @@ -38,7 +38,7 @@ ApplicationWindow { minimumWidth: 600 minimumHeight: 400 width: 800 - height: 600 + height: 650 color: Appearance.m3colors.m3background Process { @@ -53,13 +53,29 @@ ApplicationWindow { } } + component SelectionConnectedButton: GroupButton { + id: selectionConnectedButtonRoot + horizontalPadding: 12 + verticalPadding: 8 + bounce: false + property bool leftmost: false + property bool rightmost: false + leftRadius: (toggled || leftmost) ? (height / 2) : Appearance.rounding.unsharpenmore + rightRadius: (toggled || rightmost) ? (height / 2) : Appearance.rounding.unsharpenmore + colBackground: Appearance.colors.colSecondaryContainer + contentItem: StyledText { + color: parent.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer + text: selectionConnectedButtonRoot.buttonText + } + } + component Section: ColumnLayout { id: sectionRoot property string title default property alias data: sectionContent.data Layout.fillWidth: true - spacing: 10 + spacing: 8 StyledText { text: sectionRoot.title font.pixelSize: Appearance.font.pixelSize.larger @@ -84,10 +100,10 @@ ApplicationWindow { } implicitHeight: 35 horizontalPadding: 15 - buttonRadius: Appearance.rounding.full - colBackground: Appearance.colors.colSecondaryContainer - colBackgroundHover: Appearance.colors.colSecondaryContainerHover - colRipple: Appearance.colors.colSecondaryContainerActive + buttonRadius: Appearance.rounding.small + colBackground: Appearance.colors.colLayer2 + // colBackgroundHover: Appearance.colors.colSecondaryContainerHover + // colRipple: Appearance.colors.colSecondaryContainerActive contentItem: RowLayout { Item { @@ -295,69 +311,165 @@ ApplicationWindow { Layout.fillWidth: true Layout.fillHeight: true radius: Appearance.rounding.windowRounding - root.contentPadding - ColumnLayout { - id: contentColumn - anchors { - top: parent.top - bottom: parent.bottom - horizontalCenter: parent.horizontalCenter - margins: 10 - } - spacing: 20 - - Section { - title: "Style & wallpaper" - - ButtonGroup { - Layout.fillWidth: true - LightDarkPrefButton { - dark: false - } - LightDarkPrefButton { - dark: true - } + Flickable { + clip: true + anchors.fill: parent + contentHeight: contentColumn.implicitHeight + implicitWidth: contentColumn.implicitWidth + ColumnLayout { + id: contentColumn + anchors { + top: parent.top + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + margins: 10 } + spacing: 20 - RowLayout { - Layout.alignment: Qt.AlignHCenter - ButtonWithIcon { - id: rndWallBtn + Section { + title: "Style & wallpaper" + + ButtonGroup { + Layout.fillWidth: true + LightDarkPrefButton { + dark: false + } + LightDarkPrefButton { + dark: true + } + } + + RowLayout { Layout.alignment: Qt.AlignHCenter - buttonRadius: Appearance.rounding.small - iconText: "wallpaper" - mainText: konachanWallProc.running ? "Be patient..." : "Random: Konachan" - onClicked: { - console.log(konachanWallProc.command.join(" ")) - konachanWallProc.running = true; + ButtonWithIcon { + id: rndWallBtn + Layout.alignment: Qt.AlignHCenter + buttonRadius: Appearance.rounding.small + iconText: "wallpaper" + mainText: konachanWallProc.running ? "Be patient..." : "Random: Konachan" + onClicked: { + console.log(konachanWallProc.command.join(" ")) + konachanWallProc.running = true; + } + } + ButtonWithIcon { + iconText: "wallpaper" + onClicked: { + Hyprland.dispatch(`exec ${Directories.wallpaperSwitchScriptPath}`) + } + mainContentComponent: Component { + RowLayout { + spacing: 10 + StyledText { + font.pixelSize: Appearance.font.pixelSize.small + text: "Choose file" + color: Appearance.colors.colOnSecondaryContainer + } + RowLayout { + spacing: 3 + KeyboardKey { + key: "Ctrl" + } + KeyboardKey { + key: "󰖳" + } + StyledText { + Layout.alignment: Qt.AlignVCenter + text: "+" + } + KeyboardKey { + key: "T" + } + } + } + } } } - ButtonWithIcon { - iconText: "wallpaper" - onClicked: { - Hyprland.dispatch(`exec ${Directories.wallpaperSwitchScriptPath}`) - } - mainContentComponent: Component { - RowLayout { - spacing: 10 - StyledText { - font.pixelSize: Appearance.font.pixelSize.small - text: "Choose file" - color: Appearance.colors.colOnSecondaryContainer + + StyledText { + Layout.alignment: Qt.AlignHCenter + text: "Change any time later with /dark, /light, /img in the launcher" + font.pixelSize: Appearance.font.pixelSize.smaller + color: Appearance.colors.colSubtext + } + } + + Section { + title: "Policies" + + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: 15 + ColumnLayout { // Weeb policy + StyledText { + text: "Weeb" + color: Appearance.colors.colSubtext + } + ButtonGroup { + id: weebPolicyBtnGroup + property int selectedPolicy: ConfigOptions.policies.weeb + spacing: 2 + SelectionConnectedButton { + property int value: 0 + leftmost: true + buttonText: "No" + toggled: (weebPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.weeb", value); + } } - RowLayout { - spacing: 3 - KeyboardKey { - key: "Ctrl" + SelectionConnectedButton { + property int value: 1 + buttonText: "Yes" + toggled: (weebPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.weeb", value); } - KeyboardKey { - key: "󰖳" + } + SelectionConnectedButton { + property int value: 2 + rightmost: true + buttonText: "Closet" + toggled: (weebPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.weeb", value); } - StyledText { - Layout.alignment: Qt.AlignVCenter - text: "+" + } + } + } + ColumnLayout { // AI policy + StyledText { + text: "AI" + color: Appearance.colors.colSubtext + } + ButtonGroup { + id: aiPolicyBtnGroup + property int selectedPolicy: ConfigOptions.policies.ai + spacing: 2 + SelectionConnectedButton { + property int value: 0 + leftmost: true + buttonText: "No" + toggled: (aiPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.ai", value); } - KeyboardKey { - key: "T" + } + SelectionConnectedButton { + property int value: 1 + buttonText: "Yes" + toggled: (aiPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.ai", value); + } + } + SelectionConnectedButton { + property int value: 2 + rightmost: true + buttonText: "Local only" + toggled: (aiPolicyBtnGroup.selectedPolicy === value) + onClicked: { + ConfigLoader.setConfigValueAndSave("policies.ai", value); } } } @@ -365,99 +477,90 @@ ApplicationWindow { } } - StyledText { - Layout.alignment: Qt.AlignHCenter - text: "Change any time later with /dark, /light, /img in the launcher" - font.pixelSize: Appearance.font.pixelSize.smaller - color: Appearance.colors.colSubtext - } - } + Section { + title: "Info" - Section { - title: "Info" + Flow { + Layout.fillWidth: true + spacing: 10 - Flow { - Layout.fillWidth: true - spacing: 10 - - ButtonWithIcon { - iconText: "keyboard_alt" - onClicked: { - Hyprland.dispatch("global quickshell:cheatsheetOpen") - } - mainContentComponent: Component { - RowLayout { - spacing: 10 - StyledText { - font.pixelSize: Appearance.font.pixelSize.small - text: "Keybinds" - color: Appearance.colors.colOnSecondaryContainer - } + ButtonWithIcon { + iconText: "keyboard_alt" + onClicked: { + Hyprland.dispatch("global quickshell:cheatsheetOpen") + } + mainContentComponent: Component { RowLayout { - spacing: 3 - KeyboardKey { - key: "󰖳" - } + spacing: 10 StyledText { - Layout.alignment: Qt.AlignVCenter - text: "+" + font.pixelSize: Appearance.font.pixelSize.small + text: "Keybinds" + color: Appearance.colors.colOnSecondaryContainer } - KeyboardKey { - key: "/" + RowLayout { + spacing: 3 + KeyboardKey { + key: "󰖳" + } + StyledText { + Layout.alignment: Qt.AlignVCenter + text: "+" + } + KeyboardKey { + key: "/" + } } } } } - } - ButtonWithIcon { - iconText: "help" - mainText: "Usage" - onClicked: { - Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/02usage/") + ButtonWithIcon { + iconText: "help" + mainText: "Usage" + onClicked: { + Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/02usage/") + } } - } - ButtonWithIcon { - iconText: "construction" - mainText: "Configuration" - onClicked: { - Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/03config/") + ButtonWithIcon { + iconText: "construction" + mainText: "Configuration" + onClicked: { + Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/03config/") + } } } } - } - Section { - title: "Useless buttons" + Section { + title: "Useless buttons" - Flow { + Flow { + Layout.fillWidth: true + spacing: 10 + + ButtonWithIcon { + nerdIcon: "󰊤" + mainText: "GitHub" + onClicked: { + Qt.openUrlExternally("https://github.com/end-4/dots-hyprland") + } + } + ButtonWithIcon { + iconText: "favorite" + mainText: "Funny number" + onClicked: { + Qt.openUrlExternally("https://github.com/sponsors/end-4") + } + } + } + } + + Item { Layout.fillWidth: true - anchors.left: parent.left - anchors.right: parent.right - spacing: 10 - - ButtonWithIcon { - nerdIcon: "󰊤" - mainText: "GitHub" - onClicked: { - Qt.openUrlExternally("https://github.com/end-4/dots-hyprland") - } - } - ButtonWithIcon { - iconText: "favorite" - mainText: "Funny number" - onClicked: { - Qt.openUrlExternally("https://github.com/sponsors/end-4") - } - } + Layout.fillHeight: true } - } - Item { - Layout.fillWidth: true - Layout.fillHeight: true } - } } }