s-victor / TinyPedal

Free and Open Source telemetry overlay application for racing simulation
GNU General Public License v3.0
75 stars 8 forks source link

Add resizable overlay grid for widget positioning #36

Closed berarma closed 10 months ago

berarma commented 10 months ago

I think this would help correctly align widgets with less effort. The grid can be enabled in the Overlay menu or in the tray the same way as the lock and autohide features. The grid is invisible. The grid size can be set in the compatibility config.

I'm not happy putting the grid size in the compatibility window but I didn't feel like creating a new window only for it. Suggestions welcomed.

I added an attribute to the widgets to set them as type Dock. I hope this doesn't cause any trouble. I think it's compatible with how we expect the widgets to behave. I had to add it so that widgets could go over the top bar in Gnome and also extend past the screen. Without this attribute widgets were confined inside the workspace.

s-victor commented 10 months ago

hi, thanks for this, I just tested and working great.

There is a missing line in main.py line 195, add below so that main menu is updated: self.overlay_grid.setChecked(cfg.overlay["enable_grid"])

I think it is better just to place "grid_size" option below "enable_grid" under "overlay" section ( cfg.overlay["grid_size"] ), which suits better.

Also I think the menu option name is better named as "Grid move" without Enable word (json name would be "enable_grid_move" & "grid_move_size" respectively)

Otherwise all good, thanks

s-victor commented 10 months ago

sorry, just realized what you mean about grid_size in compatibility dialog. I agree, just keep it under compatibility section is good enough. alternatively, we can add an "Overlay" dialog accessible from config menu to be more consistent, either is good.

berarma commented 10 months ago

I've applied the requested changes. I've left it under compatibility. In the future settings could be reorganized to avoid having many sections with few settings maybe. It's your call.

I've also tested it on Gnome with Wayland, previously tested on Gnome with X11, and found no issues.

s-victor commented 10 months ago

perfect, thanks!

berarma commented 10 months ago

I've noticed widgets don't stay on top of the rFactor borderless window after setting window type dock unless enabling bypass window manager. I think I'll play a bit more with the available options and see which is the best one.

s-victor commented 10 months ago

np, there is also an unrelated strange behavior I noticed under KDE earlier. If I run from source, widgets cannot be dragged, but only after installed then they can. So for some situation it is probably best test both source and installation just in case and not wasting time.

berarma commented 10 months ago

np, there is also an unrelated strange behavior I noticed under KDE earlier. If I run from source, widgets cannot be dragged, but only after installed then they can. So for some situation it is probably best test both source and installation just in case and not wasting time.

Use the TinyPedal.sh script to run from source instead of run.py so it sets the env variable needed for drag to work.

berarma commented 10 months ago

I've done some more tests on Gnome. I've inspected the widget windows with xprop and the hints aren't what I expected them to be. It seems that QT has its own way of implementing hints because I guess it tries to behave similarly on different platforms for the same code. It becomes complex trying to get a specific window setup on a particular platform.

Enabling bypass window manager solves the issue of the widgets not showing on top when window type is set to dock. But then type dock isn't needed to make the widget freely movable across all the screen. The only downside is that OBS doesn't show the windows for capture anymore (at least on X11).

I would remove window type dock and at least it would be usable on Gnome with bypass enabled and disabled. Enabled would allow moving the widgets over the top bar and disabled would allow capturing widgets with OBS. I think this doesn't affect other DEs.

I'm wondering about making bypass window manager enabled by default too since most won't be streaming.