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

Add "Show desktop" button #169

Merged
merged 7 commits into from
Apr 24, 2023
Merged

Add "Show desktop" button #169

merged 7 commits into from
Apr 24, 2023

Conversation

xoascf
Copy link
Collaborator

@xoascf xoascf commented Nov 19, 2021

Fixes:

Small issues:

  • Does not keep the button state when the desktop is shown
  • Not fully tested, Peek function may not work occasionally on Windows 7


private void ToggleDesktop()
{
NativeMethods.SendMessage(WindowHelper.FindWindowsTray(IntPtr.Zero),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it should be better to add this to ManagedShell instead of being here.

Copy link
Owner

Choose a reason for hiding this comment

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

I agree. This could complement the other Aero Peek helper methods in ManagedShell.

@xoascf xoascf force-pushed the show-desktop-button branch from ebc500f to 9e553de Compare November 24, 2021 21:49
@xoascf xoascf force-pushed the show-desktop-button branch from aaeeb34 to 7a0369f Compare December 20, 2021 18:53
@xoascf xoascf self-assigned this Dec 20, 2021
@xoascf

This comment was marked as outdated.

@xoascf xoascf force-pushed the show-desktop-button branch from 83f78f9 to 7a0369f Compare January 10, 2022 07:25
@sunnydayoutside

This comment was marked as outdated.

@Jawomo
Copy link

Jawomo commented Mar 22, 2022

@xoascf
@dremin

Maybe using https://github.com/michaelnoonan/inputsimulator
methods to send Win + D fixes the freeze problems.

They use NativeMethods.SendInput.

@xoascf
Copy link
Collaborator Author

xoascf commented Mar 22, 2022

Maybe using https://github.com/michaelnoonan/inputsimulator methods to send Win + D fixes the freeze problems.

They use NativeMethods.SendInput.

Thanks, but I don't want to use the keyboard shortcuts, as I know some people like to override the default shortcuts with custom ones. I will look into this situation a bit anyway.

@Jawomo
Copy link

Jawomo commented Mar 23, 2022

Tested the #305 action build and have no issues with the desktop button so far. Windows 11 Pro

@@ -143,5 +143,24 @@ private void TasksScrollViewer_PreviewMouseWheel(object sender, System.Windows.I
e.Handled = true;
}
}

public bool AreAllWindowsMinimized()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dremin, is it possible that we need to bind AreAllWindowsMinimized to the ShowDesktop Checked state, or is there a better way to detect when all windows are minimized?

Copy link
Owner

Choose a reason for hiding this comment

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

I don't think you'll need to check if windows are minimized. From testing it seems like Explorer sets the desktop as the foreground window when "show desktop" is "enabled", and then considers it "enabled" until the desktop is no longer the foreground window. Once another window is foreground, toggling "show desktop" will show the desktop again rather than restore the windows. So basically once we enable show desktop, we want to keep the button checked until the foreground window changes.

There are a couple ways to do this, one being an approach similar to FullScreenHelper that polls GetForegroundWindow() every 100ms. Another idea that might be cleaner is to add an event to TasksService on shell hook messages that RetroBar could add a handler for (maybe FullScreenHelper could even be refactored to use this down the road if appropriate).

Copy link
Owner

Choose a reason for hiding this comment

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

@xoascf Would you like me to help with the above to get this finished up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh that would be perfect, this week I tried to add it in ManagedShell but I don't quite understand how to do it as you described above, I would be very grateful if you could do it for me, maybe later changes can be made if needed or requested for some themes.

The "Allow edits..." option is enabled, you can make the changes you want in this PR or separately, @dremin.

Copy link
Collaborator Author

@xoascf xoascf Mar 30, 2023

Choose a reason for hiding this comment

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

It seems that the behavior varies for certain themes:

In Windows 95 (and presumably the same for classic pre-7 themes): The button appears pressed when all windows are minimized (either with the button itself or with a keyboard shortcut to minimize them) and if the desktop is active after that (if the desktop is just foregrounded without any minimized windows, it's not going to appear as pressed).

In Windows 7 (and later): The button does not appear pressed when all windows are minimized or after you click it.

In both cases, it seems that the value (all minimized windows) is used for the context menu options, this seems to be especially useful for toggling them in #461.

allwinarevis allwinaremin

Copy link
Owner

Choose a reason for hiding this comment

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

@xoascf cairoshell/ManagedShell#74 is the ManagedShell support for this. Would you like me to wait to commit the RetroBar changes until a ManagedShell build is available on NuGet?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is the ManagedShell support for this. Would you like me to wait to commit the RetroBar changes until a ManagedShell build is available on NuGet?

That would be preferable.

Copy link
Owner

Choose a reason for hiding this comment

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

@xoascf Just pushed the changes.

Copy link
Collaborator Author

@xoascf xoascf Apr 21, 2023

Choose a reason for hiding this comment

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

Thanks @dremin, by the way, the Show desktop button is not selected or deselected when using the shortcut to show the desktop with Win + D. Is this by design?

Copy link
Owner

Choose a reason for hiding this comment

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

@xoascf Yeah, that is expected. I didn't add any handling for WM_COMMAND but will look into it. I don't think that should block this though.

@xoascf xoascf force-pushed the show-desktop-button branch from a59483f to 9c52bd1 Compare July 15, 2022 01:24
@codezi
Copy link

codezi commented Sep 4, 2022

Hope that is complete soon.

@xoascf xoascf force-pushed the show-desktop-button branch from 499a282 to cffac80 Compare September 7, 2022 23:29
@xoascf xoascf force-pushed the show-desktop-button branch 2 times, most recently from e552fd2 to f4e8765 Compare November 6, 2022 05:28
@som3rando
Copy link
Contributor

som3rando commented Feb 2, 2023

  • Not fully tested, Peek function may not work occasionally on Windows 7

@xoascf I am interested in testing you fork on a unused windows 7 pc so I can encounter this issue and try to help you fix it.

@xoascf
Copy link
Collaborator Author

xoascf commented Feb 2, 2023

Alright @som3rando, let me fix this real quick.

@xoascf xoascf force-pushed the show-desktop-button branch from d9cabf3 to a3a6f97 Compare February 2, 2023 19:06
@som3rando
Copy link
Contributor

som3rando commented Feb 2, 2023

Had difficulties with the pc so i switched to a VM, and i believe i found a issue with the peek feature wich happens when you interact with the original peek function and switch back to retrobar. To fix the issue I had to delete appdata and restart.
This issue only shows up on windows 7 and doesn't show up on event viewer.
Video:https://youtu.be/7QA5hUgsOHs
VM Logs with issue.log
I will edit this comment with more issues if i find them.
When peeking desktop and clicking the desktop button the desktop will continue peeking until you move you mouse away.
also a recommendation to add a timer for 1-2 sec on peeking the desktop so it doesn't accidentally trigger
the desktop button keeps the pressed state but i assume that is "Does not keep the button state when the desktop is shown"

@xoascf xoascf force-pushed the show-desktop-button branch from a3a6f97 to 4cd8adc Compare March 21, 2023 05:42
@xoascf
Copy link
Collaborator Author

xoascf commented Mar 21, 2023

Ok, I'm not sure if we will continue to support Windows 7, it would be better to finish this and if a solution is found, implement it in the future.

@xoascf xoascf force-pushed the show-desktop-button branch from 4cd8adc to a89de8d Compare March 24, 2023 00:41
@dremin
Copy link
Owner

dremin commented Apr 23, 2023

I'm working on some additional tweaks to the appearance to better match what I am seeing in Memphis build 1400 and NT 5 build 1796, as well as some improvements to the XP themes.

Where does the peek feature currently stand? It seems to be working great for me.

@dremin
Copy link
Owner

dremin commented Apr 23, 2023

@xoascf I think this is good to go. What do you think?

@xoascf xoascf marked this pull request as ready for review April 24, 2023 05:59
@xoascf
Copy link
Collaborator Author

xoascf commented Apr 24, 2023

@xoascf I think this is good to go. What do you think?

Yes, this looks pretty good already, thanks for your patience and cooperation.
Let's merge it for now, and if there are any issues, we'll fix them in another PR.

@xoascf xoascf merged commit 1381e4c into dremin:master Apr 24, 2023
@xoascf xoascf deleted the show-desktop-button branch April 24, 2023 06:07
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.

add visible desktop button on bottom right like in win 7 pls
6 participants