diff --git a/examples/config.corn b/examples/config.corn
index 7e892df..8cb6d4c 100644
--- a/examples/config.corn
+++ b/examples/config.corn
@@ -24,19 +24,53 @@ let {
$sys_info = {
type = "sys-info"
- format = ["{cpu-percent}% " "{memory-percent}% "]
+ format = ["{cpu_percent}% " "{memory_percent}% "]
}
$tray = { type = "tray" }
- $clock = { type = "clock" }
+ $clock = {
+ type = "clock"
+ // show-if = "500:[ $(($(date +%s) % 2)) -eq 0 ]"
+ show_if.cmd = "exit 0"
+ show_if.interval = 500
+ }
$phone_battery = {
type = "script"
path = "/home/jake/bin/phone-battery"
}
+ $log_tail = {
+ type = "script"
+ path = "tail -f /home/jake/.local/share/ironbar/error.log"
+ mode = "watch"
+ }
+
+ $power_menu = {
+ type = "custom"
+ class = "power-menu"
+
+ bar = [ { type = "button" name="power-btn" label = "" on_click = "popup:toggle" } ]
+
+ popup = [ {
+ type = "box"
+ orientation = "vertical"
+ widgets = [
+ { type = "label" name = "header" label = "Power menu" }
+ {
+ type = "box"
+ widgets = [
+ { type = "button" class="power-btn" label = "" on_click = "!shutdown now" }
+ { type = "button" class="power-btn" label = "" on_click = "!reboot" }
+ ]
+ }
+ { type = "label" name = "uptime" label = "Uptime: {{30000:uptime -p | cut -d ' ' -f2-}}" }
+ ]
+ } ]
+ }
+
$left = [ $workspaces $launcher ]
- $right = [ $mpd_local $mpd_server $phone_battery $sys_info $clock ]
+ $right = [ $mpd_local $mpd_server $phone_battery $sys_info $power_menu $clock ]
}
in {
anchor_to_edges = true
diff --git a/examples/config.json b/examples/config.json
index b3f09a1..c8d2600 100644
--- a/examples/config.json
+++ b/examples/config.json
@@ -28,10 +28,10 @@
},
{
"format": [
- "{cpu-percent}% ",
- "{memory-percent}% "
+ "{cpu_percent}% ",
+ "{memory_percent}% "
],
- "type": "sys-info"
+ "type": "sys_info"
},
{
"type": "tray"
diff --git a/examples/custom.corn b/examples/custom.corn
index 41ad89b..1619839 100644
--- a/examples/custom.corn
+++ b/examples/custom.corn
@@ -1,25 +1,29 @@
let {
+ $button = { type = "button" name="power-btn" label = "" on_click = "popup:toggle" }
+
+ $popup = {
+ type = "box"
+ orientation = "vertical"
+ widgets = [
+ { type = "label" name = "header" label = "Power menu" }
+ {
+ type = "box"
+ widgets = [
+ { type = "button" class="power-btn" label = "" on_click = "!shutdown now" }
+ { type = "button" class="power-btn" label = "" on_click = "!reboot" }
+ ]
+ }
+ { type = "label" name = "uptime" label = "Uptime: {{30000:uptime -p | cut -d ' ' -f2-}}" }
+ ]
+ }
+
$power_menu = {
type = "custom"
class = "power-menu"
- bar = [ { type = "button" name="power-btn" label = "" exec = "popup:toggle" } ]
-
- popup = [ {
- type = "box"
- orientation = "vertical"
- widgets = [
- { type = "label" name = "header" label = "Power menu" }
- {
- type = "box"
- widgets = [
- { type = "button" class="power-btn" label = "" exec = "!shutdown now" }
- { type = "button" class="power-btn" label = "" exec = "!reboot" }
- ]
- }
- ]
- } ]
+ bar = [ $button ]
+ popup = [ $popup ]
}
} in {
- end = [ { type = "clock" } $power_menu ]
+ end = [ $power_menu { type = "clock" } ]
}
\ No newline at end of file
diff --git a/examples/sys-info.corn b/examples/sys-info.corn
index ec1556d..65f6ad3 100644
--- a/examples/sys-info.corn
+++ b/examples/sys-info.corn
@@ -1,7 +1,7 @@
{
end = [
{
- type = "sys-info"
+ type = "sys_info"
interval.memory = 30
interval.cpu = 1
@@ -10,12 +10,12 @@
interval.networks = 3
format = [
- " {cpu-percent}% | {temp-c:k10temp-Tccd1}°C"
- " {memory-used} / {memory-total} GB ({memory-percent}%)"
- "| {swap-used} / {swap-total} GB ({swap-percent}%)"
- " {disk-used:/} / {disk-total:/} GB ({disk-percent:/}%)"
- "李 {net-down:enp39s0} / {net-up:enp39s0} Mbps"
- "猪 {load-average:1} | {load-average:5} | {load-average:15}"
+ " {cpu_percent}% | {temp_c:k10temp_Tccd1}°C"
+ " {memory_used} / {memory_total} GB ({memory_percent}%)"
+ "| {swap_used} / {swap_total} GB ({swap_percent}%)"
+ " {disk_used:/} / {disk_total:/} GB ({disk_percent:/}%)"
+ "李 {net_down:enp39s0} / {net_up:enp39s0} Mbps"
+ "猪 {load_average:1} | {load_average:5} | {load_average:15}"
" {uptime}"
]
}