窗口的QTile设置位置

发布于 2025-01-24 11:01:30 字数 175 浏览 0 评论 0原文

我的问题是,我想在屏幕上(浮动窗口)在屏幕上的特定X和y位置有一个特定的WM_Class产卵。

我阅读了文档,但无法找到一种方法。 我试图使用该方法:

set_position_floating()

My problem is that I want to have a specific wm_class spawn at a specific X and Y position on my screen every time it opens (Floating window).

I read the documentation, but couldn't figure out a way.
I was trying to use the method:

set_position_floating()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终难遇 2025-01-31 11:01:30

我设法以qtile做到这一点,就像我在DWM中这样做的方式一样。我将NCMPCPP放置在屏幕上,通过执行以下操作。 NCMPCPP在终端中运行,我的终端为“ ST”。因此,我将此键绑定在我的配置中放在Spawn NCMPCPP中:

Key([mod], "n", lazy.spawn("st -c float-term -g 100x25+550+300 ncmpcpp")),

我相信“ C”标志允许您为新的WM_CLASS选择一个名称。我选择了“ float-term”作为班级名称。 “ G”标志使您可以设置所需的几何形状。然后,我在我的config.py中的float_rules列表中添加了新的WM_CLASS名称:

floating_layout = layout.Floating(float_rules=[
    # Run the utility of `xprop` to see the wm class and name of an X client.
    *layout.Floating.default_float_rules,
    Match(wm_class='confirmreset'),  # gitk
    Match(wm_class='makebranch'),  # gitk
    Match(wm_class='maketag'),  # gitk
    Match(wm_class='ssh-askpass'),  # ssh-askpass
    Match(title='branchdialog'),  # gitk
    Match(title='pinentry'),  # GPG key password entry
    Match(wm_class='bomi'), #bomi player
    Match(wm_class='brave-browser-beta'), #brave browser
    Match(wm_class='gsimplecal'), #gsimplecal
    Match(wm_class='float-term'), #ncmpcpp

此方法使我可以在屏幕上催生任何位置。除了运行NCMPCPP的ST之外,我还没有尝试过任何其他程序,但是我敢肯定它会起作用。

I managed to do this in qtile the same way I did it in dwm. I placed ncmpcpp where I wanted on the screen by doing the following. Ncmpcpp runs in the terminal and my terminal is 'st'. So, I put this key binding in my config to spawn ncmpcpp:

Key([mod], "n", lazy.spawn("st -c float-term -g 100x25+550+300 ncmpcpp")),

I believe the 'c' flag allows you to choose a name for a new wm_class. I chose 'float-term' as the class name. The 'g' flag allows you to set the geometry that you want. Then, I added the new wm_class name to the float_rules list in my config.py:

floating_layout = layout.Floating(float_rules=[
    # Run the utility of `xprop` to see the wm class and name of an X client.
    *layout.Floating.default_float_rules,
    Match(wm_class='confirmreset'),  # gitk
    Match(wm_class='makebranch'),  # gitk
    Match(wm_class='maketag'),  # gitk
    Match(wm_class='ssh-askpass'),  # ssh-askpass
    Match(title='branchdialog'),  # gitk
    Match(title='pinentry'),  # GPG key password entry
    Match(wm_class='bomi'), #bomi player
    Match(wm_class='brave-browser-beta'), #brave browser
    Match(wm_class='gsimplecal'), #gsimplecal
    Match(wm_class='float-term'), #ncmpcpp

This method allowed me to spawn st any place on the screen. I have not tried this with any program other than st running ncmpcpp yet, but I'm pretty sure it would work.

暗地喜欢 2025-01-31 11:01:30

设置位置:

@subscribe.client_new 
def new_clinet(client):
    if "pavucontrol" in client.get_wm_class():
        client.set_position_floating(200,200)

防止重新定位 no_reposition_rules

floating_layout = layout.Floating(
    float_rules=[
        *layout.Floating.default_float_rules,
    ],
    no_reposition_rules=[
        Match(wm_class="pavucontrol"),
    ],
)

如果您为 pavucontrol添加匹配

Set position:

@subscribe.client_new 
def new_clinet(client):
    if "pavucontrol" in client.get_wm_class():
        client.set_position_floating(200,200)

prevent reposition to center by no_reposition_rules:

floating_layout = layout.Floating(
    float_rules=[
        *layout.Floating.default_float_rules,
    ],
    no_reposition_rules=[
        Match(wm_class="pavucontrol"),
    ],
)

if u add match for pavucontrol in float_rules then qtile will resize the window when it appears

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文