This commit is contained in:
Cat /dev/Nulo 2022-05-25 21:34:43 -03:00
parent be2aae1729
commit 000759de26
3 changed files with 154 additions and 4 deletions

149
modules/yambar.lua Normal file
View file

@ -0,0 +1,149 @@
save_config("yambar", [[
background: &bg {{base}}ff
backgroundish: &bgish {{highlightMed}}ff
foreground: &fg {{text}}ff
accent: &accent {{pine}}ff
bar:
height: 16
location: top
layer: top
spacing: 8
right-margin: 8
background: *bg
foreground: *fg
font: sans-serif:size=12
left:
- river:
anchors:
base: &river_base
margin: 8
tag: id
default: &river_default
default: {string: {text: "{id}"}}
values: &river_values
1: {string: {text: "I"}}
2: {string: {text: "II"}}
3: {string: {text: "III"}}
4: {string: {text: "IV"}}
5: {string: {text: "V"}}
6: {string: {text: "VI"}}
7: {string: {text: "VII"}}
8: {string: {text: "VIII"}}
9: {string: {text: "IX"}}
10: {empty: {}}
11: {empty: {}}
12: {empty: {}}
13: {empty: {}}
14: {empty: {}}
15: {empty: {}}
16: {empty: {}}
17: {empty: {}}
18: {empty: {}}
19: {empty: {}}
20: {empty: {}}
21: {empty: {}}
22: {empty: {}}
23: {empty: {}}
24: {empty: {}}
25: {empty: {}}
26: {empty: {}}
27: {empty: {}}
28: {empty: {}}
29: {empty: {}}
30: {empty: {}}
31: {empty: {}}
32: {empty: {}}
content:
map:
tag: state
values:
focused:
map:
<<: *river_base
deco: {background: {color: *accent}}
values:
<<: *river_values
1: {string: {text: "I", foreground: *bg}}
2: {string: {text: "II", foreground: *bg}}
3: {string: {text: "III", foreground: *bg}}
4: {string: {text: "IV", foreground: *bg}}
5: {string: {text: "V", foreground: *bg}}
6: {string: {text: "VI", foreground: *bg}}
7: {string: {text: "VII", foreground: *bg}}
8: {string: {text: "VIII", foreground: *bg}}
9: {string: {text: "IX", foreground: *bg}}
unfocused:
map:
<<: *river_base
values:
<<: *river_values
invisible:
map:
tag: occupied
values:
true:
map:
deco: {background: {color: *bgish}}
<<: *river_base
values:
<<: *river_values
false:
map:
<<: *river_base
values:
<<: *river_values
right:
- network:
name: eth0
content:
map:
tag: carrier
default: {empty: {}}
values:
true:
map:
tag: state
values:
down: {string: {text: Ethernet down, foreground: *accent}}
up:
map:
tag: ipv4
default: {string: {text: Ethernet}}
values:
"": {string: {text: Ethernet sin IPv4, foreground: *accent}}
- network:
name: wlan0
content:
map:
tag: state
values:
down: {string: {text: WiFi down, foreground: *accent}}
up:
map:
tag: ipv4
default: {string: {text: WiFi}}
values:
"": {string: {text: WiFi sin IPv4, foreground: *accent}}
- battery:
name: BAT0
poll-interval: 30
content:
map:
tag: state
values:
discharging: {string: {text: "{capacity}%"}}
unknown: {string: {text: "{capacity}% limite"}}
not charging: {string: {text: "{capacity}% limite"}}
charging: {string: {text: "{capacity}% cargando"}}
full: {string: {text: "{capacity}% full"}}
- clock:
date-format: "%A %d of %B"
content:
- string: {text: " {date}", right-margin: 12}
- string: {text: " {time}"}
]], theme, "{{(%w+)}}")

View file

@ -25,15 +25,16 @@ theme = dofile("themes/"..theme_name..".lua")
local status = os.execute("mkdir -p ~/.cache/themer.lua/")
if not (status == 0) then return status end
function save_config(name, template, params)
function save_config(name, template, params, pattern)
local file, err = io.open(os.getenv("HOME").."/.cache/themer.lua/"..name, "w+")
if not file then expect_nil(err) end
file:write(templater(template, params))
file:write(templater(template, params, pattern))
file:close()
end
require 'modules/sway'
require 'modules/river'
require 'modules/yambar'
require 'modules/foot'
require 'modules/fnott'
require 'modules/fuzzel'

View file

@ -1,5 +1,5 @@
return function (template, params)
local content = string.gsub(template, "{(%w+)}", function (s)
return function (template, params, pattern)
local content = string.gsub(template, pattern or "{(%w+)}", function (s)
if params[s] == nil then
expect_nil("No variable "..s)
end