aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-04-09 18:27:31 +0200
committerdec05eba <dec05eba@protonmail.com>2025-04-09 18:27:45 +0200
commit9ada8caabc75c32296bcea1e83580dde32dd5a37 (patch)
treef77e1af290beda435516b94082e2ffd6c2ae003e
parent746ce51e65232bfb6fc33a17a1450a90e020c341 (diff)
Add emergency exit buttons, (left) ctrl+shift+alt+esc to close gpu screen recorder and remove it from system startup
-rw-r--r--README.md7
-rw-r--r--TODO4
-rw-r--r--include/Overlay.hpp1
-rw-r--r--src/Overlay.cpp20
-rw-r--r--src/main.cpp3
5 files changed, 30 insertions, 5 deletions
diff --git a/README.md b/README.md
index abec410..90f0a87 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,11 @@ There are also additional dependencies needed at runtime:
* [GPU Screen Recorder Notification](https://git.dec05eba.com/gpu-screen-recorder-notification/)
## Program behavior notes
-This program has to grab all keyboards and create a virtual keyboard (`gsr-ui virtual keyboard`) to make global hotkeys work on all Wayland compositors.
-This might cause issues for you if you use input remapping software. To workaround this you can go into settings and select "Only grab virtual devices"
+This program has to grab all keyboards and create a virtual keyboard (`gsr-ui virtual keyboard`) to make global hotkeys work on all Wayland compositors.\
+This might cause issues for you if you use input remapping software. To workaround this you can go into settings and select "Only grab virtual devices".\
+If you use input remapping software such as keyd then make sure to make it ignore "gsr-ui virtual keyboard", otherwise your keyboard can get locked
+as gpu screen recorder tries to grab keys and keyd grabs gpu screen recorder, leading to a lock.\
+If you are stuck in such a lock where you cant press and keyboard keys you can press (left) ctrl+shift+alt+esc to close gpu screen recorder and remove it from system startup.
# License
This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`.\
diff --git a/TODO b/TODO
index 466bd25..1a91e87 100644
--- a/TODO
+++ b/TODO
@@ -113,6 +113,8 @@ Check if "modprobe uinput" is needed on some systems (old fedora?).
Add recording timer to see duration of recording/streaming.
Make folder with window name work when using gamescope. Gamescope runs x11 itself so to get the window name inside that we have to connect to the gamescope X11 server (DISPLAY=:1 on x11 and DISPLAY=:2 on wayland, but not always).
+ Detect if the window is gamescope automatically (WM_CLASS = "gamescope") and get the x11 display automatically and connect to it to get the application its running.
+ This seems to only be an issue on wayland? the window title of the gamescope/steam bigpicture mode is the title of the game on x11, so it works automatically on x11.
When clicking on current directory in file manager show a dropdown menu where you can select common directories (HOME, Videos, Downloads and mounted drives) for quick navigation. Maybe even button to search.
@@ -158,3 +160,5 @@ Notification with the focused monitor (with CursorTrackerWayland) assumes that t
If CursorTrackerWayland fails then fallback to getting focused monitor by window creation trick. Need to take into consideration prime laptop with dGPU that controls external monitors which cant be captured (different /dev/dri/card device).
Maybe automatically switch to recording with the device that controls the monitor.
In that case also add all monitors available to capture in the capture list and automatically choose the gpu that controls the monitor.
+
+Support cjk font. Use fc-match to find the location of the font. This also works in flatpak, in which case the fonts are in /run/host/..., where it lists system fonts.
diff --git a/include/Overlay.hpp b/include/Overlay.hpp
index cd52efa..ac9d2b1 100644
--- a/include/Overlay.hpp
+++ b/include/Overlay.hpp
@@ -65,6 +65,7 @@ namespace gsr {
bool is_open() const;
bool should_exit(std::string &reason) const;
void exit();
+ void go_back_to_old_ui();
const Config& get_config() const;
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 2e79d31..2a4ca81 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -338,6 +338,13 @@ namespace gsr {
fprintf(stderr, "pressed %s\n", id.c_str());
overlay->take_screenshot_region();
});
+
+ global_hotkeys->bind_key_press(
+ config_hotkey_to_hotkey(ConfigHotkey{ mgl::Keyboard::Key::Escape, HOTKEY_MOD_LCTRL | HOTKEY_MOD_LSHIFT | HOTKEY_MOD_LALT }),
+ "exit", [overlay](const std::string &id) {
+ fprintf(stderr, "pressed %s\n", id.c_str());
+ overlay->go_back_to_old_ui();
+ });
}
static std::unique_ptr<GlobalHotkeysLinux> register_linux_hotkeys(Overlay *overlay, GlobalHotkeysLinux::GrabType grab_type) {
@@ -1468,6 +1475,19 @@ namespace gsr {
do_exit = true;
}
+ void Overlay::go_back_to_old_ui() {
+ const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
+ if(inside_flatpak)
+ exit_reason = "back-to-old-ui";
+ else
+ exit_reason = "exit";
+
+ const char *args[] = { "systemctl", "disable", "--user", "gpu-screen-recorder-ui", nullptr };
+ std::string stdout_str;
+ exec_program_on_host_get_stdout(args, stdout_str);
+ exit();
+ }
+
const Config& Overlay::get_config() const {
return config;
}
diff --git a/src/main.cpp b/src/main.cpp
index 7c10a6e..be2f6d0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -303,9 +303,6 @@ int main(int argc, char **argv) {
if(exit_reason == "back-to-old-ui") {
const char *args[] = { "gpu-screen-recorder-gtk", "use-old-ui", nullptr };
execvp(args[0], (char* const*)args);
- } else if(exit_reason == "restart") {
- const char *args[] = { "gsr-ui", "launch-show", nullptr };
- execvp(args[0], (char* const*)args);
}
return 0;