mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added flag emoji instead of country code in the popup view, and countryCode and flag options to the Text widget (#2916)
This commit is contained in:
@@ -275,6 +275,8 @@ public class Network: Module {
|
||||
case "private": replacement = value.laddr.v4 ?? value.laddr.v6 ?? "-"
|
||||
case "privateV4": replacement = value.laddr.v4 ?? "-"
|
||||
case "privateV6": replacement = value.laddr.v6 ?? "-"
|
||||
case "countryCode": replacement = value.raddr.countryCode ?? "-"
|
||||
case "flag": replacement = value.raddr.countryCode != nil ? countryFlag(value.raddr.countryCode!) : "-"
|
||||
default: return
|
||||
}
|
||||
case "$interface":
|
||||
|
||||
@@ -525,7 +525,12 @@ internal class Popup: PopupWrapper {
|
||||
}
|
||||
var ip = addr
|
||||
if let cc = value.raddr.countryCode, !cc.isEmpty {
|
||||
ip += " (\(cc))"
|
||||
if let flag = countryFlag(cc) {
|
||||
ip += " \(flag)"
|
||||
} else {
|
||||
ip += " (\(cc))"
|
||||
}
|
||||
self.publicIPv4Field?.toolTip = cc
|
||||
}
|
||||
if self.publicIPv4Field?.stringValue != ip {
|
||||
self.publicIPv4Field?.stringValue = ip
|
||||
@@ -545,7 +550,12 @@ internal class Popup: PopupWrapper {
|
||||
}
|
||||
var ip = addr
|
||||
if let cc = value.raddr.countryCode {
|
||||
ip += " (\(cc))"
|
||||
if let flag = countryFlag(cc) {
|
||||
ip += " \(flag)"
|
||||
} else {
|
||||
ip += " (\(cc))"
|
||||
}
|
||||
self.publicIPv6Field?.toolTip = cc
|
||||
}
|
||||
if self.publicIPv6Field?.stringValue != ip {
|
||||
self.publicIPv6Field?.stringValue = ip
|
||||
|
||||
@@ -29,6 +29,8 @@ You can use a combination of any of the variables. There is only one limitation:
|
||||
<li><b>$addr.private</b>: <small>Private/local IP address.</small></li>
|
||||
<li><b>$addr.privateV4</b>: <small>Private/local IPv4 address.</small></li>
|
||||
<li><b>$addr.privateV6</b>: <small>Private/local IPv6 address.</small></li>
|
||||
<li><b>$addr.countryCode</b>: <small>Country code based on the public IP address.</small></li>
|
||||
<li><b>$addr.flag</b>: <small>Emoji flag based on the country code.</small></li>
|
||||
<li><b>$interface.displayName</b>: <small>Network interface name.</small></li>
|
||||
<li><b>$interface.BSDName</b>: <small>BSD name of the network interface.</small></li>
|
||||
<li><b>$interface.address</b>: <small>MAC address of the network interface.</small></li>
|
||||
|
||||
Reference in New Issue
Block a user