-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
executable file
·54 lines (46 loc) · 1.58 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local Dispatcher = require("dispatcher") -- luacheck:ignore
local InfoMessage = require("ui/widget/infomessage")
local UIManager = require("ui/uimanager")
local WidgetContainer = require("ui/widget/container/widgetcontainer")
local Device = require("device")
local logger = require("logger")
local commands = require("commands")
local _ = require("gettext")
local Xapp = WidgetContainer:new{
name = "kindle_start_x_app",
is_doc_only = false,
}
function Xapp:onDispatcherRegisterActions()
--Dispatcher:registerAction("startxapp_action", {category="none", event="StartXapp", title=_("Start Xapp"), general=true,})
end
function Xapp:init()
self:onDispatcherRegisterActions()
self.ui.menu:registerToMainMenu(self)
end
function Xapp:addToMainMenu(menu_items)
for key, command in pairs(commands) do
local sorting_hint = "more_tools"
if command.sorting_hint ~= nil then
sorting_hint = command.sorting_hint
end
menu_items['start_xapp_' .. key] = {
text = command.text,
sorting_hint = sorting_hint,
callback = function()
self:startXapp(command.command)
end,
}
end
end
function Xapp:startXapp(args)
require("ffi/input"):closeAll()
os.execute("killall -CONT awesome")
os.execute("LD_LIBRARY_PATH= " .. args)
os.execute("killall -STOP awesome")
if Device.touch_dev ~= nil then
Device.input.open(Device.touch_dev)
end
Device.input.open("fake_events")
UIManager:nextTick(function() UIManager:setDirty("all", "full") end)
end
return Xapp