mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
startupfeedback: Handle case where same icon is used for opening
This commit is contained in:
parent
4dddf9a46c
commit
e0768d64c0
1 changed files with 19 additions and 5 deletions
|
|
@ -29,8 +29,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
|||
background.scale = 0;
|
||||
backgroundParent.x = -root.width/2 + x
|
||||
backgroundParent.y = -root.height/2 + y
|
||||
colorGenerator.resetColor();
|
||||
icon.source = splashIcon;
|
||||
updateIconSource(splashIcon);
|
||||
|
||||
if (ShellSettings.Settings.animationsEnabled) {
|
||||
openAnimComplex.restart();
|
||||
|
|
@ -66,13 +65,24 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
|||
background.scale = 0.5;
|
||||
backgroundParent.x = 0
|
||||
backgroundParent.y = 0
|
||||
colorGenerator.resetColor();
|
||||
icon.source = iconName
|
||||
root.updateIconSource(iconName);
|
||||
openAnimComplex.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateIconSource(source) {
|
||||
if (icon.source !== 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
|
||||
colorGenerator.resetColor();
|
||||
} else {
|
||||
// case where we set the same icon, ensure the color is set
|
||||
colorGenerator.updateColor();
|
||||
}
|
||||
icon.source = source;
|
||||
}
|
||||
|
||||
Kirigami.ImageColors {
|
||||
id: colorGenerator
|
||||
source: icon.source
|
||||
|
|
@ -84,9 +94,13 @@ MouseArea { // use mousearea to ensure clicks don't go behind
|
|||
function resetColor() {
|
||||
colorToUse = 'transparent';
|
||||
}
|
||||
onPaletteChanged: {
|
||||
function updateColor() {
|
||||
colorToUse = colorGenerator.dominant;
|
||||
}
|
||||
onPaletteChanged: {
|
||||
// update color once palette has loaded
|
||||
updateColor();
|
||||
}
|
||||
}
|
||||
|
||||
// animation that moves the icon
|
||||
|
|
|
|||
Loading…
Reference in a new issue