1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-15 12:50:04 +00:00

Merge branch 'main' into dev

This commit is contained in:
Tw93
2026-01-17 08:22:02 +08:00
5 changed files with 9 additions and 26 deletions

View File

@@ -149,6 +149,7 @@ type NetworkStatus struct {
TxRateMBs float64 TxRateMBs float64
IP string IP string
} }
// NetworkHistory holds the global network usage history. // NetworkHistory holds the global network usage history.
type NetworkHistory struct { type NetworkHistory struct {
RxHistory []float64 RxHistory []float64
@@ -324,11 +325,11 @@ func (c *Collector) Collect() (MetricsSnapshot, error) {
TxHistory: c.txHistoryBuf.Slice(), TxHistory: c.txHistoryBuf.Slice(),
}, },
Proxy: proxyStats, Proxy: proxyStats,
Batteries: batteryStats, Batteries: batteryStats,
Thermal: thermalStats, Thermal: thermalStats,
Sensors: sensorStats, Sensors: sensorStats,
Bluetooth: btStats, Bluetooth: btStats,
TopProcesses: topProcs, TopProcesses: topProcs,
}, mergeErr }, mergeErr
} }

View File

@@ -201,8 +201,6 @@ func getScoreStyle(score int) lipgloss.Style {
} }
} }
func hasSensorData(sensors []SensorReading) bool { func hasSensorData(sensors []SensorReading) bool {
for _, s := range sensors { for _, s := range sensors {
if s.Note == "" && s.Value > 0 { if s.Note == "" && s.Value > 0 {
@@ -475,21 +473,6 @@ func renderNetworkCard(netStats []NetworkStatus, history NetworkHistory, proxy P
return cardData{icon: iconNetwork, title: "Network", lines: lines} return cardData{icon: iconNetwork, title: "Network", lines: lines}
} }
func netBar(rate float64) string {
filled := min(int(rate/2.0), 5)
if filled < 0 {
filled = 0
}
bar := strings.Repeat("▮", filled) + strings.Repeat("▯", 5-filled)
if rate > 8 {
return dangerStyle.Render(bar)
}
if rate > 3 {
return warnStyle.Render(bar)
}
return okStyle.Render(bar)
}
// 8 levels: ▁▂▃▄▅▆▇█ // 8 levels: ▁▂▃▄▅▆▇█
func sparkline(history []float64, current float64, width int) string { func sparkline(history []float64, current float64, width int) string {
blocks := []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'} blocks := []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'}

View File

@@ -206,7 +206,7 @@ read_key() {
echo "QUIT" echo "QUIT"
fi fi
;; ;;
' ') echo "SPACE" ;; # Allow space in filter mode for selection ' ') echo "SPACE" ;; # Allow space in filter mode for selection
[[:print:]]) echo "CHAR:$key" ;; [[:print:]]) echo "CHAR:$key" ;;
*) echo "OTHER" ;; *) echo "OTHER" ;;
esac esac

View File

@@ -389,7 +389,6 @@ batch_uninstall_applications() {
local has_system_files="false" local has_system_files="false"
[[ -n "$system_files" ]] && has_system_files="true" [[ -n "$system_files" ]] && has_system_files="true"
stop_launch_services "$bundle_id" "$has_system_files" stop_launch_services "$bundle_id" "$has_system_files"
# Remove from Login Items # Remove from Login Items

View File

@@ -179,8 +179,8 @@ brew_uninstall_cask() {
# Ensure we have sudo access if needed, to prevent brew from hanging on password prompt # Ensure we have sudo access if needed, to prevent brew from hanging on password prompt
# Many brew casks need sudo to uninstall # Many brew casks need sudo to uninstall
if ! sudo -n true 2> /dev/null; then if ! sudo -n true 2> /dev/null; then
# If we don't have sudo, try to get it (visibly) # If we don't have sudo, try to get it (visibly)
sudo -v sudo -v
fi fi
local uninstall_ok=false local uninstall_ok=false