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
|
||||
font.family: Theme.iconFont
|
||||
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
|
||||
|
|
@ -2043,7 +2048,18 @@ in
|
|||
property string netState: "disconnected"
|
||||
property string netConn: ""
|
||||
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 string netDevice: ""
|
||||
|
||||
|
|
@ -2120,11 +2136,10 @@ in
|
|||
netWidget.netConn = netWidget._pendingConn;
|
||||
netWidget.netType = netWidget._pendingType.length > 0 ? netWidget._pendingType : netWidget.netType;
|
||||
netWidget.netDevice = netWidget._pendingDevice.length > 0 ? netWidget._pendingDevice : netWidget.netDevice;
|
||||
if (netWidget.netState === "connected") {
|
||||
netWidget.netIcon = netWidget.netType === "wifi" ? "wifi" : "lan";
|
||||
} else {
|
||||
netWidget.netIcon = netWidget.netType === "wifi" ? "wifi_off" : "settings_ethernet";
|
||||
}
|
||||
// netIcon is a binding now; wifi needs the
|
||||
// active AP's signal to pick its glyph.
|
||||
if (netWidget.netState === "connected" && netWidget.netType === "wifi")
|
||||
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 {
|
||||
id: wifiConnectProc
|
||||
property string targetSsid: ""
|
||||
|
|
@ -3317,7 +3345,7 @@ in
|
|||
|
||||
SIcon {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: netWidget.netState === "connected" ? "wifi" : "wifi_off"
|
||||
text: netWidget.netIcon
|
||||
color: Theme.base05
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
|
@ -3343,7 +3371,6 @@ in
|
|||
netDisconnectProc.running = true;
|
||||
netWidget.netState = "disconnected";
|
||||
netWidget.netConn = "";
|
||||
netWidget.netIcon = "wifi_off";
|
||||
bar.closeAllDropdowns();
|
||||
netRefreshDelay.start();
|
||||
}
|
||||
|
|
@ -3392,12 +3419,17 @@ in
|
|||
spacing: 8
|
||||
|
||||
SIcon {
|
||||
// caelestia's getNetworkIcon, secure
|
||||
// variant included — a padlocked arc
|
||||
// for encrypted APs.
|
||||
text: {
|
||||
let s = modelData.signal;
|
||||
if (s >= 75) return "signal_wifi_4_bar";
|
||||
if (s >= 50) return "network_wifi_3_bar";
|
||||
if (s >= 25) return "network_wifi_2_bar";
|
||||
return "network_wifi_1_bar";
|
||||
if (s < 20) return "signal_wifi_0_bar";
|
||||
let lock = modelData.security.length > 0 ? "_locked" : "";
|
||||
if (s >= 80) return "network_wifi" + lock;
|
||||
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
|
||||
font.pixelSize: 16
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue