使用 Devilspie 2 在 Ubuntu 上编写脚本窗口操作使用 Devilspie 2 在 Ubuntu 上编写脚本窗口操作使用 Devilspie 2 在 Ubuntu 上编写脚本窗口操作使用 Devilspie 2 在 Ubuntu 上编写脚本窗口操作
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

使用 Devilspie 2 在 Ubuntu 上编写脚本窗口操作

在此页

  1. 什么是 LUA?

  1. 示例脚本。
  2. 脚本命令。

Devilspie2 是一个在创建窗口时检测窗口并对其执行脚本操作的程序。这些脚本是用 LUA 编写的,允许进行大量定制。本教程将向您展示 Devilspie 2 在 Ubuntu 14.04 上的安装,并向您介绍 Devilspie 脚本。

什么是 LUA?

Lua 是一种功能强大、快速、轻量级、可嵌入的脚本语言。 Lua 将简单的过程语法与基于关联数组和可扩展语义的强大数据描述结构相结合。 Lua 是动态类型的,通过为基于寄存器的虚拟机解释字节码来运行,并具有自动内存管理和增量垃圾收集,使其成为配置、脚本和快速原型制作的理想选择。

有关更多信息,请访问: http://www.lua.org/

安装。

输入以下内容:

sudo apt-get install devilspie2

(确保它是 devilspie2,因为 devilspie 有点乱,不再开发了。)

不幸的是,Devilspie 2 不再支持原版 Devils Pie 的规则。

配置和脚本。

示例脚本。

the debug_print command does only print anything to stdout 
-- if devilspie2 is run using the --debug option

debug_print("Window Name: "..	get_window_name());
debug_print("Application name: "..get_application_name())

I want my Xfce4-terminal to the right on the second screen of my two-monitor 
setup,

if (get_window_name()=="Terminal") then
	-- x,y, xsize, ysize
	set_window_geometry(1600,300,900,700);
end

Make Iceweasel always start maximized.

if (get_application_name()=="Iceweasel") then
	maximize();
end

要了解有关脚本语言的更多信息,请访问以下内容:

See FAQ at

www.lua.org/FAQ.html 

Documentation at

www.lua.org/docs.html 

Tutorials at 

http://lua-users.org/wiki/TutorialDirectory
	

脚本命令。

get_window_name()
返回包含当前窗口名称的字符串。

get_application_name()
返回当前窗口的应用程序名称window.

set_window_position(xpos, ypos)
设置窗口的位置。

set_window_size(xsize, ysize)
设置窗口的大小。

set_window_geometry(xpos, ypos, xsize ysize)
设置窗口的几何形状。

make_always_on_top()
设置窗口始终在顶部标记。

set_on_top()
将窗口设置在其他窗口之上(但这不会将窗口锁定在该位置)。

debug_print()
将字符串打印到标准输出的调试助手。仅当使用 --debug 选项运行 devilspie2 时才会打印。

shade()
\Shades\ 窗口,仅显示标题栏。< br>
unshade()
取消窗口阴影 - 与“阴影”相反

maximize()
最大化窗口

unmaximize()
取消最大化窗口

maximize_vertically()
垂直最大化当前窗口。< br>
maximize_horisontally()
水平最大化当前窗口。

minimize()
最小化窗口
< br> unminimize()
取消最小化一个窗口,即将它从最小化的位置/大小带回屏幕。

decorate_window()< br> 显示所有窗口装饰。

undecorate_window()
删除所有窗口装饰。

set_window_workspace(number)
将窗口移动到另一个工作区。 number 变量从 1 开始计数。

change_workspace(number)
将当前工作区更改为另一个。数字变量从 1 开始计数。

pin_window()
要求窗口管理器将窗口放在所有工作区上。

unpin_window( )
要求窗口管理器仅将窗口放在当前活动的工作区中。

stick_window()
要求窗口管理器保持窗口位置固定在屏幕上,即使工作区或视口滚动。

unstick_window()
当工作区或视口滚动时,要求窗口管理器不要将窗口位置固定在屏幕上scrolls.

devilspie2 教程到此结束。

链接

  • 鬼侦探2

©2015-2025 艾丽卡 support@alaica.com