diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index f563d1d..11fbda5 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,6 +1,7 @@ pragma ComponentBehavior: Bound import Quickshell import QtQuick +import QtQuick.Layouts import qs import qs.settings @@ -32,9 +33,9 @@ Variants { color: Qt.rgba(Colors.surface.r, Colors.surface.g, Colors.surface.b, Settings.config.translucency) radius: Settings.config.floating ? Settings.config.barHeight / 2 : 0 - Row { + RowLayout { id: leftStuff - leftPadding: Settings.config.barHeight / 4 + anchors.margins: Settings.config.barHeight / 4 spacing: 10 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter @@ -51,12 +52,14 @@ Variants { Clock {} } - Row { + RowLayout { id: rightStuff - rightPadding: Settings.config.barHeight / 4 + anchors.margins: Settings.config.barHeight / 4 spacing: 10 + clip: true anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter + Network {} Volume {} Battery {} SysTray {} diff --git a/modules/bar/Battery.qml b/modules/bar/Battery.qml index bbd774c..7663ad0 100644 --- a/modules/bar/Battery.qml +++ b/modules/bar/Battery.qml @@ -11,14 +11,13 @@ import qs.settings Loader { id: batLoader active: UPower.displayDevice.isLaptopBattery - anchors.verticalCenter: parent.verticalCenter sourceComponent: Rectangle { id: container radius: implicitHeight / 2 color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer anchors.verticalCenter: parent.verticalCenter - implicitWidth: root.implicitWidth + 20 + implicitWidth: UPower.displayDevice.isLaptopBattery ? root.implicitWidth + 20 : 0 implicitHeight: Settings.config.barHeight - 10 Item { id: root diff --git a/modules/bar/Network.qml b/modules/bar/Network.qml new file mode 100644 index 0000000..bbb78d0 --- /dev/null +++ b/modules/bar/Network.qml @@ -0,0 +1,89 @@ +pragma ComponentBehavior: Bound +import Quickshell.Networking +import QtQuick +import QtQuick.Layouts +import qs.reusables +import qs.settings +import qs + +Rectangle { + id: root + // This is the background of the entire bar/module + // You might want to make this transparent if you only want the "pills" to show + implicitHeight: Settings.config.barHeight - 10 + implicitWidth: mainLayout.implicitWidth + 20 + color: Colors.surfaceContainer + radius: implicitHeight / 2 + + // --- Logic Functions --- + function getIcon(device) { + if (device.type === DeviceType.Wifi) { + for (var i = 0; i < device.networks.values.length; i++) { + var net = device.networks.values[i]; + if (net.connected) { + if (net.signalStrength <= 0.20) + return "android_wifi_0_bar"; + if (net.signalStrength <= 0.40) + return "android_wifi_1_bar"; + if (net.signalStrength <= 0.60) + return "android_wifi_2_bar"; + if (net.signalStrength <= 0.80) + return "android_wifi_3_bar"; + return "android_wifi_4_bar"; + } + } + return "wifi_off"; + } else if (device.connected) { + return "settings_ethernet"; + } + return "wifi_off"; + } + + function getStatus(device) { + if (device.type === DeviceType.Wifi) { + for (var i = 0; i < device.networks.values.length; i++) { + var net = device.networks.values[i]; + if (net.connected) { + return net.name; + } + } + return "Disconnected"; + } + return device.connected ? "Connected" : "Disconnected"; + } + + // --- Main Layout --- + RowLayout { + id: mainLayout + anchors.centerIn: parent + spacing: 10 // Space between multiple device pills (if you have ethernet + wifi) + + Repeater { + id: netRepeater + model: Networking.devices + + delegate: RowLayout { + id: innerContent + required property var modelData + // THIS fixes the centering issue: + anchors.centerIn: parent + spacing: 8 + + CustomIcon { + id: netIcon + Layout.alignment: Qt.AlignVCenter + text: root.getIcon(innerContent.modelData) + } + + CustomText { + id: netText + Layout.topMargin: 1 + Layout.alignment: Qt.AlignVCenter + text: root.getStatus(innerContent.modelData) + // Ensures the text font aligns vertically within its own line-height + verticalAlignment: Text.AlignVCenter + } + } + } + } +} diff --git a/modules/bar/SettingsIcon.qml b/modules/bar/SettingsIcon.qml index 1ff2e06..37fa85d 100644 --- a/modules/bar/SettingsIcon.qml +++ b/modules/bar/SettingsIcon.qml @@ -8,7 +8,6 @@ Rectangle { id: root radius: implicitHeight / 2 color: pavuArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer - anchors.verticalCenter: parent.verticalCenter implicitWidth: volumeIcon.implicitWidth + 10 implicitHeight: Settings.config.barHeight - 10 CustomIcon { diff --git a/modules/bar/Title.qml b/modules/bar/Title.qml index 85df49e..2b5cf62 100644 --- a/modules/bar/Title.qml +++ b/modules/bar/Title.qml @@ -8,7 +8,6 @@ Rectangle { id: container radius: implicitHeight / 2 color: Colors.surfaceContainer - anchors.verticalCenter: parent.verticalCenter implicitWidth: root.implicitWidth implicitHeight: Settings.config.barHeight - 10 Item { diff --git a/modules/bar/Volume.qml b/modules/bar/Volume.qml index 67fb916..8257796 100644 --- a/modules/bar/Volume.qml +++ b/modules/bar/Volume.qml @@ -10,9 +10,8 @@ Rectangle { id: root radius: implicitHeight / 2 color: pavuArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer - anchors.verticalCenter: parent.verticalCenter implicitWidth: textRow.implicitWidth + 20 - implicitHeight: Settings.config.barHeight - 8 + implicitHeight: Settings.config.barHeight - 10 property var sink: Pipewire.defaultAudioSink function getVolumeIcon() { // Safety check: if Pipewire is dead or sink is missing @@ -40,8 +39,10 @@ Rectangle { id: textRow spacing: 2 anchors.centerIn: parent + height: parent.height CustomText { id: volumeText + Layout.topMargin: 1 PwObjectTracker { objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] } @@ -50,7 +51,6 @@ Rectangle { } CustomIcon { id: volumeIcon - Layout.alignment: Qt.AlignVCenter opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0 text: Pipewire.ready ? root.getVolumeIcon() : null } diff --git a/modules/bar/Workspaces.qml b/modules/bar/Workspaces.qml index 040445b..c12163f 100644 --- a/modules/bar/Workspaces.qml +++ b/modules/bar/Workspaces.qml @@ -10,9 +10,8 @@ Rectangle { color: Colors.surfaceContainer implicitWidth: workspaceRow.implicitWidth + 10 - implicitHeight: Settings.config.barHeight - 10 + implicitHeight: Settings.config.barHeight - 10 radius: Settings.config.barHeight / 2 - anchors.verticalCenter: parent.verticalCenter property var screen: screen Row { id: workspaceRow diff --git a/modules/ipc/Ipc.qml b/modules/ipc/Ipc.qml index 37cd653..0d91445 100644 --- a/modules/ipc/Ipc.qml +++ b/modules/ipc/Ipc.qml @@ -2,6 +2,7 @@ import QtQuick import Quickshell.Io import qs.settings import QtQuick.Dialogs +import Quickshell Item { FontDialog { @@ -12,18 +13,15 @@ Item { IpcHandler { id: ipcHandler target: "settings" - function setWall(newWall: string): void { - console.log(Settings.config.generateScheme); - Settings.config.currentWall = newWall; - if (Settings.config.generateScheme === true) { - wallustRunner.startDetached(); - } - } function setFont(newFont: string): void { Settings.config.font = newFont; } function gen(toggle: bool): void { Settings.config.generateScheme = toggle; } + function reload(hard: bool): void { + Quickshell.reload(hard); + console.log("reloaded!"); + } } } diff --git a/modules/notifications/NotificationCard.qml b/modules/notifications/NotificationCard.qml index aa86558..f19e469 100644 --- a/modules/notifications/NotificationCard.qml +++ b/modules/notifications/NotificationCard.qml @@ -11,7 +11,7 @@ Rectangle { required property var modelData implicitWidth: ListView.view ? ListView.view.width : 300 implicitHeight: fullLayout.implicitHeight + 20 - color: dismissArea.containsMouse ? Colors.color5 : Colors.color6 + color: dismissArea.containsMouse ? Colors.surfaceContainerLow : Colors.surfaceContainerHigh radius: 22 Timer { id: dismissTimer @@ -32,7 +32,7 @@ Rectangle { id: notiIcon radius: notifyItem.radius - notifyItem.radius / 3 implicitWidth: 64 - color: Colors.color8 + color: "transparent" implicitHeight: 64 visible: notifyItem.modelData.image !== "" IconImage { diff --git a/modules/widgets/settingsapp/Appearance.qml b/modules/widgets/settingsapp/Appearance.qml index fa5eaa9..ae7e5c8 100644 --- a/modules/widgets/settingsapp/Appearance.qml +++ b/modules/widgets/settingsapp/Appearance.qml @@ -278,38 +278,6 @@ ClippingWrapperRectangle { } } } - ClippingWrapperRectangle { - id: schemeGeneratorWrapper - Layout.fillWidth: true - leftMargin: 10 - rightMargin: 15 - implicitHeight: 30 - bottomLeftRadius: 12 - bottomRightRadius: 12 - topRightRadius: 4 - topLeftRadius: 4 - color: Colors.surfaceContainerHigh - child: RowLayout { - id: schemeGeneratorLayout - spacing: 5 - CustomText { - id: schemeGeneratorText - text: "Scheme generator" - Layout.fillWidth: true - } - CustomButton { - implicitHeight: schemeGeneratorWrapper.implicitHeight - 10 - onClicked: { - if (Settings.config.schemeGenerator === "matugen") { - Settings.config.schemeGenerator = "wallust"; - } else { - Settings.config.schemeGenerator = "matugen"; - } - } - customText: Settings.config.schemeGenerator - } - } - } Item { id: spring Layout.fillHeight: true diff --git a/modules/widgets/wallswitcher/WallSwitcher.qml b/modules/widgets/wallswitcher/WallSwitcher.qml index 65aac2d..351be04 100644 --- a/modules/widgets/wallswitcher/WallSwitcher.qml +++ b/modules/widgets/wallswitcher/WallSwitcher.qml @@ -23,7 +23,7 @@ FloatingWindow { } Process { id: wallustRunner - property string cmd: Settings.config.schemeGenerator === "matugen" ? "matugen image " + Settings.config.currentWall : "wallust run " + Settings.config.currentWall + property string cmd: "matugen image " + Settings.config.currentWall command: ["sh", "-c", cmd] } GlobalShortcut { diff --git a/reusables/CustomIcon.qml b/reusables/CustomIcon.qml index a312afb..6647e7d 100644 --- a/reusables/CustomIcon.qml +++ b/reusables/CustomIcon.qml @@ -1,10 +1,16 @@ import QtQuick -import qs.settings import qs +import qs.settings Text { - verticalAlignment: Text.AlignVCenter + property real fill: 0 font.family: "Material Symbols Rounded" color: Colors.onSurfaceColor - font.pixelSize: Settings.config.fontSize + 2 + font.pixelSize: Settings.config.fontSize + font.variableAxes: ({ + FILL: fill, + GRAD: 200, + opsz: 36, + wght: 400 + }) }