mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 13:23:00 +00:00
Show host uptime information
This commit is contained in:
parent
f0fc877f4e
commit
02e01ba04f
3 changed files with 14 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import { TabWidget, StandardButton, GridBox, ListView } from "sixtyfps_widgets.6
|
||||||
|
|
||||||
|
|
||||||
SysInfo := Dialog {
|
SysInfo := Dialog {
|
||||||
|
property uptime <=> uptime.text;
|
||||||
property cpu_count <=> cpu-count.text;
|
property cpu_count <=> cpu-count.text;
|
||||||
property cpu_model <=> cpu-model.text;
|
property cpu_model <=> cpu-model.text;
|
||||||
property cpu_vendor <=> cpu-vendor.text;
|
property cpu_vendor <=> cpu-vendor.text;
|
||||||
|
|
@ -70,6 +71,14 @@ SysInfo := Dialog {
|
||||||
text: "\{floor(mem_size_kb / (1000*1000))} GB";
|
text: "\{floor(mem_size_kb / (1000*1000))} GB";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Row {
|
||||||
|
Text{
|
||||||
|
text: "Uptime:";
|
||||||
|
max-width: min-width;
|
||||||
|
}
|
||||||
|
uptime := Text {
|
||||||
|
}
|
||||||
|
}
|
||||||
Rectangle {}
|
Rectangle {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
# Please contact info@sixtyfps.io for more information.
|
# Please contact info@sixtyfps.io for more information.
|
||||||
# LICENSE END
|
# LICENSE END
|
||||||
|
|
||||||
|
uptime=`uptime -p | cut -d " " -f2-`
|
||||||
cpu_count=`grep processor /proc/cpuinfo | wc -l`
|
cpu_count=`grep processor /proc/cpuinfo | wc -l`
|
||||||
cpu_vendor=`awk -F ": " '/vendor_id/{ print $2; exit}' < /proc/cpuinfo`
|
cpu_vendor=`awk -F ": " '/vendor_id/{ print $2; exit}' < /proc/cpuinfo`
|
||||||
cpu_model=`awk -F ": " '/model name/{ print $2; exit}' < /proc/cpuinfo`
|
cpu_model=`awk -F ": " '/model name/{ print $2; exit}' < /proc/cpuinfo`
|
||||||
|
|
@ -17,6 +18,7 @@ partitions=`df --block-size=1 | tail -n+2 | sed 's/\([^ ]*\) *\([^ ]*\) *\([^
|
||||||
|
|
||||||
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
|
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
|
||||||
{
|
{
|
||||||
|
"uptime": "$uptime",
|
||||||
"cpu_count": "$cpu_count",
|
"cpu_count": "$cpu_count",
|
||||||
"cpu_vendor": "$cpu_vendor",
|
"cpu_vendor": "$cpu_vendor",
|
||||||
"cpu_model": "$cpu_model",
|
"cpu_model": "$cpu_model",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
# Please contact info@sixtyfps.io for more information.
|
# Please contact info@sixtyfps.io for more information.
|
||||||
# LICENSE END
|
# LICENSE END
|
||||||
|
|
||||||
|
uptime=`uptime | awk 'BEGIN{FS="up |,"}{print $2}'`
|
||||||
cpu_count=`sysctl -n hw.ncpu`
|
cpu_count=`sysctl -n hw.ncpu`
|
||||||
cpu_vendor=`sysctl -n machdep.cpu.vendor`
|
cpu_vendor=`sysctl -n machdep.cpu.vendor`
|
||||||
cpu_model=`sysctl -n machdep.cpu.brand_string`
|
cpu_model=`sysctl -n machdep.cpu.brand_string`
|
||||||
|
|
@ -17,6 +18,7 @@ partitions=`df -lk | tail -n+2 | sed 's/\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^
|
||||||
|
|
||||||
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
|
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
|
||||||
{
|
{
|
||||||
|
"uptime": "$uptime",
|
||||||
"cpu_count": "$cpu_count",
|
"cpu_count": "$cpu_count",
|
||||||
"cpu_vendor": "$cpu_vendor",
|
"cpu_vendor": "$cpu_vendor",
|
||||||
"cpu_model": "$cpu_model",
|
"cpu_model": "$cpu_model",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue