aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--src/main.cpp24
2 files changed, 22 insertions, 6 deletions
diff --git a/TODO b/TODO
index 46cb5eb..89c8666 100644
--- a/TODO
+++ b/TODO
@@ -30,4 +30,6 @@ Gray out monitor capture on intel if plane is compressed. Show the user to deskt
Look at showmethekey https://github.com/AlynxZhou/showmethekey to see how to do global hotkeys without x11/wayland.
-Detect when using hyprland to show a popup when pressing "register hotkeys" to explain to the user to run `hyprctl globalshortcuts` and how to bind that to keys with for example `bind = SUPERSHIFT, R, global, :gpu_screen_recorder_start_recording` \ No newline at end of file
+A single flatpak can only be installed either system-wide or user, so there can be a check if it's installed system-wide or user and it will only match one. With this information we can guaranteed know the flatpak directory of the running gpu screen recorder instance. The command `flatpak info -l com.dec05eba.gpu_screen_recorder` can also be used and is available for all flatpak users.
+
+Re-renable hotkeys on hyprland after it's fixed in the hyprland desktop portal. \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 439fc81..3b6d905 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,6 +4,7 @@ extern "C" {
}
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#include <gdk/gdkwayland.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
@@ -3078,9 +3079,9 @@ static void add_wayland_global_hotkeys_ui(GtkGrid *grid, int &row, int width) {
gtk_grid_attach(grid, GTK_WIDGET(aa_grid), 0, row++, width, 1);
gtk_grid_set_column_spacing(aa_grid, 10);
- gtk_grid_attach(aa_grid, gtk_label_new("On Wayland hotkeys are managed externally by the Wayland compositor, click here to register hotkeys:"), 0, 0, 1, 1);
+ gtk_grid_attach(aa_grid, gtk_label_new("On Wayland hotkeys are managed externally by the Wayland compositor, click here to change hotkeys:"), 0, 0, 1, 1);
- GtkButton *register_hotkeys_button = GTK_BUTTON(gtk_button_new_with_label("Register hotkeys"));
+ GtkButton *register_hotkeys_button = GTK_BUTTON(gtk_button_new_with_label("Change hotkeys"));
gtk_widget_set_hexpand(GTK_WIDGET(register_hotkeys_button), true);
//gtk_widget_set_halign(GTK_WIDGET(register_hotkeys_button), GTK_ALIGN_START);
g_signal_connect(register_hotkeys_button, "clicked", G_CALLBACK(on_register_hotkeys_button_clicked), nullptr);
@@ -4123,9 +4124,22 @@ static void activate(GtkApplication *app, gpointer) {
load_config();
if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) {
- if(!gsr_global_shortcuts_init(&global_shortcuts, init_shortcuts_callback, NULL)) {
- fprintf(stderr, "gsr error: failed to initialize global shortcuts\n");
- init_shortcuts_callback(false, nullptr);
+ init_shortcuts_callback(false, nullptr);
+ // TODO:
+ // Disable global hotkeys on Hyprland for now. It crashes the hyprland desktop portal.
+ // When it's re-enabled on Hyprland it will need special handing where it does BindShortcuts immediately on startup
+ // instead of having a "register hotkeys" button. This needed because Hyprland doesn't remember registered hotkeys after
+ // the desktop portal is restarted (when the computer is restarted for example).
+ const bool is_hyprland = gdk_wayland_display_query_registry(gdk_display_get_default(), "hyprland_global_shortcuts_manager_v1");
+ if(is_hyprland) {
+ const char *hotkeys_not_supported_text = "Global hotkeys have been disabled on your system because of a Hyprland bug.\nUse X11 or KDE Plasma on Wayland if you want to use hotkeys.";
+ gtk_label_set_text(GTK_LABEL(recording_hotkeys_not_supported_label), hotkeys_not_supported_text);
+ gtk_label_set_text(GTK_LABEL(replay_hotkeys_not_supported_label), hotkeys_not_supported_text);
+ gtk_label_set_text(GTK_LABEL(streaming_hotkeys_not_supported_label), hotkeys_not_supported_text);
+ } else {
+ if(!gsr_global_shortcuts_init(&global_shortcuts, init_shortcuts_callback, NULL)) {
+ fprintf(stderr, "gsr error: failed to initialize global shortcuts\n");
+ }
}
}
}