This looks familiar, I think I started out with something similar and
decided it didn't work. It might just be the "toggle=False" when calling
cmd_toscreen() that causes things to not work as expected for you.
Overall I agree that this should be easier to achieve; maybe setting
focus_on_window_activation to "focus" is indeed bugged, as I would expect
exactly this behaviour after reading the documentation. Might be worth
opening an issue, if there isn't already one.
On Tuesday, 9 June 2020 03:00:19 UTC+2, Marco Obaid wrote:
>
>
> That did it ! I was hoping this would be natively supported, as it makes
> lots of sense, when "Group Matches" feature is used.
>
> We had a custom hook written for our users (code below), but it started
> behving strangely when we upgraded to v0.15.1. For example, whenever a rule
> is matched, the focus shifts to the previously focused screen. When we
> downgrade to v0.14.2, it works as expected. The example below does not use
> Qtile Group Matches. The rules are defined in the funtion, obviously. If
> anyone can spot what causes v0.15.1 to act differently than v0.14.2, it
> would be greatly appreciated.
>
> However, we will switch to your hook as it is clearner and Group Matches
> is a native feature of Qtile.
>
> @hook.subscribe.client_new
>
> def apptogroup(client):
>
> d = {}
>
> #########################################################
>
> ################ assgin apps to groups ##################
>
> #########################################################
>
> d[group_names[0]] = ["vivaldi-stable", "vivaldi-snapshot", "Navigator", ]
>
> d[group_names[1]] = ["subl3", "atom", ]
>
> d[group_names[2]] = ["termite","urxvt", ]
>
> d[group_names[3]] = ["org.gnome.meld", ]
>
> d[group_names[4]] = ["", ]
>
> d[group_names[5]] = ["", ]
>
> d[group_names[6]] = ["VirtualBox Manager", "VirtualBox Machine", ]
>
> d[group_names[7]] = ["thunar", "Thunar", ]
>
> d[group_names[8]] = ["pragha", ]
>
> d[group_names[9]] = ["discord", "telegram-desktop", ]
>
> ##########################################################
>
> wm_class = client.window.get_wm_class()[0]
>
>
> for i in range(len(d)):
>
> if wm_class in list(d.values())[i]:
>
> group = list(d.keys())[i]
>
> client.togroup(group)
>
> client.group.cmd_toscreen()
>
>
>
> On Sun, 2020-06-07 at 22:29 -0700, tcld wrote:
>
> I am honestly not sure if there is an easier, cleaner way to achieve what
> you are after, but I am doing this manually using the following hook.
> "focus_on_window_activation" is set to "smart":
>
> @hook.subscribe.client_new
> def modify_window(client):
> if (client.window.get_wm_transient_for() or client.window.get_wm_type() in
> floating_types):
> client.floating = True
>
> for group in groups: # follow on auto-move
> match = next((m for m in group.matches if m.compare(client)), None)
> if match:
> targetgroup = client.qtile.groups_map[group.name] # there can be multiple
> instances of a group
> targetgroup.cmd_toscreen(toggle=False)
> break
>
> The first two lines in that function only serve to take care of floating
> windows, you might already have that taken care of somewhere. My groups are
> publicly available in a list.
> From my experience this works perfectly; you could even exempt certain
> groups (or windows, although that would be a little uglier) from moving
> focus to automatically.
>
>
>
> On Monday, 8 June 2020 02:06:53 UTC+2, Marco Obaid wrote:
>
> Guillaume, do you or the DEV team have a suggestion on how to overcome
> this problem? We release a Qtile ISO for our Arcolinux users and our users
> have been asking for this functionality. Thanks
>
> On Fri, May 29, 2020 at 1:43 PM Marco Obaid <[email protected]> wrote:
>
> I tested this on 0.15.1 and 0.14.2 with the same result stated below.
>
> On Fri, May 29, 2020 at 1:40 PM Guillaume Gelin <[email protected]> wrote:
>
> What version / commit of Qtile are you using?
>
> Le ven. 29 mai 2020 à 20:38, Marco Obaid <[email protected]> a écrit :
>
> I am trying to assign specific applications to open only in
> specific groups. Reading the documentation, I came across "Group Matches".
> I defined it in my config.py as stated below. For the most part it is
> working well. The application defined in the example below do open only in
> their assigned group. The only issue that I am trying to overcome is that
> "focus" does not automatically shift to the targeted group when I launch an
> application that is defined in the Match list below. For example, if I am
> in group 1 and launch Termite, which is assigned group 3. Termite WILL
> open in group 3, however, I have to switch the group manually from 1 to 3
> to start using Termite. The odd thing is that this is not happening to
> Sublime Text. If I am in any group, other than group 2 (defined for
> Sublime), two things will happen: 1) Sublime Text will open in group 2,
> AND, the focus is shifted to group 2 (which is the desired behavior). I
> have played around with "focus_on_window_activation" but it did not make a
> difference (value of "focus" seems to be the best settings).
>
> Any suggestion? Is this a possible bug?
>
> group_matches = [
> #Group 1
> [Match(wm_class=["vivaldi-stable", "Vivaldi-stable", ])],
> #Group 2
> [Match(wm_class=["subl3", "Subl3", ])],
> #Group 3
> [Match(wm_class=["termite", "Termite", "urxvt", "URxvt", ])],
> #Group 4
> None, #[Match(wm_class=["Firefox", "firefox", "Navigator", ])],
> #Group 5
> None,
> #Group 6
> [Match(wm_class=["pragha", "Pragha", ])],
> #Group 7
> [Match(wm_class=["VirtualBox Manager", ])],
> #Group 8
> [Match(wm_class=["thunar", "Thunar", ])],
> #Group 9
> None,
> #Group 0
> [Match(wm_class=["discord", ])],
> ]
>
> for i in range(len(group_names)):
> groups.append(
> Group(
> name=group_names[i],
> layout=group_layouts[i].lower(),
> label=group_labels[i],
> matches=group_matches[i],
> exclusive=group_exclusives[i],
> persist=group_persists[i],
> init=group_inits[i],
> #####spawn=group_spawns,
> ))
>
> .
> .
> .
>
> focus_on_window_activation = "focus" # or smart
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "qtile-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qtile-dev/CABZGO-qhDX3O19J8fsTwX9mRgf64vLRW4DFx64caZxOBrabjcQ%40mail.gmail.com
>
> <https://groups.google.com/d/msgid/qtile-dev/CABZGO-qhDX3O19J8fsTwX9mRgf64vLRW4DFx64caZxOBrabjcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
>
> --
> Guillaume Gelin
> --
> You received this message because you are subscribed to the Google Groups
> "qtile-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Boc3iRvu-9%2B%2BVm5LrWzcA-LWiV1qQO6nNmTvaRfZdw2sQ%40mail.gmail.com
>
> <https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Boc3iRvu-9%2B%2BVm5LrWzcA-LWiV1qQO6nNmTvaRfZdw2sQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
--
You received this message because you are subscribed to the Google Groups
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/qtile-dev/c53bbc1c-a8d2-46d4-b971-d22657ec30f2o%40googlegroups.com.