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

Added default apps in groups #4253

Closed

Conversation

Bennett-Wendorf
Copy link

This project adds functionality to groups that allows the user to set a default application for each group, and then spawn the default app for the current group with a single key bind (such as mod+t).

Since my implementation in the qtile-examples repo wasn't clean enough for my liking, this is the more integrated version. That alternative implementation can be found here. My intention is to present both solutions, and let the maintainers decide which implementation they would prefer.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Qtile!
If you have not heard from us in a while, please feel free to ping one of the devs or anyone who has commented on the PR, as sometimes things fall through the cracks.
You can also join the chat room for real-time discussion, see the community links.
For details on what PRs might need to include before we will merge them please see the docs.

@Bennett-Wendorf
Copy link
Author

Hi, I noticed that one of the workflows is failing on this project, but it looks unrelated to what I changed, and I'm not really sure what's going on. Would someone more knowledgeable be able to take a look and help me figure out how to get the docs building correctly?

@elParaguayo
Copy link
Member

You probably need to rebase your branch onto the latest master. We fixed a bug in the workflows a few days ago.

Signed-off-by: Bennett-Wendorf <[email protected]>
@jwijenbergh
Copy link
Contributor

jwijenbergh commented May 7, 2023

Hi, thanks for the PR. I don't really like it to have this in the core unfortunately, but others might disagree.

In my config, I currently define groups and their arguments (the first arguments are unicode characters, just the group names):

group_labels = [(" ", {'layout': 'monadtall'}),
                (" ", {'layout': 'monadwide'}),
                (" ", {'layout': 'max'}),
                (" ", {'layout': 'monadtall'}),
                (" ", {'layout': 'max'}),
                (" ", {'layout': 'monadtall'}),
                (" ", {'layout': 'monadtall'})]

groups = [Group(name, **kwargs) for name, kwargs in group_labels]

To extend this for default apps I can just do

group_labels = [(" ", {'layout': 'monadtall'}, "chromium"),
                (" ", {'layout': 'monadwide'}, terminal),
                (" ", {'layout': 'max'}, None),
                (" ", {'layout': 'monadtall'}, None),
                (" ", {'layout': 'max'}, None),
                (" ", {'layout': 'monadtall'}, None),
                (" ", {'layout': 'monadtall'}, None)]
groups = []
default_apps = {}
for name, kwargs, default_app in group_labels:
   groups.append(Group(name, **kwargs))
   # here my default (default default actually haha) app is emacs
   default = default_app or "emacs"
   default_apps[name] = default

def spawn_default_app(qtile, apps):
   qtile.spawn(apps[qtile.current_group.name])

keys.append(Key([mod], "t", lazy.function(spawn_default_app, default_apps)))

This keeps it short and simple, maybe even nicer way than the qtile-examples script you provided, but that's debatable. Hope this helps!

@Bennett-Wendorf
Copy link
Author

I had tried something similar to that initially, but I found that it didn't really abstract out to a module particularly well. While I know that many Qtile users have enough experience programming to make something like this work, my hope with both pull requests was to make it as simple for the end user as possible. If you and the other maintainers think that this functionality doesn't make much sense in core, that's OK too!

@jwijenbergh
Copy link
Contributor

I had tried something similar to that initially, but I found that it didn't really abstract out to a module particularly well. While I know that many Qtile users have enough experience programming to make something like this work, my hope with both pull requests was to make it as simple for the end user as possible. If you and the other maintainers think that this functionality doesn't make much sense in core, that's OK too!

Fair enough.

What do you think about this? @elParaguayo

@elParaguayo
Copy link
Member

I don't see a need for it in the core code.

@jwijenbergh
Copy link
Contributor

Let's work towards a nice example in the qtile-examples repo then. Thanks for the PR @Bennett-Wendorf

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

Successfully merging this pull request may close these issues.

None yet

3 participants