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

Code style cleanup, support for window stealing, support for right-click for settings #300

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

tliron
Copy link
Contributor

@tliron tliron commented Mar 27, 2016

This seems like a very massive pull request, but that's only because of the code-style cleanup. :) Actually, the change is just adding one file and a few smaller interventions.

Cleanup involved:

  • Using more and smaller JS files, organized by "feature" (to be more like the Shell's codebase).
  • Standardizing on one specific JS style (there were many different styles before: different use of spaces, indents; sometimes single line blocks had brackets and sometimes not; different styles of comments; different standards for camel-case; various conventions for GObject class names; and more).

Window stealing feature:

IMPORTANT: Let me say that I'll be happy to continue supporting this feature. And actually generally help you fix bugs in Dash to Dock, now that I know the codebase well. I'm not just dumping a feature on you, I really want to collaborate and help. :)

  • The feature is disabled by default, but users can enable it in prefs, in the "behavior" pane.
  • When enabled: an extra "Window Stealing" entry is added to the app icon popup menu. It entry will open a simple configuration dialog box that lets you enter a list of WM_CLASS names (or leave empty to remove stealing).
  • Once set, those windows will now be "stolen" by this icon -- the icon show in the active style if any of these windows are open, and will have the correct number of dots. Click to minimize/maximize will also take these windows into consideration. Relatedly, the extra running app icons will not appear for those windows.
  • Known bug: if you de-configure window stealing for an icon, the icon will immediately stop stealing, but the extra running icons for those windows will not reappear until restarting the Shell. This is rather hard to solve, and is also special edge case that would likely only appear during testing, so I don't think it should affect releasing the feature.
  • Another tiny bug: window minimizing/maximizing animations originate at the location of the now-invisible stolen app icon on the dash, rather than the stealing one. This doesn't affect usability, of course, but is something I will try to improve.

The code is all in windows.js, however it also affects some code in dash.js and icons.js. Specifically, instead of calling app.get_windows, we are now calling Windows.getAllWindows which knows how to handle window stealing (if enabled). We are additionally adding some simple hooks to setting changes to make sure to refresh the icons.

Right-click for settings:

This adds to ability to right-click anywhere on the dash (outside the icons) and get a simple popup menu that lets you run the settings. This is very useful for users who don't have the applications icon enabled (otherwise they have no easy way to get to settings).

The code is in dash.js line 81. Very straightforward!

@micheleg
Copy link
Owner

Thanks. I wanted to try it, and I noticed that you didn't update the Makefile. Just list the required files, changing those you renamed and adding the additional ones in the EXTRA_MODULES variable, to start. That should be enough.

@tliron
Copy link
Contributor Author

tliron commented Mar 27, 2016

Oops, you're right. :/

@tliron
Copy link
Contributor Author

tliron commented Mar 28, 2016

Fixed.

@tliron
Copy link
Contributor Author

tliron commented Apr 3, 2016

I see that you just made some major changes! I'd be happy to do the work to merge them into my pull request, but I want to make sure you actually have interest in it. I do think it really does a lot to clean up your codebase and make it friendlier to contributors.

@micheleg
Copy link
Owner

micheleg commented Apr 3, 2016

Hi,

I just fix the inevitable bug after the latest release, no major changes, nor any is planned to land soon. I've just had the time to run your version (Settings.ui is still missing in the Makefile by the way). I'm looking right now to your changes, but it will take me some time. Although merging the few changes should be trivial, there's no need for you to do it right now.

Regarding your changes, the first impact with the "windows stealing" functionality has been "now what do I write here? What's a the WM_CLASS...", while I'm not able to access the settings right clicking on the dash.

Michele

convenience.js Outdated
const Gettext = imports.gettext;
const Gio = imports.gi.Gio;
const Clutter = imports.gi.Clutter;
Copy link
Owner

Choose a reason for hiding this comment

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

Should be before (in alphabetic order).

@micheleg
Copy link
Owner

micheleg commented Apr 3, 2016

At the moment I'm trying to split the code reorganization (which once refined I want to merge as soon as possible) from the additional features (which might require more thinking). This will also help backporting to previous gnome shell versions.

The code really required some clean up and a better consistency: very nice work. Out of curiosity, did you use any tool to enforce a specific code style?

@tliron
Copy link
Contributor Author

tliron commented Apr 3, 2016

Hey, I see that you are commenting on actually an older version ... I might various fixes since then, please check my latest master. Not sure if github is having a bug here...

I did all the code style by hand because I didn't want to mess anything up with an automatic tool. It was a lot of work. :/

The question about how window stealing works: you can use the xprop WM_CLASS to find out the class of a window and experiment with that. Ideally I would want that incorporated into the dialog, but that's more work for the future.

For example, if you are say launching Minecraft with a shell script, then you need to steal the resulting window, otherwise you get a mess on your dock. For the latest version of Minecraft the WM_CLASS is "Minecraft 1.9". I've also tested it with running remote applications using ssh -X.

@micheleg
Copy link
Owner

micheleg commented Apr 5, 2016

Hi,

A quick update: I think I have condensed your style and reorganization changes (included your latest ones) in this commit 6a651a7, isolating the changes related to additional features in the following commits.

I still have to double check I haven't left dirt around and that there are not major unwanted changes left, and consider few other style changes. After that this will be merged into master (after proper rebase) and I will look at your additional features in more detail.

@tliron
Copy link
Contributor Author

tliron commented Apr 5, 2016

Looks good! I guess I should have done it this way, too, but the way it happened was that working on one thing turned into another...

intellihide.js Outdated
this._topApp = this._tracker.get_window_app(topWindow);
// If there isn't a focused app, use that of the window on top
this._focusApp = this._tracker.focus_app || this._topApp

windows = windows.filter(this._intellihideFilterInteresting, this);

for(let i=0; i< windows.length; i++) {

for (let i in windows.length) {
Copy link
Owner

Choose a reason for hiding this comment

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

It tool me a while to find the source of a bug: can you confirm that this is unintended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, unintended! Oops, I really did not intend to change any code. Probably it was a bad copy/paste. I apologize for wasting your time trying to find the bug. :/

Copy link
Owner

Choose a reason for hiding this comment

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

No problem. The reason It's taking a while to merge the changes is that I'm trying to to be sure to not introduce bugs with these huge commits, as it will be very difficult to spot the difference in the future.

@micheleg
Copy link
Owner

Sorry if it's taking me a long time to merge, I haven't had much time lately.

@tliron
Copy link
Contributor Author

tliron commented Apr 17, 2016

There is no rush at all. :) Please note that I made some more small fixes to master. Basically, anything that you want to fix just let me know and I can do that, so that in the end you can just push "merge" and have it done.

@micheleg
Copy link
Owner

I've merged into master the first big code refactoring commit [f9b4bab]. I'm confident everything is consistent and there are no bugs! I know I will be proven wrong, but I don't want to leave it unused for too long or it will be lost. Thanks again for the great work. Additional changes will follow.

@tliron
Copy link
Contributor Author

tliron commented May 12, 2016

Terrific! I'm traveling now but will double check next week.
On May 12, 2016 01:25, "Michele" notifications@github.com wrote:

I've merged into master the first big code refactoring commit [f9b4bab
https://github.com/micheleg/dash-to-dock/commit/f9b4bab12b67179fbdd325b1822dfbdd7392a576].
I'm confident everything is consistent and there are no bugs! I know I will
be proven wrong, but I don't want to leave it unused for too long or it
will be lost. Thanks again for the great work. Additional changes will
follow.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#300 (comment)

@tliron
Copy link
Contributor Author

tliron commented Mar 24, 2017

Well, it's been a long time since I touched this. But I wonder if you're still interested at all in this feature? Right now there are various launchers that don't behave properly in the dock: you launch them with one icon, and they create new icons for every window. I don't think it's hard to find a solution by gathering all such windows by their window name. As it stands, this is a glaring bug in otherwise terrific software.

If you want to see an example of such a launcher, try installing the itch.io client. Add itch.io to your favorites, and you'll see that when you launch it, it creates a new icon.

@micheleg
Copy link
Owner

Hi @tliron,

sorry for the late reply and thanks for pinging on this issue. I understand the problem and also experience similar issues on a daily basis with windows not being grouped correctly.

I'm not quite sure if this is the solution to the problem, but then, what else can we do at the extension level? I'm wondering if we should just have a simple interface and some documentation for it. At the moment the GUI is nice up to the point it asks for the windows classes, which most people -- me included -- have no idea how to easily obtain. A nice user-friendly interface would probably require way too much effort, but it could be considered together with issue #445, as a general way to workaround this and other windows management bugs.

I don't have much time to dedicate to this issue now, so I can't make promises. I would appreciate if you could just isolate your patches and possibly rebase on master so that in future it will make it easier for me to go back and work on it (right now they still mixed with your work on code clean up).

@tliron
Copy link
Contributor Author

tliron commented Mar 30, 2017

Sounds good. OK, so I think it should be separated into two PRs:

  1. One PR that implements the feature without a GUI. To enable/test it you'll need to edit the gsettings directly.
  2. Assuming everything works with that, we can move to a second PR that adds a nice GUI.

@micheleg
Copy link
Owner

That would be ideal, thank you.

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.

2 participants