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

Always on top powertoy #702

Closed
wants to merge 12 commits into from

Conversation

vldmr11080
Copy link
Contributor

@vldmr11080 vldmr11080 commented Nov 12, 2019

This service provides simple window management, where user can specify certain window and force it to be always on top. This can be achieved either by opening window system menu (right mouse click on window title bar) and selecting Always On Top option, or through hotkey, which can be configured in general settings for Always On Top module.

This is a PR for #13 which also referenced #49

@enricogior enricogior requested a review from bzoz November 12, 2019 20:44
@enricogior
Copy link
Contributor

@vldmr11080
I've found a problem when you first set Chrome Always On Top and then you detach/re-attach a tab and turn Always On Top on and off:

image

We can fix this after this PR is merged, I'll open the issue with better repro steps.

Copy link
Contributor

@bzoz bzoz left a comment

Choose a reason for hiding this comment

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

Generally LGTM, great work!

I've added two more suggestions.

{
ResetCurrentOnTop();
if (hotKeyHandleWindow) {
DestroyWindow(hotKeyHandleWindow);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also unregister HotkeyHandleWindow window class

virtual void disable()
{
ResetCurrentOnTop();
enabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

The hotKeyHandleWindow should be destroyed here, and the class should be unregistered.

@crutkas crutkas added this to the 0.14 milestone Nov 13, 2019
@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

@enricogior does this include the necessary changes to the installer?

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

@vldmr11080 can you add always_on_top as dependency for runner:
image

Also, Win + Alt + T is not working for me. Other combinations like Win + Alt + E work just fine though.

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

I got the menu even though it is disabled in the settings:
image

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

Got this when stopping PowerToys
image
happened during exit:
image

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

After starting always_on_top again I've got this:
image

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

Ok, even when stopped I have the "always on top" menu entry.

@enricogior
Copy link
Contributor

@bzoz good catch. we need to update the installer as well, but given we already planned to add telemetry and the icon after the first commit, we can also add the setup update later.

@enricogior
Copy link
Contributor

Also, Win + Alt + T is not working for me. Other combinations like Win + Alt + E work just fine though.

@bzoz what about, Win + Ctrl + T, does it work for you?

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

Some placement issues: from Google Hangout as a standalone app:
image
and from Windows terminal:
image

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

@enricogior Win+Ctrl+T works but is very awkward to press. Ctrl + Alt + T works better.

@bzoz
Copy link
Contributor

bzoz commented Nov 14, 2019

Looks like the crash I've found can be triggered by disabling the Always on top in the settings, then enabling it again and then exiting. It also leaves a stray system menu entry.

@enricogior
Copy link
Contributor

enricogior commented Nov 14, 2019

Ctrl + Alt + T works better.

OK!

@bzoz
Copy link
Contributor

bzoz commented Nov 15, 2019

One nit: I get 17>[...]\powertoys\src\runner\system_menu_helper.cpp(90,31): warning C4267: '=': conversion from 'size_t' to 'UINT', possible loss of data while compiling.

@bzoz
Copy link
Contributor

bzoz commented Nov 15, 2019

I've been starting/stopping the powertoy, I've found two issues. First, it does not appear in Chrome:
image
and in Hangouts app I have the item disabled:
image

Funny enough: after restarting the powertoy everything went back to normal. Is it possible, that we have a race condition with Chrome? Especially in the Hangouts app, when started for the first time it almost looks like the menu gets populated on the fly. Notice, the order of elements is different now when the item works:
image

Other than that, the tool works great! Crashes are gone and it can be disabled.

@bzoz
Copy link
Contributor

bzoz commented Nov 18, 2019

Almost there, all the previous issues are gone, but I have a new one: when the "always on top" is activated through the keyboard, the menu does not get updated - the "enabled tick" is not added. If you then click on the option, it disables the "always on top" but adds the tick.

@enricogior
Copy link
Contributor

After starting PowerToys, the first time I right-click a title-bar, the Always On Top menu item doesn't appear, I need to right-click a second time.

This as a side effect: start PowerToys and use the hotkey before opening the context menu, this will correctly set the window 'on top', but the context menu will not have the check flag, so turning 'on top' off for the window will make the check flagincorrectly appear.

@bzoz
Copy link
Contributor

bzoz commented Nov 19, 2019

@enricogior I don't see this happening with the current code, can you update and test?

@enricogior
Copy link
Contributor

@bzoz
start PowerToys, open Notepad, right-click on the title-bar: does it show the Always On Top menu item? For me it doesn't, I have to right-click a second time.

image

@enricogior enricogior modified the milestones: 0.14, 0.15 Nov 22, 2019
@yuyoyuppe yuyoyuppe added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. labels Dec 18, 2019
@enricogior
Copy link
Contributor

Closing this for now, we will reopen when we will have a solid solution for adding items to the system menu or come up with a different approach (our own context menu).

@enricogior enricogior closed this Dec 18, 2019
@vldmr11080 vldmr11080 deleted the always_on_top_powertoy branch February 25, 2020 18:14
@reineckefux
Copy link

Hello,

I'm wondering why a menu item is needed; I think a keyboard shortcut should do.

Perhaps you can check out the supporting information mentioned here:

#12788

Regards
reineckefux

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.

6 participants