Skip to content

Instantly share code, notes, and snippets.

@hugmanrique
Last active January 15, 2023 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugmanrique/15e477d3c3a22e07f067e44ca76b844c to your computer and use it in GitHub Desktop.
Save hugmanrique/15e477d3c3a22e07f067e44ca76b844c to your computer and use it in GitHub Desktop.
Simple KDE Splash screen that displays a background image (ideally the desktop wallpaper)
#!/bin/bash
set -euo pipefail
BREEZE='/usr/share/plasma/look-and-feel/org.kde.breeze.desktop'
print_usage() {
cat << EOF
Usage: $0 [options] image
Creates a KDE Splash Screen that displays the given image in
the background.
Options:
-t [src] The directory containing the Breeze theme for the Plasma
desktop (default: $BREEZE).
EOF
exit 1
}
while getopts 't:' flag; do
case "$flag" in
t) BREEZE="$OPTARG" ;;
*) print_usage ;;
esac
done
shift $((OPTIND -1))
if [ "$#" -ne 1 ]; then print_usage; fi
IMAGE="$1"
DEST="$(dirname "$BREEZE")/me.hugmanrique.image-splash.desktop"
if [[ "$IMAGE" != *.jpg ]]; then
echo "Only .jpg background files are supported"
exit 1
fi
# Move files to theme directory.
mkdir -p "$DEST/contents/splash/images"
cp "$IMAGE" "$DEST/contents/splash/images/background.jpg"
mv Splash.qml "$DEST/contents/splash"
# Copy busy widget icon from the Breeze theme
cp "$BREEZE/contents/splash/images/busywidget.svgz" "$DEST/contents/splash/images"
echo "Success! Enable the theme in System Settings → Appearance → Splash Screen"
{
"KPlugin": {
"Authors": [
{
"Email": "plasma-devel@kde.org",
"Name": "KDE Visual Design Group",
"Name[ar]": "مجموعة التصميم المرئي لكدي",
"Name[az]": "KDE Vizual Dizayn Qrupu",
"Name[bg]": "KDE Visual Design Group",
"Name[ca@valencia]": "Grup de disseny visual de KDE",
"Name[ca]": "Grup de disseny visual de KDE",
"Name[cs]": "Skupina vizuálního návrhu KDE",
"Name[da]": "KDE Visual Design Group",
"Name[de]": "KDE Visual Design Group",
"Name[en_GB]": "KDE Visual Design Group",
"Name[es]": "El grupo de diseño visual de KDE",
"Name[eu]": "KDE Diseinu bisualeko taldea",
"Name[fi]": "KDE:n visuaalinen suunnitteluryhmä",
"Name[fr]": "Groupe de conception visuelle de KDE",
"Name[hu]": "KDE Visual Design Group",
"Name[ia]": "KDE Visual Design Group (Gruppo de Designo Visual de KDE)",
"Name[id]": "Grup Desain Visual KDE",
"Name[is]": "Myndrænn hönnunarhópur KDE",
"Name[it]": "KDE Visual Design Group",
"Name[ja]": "KDE Visual Design Group",
"Name[ka]": "KDE-ის ვიზუალური დიზაინის ჯგუფი",
"Name[ko]": "KDE 시각 디자인 그룹",
"Name[lt]": "KDE vaizdinio dizaino grupė",
"Name[nl]": "KDE Visuele ontwerpgroep",
"Name[nn]": "KDE Visual Design Group",
"Name[pl]": "Grupa oprawy graficznej KDE",
"Name[pt]": "Grupo de Desenho Visual do KDE",
"Name[pt_BR]": "Grupo de Design Visual do KDE",
"Name[ro]": "KDE Visual Design Group",
"Name[ru]": "Группа KDE Visual Design",
"Name[sk]": "KDE Visual Design Group",
"Name[sl]": "Skupina vizualnega designa KDE",
"Name[sv]": "KDE:s visuella designgrupp",
"Name[ta]": "கே.டீ.யீ. வரைகலை வடிவமைப்புக் குழு",
"Name[tr]": "KDE Görsel Tasarım Grubu",
"Name[uk]": "Група з візуального дизайну KDE",
"Name[vi]": "Đội Thiết kế Trực quan KDE",
"Name[x-test]": "xxKDE Visual Design Groupxx",
"Name[zh_CN]": "KDE 视觉设计团队"
},
{
"Email": "contact@hugmanrique.me",
"Name": "Hugo Manrique"
}
],
"Category": "",
"Description": "Image splash screen",
"Id": "me.hugmanrique.image-splash.desktop",
"License": "GPLv2+",
"Name": "Image splash screen",
"ServiceTypes": [
"Plasma/LookAndFeel"
],
"Version": "1.0",
"Website": "https://hugmanrique.me"
},
"Keywords": "Desktop;Workspace;Appearance;Look and Feel;",
"X-Plasma-APIVersion": "2",
"X-Plasma-MainScript": "defaults"
}
/*
SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
SPDX-FileCopyrightText: 2023 Hugo Manrique <contact@hugmanrique.me>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.5
import QtQuick.Window 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
Image {
id: root
source: "images/background.jpg"
fillMode: Image.PreserveAspectCrop
property int stage
onStageChanged: {
if (stage == 2) {
introAnimation.running = true;
} else if (stage == 5) {
introAnimation.target = busyIndicator;
introAnimation.from = 1;
introAnimation.to = 0;
introAnimation.running = true;
}
}
Item {
id: content
anchors.fill: parent
opacity: 0
// TODO: port to PlasmaComponents3.BusyIndicator
Image {
id: busyIndicator
y: parent.height * 3 / 4
anchors.horizontalCenter: parent.horizontalCenter
source: "images/busywidget.svgz"
sourceSize.height: PlasmaCore.Units.gridUnit * 2
sourceSize.width: PlasmaCore.Units.gridUnit * 2
RotationAnimator on rotation {
id: rotationAnimator
from: 0
to: 360
// Not using a standard duration value because we don't want the
// animation to spin faster or slower based on the user's animation
// scaling preferences; it doesn't make sense in this context
duration: 2000
loops: Animation.Infinite
// Don't want it to animate at all if the user has disabled animations
running: PlasmaCore.Units.longDuration > 1
}
}
}
OpacityAnimator {
id: introAnimation
running: false
target: content
from: 0
to: 1
duration: PlasmaCore.Units.veryLongDuration
easing.type: Easing.InOutQuad
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment