-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
185 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
# Placement configuration, add placement section if you want SFWBar to handle | ||
# window placement. xcascade and ycascade paramters define a step to offset | ||
# a new window location by. They are specified as a percent of desktop size. | ||
|
||
placement { | ||
xcascade = 5 # step by 5% of desktop horizontally | ||
ycascade = 5 # step by 5% of desktop vertically | ||
xorigin = 5 | ||
yorigin = 5 | ||
children = false | ||
} | ||
|
||
# Task Switcher | ||
|
||
switcher { | ||
delay = 7 | ||
title = false | ||
columns = 5 | ||
css = "* { -GtkWidget-icon-size: 48; }" # set icon size | ||
} | ||
|
||
# Scanner defines the variables to be extracted from system files | ||
|
||
scanner { | ||
|
||
# Add up received and transmitted bytes cross all enp* interfaces | ||
"/proc/net/dev" { | ||
flags = "NoGlob" | ||
EthRcvd.add = "enp.*:[\t ]*([0-9]+)" | ||
EthSent.add = "enp.*:(?:[\t ]*[0-9]+){8}[\t ]([0-9]+)" | ||
} | ||
|
||
# Extract memory usage information | ||
"/proc/meminfo" { | ||
MemTotal. = "^MemTotal:[\t ]*([0-9]+)[\t ]" | ||
MemFree.= "^MemFree:[\t ]*([0-9]+)[\t ]" | ||
MemCache.= "^Cached:[\t ]*([0-9]+)[\t ]" | ||
MemBuff.= "^Buffers:[\t ]*([0-9]+)[\t ]" | ||
} | ||
|
||
# Add up total and used swap capacity across all partitions | ||
"/proc/swaps" { | ||
SwapTotal.add = "[\t ]([0-9]+)" | ||
SwapUsed.add = "[\t ][0-9]+[\t ]([0-9]+)" | ||
} | ||
|
||
# Add up CPU utilization stats across all CPUs | ||
"/proc/stat" { | ||
CpuUser.add = "^cpu [\\t ]*([0-9]+)","flag" | ||
CpuNice.add = "^cpu [\\t ]*[0-9]+ ([0-9]+)" | ||
CpuSystem.add = "^cpu [\\t ]*[0-9]+ [0-9]+ ([0-9]+)" | ||
CpuIdle.add = "^cpu [\\t ]*[0-9]+ [0-9]+ [0-9]+ ([0-9]+)" | ||
} | ||
|
||
# Poll motherboard temperature | ||
"/sys/class/hwmon/hwmon2/temp1_input" { | ||
MBTemp.= "([0-9]+)" | ||
} | ||
|
||
# Poll CPU temperature | ||
"/sys/class/hwmon/hwmon1/temp1_input" { | ||
CPUTemp.= "([0-9]+)" | ||
} | ||
|
||
# Poll CPU fan rpm | ||
"/sys/devices/platform/it87*/hwmon/hwmon2/fan2_input" { | ||
CPUFan.= "([0-9]+)" | ||
} | ||
|
||
# Poll MB fan rpm | ||
"/sys/devices/platform/it87*/hwmon/hwmon2/fan1_input" { | ||
MBFan.= "([0-9]+)" | ||
} | ||
|
||
# Parse yr.no weather forecast | ||
"wget -O - \"https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=51.8711&lon=0.1587\"" { | ||
WthrTemp = "\"timeseries\".*\"air_temperature\":([0-9\\.]*)" | ||
WthrPrss.= "\"timeseries\".*\"air_pressure_at_sea_level\":([0-9\\.]*)" | ||
WthrWind = "\"timeseries\".*\"wind_speed\":([0-9\\.]*)" | ||
WthrCond = "\"timeseries\".*\"symbol_code\":\"([A-Za-z_]*)\"" | ||
} | ||
} | ||
|
||
# Panel layout | ||
|
||
layout { | ||
|
||
# add a taskbar | ||
taskbar { | ||
type = taskbar | ||
css = "* { -GtkWidget-hexpand: true; -GtkWidget-icon-size: 16; }" # take up empty space, set icon size | ||
icon = true # display icons | ||
title = true # display titles | ||
rows = 1 # stack window buttons across two rows | ||
} | ||
|
||
# Uncomment this section if you would like to put widgets on the left and right | ||
# edges of the taskbar with empty space in the middle. | ||
# spacer { | ||
# type = label | ||
# } | ||
|
||
# add a pager | ||
pager { | ||
type = pager | ||
preview = true; | ||
rows = 1 | ||
pins = ["1","2","3","4"] | ||
} | ||
|
||
# add a launcher | ||
button1 { | ||
type = button | ||
action = "firefox" # launch firefox on click | ||
icon = "firefox" # set icon on the button | ||
css = "* { -GtkWidget-icon-size: 18px; min-height: 1px; }" # set icon size | ||
} | ||
button2 { | ||
type = button | ||
action = "alacritty" | ||
icon = "Alacritty" | ||
css = "* { -GtkWidget-icon-size: 18px; min-height: 1px; }" | ||
} | ||
|
||
# add a sub-grid to house scales | ||
pbars { | ||
type = grid | ||
children { | ||
# add a scale to display CPU utilization | ||
Cpu { | ||
type = scale | ||
css = "progressbar progress { background-color: #0000ff; -GtkWidget-Direction: right; }" | ||
value = "(CpuUser-CpuUser.pval)/(CpuUser+CpuNice+CpuSystem+CpuIdle-CpuUser.pval-CpuNice.pval-CpuSystem.pval-CpuIdle.pval)" | ||
} | ||
Mem { | ||
type = scale | ||
css = "progressbar progress { background-color: #00ff00; -GtkWidget-Direction: right; }" | ||
value= "(MemTotal-MemFree-MemCache-MemBuff)/MemTotal" | ||
} | ||
} | ||
} | ||
Weather { | ||
type = grid | ||
style = frame | ||
css = "* { -GtkWidget-direction: right; }" | ||
children { | ||
Temp { | ||
type = label | ||
freq = 300000 | ||
css = "* { font: Sans 18px; font-weight: 700; padding: 2px; padding-right: 10px; -GtkWidget-align: 0.5;}" | ||
value = "$WthrTemp" | ||
} | ||
Cond { | ||
type = image | ||
freq = 300000 | ||
css = "* { -GtkWidget-icon-size: 24;}" | ||
value = "'/usr/share/sfwbar/icons/weather/'+$WthrCond+'.svg'" | ||
} | ||
} | ||
} | ||
Clock { | ||
type = grid | ||
style = "frame", | ||
css = "* { -GtkWidget-direction: right; }" | ||
children { | ||
Time { | ||
type = label | ||
css = "* { font: Sans 18px; font-weight: 700; padding: 2px; padding-left: 10px; padding-right: 10px; -GtkWidget-align: 0.5;}" | ||
value = "Extract(Time(),'([0-9]*:[0-9]*)')" | ||
} | ||
Date { | ||
type = label | ||
value = "Extract(Time(),'^([A-Za-z]+\\ [A-Za-z]+[\\ ]+[0-9]+)')" | ||
css = "* { font: Sans 18px; padding: 2px; padding-right: 10px; -GtkWidget-align: 0.5;}" | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters