Skip to content

Commit

Permalink
config update
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCrion committed May 14, 2021
1 parent c662fa2 commit 2acba3b
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 35 deletions.
179 changes: 179 additions & 0 deletions config/oneline.config
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;}"
}
}
}
}

41 changes: 6 additions & 35 deletions config/sfwbar.config
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ layout {
# add a pager
pager {
type = pager
preview = true
preview = true;
rows = 2
pins = ["1","2","3","4"]
}
Expand Down Expand Up @@ -201,48 +201,19 @@ layout {
Weather {
type = grid
style = frame
css = "* { -GtkWidget-direction: bottom; }"
children {
Temp {
type = label
freq = 300000
css = "label { font: 20px Sans; font-weight: 700; min-width: 84px; padding-top: 1px; padding-bottom: 2px; -GtkWidget-align: 0.5;}"
css = "* { font: 18px Sans; font-weight: 700; min-width: 84px; padding-top: 2px; -GtkWidget-align: 0.5;}"
value = "$WthrTemp"
x = 1, y = 1, w = 4, h = 1
}
Cond {
type = label
freq = 300000
css = "label { -GtkWidget-align: 0.5; }"
value = "$WthrCond"
x = 1, y = 2, w = 4, h = 1
}
WindLabel {
type = label
freq = 300000
css = " label { min-width: 10px; }"
value = "'W:'"
x = 1, y = 3
}
Wind {
type = label
freq = 300000
css = " label { min-width: 25px;}"
value = "$WthrWind"
x = 2, y = 3
}
PressLabel {
type = label
freq = 300000
css = " label { min-width: 10px;}"
value = "'P:'"
x= 3, y = 3
}
Pressure {
type = label
type = image
freq = 300000
css = " label { min-width: 25px;}"
value = "$WthrPrss"
x = 4, y = 3
css = "* { -GtkWidget-icon-size: 28;}"
value = "'/usr/share/sfwbar/icons/weather/'+$WthrCond+'.svg'"
}
}
}
Expand Down

0 comments on commit 2acba3b

Please sign in to comment.