Merge remote-tracking branch 'origin/main' into addon-i18n

This commit is contained in:
月月
2025-07-13 13:22:49 +08:00
11 changed files with 216 additions and 85 deletions
+3 -5
View File
@@ -37,11 +37,11 @@ Scope {
return screens;
return screens.filter(screen => list.includes(screen.name));
}
LazyLoader {
Loader {
id: barLoader
activeAsync: GlobalStates.barOpen
active: GlobalStates.barOpen
required property ShellScreen modelData
component: PanelWindow { // Bar window
sourceComponent: PanelWindow { // Bar window
id: barRoot
screen: barLoader.modelData
@@ -533,7 +533,6 @@ Scope {
size: Appearance.rounding.screenRounding
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
opacity: 1.0 - Appearance.transparency
corner: RoundCorner.CornerEnum.TopLeft
states: State {
@@ -553,7 +552,6 @@ Scope {
}
size: Appearance.rounding.screenRounding
color: showBarBackground ? Appearance.colors.colLayer0 : "transparent"
opacity: 1.0 - Appearance.transparency
corner: RoundCorner.CornerEnum.TopRight
states: State {
@@ -68,6 +68,7 @@ Item {
}
StyledText {
visible: Config.options.bar.verbose
width: rowLayout.width - (CircularProgress.size + rowLayout.spacing * 2)
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true // Ensures the text takes up available space
@@ -46,9 +46,11 @@ MouseArea {
implicitWidth: weatherPopup.implicitWidth
implicitHeight: weatherPopup.implicitHeight
anchor.item: root
anchor.edges: Edges.Bottom
anchor.edges: Edges.Top
anchor.rect.x: (root.implicitWidth - popupWindow.implicitWidth) / 2
anchor.rect.y: root.implicitHeight + 10
anchor.rect.y: Config.options.bar.bottom ?
(-weatherPopup.implicitHeight - 15) :
(root.implicitHeight + 15 )
color: "transparent"
WeatherPopup {
id: weatherPopup
@@ -66,6 +66,11 @@ Singleton {
property bool extraBackgroundTint: true
property int fakeScreenRounding: 2 // 0: None | 1: Always | 2: When not fullscreen
property bool transparency: false
property JsonObject wallpaperTheming: JsonObject {
property bool enableAppsAndShell: true
property bool enableQtApps: true
property bool enableTerminal: true
}
property JsonObject palette: JsonObject {
property string type: "auto" // Allowed: auto, scheme-content, scheme-expressive, scheme-fidelity, scheme-fruit-salad, scheme-monochrome, scheme-neutral, scheme-rainbow, scheme-tonal-spot
}
@@ -6,26 +6,53 @@ import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Widgets
// Material 3 slider. See https://m3.material.io/components/sliders/overview
/**
* Material 3 slider. See https://m3.material.io/components/sliders/overview
* It doesn't exactly match the spec because it does not make sense to have stuff on a computer that fucking huge.
* Should be at 3/4 scale...
*/
Slider {
id: root
property real scale: 0.85
property real backgroundDotSize: 4 * scale
property real backgroundDotMargins: 4 * scale
// property real handleMargins: 0 * scale
property real handleMargins: (root.pressed ? 0 : 2) * scale
property real handleWidth: (root.pressed ? 3 : 5) * scale
property real handleHeight: 44 * scale
property real handleLimit: root.backgroundDotMargins
property real trackHeight: 30 * scale
property list<real> stopIndicatorValues: [1]
enum Configuration {
XS = 12,
S = 18,
M = 30,
L = 42,
XL = 72
}
property var configuration: StyledSlider.Configuration.S
property real handleDefaultWidth: 3
property real handlePressedWidth: 1.5
property color highlightColor: Appearance.colors.colPrimary
property color trackColor: Appearance.colors.colSecondaryContainer
property color handleColor: Appearance.m3colors.m3onSecondaryContainer
property real trackRadius: Appearance.rounding.verysmall * scale
property color dotColor: Appearance.m3colors.m3onSecondaryContainer
property color dotColorHighlighted: Appearance.m3colors.m3onPrimary
property real unsharpenRadius: Appearance.rounding.unsharpen
property real limitedHandleRangeWidth: (root.availableWidth - handleWidth - root.handleLimit * 2)
property real trackWidth: configuration
property real trackRadius: trackWidth >= StyledSlider.Configuration.XL ? 21
: trackWidth >= StyledSlider.Configuration.L ? 12
: trackWidth >= StyledSlider.Configuration.M ? 9
: 6
property real handleHeight: Math.max(33, trackWidth + 9)
property real handleWidth: root.pressed ? handlePressedWidth : handleDefaultWidth
property real handleMargins: 4
onHandleMarginsChanged: {
console.log("Handle margins changed to", handleMargins);
}
property real trackDotSize: 3
property string tooltipContent: `${Math.round(value * 100)}%`
leftPadding: handleMargins
rightPadding: handleMargins
property real effectiveDraggingWidth: width - leftPadding - rightPadding
Layout.fillWidth: true
from: 0
to: 1
@@ -37,10 +64,20 @@ Slider {
}
Behavior on handleMargins {
NumberAnimation {
duration: Appearance.animation.elementMoveFast.duration
easing.type: Appearance.animation.elementMoveFast.type
easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
component TrackDot: Rectangle {
required property real value
anchors.verticalCenter: parent.verticalCenter
x: root.handleMargins + (value * root.effectiveDraggingWidth) - (root.trackDotSize / 2)
width: root.trackDotSize
height: root.trackDotSize
radius: Appearance.rounding.full
color: value > root.visualPosition ? root.dotColor : root.dotColorHighlighted
Behavior on color {
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
}
}
@@ -52,14 +89,17 @@ Slider {
background: Item {
anchors.verticalCenter: parent.verticalCenter
implicitHeight: trackHeight
width: parent.width
implicitHeight: trackWidth
// Fill left
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
width: root.handleLimit * 2 + root.visualPosition * root.limitedHandleRangeWidth - (root.handleMargins + root.handleWidth / 2)
height: trackHeight
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
}
width: root.handleMargins + (root.visualPosition * root.effectiveDraggingWidth) - (root.handleWidth / 2 + root.handleMargins)
height: trackWidth
color: root.highlightColor
topLeftRadius: root.trackRadius
bottomLeftRadius: root.trackRadius
@@ -69,35 +109,37 @@ Slider {
// Fill right
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
width: root.handleLimit * 2 + (1 - root.visualPosition) * root.limitedHandleRangeWidth - (root.handleMargins + root.handleWidth / 2)
height: trackHeight
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
}
width: root.handleMargins + ((1 - root.visualPosition) * root.effectiveDraggingWidth) - (root.handleWidth / 2 + root.handleMargins)
height: trackWidth
color: root.trackColor
topLeftRadius: root.unsharpenRadius
bottomLeftRadius: root.unsharpenRadius
topRightRadius: root.trackRadius
bottomRightRadius: root.trackRadius
topLeftRadius: root.unsharpenRadius
bottomLeftRadius: root.unsharpenRadius
}
// Dot at the end
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: root.backgroundDotMargins
width: root.backgroundDotSize
height: root.backgroundDotSize
radius: Appearance.rounding.full
color: root.handleColor
// Stop indicators
Repeater {
model: root.stopIndicatorValues
TrackDot {
required property real modelData
value: modelData
anchors.verticalCenter: parent.verticalCenter
}
}
}
handle: Rectangle {
id: handle
x: root.leftPadding + root.handleLimit + root.visualPosition * root.limitedHandleRangeWidth
y: root.topPadding + root.availableHeight / 2 - height / 2
implicitWidth: root.handleWidth
implicitHeight: root.handleHeight
x: root.handleMargins + (root.visualPosition * root.effectiveDraggingWidth) - (root.handleWidth / 2)
anchors.verticalCenter: parent.verticalCenter
radius: Appearance.rounding.full
color: root.handleColor
@@ -23,7 +23,7 @@ Item { // Player instance
property string artDownloadLocation: Directories.coverArt
property string artFileName: Qt.md5(artUrl) + ".jpg"
property string artFilePath: `${artDownloadLocation}/${artFileName}`
property color artDominantColor: ColorUtils.mix(colorQuantizer?.colors[0], Appearance.colors.colPrimaryContainer, 0.8) || Appearance.m3colors.m3secondaryContainer
property color artDominantColor: ColorUtils.mix((colorQuantizer?.colors[0] ?? Appearance.colors.colPrimary), Appearance.colors.colPrimaryContainer, 0.8) || Appearance.m3colors.m3secondaryContainer
property bool downloaded: false
property list<real> visualizerPoints: []
property real maxVisualizerValue: 1000 // Max value in the data points
@@ -0,0 +1,46 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "root:/services/"
import "root:/modules/common/"
import "root:/modules/common/widgets/"
ContentPage {
forceWidth: true
ContentSection {
title: "Color generation"
ConfigRow {
uniform: true
ConfigSwitch {
text: "Shell & utilities"
checked: Config.options.appearance.wallpaperTheming.enableAppsAndShell
onCheckedChanged: {
Config.options.appearance.wallpaperTheming.enableAppsAndShell = checked;
}
}
ConfigSwitch {
text: "Qt apps"
checked: Config.options.appearance.wallpaperTheming.enableQtApps
onCheckedChanged: {
Config.options.appearance.wallpaperTheming.enableQtApps = checked;
}
StyledToolTip {
content: "Shell & utilities theming must also be enabled"
}
}
ConfigSwitch {
text: "Terminal"
checked: Config.options.appearance.wallpaperTheming.enableTerminal
onCheckedChanged: {
Config.options.appearance.wallpaperTheming.enableTerminal = checked;
}
StyledToolTip {
content: "Shell & utilities theming must also be enabled"
}
}
}
}
}
@@ -11,55 +11,56 @@ import Quickshell.Services.Pipewire
Item {
id: root
required property PwNode node;
PwObjectTracker { objects: [ node ] }
required property PwNode node
PwObjectTracker {
objects: [node]
}
implicitHeight: rowLayout.implicitHeight
RowLayout {
id: rowLayout
anchors.fill: parent
spacing: 10
spacing: 6
Image {
property real size: slider.height * 0.9
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: source != ""
sourceSize.width: size
sourceSize.height: size
source: {
let icon;
icon = AppSearch.guessIcon(root.node.properties["application.icon-name"]);
if (AppSearch.iconExists(icon))
return Quickshell.iconPath(icon, "image-missing");
icon = AppSearch.guessIcon(root.node.properties["node.name"]);
return Quickshell.iconPath(icon, "image-missing");
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 0
spacing: -4
RowLayout {
StyledText {
Layout.fillWidth: true
font.pixelSize: Appearance.font.pixelSize.normal
elide: Text.ElideRight
text: {
// application.name -> description -> name
const app = root.node.properties["application.name"] ?? (root.node.description != "" ? root.node.description : root.node.name);
const media = root.node.properties["media.name"];
return media != undefined ? `${app} ${media}` : app;
}
StyledText {
Layout.fillWidth: true
font.pixelSize: Appearance.font.pixelSize.small
color: Appearance.colors.colSubtext
elide: Text.ElideRight
text: {
// application.name -> description -> name
const app = root.node.properties["application.name"] ?? (root.node.description != "" ? root.node.description : root.node.name);
const media = root.node.properties["media.name"];
return media != undefined ? `${app} ${media}` : app;
}
}
RowLayout {
Image {
property real size: slider.trackHeight * 1.3
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: source != ""
sourceSize.width: size
sourceSize.height: size
source: {
let icon;
icon = AppSearch.guessIcon(root.node.properties["application.icon-name"]);
if (AppSearch.iconExists(icon)) return Quickshell.iconPath(icon, "image-missing");
icon = AppSearch.guessIcon(root.node.properties["node.name"]);
return Quickshell.iconPath(icon, "image-missing");
}
}
StyledSlider {
id: slider
value: root.node.audio.volume
onValueChanged: root.node.audio.volume = value
}
StyledSlider {
id: slider
value: root.node.audio.volume
onValueChanged: root.node.audio.volume = value
}
}
}
}
}
@@ -57,5 +57,16 @@ apply_qt() {
python "$CONFIG_DIR/scripts/kvantum/changeAdwColors.py" # apply config colors
}
apply_qt &
apply_term &
# Check if terminal theming is enabled in config
CONFIG_FILE="$XDG_CONFIG_HOME/illogical-impulse/config.json"
if [ -f "$CONFIG_FILE" ]; then
enable_terminal=$(jq -r '.appearance.wallpaperTheming.enableTerminal' "$CONFIG_FILE")
if [ "$enable_terminal" = "true" ]; then
apply_term &
fi
else
echo "Config file not found at $CONFIG_FILE. Applying terminal theming by default."
apply_term &
fi
# apply_qt & # Qt theming is already handled by kde-material-colors
@@ -12,6 +12,15 @@ MATUGEN_DIR="$XDG_CONFIG_HOME/matugen"
terminalscheme="$SCRIPT_DIR/terminal/scheme-base.json"
handle_kde_material_you_colors() {
# Check if Qt app theming is enabled in config
CONFIG_FILE="$XDG_CONFIG_HOME/illogical-impulse/config.json"
if [ -f "$CONFIG_FILE" ]; then
enable_qt_apps=$(jq -r '.appearance.wallpaperTheming.enableQtApps' "$CONFIG_FILE")
if [ "$enable_qt_apps" == "false" ]; then
return
fi
fi
# Map $type_flag to allowed scheme variants for kde-material-you-colors-wrapper.sh
local kde_scheme_variant=""
case "$type_flag" in
@@ -46,6 +55,7 @@ post_process() {
local screen_height="$2"
local wallpaper_path="$3"
handle_kde_material_you_colors &
# Determine the largest region on the wallpaper that's sufficiently un-busy to put widgets in
@@ -242,6 +252,16 @@ switch() {
pre_process "$mode_flag"
# Check if app and shell theming is enabled in config
CONFIG_FILE="$XDG_CONFIG_HOME/illogical-impulse/config.json"
if [ -f "$CONFIG_FILE" ]; then
enable_apps_shell=$(jq -r '.appearance.wallpaperTheming.enableAppsAndShell' "$CONFIG_FILE")
if [ "$enable_apps_shell" == "false" ]; then
echo "App and shell theming disabled, skipping matugen and color generation"
return
fi
fi
matugen "${matugen_args[@]}"
source "$(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate"
python3 "$SCRIPT_DIR/generate_colors_material.py" "${generate_colors_material_args[@]}" \
+5
View File
@@ -42,6 +42,11 @@ ApplicationWindow {
icon: "settings",
component: "modules/settings/ServicesConfig.qml"
},
{
name: "Advanced",
icon: "construction",
component: "modules/settings/AdvancedConfig.qml"
},
{
name: "About",
icon: "info",