You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
7.0 KiB
215 lines
7.0 KiB
-- This file is part of Reno desktop.
|
|
--
|
|
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
--
|
|
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
local parsers = require("parsers")
|
|
function rprint(t,ident)
|
|
ident = ident or 0
|
|
for k,v in pairs(t) do
|
|
print((" "):rep(ident)..k,v)
|
|
if type(v) == "table" then
|
|
rprint(v,ident+4)
|
|
end
|
|
end
|
|
end
|
|
-- Conf parser
|
|
local data = [[
|
|
# Global variables
|
|
[global]
|
|
terminal = "$HOME/.local/bin/st"
|
|
browser = "prime-run librewolf"
|
|
modkey = "Mod4"
|
|
theme = "reno98"
|
|
shell = "zsh"
|
|
|
|
# Keybindings
|
|
# Format: <modifier>(+<modifier>+...)+<key> = "<command or :internal.function>"
|
|
# "modkey" as modifier will be substituted for modkey variable in [global]
|
|
[keys]
|
|
"modkey+Up" = ":root.client_next"
|
|
"modkey+Down" = ":root.client_previous"
|
|
"modkey+Control+Up" = ":root.screen_next"
|
|
"modkey+Control+Down" = ":root.screen_previous"
|
|
"modkey+Tab" = ":root.client_swap"
|
|
"modkey+Return" = ":root.spawn_terminal"
|
|
"modkey+Shift+Return" = ":root.spawn_browser"
|
|
|
|
# Client keys only work if a focused client exists
|
|
"modkey+Shift+c" = ":client.kill"
|
|
"modkey+t" = ":client.cycle_screen"
|
|
"modkey+o" = ":client.ontop"
|
|
"modkey+b" = ":client.below"
|
|
"modkey+f" = ":client.fullscreen"
|
|
"modkey+n" = ":client.minimize"
|
|
"modkey+m" = ":client.maximize"
|
|
]]
|
|
for k,v in pairs(parsers.conf(data)) do
|
|
print("Block: ["..k.."]")
|
|
for kk,vv in pairs(v) do
|
|
print(kk,vv)
|
|
end
|
|
end
|
|
|
|
-- yaml-like (pactl) parser
|
|
data = [[
|
|
Sink Input #75
|
|
Driver: PipeWire
|
|
Owner Module: n/a
|
|
Client: 58
|
|
Sink: 46
|
|
Sample Specification: float32le 2ch 44100Hz
|
|
Channel Map: front-left,front-right
|
|
Format: pcm, format.sample_format = "\"float32le\"" format.rate = "44100" format.channels = "2" format.channel_map = "\"front-left,front-right\""
|
|
Corked: no
|
|
Mute: no
|
|
Volume: front-left: 38326 / 58% / -13.98 dB, front-right: 38326 / 58% / -13.98 dB
|
|
balance 0.00
|
|
Buffer Latency: 0 usec
|
|
Sink Latency: 0 usec
|
|
Resample method: PipeWire
|
|
Properties:
|
|
client.api = "pipewire-pulse"
|
|
pulse.server.type = "unix"
|
|
application.name = "LibreWolf"
|
|
application.process.id = "1756"
|
|
application.process.user = "yessiest"
|
|
application.process.host = "architect"
|
|
application.process.binary = "librewolf"
|
|
application.language = "C.UTF-8"
|
|
window.x11.display = ":0"
|
|
application.process.machine_id = "a8099c2d12fe88c3df940ed562adbe8c"
|
|
application.process.session_id = "1"
|
|
media.name = "AudioStream"
|
|
node.rate = "1/44100"
|
|
node.latency = "3307/44100"
|
|
stream.is-live = "true"
|
|
node.name = "LibreWolf"
|
|
node.autoconnect = "true"
|
|
node.want-driver = "true"
|
|
media.class = "Stream/Output/Audio"
|
|
adapt.follower.spa-node = ""
|
|
object.register = "false"
|
|
factory.id = "6"
|
|
clock.quantum-limit = "8192"
|
|
factory.mode = "split"
|
|
audio.adapt.follower = ""
|
|
library.name = "audioconvert/libspa-audioconvert"
|
|
client.id = "56"
|
|
object.id = "57"
|
|
object.serial = "75"
|
|
pulse.attr.maxlength = "4194304"
|
|
pulse.attr.tlength = "44104"
|
|
pulse.attr.prebuf = "35296"
|
|
pulse.attr.minreq = "8816"
|
|
module-stream-restore.id = "sink-input-by-application-name:LibreWolf"
|
|
]]
|
|
rprint(parsers.yaml_pseudo(data))
|
|
-- Fast incomplete yaml parser
|
|
data = [[
|
|
Sink Input #73
|
|
Driver: PipeWire
|
|
Owner Module: n/a
|
|
Client: 58
|
|
Sink: 46
|
|
Sample Specification: float32le 2ch 44100Hz
|
|
Channel Map: front-left,front-right
|
|
Format: pcm, format.sample_format = "\"float32le\"" format.rate = "44100" format.channels = "2" format.channel_map = "\"front-left,front-right\""
|
|
Corked: no
|
|
Mute: no
|
|
Volume: front-left: 38326 / 58% / -13.98 dB, front-right: 38326 / 58% / -13.98 dB
|
|
balance 0.00
|
|
Buffer Latency: 0 usec
|
|
Sink Latency: 0 usec
|
|
Resample method: PipeWire
|
|
Properties:
|
|
client.api = "pipewire-pulse"
|
|
pulse.server.type = "unix"
|
|
application.name = "LibreWolf"
|
|
application.process.id = "1756"
|
|
application.process.user = "yessiest"
|
|
application.process.host = "architect"
|
|
application.process.binary = "librewolf"
|
|
application.language = "C.UTF-8"
|
|
window.x11.display = ":0"
|
|
application.process.machine_id = "a8099c2d12fe88c3df940ed562adbe8c"
|
|
application.process.session_id = "1"
|
|
media.name = "AudioStream"
|
|
node.rate = "1/44100"
|
|
node.latency = "3307/44100"
|
|
stream.is-live = "true"
|
|
node.name = "LibreWolf"
|
|
node.autoconnect = "true"
|
|
node.want-driver = "true"
|
|
media.class = "Stream/Output/Audio"
|
|
adapt.follower.spa-node = ""
|
|
object.register = "false"
|
|
factory.id = "6"
|
|
clock.quantum-limit = "8192"
|
|
factory.mode = "split"
|
|
audio.adapt.follower = ""
|
|
library.name = "audioconvert/libspa-audioconvert"
|
|
client.id = "56"
|
|
object.id = "57"
|
|
object.serial = "75"
|
|
pulse.attr.maxlength = "4194304"
|
|
pulse.attr.tlength = "44104"
|
|
pulse.attr.prebuf = "35296"
|
|
pulse.attr.minreq = "8816"
|
|
module-stream-restore.id = "sink-input-by-application-name:LibreWolf"
|
|
|
|
Sink Input #75
|
|
Driver: PipeWire
|
|
Owner Module: n/a
|
|
Client: 58
|
|
Sink: 46
|
|
Sample Specification: float32le 2ch 44100Hz
|
|
Channel Map: front-left,front-right
|
|
Format: pcm, format.sample_format = "\"float32le\"" format.rate = "44100" format.channels = "2" format.channel_map = "\"front-left,front-right\""
|
|
Corked: no
|
|
Mute: no
|
|
Volume: front-left: 38326 / 58% / -13.98 dB, front-right: 38326 / 58% / -13.98 dB
|
|
balance 0.00
|
|
Buffer Latency: 0 usec
|
|
Sink Latency: 0 usec
|
|
Resample method: PipeWire
|
|
Properties:
|
|
client.api = "pipewire-pulse"
|
|
pulse.server.type = "unix"
|
|
application.name = "LibreWolf"
|
|
application.process.id = "1756"
|
|
application.process.user = "yessiest"
|
|
application.process.host = "architect"
|
|
application.process.binary = "librewolf"
|
|
application.language = "C.UTF-8"
|
|
window.x11.display = ":0"
|
|
application.process.machine_id = "a8099c2d12fe88c3df940ed562adbe8c"
|
|
application.process.session_id = "1"
|
|
media.name = "AudioStream"
|
|
node.rate = "1/44100"
|
|
node.latency = "3307/44100"
|
|
stream.is-live = "true"
|
|
node.name = "LibreWolf"
|
|
node.autoconnect = "true"
|
|
node.want-driver = "true"
|
|
media.class = "Stream/Output/Audio"
|
|
adapt.follower.spa-node = ""
|
|
object.register = "false"
|
|
factory.id = "6"
|
|
clock.quantum-limit = "8192"
|
|
factory.mode = "split"
|
|
audio.adapt.follower = ""
|
|
library.name = "audioconvert/libspa-audioconvert"
|
|
client.id = "56"
|
|
object.id = "57"
|
|
object.serial = "75"
|
|
pulse.attr.maxlength = "4194304"
|
|
pulse.attr.tlength = "44104"
|
|
pulse.attr.prebuf = "35296"
|
|
pulse.attr.minreq = "8816"
|
|
module-stream-restore.id = "sink-input-by-application-name:LibreWolf"
|
|
]]
|
|
rprint(parsers.fast_split_yaml(data))
|