And*_*eno 4 openbox window-management lxde wmctrl
是否可以使用wmctrl
或其他方式使特定窗口自动显示在所有桌面上?
我使用Prime Player Google Play Music miniplayer Chrome 扩展来控制音乐播放。我已经有了一个 bash 别名,我可以调用它使迷你播放器停留在其他窗口的顶部,但我还想让它把迷你播放器窗口发送到所有桌面,这样我就不必右键单击并选择发送到桌面?所有桌面(通过 openbox)。
理想情况下,我会让一个脚本在后台运行一些东西,一旦它检测到迷你播放器窗口,它就会把它放在最上面并发送到所有桌面。这可能吗?
您实际上可以在没有第三方脚本的情况下执行此操作。Openbox 支持广泛的每个应用程序设置。
创建特定于应用程序的规则
应用程序规则与不同的属性相匹配,例如窗口名称、类、角色或标题。可以通过运行为特定窗口获取这些属性中的大多数
obxprop | grep "^_OB_APP"
Run Code Online (Sandbox Code Playgroud)
并单击有问题的窗口。
查看您计划如何为 Chrome 扩展程序窗口指定规则,您可能希望提供尽可能多的匹配属性,以使规则尽可能具体。您不希望它适用于所有 Chrome 窗口。尝试不同的匹配属性,看看哪种最适合您。
定义匹配窗口后,您可以设置专门应用于相关窗口/应用程序的不同属性。这是rc.xml
描述所有可用属性的默认值的摘录:
# each rule element can be left out or set to 'default' to specify to not
# change that attribute of the window
<decor>yes</decor>
# enable or disable window decorations
<shade>no</shade>
# make the window shaded when it appears, or not
<position force="no">
# the position is only used if both an x and y coordinate are provided
# (and not set to 'default')
# when force is "yes", then the window will be placed here even if it
# says you want it placed elsewhere. this is to override buggy
# applications who refuse to behave
<x>center</x>
# a number like 50, or 'center' to center on screen. use a negative number
# to start from the right (or bottom for <y>), ie -50 is 50 pixels from
# the right edge (or bottom). use 'default' to specify using value
# provided by the application, or chosen by openbox, instead.
<y>200</y>
<monitor>1</monitor>
# specifies the monitor in a xinerama setup.
# 1 is the first head, or 'mouse' for wherever the mouse is
</position>
<size>
# the size to make the window.
<width>20</width>
# a number like 20, or 'default' to use the size given by the application.
# you can use fractions such as 1/2 or percentages such as 75% in which
# case the value is relative to the size of the monitor that the window
# appears on.
<height>30%</height>
</size>
<focus>yes</focus>
# if the window should try be given focus when it appears. if this is set
# to yes it doesn't guarantee the window will be given focus. some
# restrictions may apply, but Openbox will try to
<desktop>1</desktop>
# 1 is the first desktop, 'all' for all desktops
<layer>normal</layer>
# 'above', 'normal', or 'below'
<iconic>no</iconic>
# make the window iconified when it appears, or not
<skip_pager>no</skip_pager>
# asks to not be shown in pagers
<skip_taskbar>no</skip_taskbar>
# asks to not be shown in taskbars. window cycling actions will also
# skip past such windows
<fullscreen>yes</fullscreen>
# make the window in fullscreen mode when it appears
<maximized>true</maximized>
# 'Horizontal', 'Vertical' or boolean (yes/no)
Run Code Online (Sandbox Code Playgroud)
在您的特定情况下,您将有兴趣指定应用程序的layer
和desktop
。下面是一个规则示例,该规则将指定特定应用程序的所有窗口始终位于所有可用桌面的顶部并无所不在:
<application name="miniplayer" class="miniplayer" type="normal">
<layer>above</layer>
<desktop>all</desktop>
</application>
Run Code Online (Sandbox Code Playgroud)
我为这个例子选择了一个任意的应用程序名称和类。如前所述,您必须确保为您的特定应用找到正确的值。
编辑:我查看了您的特定应用程序并提出了适用于我的系统的规则:
<application name="crx_npngaakpdgeaajbnidkkginekmnaejbi" class="Google-chrome" type="normal" role="pop-up">
<layer>above</layer>
<desktop>all</desktop>
</application>
Run Code Online (Sandbox Code Playgroud)
我希望这也适用于你。
修改您的 openbox 配置以添加特定于应用程序的规则
要添加应用程序规则,请打开您的 openbox rc.xml
(在~/.config/openbox/rc.xml
stock openbox 或~/.config/openbox/lxde-rc.xml
LXDE下找到)并导航到<applications>
文件末尾的部分。
在<applications>..</applications>
标签之间插入您的应用程序特定规则。然后保存文件并通过执行以下命令继续重新加载配置:
openbox --reconfigure
Run Code Online (Sandbox Code Playgroud)
应用程序特定规则应在此之后生效,并将自动应用于新生成的窗口。