aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/curious.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/curious.lua')
-rw-r--r--.config/awesome/curious.lua36
1 files changed, 22 insertions, 14 deletions
diff --git a/.config/awesome/curious.lua b/.config/awesome/curious.lua
index 3a0bf5d..66c33da 100644
--- a/.config/awesome/curious.lua
+++ b/.config/awesome/curious.lua
@@ -15,11 +15,11 @@ local interface = Gio.DBusInterfaceInfo {
out_args = {
Gio.DBusArgInfo {
name = "widget_tree",
- signature = "av"
- }
- }
- }
- }
+ signature = "av",
+ },
+ },
+ },
+ },
}
-- iterate with ipairs, get the length of the array, check if key value from pairs is a number lower than the length and if so, use as a dict key cause it's not gonna work with :add anyway
@@ -43,17 +43,17 @@ local function serialize(builder, t)
signature = "b"
data = v
elseif _type == "thread" or _type == "function" or (_type == "userdata" and not getmetatable(v).__tostring) then
- local address = tonumber(tostring(v):match("%a+: 0x(%w+)"), 16)
+ local address = tonumber(tostring(v):match "%a+: 0x(%w+)", 16)
signature = "(s(t))"
data = { _type, address }
elseif _type == "userdata" then
if getmetatable(v).emit_signal then -- One of the properties available on any awesome luaobject
- local _, _, content = tostring(v):match("%a+/(.*)")
+ local _, _, content = tostring(v):match "%a+/(.*)"
local stringified = tostring(v)
if content then
stringified = content
end
- local type, extra, address = stringified:match("(%a+)(.*): 0x(%w+)")
+ local type, extra, address = stringified:match "(%a+)(.*): 0x(%w+)"
if extra ~= "" then
extra:sub(2, -2)
signature = "(s(st))"
@@ -64,7 +64,7 @@ local function serialize(builder, t)
end
else
signature = "(s())"
- data = { _type, {}}
+ data = { _type, {} }
end
end
@@ -72,16 +72,16 @@ local function serialize(builder, t)
builder:add("v", GLib.Variant(signature, data))
else
print(type(signature), type(data))
- local variant = GLib.Variant("{sd}", { "test", 4})
+ local variant = GLib.Variant("{sd}", { "test", 4 })
builder:add_value(GLib.Variant("v", variant))
end
end
end
function methods.Select(parameters, invocation)
- local builder = GLib.VariantBuilder(GLib.VariantType("av"))
+ local builder = GLib.VariantBuilder(GLib.VariantType "av")
serialize(builder, { "test", some_key = "some_value" })
- local tuple_builder = GLib.VariantBuilder(GLib.VariantType("(av)"))
+ local tuple_builder = GLib.VariantBuilder(GLib.VariantType "(av)")
tuple_builder:add_value(builder:_end())
-- builder
-- invocation:return_value(GLib.Variant("(av)", { builder }))
@@ -89,7 +89,10 @@ function methods.Select(parameters, invocation)
end
local function handle_call(_, _, _, _, method, parameters, invocation)
- if not methods[method] then print("invalid"); return end
+ if not methods[method] then
+ print "invalid"
+ return
+ end
gpcall(methods[method], parameters, invocation)
end
@@ -97,4 +100,9 @@ local function acquire(connection)
connection:register_object("/com/twoexem/delta/Curious", interface, GObject.Closure(handle_call))
end
-local connection = Gio.bus_own_name(Gio.BusType.SESSION, "com.twoexem.delta.Curious", Gio.BusNameOwnerFlags.NONE, GObject.Closure(acquire))
+local connection = Gio.bus_own_name(
+ Gio.BusType.SESSION,
+ "com.twoexem.delta.Curious",
+ Gio.BusNameOwnerFlags.NONE,
+ GObject.Closure(acquire)
+)