mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 09:18:07 +00:00
startupfeedback: Ensure that old colours don't get shown when launching app
This commit is contained in:
parent
d895e34e6b
commit
4dddf9a46c
1 changed files with 16 additions and 10 deletions
|
|
@ -24,21 +24,14 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
property alias backgroundColor: background.color
|
property alias backgroundColor: background.color
|
||||||
property alias icon: icon.source
|
property alias icon: icon.source
|
||||||
|
|
||||||
function open(splashIcon, title, x, y, sourceIconSize, color) {
|
function open(splashIcon, title, x, y, sourceIconSize) {
|
||||||
iconParent.scale = sourceIconSize/iconParent.width;
|
iconParent.scale = sourceIconSize/iconParent.width;
|
||||||
background.scale = 0;
|
background.scale = 0;
|
||||||
backgroundParent.x = -root.width/2 + x
|
backgroundParent.x = -root.width/2 + x
|
||||||
backgroundParent.y = -root.height/2 + y
|
backgroundParent.y = -root.height/2 + y
|
||||||
|
colorGenerator.resetColor();
|
||||||
icon.source = splashIcon;
|
icon.source = splashIcon;
|
||||||
|
|
||||||
if (color !== undefined) {
|
|
||||||
// Break binding to use custom color
|
|
||||||
background.color = color
|
|
||||||
} else {
|
|
||||||
// Recreate binding
|
|
||||||
background.color = Qt.binding(function() { return colorGenerator.dominant})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ShellSettings.Settings.animationsEnabled) {
|
if (ShellSettings.Settings.animationsEnabled) {
|
||||||
openAnimComplex.restart();
|
openAnimComplex.restart();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -48,6 +41,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
visible = false;
|
visible = false;
|
||||||
|
colorGenerator.resetColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// close when an app opens
|
// close when an app opens
|
||||||
|
|
@ -72,6 +66,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
background.scale = 0.5;
|
background.scale = 0.5;
|
||||||
backgroundParent.x = 0
|
backgroundParent.x = 0
|
||||||
backgroundParent.y = 0
|
backgroundParent.y = 0
|
||||||
|
colorGenerator.resetColor();
|
||||||
icon.source = iconName
|
icon.source = iconName
|
||||||
openAnimComplex.restart();
|
openAnimComplex.restart();
|
||||||
}
|
}
|
||||||
|
|
@ -81,6 +76,17 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
Kirigami.ImageColors {
|
Kirigami.ImageColors {
|
||||||
id: colorGenerator
|
id: colorGenerator
|
||||||
source: icon.source
|
source: icon.source
|
||||||
|
|
||||||
|
// the colors are generated async from the icon, so we need to ensure we don't display an old color
|
||||||
|
// for a moment when an app opens
|
||||||
|
property color colorToUse: 'transparent'
|
||||||
|
|
||||||
|
function resetColor() {
|
||||||
|
colorToUse = 'transparent';
|
||||||
|
}
|
||||||
|
onPaletteChanged: {
|
||||||
|
colorToUse = colorGenerator.dominant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// animation that moves the icon
|
// animation that moves the icon
|
||||||
|
|
@ -180,7 +186,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
||||||
id: background
|
id: background
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
color: colorGenerator.dominant
|
color: colorGenerator.colorToUse
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue