Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom spawn location for floating windows #4791

Open
2 tasks done
fug4r opened this issue Apr 29, 2024 · 2 comments
Open
2 tasks done

Custom spawn location for floating windows #4791

fug4r opened this issue Apr 29, 2024 · 2 comments

Comments

@fug4r
Copy link

fug4r commented Apr 29, 2024

Issue description

I have set a bunch of floating rules in my config for certain programs and this has worked fine, but I'd like to make them spawn in a specific location and can't find an option for it. It would be perfect if I could even make a global rule for all floating windows to spawn with a certain offset from the top-right corner.

Thanks for the help!

Version

0.25.1.dev0+g005da458.d20240413

Backend

X11 (default)

Config

# Layout theme and layouts
layout_theme = {
    "margin": 6,
    "border_width": 3,
    "border_focus": workspaceColor,
    "border_normal": chordColor,
}

layouts = [
    layout.MonadTall(**layout_theme),
    # layout.RatioTile(**layout_theme),
    layout.Max(**layout_theme),
]

groups.append(
    ScratchPad(
        "scratchpad",
        [
            DropDown(
                "term1", "kitty --class=scratch", width=0.8, height=0.8, x=0.1, y=0.1
            ),
            DropDown(
                "term2", "kitty --class=scratch", width=0.8, height=0.8, x=0.1, y=0.1
            ),
        ],
    )
)

keys.extend(
    [
        Key(
            [mod],
            "n",
            lazy.group["scratchpad"].dropdown_toggle("term1"),
            desc="Terminal scratchpad 1",
        ),
        Key(
            [mod],
            "m",
            lazy.group["scratchpad"].dropdown_toggle("term2"),
            desc="Terminal scratchpad 2",
        ),
    ]
)

widget_defaults = dict(
    font="JetBrainsMono Nerd Font Mono",
    fontsize=12,
    padding=3,
)
extension_defaults = widget_defaults.copy()

# Drag floating layouts.
mouse = [
    Drag(
        [mod],
        "Button1",
        lazy.window.set_position_floating(),
        start=lazy.window.get_position(),
    ),
    Drag(
        [mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()
    ),
    Click([mod], "Button2", lazy.window.bring_to_front()),
]

dgroups_key_binder = None
dgroups_app_rules = []  # type: list
follow_mouse_focus = True
bring_front_click = False
floats_kept_above = True
cursor_warp = False
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="blueman-manager"),  # blueman

        # New float rules
        Match(wm_class="HardwareSimulatorMain"),
        Match(wm_class="CPUEmulatorMain"),
        Match(wm_class="VMEmulatorMain"),
        Match(wm_class="HackAssemblerMain"),
    ],
    border_width=3,
    border_focus=workspaceColor,
    border_normal=chordColor,
)
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True


# Autorstart commands
@hook.subscribe.startup_once
def autostart():
    home = os.path.expanduser("~/.config/qtile/autostart")
    subprocess.Popen([home])

Logs

No response

Required

  • I have searched past issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
@elParaguayo
Copy link
Member

Interesting idea.

This can obviously be done with hooks (e.g. client_managed) but allowing float_rules to take Rule objects would seem reasonable too.

@fug4r
Copy link
Author

fug4r commented May 4, 2024

Alright I'll look into the hooks solution for the time being and come back here if I am still having issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants