libratbag / piper

GTK application to configure gaming devices
GNU General Public License v2.0
4.8k stars 177 forks source link

Missing "Apply" button when reassigning a mouse button #707

Open Vermoot opened 2 years ago

Vermoot commented 2 years ago

Hi there!

I'm trying to reassign buttons on my G600 with Piper, and it's recognized properly, I can change DPI, LEDs, etc, it's great.

My issue is when trying to assign an action to a button there is no "Apply" button on the popup window:
https://cdn.discordapp.com/attachments/648216442214416387/927000610765697085/unknown.png

Ignore the missing window decorations, that's normal. I've tried in an xfce4 session with the usual xfwm, same happens.

Any idea what's going on?

Thanks!

whot commented 2 years ago

This looks like some custom theme or something else here - can you check in a stock GNOME session please? I'm not sure what triggers this but there's no reason that button should be missing.

Vermoot commented 2 years ago

I do get the bar if I export GTK_CSD=1 before starting Piper. I usually have CSD off because I'm using a separate window manager (AwesomeWM).

What's surprising it that the titlebar with the Profile button, tabs and Apply button on the main window shows up, but not in the dialogs.

I guess the titlebar on the dialog windows is considered as a client-side decoration, when it shouldn't?

whot commented 2 years ago

that sounds about right but tbh I'm a bit ouf of my depth here, I've paged all of this knowledge out. Piper uses standard GTK stuff, so I'd guess any bug is more likely a GTK issue than a Piper issue.

dsalt commented 1 month ago

It's a Piper issue (well, probably ultimately a GTK issue): it assumes that CSD is available – but, as I'm using gtk3-nocsd here, no it isn't.

This patch fixes it up, though I'm not certain that it's the correct fix:

diff --git a/piper/buttonspage.py b/piper/buttonspage.py
index 53aa444..c2d6d7f 100644
--- a/piper/buttonspage.py
+++ b/piper/buttonspage.py
@@ -2,6 +2,7 @@

 from gettext import gettext as _
 from typing import Optional
+from os import getenv

 from .buttondialog import ButtonDialog
 from .mousemap import MouseMap
@@ -129,7 +130,8 @@ class ButtonsPage(Gtk.Box):
             buttons,
             device_type,
             title=_("Configure button {}").format(ratbagd_button.index),
-            use_header_bar=True,
+            # don't force CSD else buttons go missing with gtk3-nocsd
+            use_header_bar=(getenv('GTK_CSD', '1') == '1'),
             transient_for=self.get_toplevel(),
         )
         dialog.connect("response", self._on_dialog_response, ratbagd_button)