jonaskohl / CapsLockIndicator

A small utility that indicates the state of the Num lock, Caps lock and Scroll lock key.
https://cli.jonaskohl.de/
Apache License 2.0
346 stars 44 forks source link

Custom icons disabled if "Start on logon" is selected #47

Closed EverEve closed 3 years ago

EverEve commented 4 years ago

Hello, I've noticed that the custom icons are not shown if the option "Start on logon" is selected. If it is manually started after the logon, my custom icons are shown normally.

Is it possible to solve? I ask this since the boxed capital C is not very easy to detect and I wish to use black letters in white background.

Thanks.

jonaskohl commented 4 years ago

Hmm, normally there should be no difference. My best guess at what is happening is that the working directory is different when automatically starting, so it no longer sees the icon files in the current directory. (Reference: MainForm.cs#L124

EverEve commented 4 years ago

Hello, I can confirm the behavior: the program is executed from D:\Prog\CapsLock and in that directory are also the icon files. If I run the program normally, the icons are the ones I put in that directory. If I make it running at logon, the icons are the default ones. If you want, I can upload the icon files.

jonaskohl commented 4 years ago

Okay, I think I found the problem. When an application is auto-run using a registry entry in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run, it is always run in %systemroot%\SysWOW64 instead of the directory the executable is in.

sc_comp_00

A temporary fix would be to uncheck "Start on logon" and instead copying a shortcut to CLI into the autorun folder by typing shell:startup into the run box.

EverEve commented 4 years ago

I've tried in past days and it used to work.

Anyway, if you are going to solve the problem, I will be thankful.

jonaskohl commented 3 years ago

This should finally be fixed. If not, let me know and I'll reopen the issue.