From 7c0f5533e182a28fcfb208d17ff573e5b1c21f4f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 13 Aug 2025 23:03:23 +1000 Subject: internal: use icon os logo instead of nerd font Add caelestia logo to use as fallback os logo Add recolour lock fetch logo option --- README.md | 5 ++- assets/logo.svg | 80 +++++++++++++++++++++++++++++++++++++++ config/LockConfig.qml | 2 +- modules/bar/components/OsIcon.qml | 16 +++++--- modules/dashboard/dash/User.qml | 42 ++++++++++++++++---- modules/lock/Fetch.qml | 26 +++++++------ utils/Icons.qml | 45 ---------------------- utils/SysInfo.qml | 18 +++------ 8 files changed, 151 insertions(+), 83 deletions(-) create mode 100644 assets/logo.svg diff --git a/README.md b/README.md index 5ab4ab7..18a0fc9 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,9 @@ All configuration options are in `~/.config/caelestia/shell.json`. } }, "background": { + "desktopClock": { + "enabled": false + }, "enabled": true }, "bar": { @@ -285,7 +288,7 @@ All configuration options are in `~/.config/caelestia/shell.json`. } }, "lock": { - "maxNotifs": 5 + "recolourLogo": false }, "notifs": { "actionOnClick": false, diff --git a/assets/logo.svg b/assets/logo.svg new file mode 100644 index 0000000..712d1e3 --- /dev/null +++ b/assets/logo.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/config/LockConfig.qml b/config/LockConfig.qml index bcb753f..f77e033 100644 --- a/config/LockConfig.qml +++ b/config/LockConfig.qml @@ -1,7 +1,7 @@ import Quickshell.Io JsonObject { - property int maxNotifs: 5 + property bool recolourLogo: false property Sizes sizes: Sizes {} component Sizes: JsonObject { diff --git a/modules/bar/components/OsIcon.qml b/modules/bar/components/OsIcon.qml index ee24457..8418902 100644 --- a/modules/bar/components/OsIcon.qml +++ b/modules/bar/components/OsIcon.qml @@ -1,11 +1,15 @@ -import qs.components +import qs.components.effects import qs.services import qs.utils import qs.config +import Quickshell.Widgets -StyledText { - text: SysInfo.osIcon - font.pointSize: Appearance.font.size.smaller - font.family: Appearance.font.family.mono - color: Colours.palette.m3tertiary +IconImage { + source: SysInfo.osLogo + implicitSize: Appearance.font.size.large * 1.2 + + layer.enabled: true + layer.effect: Colouriser { + colorizationColor: Colours.palette.m3tertiary + } } diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index 2b475dd..e45153e 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -1,9 +1,11 @@ import qs.components +import qs.components.effects import qs.components.images import qs.services import qs.config import qs.utils import Quickshell +import Quickshell.Widgets import QtQuick Row { @@ -111,11 +113,39 @@ Row { anchors.verticalCenter: parent.verticalCenter spacing: Appearance.spacing.normal - InfoLine { - icon: SysInfo.osIcon - text: SysInfo.osPrettyName || SysInfo.osName - colour: Colours.palette.m3primary - materialIcon: false + Item { + id: line + + implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin + implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight) + + IconImage { + id: icon + + anchors.left: parent.left + anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2 + + source: SysInfo.osLogo + implicitSize: Math.floor(Appearance.font.size.normal * 1.34) + + layer.enabled: true + layer.effect: Colouriser { + colorizationColor: Colours.palette.m3primary + } + } + + StyledText { + id: text + + anchors.verticalCenter: icon.verticalCenter + anchors.left: icon.right + anchors.leftMargin: icon.anchors.leftMargin + text: `: ${SysInfo.osPrettyName || SysInfo.osName}` + font.pointSize: Appearance.font.size.normal + + width: Config.dashboard.sizes.infoWidth + elide: Text.ElideRight + } } InfoLine { @@ -139,7 +169,6 @@ Row { required property string icon required property string text required property color colour - property bool materialIcon: true implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight) @@ -154,7 +183,6 @@ Row { text: line.icon color: line.colour font.pointSize: Appearance.font.size.normal - font.family: line.materialIcon ? Appearance.font.family.material : Appearance.font.family.sans } StyledText { diff --git a/modules/lock/Fetch.qml b/modules/lock/Fetch.qml index 5584fbd..ce64c8c 100644 --- a/modules/lock/Fetch.qml +++ b/modules/lock/Fetch.qml @@ -1,10 +1,11 @@ pragma ComponentBehavior: Bound import qs.components +import qs.components.widgets +import qs.components.effects import qs.services import qs.config import qs.utils -import Quickshell import Quickshell.Widgets import Quickshell.Services.UPower import QtQuick @@ -50,14 +51,9 @@ ColumnLayout { WrappedLoader { Layout.fillHeight: true - asynchronous: true active: !iconLoader.active - visible: active - sourceComponent: IconImage { - source: Quickshell.iconPath(SysInfo.logo) - implicitSize: height - } + sourceComponent: OsLogo {} } } @@ -72,10 +68,7 @@ ColumnLayout { Layout.fillHeight: true active: root.width > 320 - sourceComponent: IconImage { - source: Quickshell.iconPath(SysInfo.logo) - implicitSize: height - } + sourceComponent: OsLogo {} } ColumnLayout { @@ -156,6 +149,17 @@ ColumnLayout { visible: active } + component OsLogo: IconImage { + source: SysInfo.osLogo + implicitSize: height + asynchronous: true + + layer.enabled: Config.lock.recolourLogo || SysInfo.isDefaultLogo + layer.effect: Colouriser { + colorizationColor: Colours.palette.m3primary + } + } + component FetchText: MonoText { Layout.fillWidth: true font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal diff --git a/utils/Icons.qml b/utils/Icons.qml index 2ed9d42..7551eac 100644 --- a/utils/Icons.qml +++ b/utils/Icons.qml @@ -6,51 +6,6 @@ import Quickshell.Services.Notifications Singleton { id: root - readonly property var osIcons: ({ - almalinux: "", - alpine: "", - arch: "", - archcraft: "", - arcolinux: "", - artix: "", - centos: "", - debian: "", - devuan: "", - elementary: "", - endeavouros: "", - fedora: "", - freebsd: "", - garuda: "", - gentoo: "", - hyperbola: "", - kali: "", - linuxmint: "󰣭", - mageia: "", - openmandriva: "", - manjaro: "", - neon: "", - nixos: "", - opensuse: "", - suse: "", - sles: "", - sles_sap: "", - "opensuse-tumbleweed": "", - parrot: "", - pop: "", - raspbian: "", - rhel: "", - rocky: "", - slackware: "", - solus: "", - steamos: "", - tails: "", - trisquel: "", - ubuntu: "", - vanilla: "", - void: "", - zorin: "" - }) - readonly property var weatherIcons: ({ "113": "clear_day", "116": "partly_cloudy_day", diff --git a/utils/SysInfo.qml b/utils/SysInfo.qml index 91ef112..a46bcf4 100644 --- a/utils/SysInfo.qml +++ b/utils/SysInfo.qml @@ -11,8 +11,8 @@ Singleton { property string osPrettyName property string osId property list osIdLike - property string logo - property string osIcon: "" + property string osLogo: `file://${Quickshell.shellDir}/assets/logo.svg` + property bool isDefaultLogo: true property string uptime readonly property string user: Quickshell.env("USER") @@ -32,17 +32,11 @@ Singleton { root.osPrettyName = fd("PRETTY_NAME"); root.osId = fd("ID"); root.osIdLike = fd("ID_LIKE").split(" "); - root.logo = fd("LOGO"); - const osIcons = Icons.osIcons; - if (osIcons.hasOwnProperty(root.osId)) { - root.osIcon = osIcons[root.osId]; - } else { - for (const id of root.osIdLike) { - if (osIcons.hasOwnProperty(id)) { - root.osIcon = osIcons[id]; - } - } + const logo = Quickshell.iconPath(fd("LOGO"), true); + if (logo) { + root.osLogo = logo; + root.isDefaultLogo = false; } } } -- cgit v1.2.3-freya