quickshell: match caelestia icon axes and wifi glyphs
This commit is contained in:
parent
4eeb496efe
commit
734d18791c
1 changed files with 44 additions and 12 deletions
|
|
@ -773,6 +773,11 @@ in
|
||||||
color: Theme.base05
|
color: Theme.base05
|
||||||
font.family: Theme.iconFont
|
font.family: Theme.iconFont
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
|
// Material Symbols variable axes, matching caelestia's
|
||||||
|
// MaterialIcon: GRAD -25 (their dark-theme value; our
|
||||||
|
// stylix polarity is always dark) and opsz 24, which is
|
||||||
|
// what actually makes the strokes read right at 16px.
|
||||||
|
font.variableAxes: ({ "FILL": 0, "GRAD": -25, "opsz": 24 })
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── BarSep: extra whitespace between widget groups. Groups are
|
// ── BarSep: extra whitespace between widget groups. Groups are
|
||||||
|
|
@ -2043,7 +2048,18 @@ in
|
||||||
property string netState: "disconnected"
|
property string netState: "disconnected"
|
||||||
property string netConn: ""
|
property string netConn: ""
|
||||||
property string netType: ""
|
property string netType: ""
|
||||||
property string netIcon: "wifi_off"
|
property int netStrength: 0
|
||||||
|
// caelestia's getNetworkIcon mapping: signal strength
|
||||||
|
// picks the arc glyph instead of one flat "wifi".
|
||||||
|
readonly property string netIcon:
|
||||||
|
netState !== "connected"
|
||||||
|
? (netType === "ethernet" ? "settings_ethernet" : "wifi_off")
|
||||||
|
: netType === "ethernet" ? "cable"
|
||||||
|
: netStrength >= 80 ? "network_wifi"
|
||||||
|
: netStrength >= 60 ? "network_wifi_3_bar"
|
||||||
|
: netStrength >= 40 ? "network_wifi_2_bar"
|
||||||
|
: netStrength >= 20 ? "network_wifi_1_bar"
|
||||||
|
: "signal_wifi_0_bar"
|
||||||
property var wifiNetworks: []
|
property var wifiNetworks: []
|
||||||
property string netDevice: ""
|
property string netDevice: ""
|
||||||
|
|
||||||
|
|
@ -2120,11 +2136,10 @@ in
|
||||||
netWidget.netConn = netWidget._pendingConn;
|
netWidget.netConn = netWidget._pendingConn;
|
||||||
netWidget.netType = netWidget._pendingType.length > 0 ? netWidget._pendingType : netWidget.netType;
|
netWidget.netType = netWidget._pendingType.length > 0 ? netWidget._pendingType : netWidget.netType;
|
||||||
netWidget.netDevice = netWidget._pendingDevice.length > 0 ? netWidget._pendingDevice : netWidget.netDevice;
|
netWidget.netDevice = netWidget._pendingDevice.length > 0 ? netWidget._pendingDevice : netWidget.netDevice;
|
||||||
if (netWidget.netState === "connected") {
|
// netIcon is a binding now; wifi needs the
|
||||||
netWidget.netIcon = netWidget.netType === "wifi" ? "wifi" : "lan";
|
// active AP's signal to pick its glyph.
|
||||||
} else {
|
if (netWidget.netState === "connected" && netWidget.netType === "wifi")
|
||||||
netWidget.netIcon = netWidget.netType === "wifi" ? "wifi_off" : "settings_ethernet";
|
wifiSignalProc.running = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2168,6 +2183,19 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No --rescan, so this reads NetworkManager's cached
|
||||||
|
// scan — cheap enough to run on every net event.
|
||||||
|
Process {
|
||||||
|
id: wifiSignalProc
|
||||||
|
command: [Commands.nmcli, "-t", "-f", "IN-USE,SIGNAL", "device", "wifi"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: data => {
|
||||||
|
let f = data.split(":");
|
||||||
|
if (f[0] === "*") netWidget.netStrength = parseInt(f[1]) || 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: wifiConnectProc
|
id: wifiConnectProc
|
||||||
property string targetSsid: ""
|
property string targetSsid: ""
|
||||||
|
|
@ -3317,7 +3345,7 @@ in
|
||||||
|
|
||||||
SIcon {
|
SIcon {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: netWidget.netState === "connected" ? "wifi" : "wifi_off"
|
text: netWidget.netIcon
|
||||||
color: Theme.base05
|
color: Theme.base05
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
}
|
}
|
||||||
|
|
@ -3343,7 +3371,6 @@ in
|
||||||
netDisconnectProc.running = true;
|
netDisconnectProc.running = true;
|
||||||
netWidget.netState = "disconnected";
|
netWidget.netState = "disconnected";
|
||||||
netWidget.netConn = "";
|
netWidget.netConn = "";
|
||||||
netWidget.netIcon = "wifi_off";
|
|
||||||
bar.closeAllDropdowns();
|
bar.closeAllDropdowns();
|
||||||
netRefreshDelay.start();
|
netRefreshDelay.start();
|
||||||
}
|
}
|
||||||
|
|
@ -3392,12 +3419,17 @@ in
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
SIcon {
|
SIcon {
|
||||||
|
// caelestia's getNetworkIcon, secure
|
||||||
|
// variant included — a padlocked arc
|
||||||
|
// for encrypted APs.
|
||||||
text: {
|
text: {
|
||||||
let s = modelData.signal;
|
let s = modelData.signal;
|
||||||
if (s >= 75) return "signal_wifi_4_bar";
|
if (s < 20) return "signal_wifi_0_bar";
|
||||||
if (s >= 50) return "network_wifi_3_bar";
|
let lock = modelData.security.length > 0 ? "_locked" : "";
|
||||||
if (s >= 25) return "network_wifi_2_bar";
|
if (s >= 80) return "network_wifi" + lock;
|
||||||
return "network_wifi_1_bar";
|
if (s >= 60) return "network_wifi_3_bar" + lock;
|
||||||
|
if (s >= 40) return "network_wifi_2_bar" + lock;
|
||||||
|
return "network_wifi_1_bar" + lock;
|
||||||
}
|
}
|
||||||
color: modelData.active ? Theme.base0B : Theme.base04
|
color: modelData.active ? Theme.base0B : Theme.base04
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue