目录
DEAI是使Linux桌面自动化的工具。它试图将Linux系统的常见事件和界面曝光以拼写语言,以使用户能够使用事件驱动的脚本自动化任务。示例可能是随着时间的时间改变屏幕亮度,或者自动安装/卸载可移动存储。
与使用Shell脚本不同,DEAI是一个工具,而不是由不同人创建的不同命令的集合,因此更一致。使用DEAI的界面处理事件要比阅读和解析命令的文本输出要好得多。
!!!警告!!! DEAI目前处于重大发展。事情可能破裂或可能无法正常工作。如果您正在考虑为DEAI创建插件,请考虑直接为此存储库做出贡献,或等到DEAI稳定。这是因为API和DEAI的ABI均未完成。 DEAI的新更改可能会破坏您的插件。
DEAI的大部分记录在这里
这里还有一些例子。如果您需要更多信息,可以问我
udev插件)dbus插件)xorg插件)lua插件)file插件)/path/to/deai module.method arguments...可以在此处找到有关如何工作的命令线参数的更详细的解释
目前,唯一支持的脚本语言是lua,因此将在lua中给出示例。
启动程序
-- "di" is how you access deai functionality in lua
-- "di.spawn" refers to the "spawn" module
-- "run" is the method that executes program
p = di . spawn : run ({ " ls " , " -lh " })
p : on ( " stdout_line " , function ( line )
print ( " output: " , line )
end )
p : on ( " exit " , function ()
-- This tells deai to exit
di : quit ()
end )设置计时器
di . event : timer ( 10 ): on ( " elapsed " , function ()
print ( " Time flies! " )
end )更改/设置环境变量
di . os . env [ " PATH " ] = " /usr "观看文件更改
(有关所有可能的信号,请参阅此信息)
watcher = di . file : watch ({ " . " })
watcher : on ( " open " , function ( dir , filepath )
print ( dir , filepath )
end )连接到Xorg
-- Connect to Xorg is the first step to get X events
xc = di . xorg : connect ()
-- You can also use :connect_to(DISPLAY)设置XRDB
-- Assuming you have connected to X
xc . xrdb = " Xft.dpi: t 192 n "x键绑定
(有关更多信息,请参阅此信息)
-- Map ctrl-a
xc . key : new ({ " ctrl " }, " a " , true ): on ( " pressed " , function ()
-- do something
end )通知新输入设备
xc . xinput : on ( " new-device " , function ( dev )
print ( dev . type , dev . use , dev . name , dev . id )
-- do something about the device
end )更改输入设备属性
(有关更多信息,请参阅此信息)
-- Assuming you get a dev from an "new-device" event
if dev . type == " touchpad " then
-- For property names, see libinput(4)
dev . props [ " libinput Tapping Enabled " ] = { 1 }
end
if dev . name == " <<<Some touchscreen device name here>>> " then
-- Map your touchscreen to an output, if you use multiple
-- monitors, you will understand the problem.
M = compute_transformation_matrix ( touchscreen_output )
dev . props [ " Coordinate Transformation Matrix " ] = M
end在更改解决方案或连接新监视器时获得通知,等等。
(有关更多信息,请参阅此信息)
-- Note: RandR support is not quite done
xc . randr : on ( " view-change " , function ( v )
-- A "view" is a rectangular section of the X screen
-- Each output (or monitor) is connected to one view
for _ , o in pairs ( v . outputs ) do
-- But each view might be used by multiple outputs
print ( o . name )
end
end )调整背光
for _ , o in pairs ( xc . randr . outputs ) do
-- Backlight must be set with an integer, math.floor is required here
o . backlight = math.floor ( o . max_backlight / 2 )
end DBUS支持:现在,许多接口都通过DBU曝光,例如udisks来管理可移动存储空间,启动电源管理。因此,显然DBUS支持是必须的。
音频:通过ALSA或Pulseaudio支持调整量等。
网络:支持网络事件并对它们做出反应。例如,切换到打开的WiFi后自动连接到VPN。
电源管理:对电源状况变化的反应等。
UI组件:允许您创建托盘图标,菜单等。因此,您可以使用GUI与DEAI进行交互。
更多语言:支持每个人喜欢的脚本语言!
还有更多...如果您想要一些东西,那就打开一个问题。