hardcoded icons on scaled, find better solution later

This commit is contained in:
Zacharias-Brohn
2025-11-14 23:10:13 +01:00
parent 52a382b0ad
commit 72e12d2078
7 changed files with 72 additions and 31 deletions
+6 -6
View File
@@ -1,12 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Widgets
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland
import Qt5Compat.GraphicalEffects
import Quickshell.Hyprland
import qs.Modules import qs.Modules
import qs.Config import qs.Config
@@ -21,6 +16,10 @@ Scope {
screen: modelData screen: modelData
property var root: Quickshell.shellDir property var root: Quickshell.shellDir
Component.onCompleted: {
console.log(modelData.x);
}
Process { Process {
id: ncProcess id: ncProcess
command: ["sh", "-c", `qs -p ${bar.root}/shell.qml ipc call root showCenter`] command: ["sh", "-c", `qs -p ${bar.root}/shell.qml ipc call root showCenter`]
@@ -50,13 +49,14 @@ Scope {
RowLayout { RowLayout {
id: leftSection id: leftSection
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: 100 Layout.preferredWidth: leftSection.childrenRect.width
Workspaces { Workspaces {
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true Layout.fillHeight: true
Layout.topMargin: 6 Layout.topMargin: 6
Layout.bottomMargin: 6 Layout.bottomMargin: 6
bar: bar
} }
AudioWidget { AudioWidget {
+2
View File
@@ -11,6 +11,7 @@ Singleton {
property alias wallpaperPath: adapter.wallpaperPath property alias wallpaperPath: adapter.wallpaperPath
property alias maxWallpapers: adapter.maxWallpapers property alias maxWallpapers: adapter.maxWallpapers
property alias wallust: adapter.wallust property alias wallust: adapter.wallust
property alias workspaceWidget: adapter.workspaceWidget
FileView { FileView {
id: root id: root
@@ -31,6 +32,7 @@ Singleton {
property AccentColor accentColor: AccentColor {} property AccentColor accentColor: AccentColor {}
property int maxWallpapers: 7 property int maxWallpapers: 7
property bool wallust: false property bool wallust: false
property WorkspaceWidget workspaceWidget: WorkspaceWidget {}
} }
} }
} }
+6
View File
@@ -0,0 +1,6 @@
import Quickshell.Io
JsonObject {
property string textColor: "black"
property string inactiveTextColor: "white"
}
+16 -9
View File
@@ -1,13 +1,9 @@
//@ pragma Env QT_STYLE_OVERRIDE=Breeze //@ pragma Env QT_STYLE_OVERRIDE=Breeze
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.DBusMenu
import Quickshell.Widgets
import Quickshell.Hyprland
import Quickshell.Services.SystemTray import Quickshell.Services.SystemTray
import Quickshell.Io
import qs.Modules import qs.Modules
MouseArea { MouseArea {
@@ -27,16 +23,27 @@ MouseArea {
globalPos = root.mapToItem(root.bar.backgroundRect, 0, 0); globalPos = root.mapToItem(root.bar.backgroundRect, 0, 0);
} }
IconImage { Image {
id: icon id: icon
Component.onCompleted: {
console.log(root.item.icon);
}
property bool batteryHDPI: root.bar.screen.x < 0 && root.item.icon.includes("battery")
property bool nmHDPI: root.bar.screen.x < 0 && root.item.icon.includes("nm-")
anchors.centerIn: parent anchors.centerIn: parent
height: 22 width: batteryHDPI ? 26 : ( nmHDPI ? 25 : 22 )
width: 22 height: batteryHDPI ? 26 : ( nmHDPI ? 25 : 22 )
source: root.item.icon source: root.item.icon
mipmap: true mipmap: true
smooth: false smooth: batteryHDPI ? false : ( nmHDPI ? false : true )
asynchronous: true asynchronous: true
sourceSize.width: batteryHDPI ? 16 : ( nmHDPI ? 16 : 22 )
sourceSize.height: batteryHDPI ? 16 : ( nmHDPI ? 16 : 22 )
autoTransform: true
fillMode: Image.PreserveAspectFit
TrayMenu { TrayMenu {
id: trayMenu id: trayMenu
+10 -9
View File
@@ -5,7 +5,7 @@ import qs.Modules
Item { Item {
id: root id: root
required property int countUpdates required property int countUpdates
implicitWidth: 60 implicitWidth: contentRow.childrenRect.width + 10
implicitHeight: 22 implicitHeight: 22
Rectangle { Rectangle {
@@ -15,6 +15,8 @@ Item {
} }
RowLayout { RowLayout {
id: contentRow
spacing: 10
anchors { anchors {
fill: parent fill: parent
leftMargin: 5 leftMargin: 5
@@ -29,17 +31,16 @@ Item {
color: "#ffffff" color: "#ffffff"
} }
Item { TextMetrics {
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft id: textMetrics
implicitWidth: 18 font.pixelSize: 16
implicitHeight: root.implicitHeight text: root.countUpdates
}
Text { Text {
anchors.centerIn: parent Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
text: root.countUpdates text: textMetrics.text
color: "white" color: "white"
} }
} }
} }
}
+1 -1
View File
@@ -16,7 +16,7 @@ Singleton {
Process { Process {
id: wallustProc id: wallustProc
command: ["wallust", "run", root.args, "--palette=dark16", "--ignore-sequence=cursor", "--threshold=9" ] command: ["wallust", "run", root.args, "--palette=dark", "--ignore-sequence=cursor", "--threshold=9" ]
running: false running: false
} }
} }
+29 -4
View File
@@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
@@ -8,9 +10,22 @@ import qs.Config
Rectangle { Rectangle {
id: root id: root
implicitWidth: workspacesRow.implicitWidth + 10 required property PanelWindow bar
property HyprlandMonitor monitor: Hyprland.monitorFor( root.bar?.screen )
implicitWidth: workspacesRow.implicitWidth + 6
implicitHeight: workspacesRow.implicitHeight + 7 implicitHeight: workspacesRow.implicitHeight + 7
function shouldShow(monitor) {
Hyprland.refreshWorkspaces();
Hyprland.refreshMonitors();
if ( monitor === root.monitor ) {
return true;
} else {
return false;
}
}
color: "#40000000" color: "#40000000"
radius: height / 2 radius: height / 2
@@ -25,7 +40,7 @@ Rectangle {
id: workspacesRow id: workspacesRow
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 5 anchors.leftMargin: 3
spacing: 8 spacing: 8
Repeater { Repeater {
@@ -34,8 +49,8 @@ Rectangle {
Rectangle { Rectangle {
required property var modelData required property var modelData
width: 14 width: 16
height: 14 height: 16
radius: height / 2 radius: height / 2
color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primary : "#606060" color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primary : "#606060"
@@ -43,6 +58,8 @@ Rectangle {
border.color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primaryAlt : "#808080" border.color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primaryAlt : "#808080"
border.width: 1 border.width: 1
visible: root.shouldShow( modelData.monitor )
scale: 1.0 scale: 1.0
opacity: 1.0 opacity: 1.0
@@ -73,6 +90,14 @@ Rectangle {
duration: 200 duration: 200
} }
Text {
anchors.centerIn: parent
text: modelData.id
font.pixelSize: 10
font.family: "Rubik"
color: modelData.id === Hyprland.focusedWorkspace.id ? Config.workspaceWidget.textColor : Config.workspaceWidget.inactiveTextColor
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {