welcome: weeb & ai policy

This commit is contained in:
end-4
2025-06-17 12:21:22 +02:00
parent 5d7905b566
commit 72f2aa5c2f
3 changed files with 260 additions and 149 deletions
@@ -107,7 +107,7 @@ Singleton {
property color colLayer1: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainerLow, m3colors.m3background, 0.8), root.contentTransparency); property color colLayer1: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainerLow, m3colors.m3background, 0.8), root.contentTransparency);
property color colOnLayer1: m3colors.m3onSurfaceVariant; property color colOnLayer1: m3colors.m3onSurfaceVariant;
property color colOnLayer1Inactive: ColorUtils.mix(colOnLayer1, colLayer1, 0.45); 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 colOnLayer2: m3colors.m3onSurface;
property color colOnLayer2Disabled: ColorUtils.mix(colOnLayer2, m3colors.m3background, 0.4); 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) property color colLayer3: ColorUtils.transparentize(ColorUtils.mix(m3colors.m3surfaceContainerHigh, m3colors.m3onSurface, 0.96), root.contentTransparency)
@@ -16,8 +16,8 @@ Button {
id: root id: root
property bool toggled property bool toggled
property string buttonText property string buttonText
property real buttonRadius: Appearance?.rounding?.small ?? 4 property real buttonRadius: Appearance?.rounding?.small ?? 8
property real buttonRadiusPressed: buttonRadius property real buttonRadiusPressed: Appearance?.rounding?.small ?? 6
property var downAction // When left clicking (down) property var downAction // When left clicking (down)
property var releaseAction // When left clicking (release) property var releaseAction // When left clicking (release)
property var altAction // When right clicking 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) Layout.fillHeight: (clickIndex - 1 <= parentGroup.children.indexOf(root) && parentGroup.children.indexOf(root) <= clickIndex + 1)
implicitWidth: (root.down && bounce) ? clickedWidth : baseWidth implicitWidth: (root.down && bounce) ? clickedWidth : baseWidth
implicitHeight: (root.down && bounce) ? clickedHeight : baseHeight 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 colBackground: ColorUtils.transparentize(Appearance?.colors.colLayer1Hover, 1) || "transparent"
property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED" property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED"
@@ -55,6 +43,8 @@ Button {
property color colBackgroundToggledActive: Appearance?.colors.colPrimaryActive ?? "#D6CEE2" property color colBackgroundToggledActive: Appearance?.colors.colPrimaryActive ?? "#D6CEE2"
property real radius: root.down ? root.buttonRadiusPressed : root.buttonRadius 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 ? property color color: root.enabled ? (root.toggled ?
(root.down ? colBackgroundToggledActive : (root.down ? colBackgroundToggledActive :
root.hovered ? colBackgroundToggledHover : 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 { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@@ -100,7 +105,10 @@ Button {
background: Rectangle { background: Rectangle {
id: buttonBackground id: buttonBackground
radius: root.radius topLeftRadius: root.leftRadius
topRightRadius: root.rightRadius
bottomLeftRadius: root.leftRadius
bottomRightRadius: root.rightRadius
implicitHeight: 50 implicitHeight: 50
color: root.color color: root.color
+236 -133
View File
@@ -38,7 +38,7 @@ ApplicationWindow {
minimumWidth: 600 minimumWidth: 600
minimumHeight: 400 minimumHeight: 400
width: 800 width: 800
height: 600 height: 650
color: Appearance.m3colors.m3background color: Appearance.m3colors.m3background
Process { 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 { component Section: ColumnLayout {
id: sectionRoot id: sectionRoot
property string title property string title
default property alias data: sectionContent.data default property alias data: sectionContent.data
Layout.fillWidth: true Layout.fillWidth: true
spacing: 10 spacing: 8
StyledText { StyledText {
text: sectionRoot.title text: sectionRoot.title
font.pixelSize: Appearance.font.pixelSize.larger font.pixelSize: Appearance.font.pixelSize.larger
@@ -84,10 +100,10 @@ ApplicationWindow {
} }
implicitHeight: 35 implicitHeight: 35
horizontalPadding: 15 horizontalPadding: 15
buttonRadius: Appearance.rounding.full buttonRadius: Appearance.rounding.small
colBackground: Appearance.colors.colSecondaryContainer colBackground: Appearance.colors.colLayer2
colBackgroundHover: Appearance.colors.colSecondaryContainerHover // colBackgroundHover: Appearance.colors.colSecondaryContainerHover
colRipple: Appearance.colors.colSecondaryContainerActive // colRipple: Appearance.colors.colSecondaryContainerActive
contentItem: RowLayout { contentItem: RowLayout {
Item { Item {
@@ -295,69 +311,165 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
radius: Appearance.rounding.windowRounding - root.contentPadding radius: Appearance.rounding.windowRounding - root.contentPadding
ColumnLayout { Flickable {
id: contentColumn clip: true
anchors { anchors.fill: parent
top: parent.top contentHeight: contentColumn.implicitHeight
bottom: parent.bottom implicitWidth: contentColumn.implicitWidth
horizontalCenter: parent.horizontalCenter ColumnLayout {
margins: 10 id: contentColumn
} anchors {
spacing: 20 top: parent.top
bottom: parent.bottom
Section { horizontalCenter: parent.horizontalCenter
title: "Style & wallpaper" margins: 10
ButtonGroup {
Layout.fillWidth: true
LightDarkPrefButton {
dark: false
}
LightDarkPrefButton {
dark: true
}
} }
spacing: 20
RowLayout { Section {
Layout.alignment: Qt.AlignHCenter title: "Style & wallpaper"
ButtonWithIcon {
id: rndWallBtn ButtonGroup {
Layout.fillWidth: true
LightDarkPrefButton {
dark: false
}
LightDarkPrefButton {
dark: true
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
buttonRadius: Appearance.rounding.small ButtonWithIcon {
iconText: "wallpaper" id: rndWallBtn
mainText: konachanWallProc.running ? "Be patient..." : "Random: Konachan" Layout.alignment: Qt.AlignHCenter
onClicked: { buttonRadius: Appearance.rounding.small
console.log(konachanWallProc.command.join(" ")) iconText: "wallpaper"
konachanWallProc.running = true; 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" StyledText {
onClicked: { Layout.alignment: Qt.AlignHCenter
Hyprland.dispatch(`exec ${Directories.wallpaperSwitchScriptPath}`) text: "Change any time later with /dark, /light, /img in the launcher"
} font.pixelSize: Appearance.font.pixelSize.smaller
mainContentComponent: Component { color: Appearance.colors.colSubtext
RowLayout { }
spacing: 10 }
StyledText {
font.pixelSize: Appearance.font.pixelSize.small Section {
text: "Choose file" title: "Policies"
color: Appearance.colors.colOnSecondaryContainer
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 { SelectionConnectedButton {
spacing: 3 property int value: 1
KeyboardKey { buttonText: "Yes"
key: "Ctrl" 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 { Section {
Layout.alignment: Qt.AlignHCenter title: "Info"
text: "Change any time later with /dark, /light, /img in the launcher"
font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colSubtext
}
}
Section { Flow {
title: "Info" Layout.fillWidth: true
spacing: 10
Flow { ButtonWithIcon {
Layout.fillWidth: true iconText: "keyboard_alt"
spacing: 10 onClicked: {
Hyprland.dispatch("global quickshell:cheatsheetOpen")
ButtonWithIcon { }
iconText: "keyboard_alt" mainContentComponent: Component {
onClicked: {
Hyprland.dispatch("global quickshell:cheatsheetOpen")
}
mainContentComponent: Component {
RowLayout {
spacing: 10
StyledText {
font.pixelSize: Appearance.font.pixelSize.small
text: "Keybinds"
color: Appearance.colors.colOnSecondaryContainer
}
RowLayout { RowLayout {
spacing: 3 spacing: 10
KeyboardKey {
key: "󰖳"
}
StyledText { StyledText {
Layout.alignment: Qt.AlignVCenter font.pixelSize: Appearance.font.pixelSize.small
text: "+" text: "Keybinds"
color: Appearance.colors.colOnSecondaryContainer
} }
KeyboardKey { RowLayout {
key: "/" spacing: 3
KeyboardKey {
key: "󰖳"
}
StyledText {
Layout.alignment: Qt.AlignVCenter
text: "+"
}
KeyboardKey {
key: "/"
}
} }
} }
} }
} }
}
ButtonWithIcon { ButtonWithIcon {
iconText: "help" iconText: "help"
mainText: "Usage" mainText: "Usage"
onClicked: { onClicked: {
Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/02usage/") Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/02usage/")
}
} }
} ButtonWithIcon {
ButtonWithIcon { iconText: "construction"
iconText: "construction" mainText: "Configuration"
mainText: "Configuration" onClicked: {
onClicked: { Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/03config/")
Qt.openUrlExternally("https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/03config/") }
} }
} }
} }
}
Section { Section {
title: "Useless buttons" 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 Layout.fillWidth: true
anchors.left: parent.left Layout.fillHeight: true
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")
}
}
} }
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
} }
} }
} }
} }