ful1e5 / Bibata_Cursor

Open source, compact, and material designed cursor set.
https://www.bibata.live
GNU General Public License v3.0
1.77k stars 70 forks source link

Install under Windows user account doesn't work #137

Closed fblais closed 9 months ago

fblais commented 1 year ago

Hi. Windows 10 Pro here. Have trouble installing this to user account. I'm entering the admin password when prompted, it "seems" to install, but then the theme is not visible in the list. Rebooting didn't help. Thanks for looking at this!

P.S. Install on admin account is no problem.

ful1e5 commented 1 year ago

Have you tried the option "Run as administrator" by right-clicking on the install script?

fblais commented 1 year ago

Yes, it's then that I'm prompted for the admin password, etc. like described in the firt post.

ful1e5 commented 9 months ago

I'm not a Windows user, but someone in the community can help you with this issue.

fblais commented 9 months ago

Thanks. Still waiting for this help to show up. :)

Regards.

stanio commented 9 months ago

The install.inf script copies the cursor files into the system directory (C:\Windows\Cursors or more generally %SYSTEMROOT%\Cursors), so it asks for administrative privileges. The custom cursor themes are otherwise installed/defined for the current user – see the registry keys:

It seems your user cannot elevate a process (via UAC) as administrator but runs with a different (administrator) user, so it sets up the cursors just for that user.

You may:

If one doesn't have any administrative privileges, they may extract the cursors into their profile, f.e. %LOCALAPPDATA%\Microsoft\Windows\Cursors, and use the first approach suggested above. Dunno if the install.inf could do this by default.

fblais commented 9 months ago

Thanks Stanio! I copied the cursors to my user appadata folder, then choosed the individual cursors one by one and saved that into a Bibata theme with success, thanks again!

stanio commented 3 months ago

If one doesn't have any administrative privileges, they may extract the cursors into their profile... Dunno if the install.inf could do this by default.

Saving this here for future reference – yes, it is possible:

The user profile (home) directory is equivalent to %USERPROFILE%. So something like:

 [DestinationDirs]
-Scheme.Cur = 10,"%CUR_DIR%"
+Scheme.Cur = 53,"%CUR_DIR%"

 [Scheme.Reg]
-HKCU,"Control Panel\Cursors\Schemes","%SCHEME_NAME%",,"%10%\%CUR_DIR%\...,%10%\%CUR_DIR%\...,..."
+HKCU,"Control Panel\Cursors\Schemes","%SCHEME_NAME%",,"%53%\%CUR_DIR%\...,%53%\%CUR_DIR%\...,..."

 [Strings]
-CUR_DIR             = "Cursors\Bibata-..."
+CUR_DIR             = "AppData\Local\Cursors\Bibata-..."

However, given INF files are primarily meant for device driver installation, it seems Windows will ask for elevated rights anyway. In this regard, install.inf is probably not the best tool for installing mouse cursors for a single user, while it is a convenient built-in facitlity to do so. An install.bat doing series of copy and reg add commands, instead of the INF CopyFiles and AddReg directives, may be better – just like the current uninstall.bat. It would require more work for someone to write one.

From Reg - Edit Registry - Windows CMD (SS64.com):

Elevation

Unlike REGEDIT, REG.exe does not always require elevation When adding an item to HKCU, REG will be automatically manifested “asInvoker”, and will work without elevation, when adding an item to HKLM then it does need to be run elevated.

stanio commented 3 months ago

Saving this here for future reference – yes, it is possible...

However, I've identified an unpleasant shortcoming related to (what it seems) the "user profile preloading" Windows feature. Haven't tried if it occurs with that feature disabled (if possible?) but I've noticed after a system restart the mouse cursors are not applied on the login screen. They are not applied even after login until one opens the "Mouse Properties" control panel and clicks "OK" to the already selected mouse pointer scheme.

This all appears related to the fact the "Mouse Properties" control panel automatically replaces paths under the user profile with %USERPROFILE%\... prefix:

> reg query "HKCU\Control Panel\Cursors" /s

and I speculate this fails to resolve before the actual login. After login, the user profile preloading has already set the cursor scheme while failing to resolve the cursor files.

I've also noticed the new (Windows 10+) "Accessibility > Mouse pointer" (Change pointer size and color) settings – they dynamically generate cursor (bitmap) files from SVG sources into %USERPROFILE%\AppData\Local\Microsoft\Windows\Cursors but they appear to update the Registry with full paths:

C:\Users\<user>\AppData\...

and that doesn't suffer from the given problem.