Skip to content

Commit 4a03820

Browse files
committed
style(cloudflare-warp): resize cloudflare-warp BarWidget icon smaller for a cleaner look & formatting
1 parent 96ac1bf commit 4a03820

1 file changed

Lines changed: 30 additions & 37 deletions

File tree

cloudflare-warp/BarWidget.qml

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import QtQuick
22
import QtQuick.Layouts
33
import Quickshell
44
import qs.Commons
5-
import qs.Widgets
65
import qs.Services.UI
6+
import qs.Widgets
77

88
Item {
99
id: root
@@ -18,31 +18,27 @@ Item {
1818
readonly property bool pillDirection: BarService.getPillDirection(root)
1919
readonly property var mainInstance: pluginApi?.mainInstance
2020

21-
readonly property string connectedColorKey: pluginApi?.pluginSettings?.connectedColor
22-
?? pluginApi?.manifest?.metadata?.defaultSettings?.connectedColor
23-
?? "primary"
21+
readonly property string connectedColorKey: pluginApi?.pluginSettings?.connectedColor ?? pluginApi?.manifest?.metadata?.defaultSettings?.connectedColor ?? "primary"
2422

25-
readonly property string disconnectedColorKey: pluginApi?.pluginSettings?.disconnectedColor
26-
?? pluginApi?.manifest?.metadata?.defaultSettings?.disconnectedColor
27-
?? "none"
23+
readonly property string disconnectedColorKey: pluginApi?.pluginSettings?.disconnectedColor ?? pluginApi?.manifest?.metadata?.defaultSettings?.disconnectedColor ?? "none"
2824

2925
readonly property color resolvedIconColor: {
30-
var key = (mainInstance?.warpConnected ?? false) ? connectedColorKey : disconnectedColorKey
31-
var resolved = Color.resolveColorKeyOptional(key)
26+
var key = (mainInstance?.warpConnected ?? false) ? connectedColorKey : disconnectedColorKey;
27+
var resolved = Color.resolveColorKeyOptional(key);
3228
// resolveColorKeyOptional ritorna "transparent" per "none" — fallback al colore neutro
3329
if (!resolved || resolved === "transparent" || resolved.a === 0)
34-
return mouseArea.containsMouse ? Color.mOnHover : Color.mOnSurface
35-
return resolved
30+
return mouseArea.containsMouse ? Color.mOnHover : Color.mOnSurface;
31+
return resolved;
3632
}
3733

3834
readonly property real contentWidth: {
3935
if (!(mainInstance?.warpInstalled ?? false)) {
40-
return Style.capsuleHeight
36+
return Style.capsuleHeight;
4137
}
4238
if ((mainInstance?.warpMode ?? "") !== "") {
43-
return contentRow.implicitWidth + Style.marginM * 2
39+
return contentRow.implicitWidth + Style.marginM * 2;
4440
}
45-
return Style.capsuleHeight
41+
return Style.capsuleHeight;
4642
}
4743
readonly property real contentHeight: Style.capsuleHeight
4844

@@ -65,12 +61,12 @@ Item {
6561
layoutDirection: Qt.LeftToRight
6662

6763
Item {
68-
implicitWidth: Style.fontSizeXXXL
69-
implicitHeight: Style.fontSizeXXXL
64+
implicitWidth: Style.fontSizeXXL
65+
implicitHeight: Style.fontSizeXXL
7066

7167
CloudflareIcon {
7268
anchors.fill: parent
73-
pointSize: Style.fontSizeXXXL
69+
pointSize: Style.fontSizeXXL
7470
applyUiScale: false
7571
color: root.resolvedIconColor
7672
opacity: (mainInstance?.isRefreshing ?? false) ? 0.5 : 1.0
@@ -89,8 +85,7 @@ Item {
8985
}
9086

9187
NText {
92-
visible: (mainInstance?.warpInstalled ?? false)
93-
&& (mainInstance?.warpMode ?? "") !== ""
88+
visible: (mainInstance?.warpInstalled ?? false) && (mainInstance?.warpMode ?? "") !== ""
9489
text: mainInstance?.warpMode ?? ""
9590
pointSize: Style.fontSizeXS
9691
color: root.resolvedIconColor
@@ -105,9 +100,7 @@ Item {
105100

106101
model: [
107102
{
108-
"label": (mainInstance?.warpConnected ?? false)
109-
? pluginApi?.tr("context.disconnect")
110-
: pluginApi?.tr("context.connect"),
103+
"label": (mainInstance?.warpConnected ?? false) ? pluginApi?.tr("context.disconnect") : pluginApi?.tr("context.connect"),
111104
"action": "toggle-warp",
112105
"icon": (mainInstance?.warpConnected ?? false) ? "plug-x" : "plug",
113106
"enabled": mainInstance?.warpInstalled ?? false
@@ -120,15 +113,15 @@ Item {
120113
]
121114

122115
onTriggered: action => {
123-
contextMenu.close()
124-
PanelService.closeContextMenu(screen)
125-
126-
if (action === "widget-settings") {
127-
BarService.openPluginSettings(screen, pluginApi.manifest)
128-
} else if (action === "toggle-warp") {
129-
mainInstance?.toggleWarp()
130-
}
131-
}
116+
contextMenu.close();
117+
PanelService.closeContextMenu(screen);
118+
119+
if (action === "widget-settings") {
120+
BarService.openPluginSettings(screen, pluginApi.manifest);
121+
} else if (action === "toggle-warp") {
122+
mainInstance?.toggleWarp();
123+
}
124+
}
132125
}
133126

134127
MouseArea {
@@ -139,11 +132,11 @@ Item {
139132
acceptedButtons: Qt.LeftButton | Qt.RightButton
140133

141134
onClicked: mouse => {
142-
if (mouse.button === Qt.LeftButton) {
143-
pluginApi?.openPanel(root.screen, root)
144-
} else if (mouse.button === Qt.RightButton) {
145-
PanelService.showContextMenu(contextMenu, root, screen)
146-
}
147-
}
135+
if (mouse.button === Qt.LeftButton) {
136+
pluginApi?.openPanel(root.screen, root);
137+
} else if (mouse.button === Qt.RightButton) {
138+
PanelService.showContextMenu(contextMenu, root, screen);
139+
}
140+
}
148141
}
149142
}

0 commit comments

Comments
 (0)