From 4e2a3ed796b7c80124b786a94792abdbe72b3839 Mon Sep 17 00:00:00 2001 From: Uyanide Date: Sat, 3 Jan 2026 23:14:18 +0100 Subject: [PATCH] qs: fix layout issues of ip component --- .../.config/quickshell/Constants/Icons.qml | 2 +- .../quickshell/Modules/Bar/Components/Ip.qml | 85 +++++-------------- .../Modules/Bar/Misc/MonitorItem.qml | 8 +- .../quickshell/Services/RecordService.qml | 12 ++- 4 files changed, 34 insertions(+), 73 deletions(-) diff --git a/config/quickshell/.config/quickshell/Constants/Icons.qml b/config/quickshell/.config/quickshell/Constants/Icons.qml index 190f323..9cf2077 100644 --- a/config/quickshell/.config/quickshell/Constants/Icons.qml +++ b/config/quickshell/.config/quickshell/Constants/Icons.qml @@ -28,7 +28,7 @@ Singleton { readonly property string tempHigh: "" readonly property string tempMedium: "" readonly property string tempLow: "" - readonly property string global: "" + readonly property string ip: "󰇧" readonly property string upload: "" readonly property string download: "" readonly property string speedSlower: "󰾆" diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Components/Ip.qml b/config/quickshell/.config/quickshell/Modules/Bar/Components/Ip.qml index 19d8ef6..016e0db 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Components/Ip.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Components/Ip.qml @@ -3,80 +3,33 @@ import QtQuick.Layouts import Quickshell import qs.Constants import qs.Services +import qs.Modules.Bar.Misc -Item { - id: root +MonitorItem { + symbol: Icons.ip + fillColor: Colors.peach + value: 100 + maxValue: 100 + textValue: displayText + symbolSize: 18 property int displayIndex: 0 readonly property list displayTexts: [IpService.countryCode, IpService.ip, IpService.alias] readonly property string displayText: displayTexts[displayIndex] - implicitHeight: parent.height - implicitWidth: layout.width + 10 - - RowLayout { - id: layout - - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: 0 - - Text { - text: Icons.global - font.pointSize: Fonts.icon + 6 - color: Colors.peach - } - - Item { - id: expander - - implicitWidth: mouseArea.containsMouse ? ipText.implicitWidth + 10 : 0 - implicitHeight: parent.height - clip: true - - Text { - id: ipText - - text: displayText - font.pointSize: displayIndex === 0 ? Fonts.medium : Fonts.small - font.family: Fonts.primary - color: Colors.peach - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 5 - } - - Behavior on implicitWidth { - NumberAnimation { - duration: Style.animationFast - easing.type: Easing.InOutCubic - } - - } - - } - + onClicked: (mouse) => { + WriteClipboard.write(displayText); + SendNotification.show("Copied to clipboard", displayText); } - MouseArea { - id: mouseArea - - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onClicked: (mouse) => { - if (mouse.button === Qt.LeftButton) { - WriteClipboard.write(displayText); - SendNotification.show("Copied to clipboard", displayText); - } else if (mouse.button === Qt.RightButton){ - let iter = 0; - do { - displayIndex = (displayIndex + 1) % displayTexts.length; - } while (!displayTexts[displayIndex] && iter++ < displayTexts.length); - } else if (mouse.button === Qt.MiddleButton) - IpService.refresh(); - } + onRightClicked: { + let iter = 0; + do { + displayIndex = (displayIndex + 1) % displayTexts.length; + } while (!displayTexts[displayIndex] && iter++ < displayTexts.length); } + onMiddleClicked: { + IpService.refresh(); + } } diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Misc/MonitorItem.qml b/config/quickshell/.config/quickshell/Modules/Bar/Misc/MonitorItem.qml index b4e51da..405d52e 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Misc/MonitorItem.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Misc/MonitorItem.qml @@ -8,6 +8,7 @@ Item { id: root required property string symbol + property int symbolSize: Fonts.icon property real maxValue: 100 property real value: 100 property string textValue: "" // override value in textDisplay if set @@ -29,6 +30,7 @@ Item { signal wheelDown() signal clicked() signal rightClicked() + signal middleClicked() implicitHeight: parent.height - 5 implicitWidth: parent.height + (_expand ? textDisplay.width : 0) @@ -74,13 +76,15 @@ Item { anchors.fill: parent hoverEnabled: !disableHover - acceptedButtons: Qt.LeftButton | Qt.RightButton + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton cursorShape: pointerCursor ? Qt.PointingHandCursor : Qt.ArrowCursor onClicked: (mouse) => { if (mouse.button === Qt.LeftButton) root.clicked(); else if (mouse.button === Qt.RightButton) root.rightClicked(); + else if (mouse.button === Qt.MiddleButton) + root.middleClicked(); } onWheel: (wheel) => { if (wheel.angleDelta.y > 0) @@ -142,7 +146,7 @@ Item { anchors.fill: parent text: symbol font.family: Fonts.nerd - font.pointSize: Fonts.icon + font.pointSize: symbolSize color: root.realColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/config/quickshell/.config/quickshell/Services/RecordService.qml b/config/quickshell/.config/quickshell/Services/RecordService.qml index 8179015..dd78601 100644 --- a/config/quickshell/.config/quickshell/Services/RecordService.qml +++ b/config/quickshell/.config/quickshell/Services/RecordService.qml @@ -14,8 +14,12 @@ Singleton { readonly property string pixelFormat: "p010le" property string recordingDisplay: "" readonly property int framerate: 60 - readonly property var codecParams: Object.freeze(["preset=p5", "rc=vbr", "cq=18", "b:v=80M", "maxrate=120M", "bufsize=160M", "color_range=tv"]) - readonly property var filterArgs: Object.freeze([]) + readonly property var codecParams: Object.freeze([ + "preset=p5", "rc=vbr", "cq=18", + "b:v=80M", "maxrate=120M", "bufsize=160M", + "color_range=tv" + ]) + readonly property var filterArgs: "" function getFilename() { var d = new Date(); @@ -84,9 +88,9 @@ Singleton { recordProcess.command.push("-p"); recordProcess.command.push(param); } - for (const filter of filterArgs) { + if (filterArgs !== "") { recordProcess.command.push("-F"); - recordProcess.command.push(filter); + recordProcess.command.push(filterArgs); } Logger.log("RecordService", "Starting recording with command: " + recordProcess.command.join(" ")); recordProcess.onErrorExit = function() {