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

[Feature] Executable to show the menu #276

Closed
donaldaken opened this issue Dec 19, 2021 · 11 comments
Closed

[Feature] Executable to show the menu #276

donaldaken opened this issue Dec 19, 2021 · 11 comments
Projects
Milestone

Comments

@donaldaken
Copy link

I would like a Windows executable that will show the menu. I want to create a Windows shortcut and Pin to taskbar or Pin to Start. I would tap the icon on the taskbar to display the menu.

An option is to add a parameter to the SystemTrayMenu.exe command line that would show the menu, rather than restart SystemTrayMenu. For example,

SystemTrayMenu.exe show

My frequently used apps are pinned to the taskbar. I will use SystemTrayMenu to launch occasionally used apps - curated and categorized. I won't use the menu enough to turn on "Show in taskbar". "Show in taskbar" has some undesirable side-effects: always in the Alt-Tab and Win-Tab lists; menu appears when switching virtual desktops and other times. I generally like tapping an icon on a touchscreen rather than clicking with the trackpad or hitting a hotkey. An icon on the taskbar is twice the size as the icon in the tray - larger is better for tapping on a touchscreen.

As a workaround, I created an autohotkey script that simply sends the Ctrl-Win hotkey to trigger the menu. I created a shortcut, and pinned it to the taskbar. I tap the taskbar to open the menu. I figure there are others who would also want this feature.

@Hofknecht
Copy link
Owner

@donaldaken
Thank you for the feedback!

That's a great workaround!

In the past I've thought about an argument '-show', but in a completely different context. I figured you could use the argument to open the STM right after the start.

But the way you describe it would actually be perfect, we can do exactly the same. If a process SystemTrayMenu.exe is already running, then we send the hotkey and exit. So basically exactly what your hotkey script does.

Currently, all other SystemTrayMenu.exe processes are terminated by default when starting.

We should definitely implement that.

I'm just thinking about how to make it accessible to even more users. Maybe something like a button in the options, which creates the shortcut with the argument '-show' in the taskbar or something similar.

Tag at least as FAQ
:)

@Hofknecht Hofknecht added the FAQ label Dec 19, 2021
@Hofknecht Hofknecht added this to Analyze / Spec in STM 1.3.0 via automation Dec 19, 2021
@Hofknecht Hofknecht added this to the 1.3 milestone Dec 19, 2021
@donaldaken
Copy link
Author

If you're trying to make the feature more accessible, I recommend showing the menu if SystemTrayMenu.exe is run when it is already running. I see no benefit for the user with the current behavior of terminating the other process. But I see a benefit for the user with a new behavior to show the menu. Of course, I say this without knowing how difficult it is to make that modification, i.e. detecting it's already running.

@Hofknecht
Copy link
Owner

yes thank you for the hint!

So in case other instance of STM already running we will send hotkey and close either 1. with argument or 2. as default (then maybe old behavior as argument -k -killOtherInstances)

e.g. when I am programming and just starting a new version, it is very useful when it terminates the others, therefore i can then set this new argument -k

@Hofknecht
Copy link
Owner

BTW killOtherInstances is causing wrong crash statistic in MS Store so this is one more reason to make option 2. as default

@Hofknecht
Copy link
Owner

for all who try this workaround or want to have it up to the next version as standard, the script is:
Send, {CTRLDOWN}{LWin down}{LWin up}{CTRLUP}

works nice!

There is a side effect of this. If the menu is open and you click on the taskbar item, you expect the menu to close, but then it opens again.
However, it is because the focus is lost and then opens again through the hotkey.
i could imagine the solution that we ignore a possible hotkey after a close 50ms. But that also has the side effect that the hotkey does not work after a close 50ms:). Therefore, something like this would only be feasible as an option

Another side effect is that it takes about 50 ms until the click on the taskbar item triggers the hotkey, this is due to windows not to autohotkey and would therefore also be a problem for us because we want maximum speed.

So we definitely want to continue to have 'Show in Taskbar' as the default. Also because of the point that the user can more easily execute 'Pin to Taskbar' the first time and then he can remove 'Show in Taskbar' in options and it would then be implemented as described 'option 2. as default '

@Hofknecht
Copy link
Owner

Hofknecht commented Jan 1, 2022

we tried using send receive, see demo project here:
https://www.c-sharpcorner.com/blogs/send-message-from-one-to-another-running-application1
there the issue is that the receive is not working if implemented in a form ShowInTaskbar false
found this but no answer in this forum https://www.pcreview.co.uk/threads/sendmessage-doesnt-work-when-window-has-showintaskbar-set-to-false.1375581/

the orignal idea send the hotkey is a bit tricky because we need kind of converter from our hotkeystring to the sendkey format, see e.g. here
https://stackoverflow.com/questions/10366152/sending-windows-key-using-sendkeys/46317756

@Hofknecht
Copy link
Owner

ok, now works fine, version 1.2.0.9.

(There are 2 hotkeys with which it not works, thats 'ALT + A' and 'ALT + SHIFT + A'. seems to be a issue in InputSimulator, but all others are fine.)

@donaldaken
FYI. now closed : )

STM 1.3.0 automation moved this from Analyze / Spec to Closed Jan 1, 2022
@Hofknecht
Copy link
Owner

  1. If you start the STM and switch to another user, the restart is still required (because we not support multiple instances). The STM then does not open.
    => We should then maybe just not do it as default and implement a argument for that new behavior?

  2. The performance is currently above 0. deactivate 1. taskbar item + 2. start process + 3. simulate hotkey, 4. hotkey arrives at the other process, unfortunately only at 600ms (debugger).
    taskbaritem process start and sendkey - needs 600 ms
    using ShowInTaskbar or via system tray is nearly instant

  3. (does not relate directly to the topic but has to do with it) the idea of multiple instances actually exists also because you want to have several root menus directly as several taskbar items. If we do that, then we will probably do it in such a way that you can set several root menus and hotkey for each in the settings and then we show e.g. several notify icons in the system tray (these 2 ways would then start very quickly). It's all a bit difficult with the taskbar. This trick via the ShowInTaskbar and a fake form for the Taskbar solves it for one taskbar item, but you cannot simply display several with one process.

@Hofknecht Hofknecht reopened this Jan 7, 2022
STM 1.3.0 automation moved this from Closed to Analyze / Spec Jan 7, 2022
@Hofknecht
Copy link
Owner

we changed that new behavior only with arg -h or -hotkey
Therefore press 'Shift' +'Right click taskbar item'
2022-01-07 18_24_35-
Then choose 'Properties', add there -h
2022-01-07 18_24_49-Window

FYI @donaldaken

now closed again, we will release in a few days

STM 1.3.0 automation moved this from Analyze / Spec to Closed Jan 7, 2022
@Hofknecht
Copy link
Owner

1>D:\Seafile\Markus\C#Projects\systemtraymenu\SystemTrayMenu.csproj : warning NU1701: Package 'InputSimulator 1.0.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net6.0-windows10.0.22000'. This package may not be fully compatible with your project.

@Hofknecht Hofknecht reopened this Jan 8, 2022
STM 1.3.0 automation moved this from Closed to Analyze / Spec Jan 8, 2022
@Hofknecht
Copy link
Owner

changed to
https://github.com/HavenDV/H.InputSimulator
which is compatible to .net 6

STM 1.3.0 automation moved this from Analyze / Spec to Closed Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
STM 1.3.0
  
Closed
Development

No branches or pull requests

2 participants