nwg-piotr / nwg-shell-config

nwg-shell configuration utility
MIT License
67 stars 10 forks source link

Idle & Lockscreen: gtklock modules #13

Closed jovanlanik closed 2 years ago

jovanlanik commented 2 years ago

Hi, I've been working on expanding module support in gtklock and ported some of @ErikReider code to implement a user info module: https://github.com/jovanlanik/gtklock-userinfo-module

I'm wondering if a GUI option for selecting modules could be added to nwg-shell-config.

There's still some work left on my side, such as documentation, loading multiple modules at once and system-wide modules that could be installed via package manager but I wanted to discuss with you and see if you're interested.

Maybe even implement music controls as a module and leave input inhibitor enabled this way.

What are your thoughts on this?

nwg-piotr commented 2 years ago

Of course I can add some more configuration options to support your modules. Also a playerctl module is a good idea. Great if you find it useful as well. I'll add whatever turns out needed on my side.

jovanlanik commented 2 years ago

I added the necesary changes to gtklock v1.3.4. It can now load multiple modules and loads system-wide modules (located in /usr/lib/gtklock/). The --module option has been replaced by --modules (used as $ gtklock -m first-module -m second-module). The option can also be set in the config file. See gtklock(1).

There are only two modules available for now:

Both are available on the AUR.

nwg-piotr commented 2 years ago

I have no idea on how to use a module. I add the module name as an argument, right? Or the module path? I tried:

gtklock -m userinfo gtklock -m userinfo-module gtklock -m /usr/lib/gtklock/userinfo-module gtklock --module=userinfo gtklock --module=userinfo-module

...and hell knows what else. Nothing worked. Could you show me the command to use the userinfo module?

jovanlanik commented 2 years ago

All of the following commands should work:

gtklock -m userinfo-module
gtklock -m userinfo-module.so
gtklock -m /usr/lib/gtklock/userinfo-module
gtklock -m /usr/lib/gtklock/userinfo-module.so

Do you get any warning messages?

nwg-piotr commented 2 years ago

Sure, like this:

$ gtklock -m userinfo-module

(gtklock:221645): GModule-CRITICAL **: 01:29:49.488: g_module_symbol: assertion 'module != NULL' failed

(gtklock:221645): GModule-CRITICAL **: 01:29:49.488: g_module_symbol: assertion 'module != NULL' failed

(gtklock:221645): GModule-CRITICAL **: 01:29:49.488: g_module_symbol: assertion 'module != NULL' failed

(gtklock:221645): GModule-CRITICAL **: 01:29:49.488: g_module_symbol: assertion 'module != NULL' failed

(gtklock:221645): GModule-CRITICAL **: 01:29:49.488: g_module_symbol: assertion 'module != NULL' failed

** (gtklock:221645): WARNING **: 01:29:49.494: gtk-layer-shell v0.7.0 may not work on GTK v3.24.34. If you experience crashes, check https://github.com/wmww/gtk-layer-shell/blob/master/compatibility.md

image

jovanlanik commented 2 years ago

What version of gtklock is that? Is it v1.3.4?

nwg-piotr commented 2 years ago

Yes. BTW, PKGBUILD specifies the version.

jovanlanik commented 2 years ago

Can you show me the output of $ gtklock --help-all?

nwg-piotr commented 2 years ago
$ gtklock --help-all
Usage:
  gtklock [OPTION?] - GTK-based lockscreen for sway

Help Options:
  -h, --help                   Show help options
  --help-all                   Show all help options
  --help-config                Show options available in the config
  --help-debug                 Show options for debugging and styling
  --help-gtk                   Show GTK+ Options

Config options
  -g, --gtk-theme              Set GTK theme
  -s, --style                  Load CSS style file
  -m, --module                 Load gtklock module
  -b, --background             Load background
  -t, --time-format            Set time format
  -H, --idle-hide              Hide form when idle
  -T, --idle-timeout           Idle timeout in seconds
  -S, --start-hidden           Start with hidden form
  -l, --no-layer-shell         Don't use wlr-layer-shell
  -i, --no-input-inhibit       Don't use wlr-input-inhibitor

Debug options
  --debug-no-layer-shell       Don't use wlr-layer-shell
  --debug-no-input-inhibit     Don't use wlr-input-inhibitor

GTK+ Options
  --class=CLASS                Program class as used by the window manager
  --name=NAME                  Program name as used by the window manager
  --gtk-module=MODULES         Load additional GTK+ modules
  --g-fatal-warnings           Make all warnings fatal

Application Options:
  -d, --daemonize              Detach from controlling terminal
  -c, --config                 Load config file
  --display=DISPLAY            X display to use
jovanlanik commented 2 years ago

I'm pretty sure this is an older version... The --module option has been replaced by --modules in v1.3.3 and later. Check if you have another gtklock binary by running $ which gtklock or try rebuilding/reinstalling gtklock from the AUR.

nwg-piotr commented 2 years ago

It would be of help if you could add the gtklock -v flag to check the version. Yes, I had a version mismatch, after building it from source some time ago. It works now, thank you.

Probably I should know it, but I don't: where/how do I add the user image? I don't use gdm / sddm / lightdm, but ly, which is a TUI.

jovanlanik commented 2 years ago

I think there is a way to add it using accountservice however I don't know any standalone tools to do that. Luckly it falls back to ~/.face (has to be a 96x96 png image), so I just use that.

nwg-piotr commented 2 years ago

Haha, alright. This should be mentioned in docs, however.

jovanlanik commented 2 years ago

Actually I found mugshot just now, might work.

EDIT: mugshot works fine, I'll recommend it in the docs.

jovanlanik commented 2 years ago

Haha, alright. This should be mentioned in docs, however.

Yeah, I'll work on the docs next.

BTW the module also has a few undocumented options available in the config file (~/.config/gtklock/config.ini):

[userinfo]
round-image=true
vertical-layout=true
under-clock=false
nwg-piotr commented 2 years ago

.face does the job.

the module also has a few undocumented options available in the config file (~/.config/gtklock/config.ini)

I'd like to avoid messing with your config file, if possible. I had to do so in the case of swaync, since Erik does not support flags, but actually a GUI to edit your configs should not be on my side, if at all.

jovanlanik commented 2 years ago

I'll see what I can do to make module options available as flags.

nwg-piotr commented 2 years ago

Very well.

Let me explain it better: new config keys/values appear in new versions. For the latest swaync I had to add a check against missing config keys, and I'm not really happy about it, as it slows my GUI down a little bit. That's why I prefer flags.

nwg-piotr commented 2 years ago

BTW: I think that nwg-shell users should know about the possibility to just edit your config file for better adjustment to their needs.

nwg-piotr commented 2 years ago

mugshot does the job as well.

ErikReider commented 2 years ago

Probably I should know it, but I don't: where/how do I add the user image? I don't use gdm / sddm / lightdm, but ly, which is a TUI.

My SwaySettings package is able to change the profile pick ;)

nwg-piotr commented 2 years ago

Good to know, thanks! I'll give it a try immediately. :)

nwg-piotr commented 2 years ago

@ErikReider It works well, however pictures seem overcompressed.

image

ErikReider commented 2 years ago

What are the specs of that image?

nwg-piotr commented 2 years ago

image

jovanlanik commented 2 years ago

I created some documentation for the module at https://github.com/jovanlanik/gtklock-userinfo-module/wiki.

ErikReider commented 2 years ago

@ErikReider It works well, however pictures seem overcompressed.

image

Seems to work for me image

Can you open a new issue?

nwg-piotr commented 2 years ago

Excellent, thanks. I need to find some place in my crowded GUI to add (a) checkbox(es) for your modules, but hope to do do it before going on vacation. 2 nights left. :)

nwg-piotr commented 2 years ago

@ErikReider Later tonight I'll try some other pictures. Possibly it's something wrong about this certain one. If I confirm the problem, will open an issue.

nwg-piotr commented 2 years ago

@ErikReider Sorry about the delay. I got stuck in a gtklock-related issue last night.

If it comes to the worse image quality when set with swaysettings, I think I know the reason. Mugshot does not scale pictures at all. It just saves them as ~/.face and /var/lib/AccountsService/icons/$USER, with no change.

My original picture was 512x512 @ 72 dpi, and swaysettings scaled it to 96x96 @ 300 dpi. This simply must look worse, especially on a drawing, not a photo. No reason to open an issue.

ErikReider commented 2 years ago

@nwg-piotr wait, was it the image quality or the lack of blended colors what you were referring to? I though that SwaySettings some how lowered the color depth

ErikReider commented 2 years ago

Sorry @jovanlanik for filling this PR with unrelated issues :)

nwg-piotr commented 2 years ago

LOL, I have deuteranopia. I don't talk about colors.

nwg-piotr commented 2 years ago

Done in nwg-shell-config 0.3.9. For now I added a single check box. We may need a more complex form when there are more modules.

image

jovanlanik commented 2 years ago

Thank you, seems good enough for now considering the userinfo module is the only available one.

nwg-piotr commented 2 years ago

LOL, I'd add power menu or buttons (reboot / power off) if I were you. ;)

jovanlanik commented 2 years ago

Not a bad idea...

jovanlanik commented 2 years ago

@nwg-piotr I threw together a module https://github.com/jovanlanik/gtklock-powerbar-module. Should work with gtklock compiled from master... Only did some quick testing so it may not be perfect, let me know if you have any issues or ideas. Also didn't have time to document it, the module has 3 options in the config (these are the defaults):

[powerbar]
show-labels=false
reboot-command=systemctl reboot
poweroff-command=systemctl -i poweroff

image

nwg-piotr commented 2 years ago

Excellent!

I'm just about to release nwg-shell 0.3.0. Will check it out as soon as I can.

nwg-piotr commented 2 years ago

https://github.com/jovanlanik/gtklock-powerbar-module

I'm getting in trouble while testing the module.

$ gtklock -m powerbar

** (gtklock:6313): WARNING **: 00:58:28.279: Module loading failed: /usr/local/lib/gtklock/powerbar.so: cannot open shared object file: No such file or directory
jovanlanik commented 2 years ago

Try $ gtklock -m powerbar-module or the full path.

nwg-piotr commented 2 years ago

@jovanlanik I've just added the powerbar support to nwg-shell-config. Thanks!

2022-09-11-040011_screenshot