diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | include/Overlay.hpp | 3 | ||||
-rw-r--r-- | src/Overlay.cpp | 9 | ||||
-rw-r--r-- | tools/gsr-global-hotkeys/README.md | 21 | ||||
-rw-r--r-- | tools/gsr-global-hotkeys/keyboard_event.c | 1 |
5 files changed, 37 insertions, 1 deletions
@@ -114,4 +114,6 @@ For keyboards that report supporting mice the keyboard grab will be delayed unti Instead of installing gsr-global-hotkeys in flatpak use kms-server-proxy to launch gsr-global-hotkeys inside the flatpak with root, just like gsr-kms-server. This removes the need to update gsr-global-hotkeys everytime there is an update. -Check if "modprobe uinput" is needed on some systems (old fedora?).
\ No newline at end of file +Check if "modprobe uinput" is needed on some systems (old fedora?). + +Add recording timer to see duration of recording/streaming.
\ No newline at end of file diff --git a/include/Overlay.hpp b/include/Overlay.hpp index a4e75dc..b14db09 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -185,5 +185,8 @@ namespace gsr { std::unique_ptr<GlobalHotkeysJoystick> global_hotkeys_js = nullptr; Display *x11_mapping_display = nullptr; XEvent x11_mapping_xev; + + mgl::Clock replay_save_clock; + bool replay_save_show_notification = false; }; }
\ No newline at end of file diff --git a/src/Overlay.cpp b/src/Overlay.cpp index f542374..6637350 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -41,6 +41,7 @@ namespace gsr { static const mgl::Color bg_color(0, 0, 0, 100); static const double force_window_on_top_timeout_seconds = 1.0; static const double replay_status_update_check_timeout_seconds = 1.0; + static const double replay_saving_notification_timeout_seconds = 0.5; static mgl::Texture texture_from_ximage(XImage *img) { uint8_t *texture_data = (uint8_t*)malloc(img->width * img->height * 3); @@ -1484,6 +1485,11 @@ namespace gsr { } void Overlay::update_gsr_replay_save() { + if(replay_save_show_notification && replay_save_clock.get_elapsed_time_seconds() >= replay_saving_notification_timeout_seconds) { + replay_save_show_notification = false; + show_notification("Saving replay, this might take some time", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY); + } + if(gpu_screen_recorder_process_output_file) { char buffer[1024]; char *replay_saved_filepath = fgets(buffer, sizeof(buffer), gpu_screen_recorder_process_output_file); @@ -1803,6 +1809,8 @@ namespace gsr { if(recording_status != RecordingStatus::REPLAY || gpu_screen_recorder_process <= 0) return; + replay_save_show_notification = true; + replay_save_clock.restart(); kill(gpu_screen_recorder_process, SIGUSR1); } @@ -1820,6 +1828,7 @@ namespace gsr { } paused = false; + replay_save_show_notification = false; // window->close(); // usleep(1000 * 50); // 50 milliseconds diff --git a/tools/gsr-global-hotkeys/README.md b/tools/gsr-global-hotkeys/README.md new file mode 100644 index 0000000..8744107 --- /dev/null +++ b/tools/gsr-global-hotkeys/README.md @@ -0,0 +1,21 @@ +# About +Global hotkeys for X11 and all Wayland compositors by using linux device api. Keyboards are grabbed and only the non-hotkey keys are passed through to the system. +The program accepts text commands as input. Run the program with the option `--virtual` to only grab virtual devices. This is useful when using keyboard input mapping software such as +kanata, otherwise kanata may fail to launch or this program may fail to launch. +# Commands +## Bind +To add a key send `bind <action> <keycode+keycode+...><newline>` to the programs stdin, for example: +``` +bind show_hide 56+44 + +``` +which will bind alt+z. When alt+z is pressed the program will output `show_hide` (and a newline) to stdout. +The program only accepts one key for each keybind command but accepts a multiple modifier keys. +The keybinding requires at least one modifier key (ctrl, alt, super or shift) and a key to be used. +The keycodes are values from `<linux/input-event-codes.h>` linux api header (which is the same as X11 keycode value minus 8). +## Unbind +To unbind all keys send `unbind_all<newline>` to the programs stdin, for example: +``` +unbind_all + +```
\ No newline at end of file diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c index 7c68320..6973d4b 100644 --- a/tools/gsr-global-hotkeys/keyboard_event.c +++ b/tools/gsr-global-hotkeys/keyboard_event.c @@ -523,6 +523,7 @@ void keyboard_event_deinit(keyboard_event *self) { self->num_global_hotkeys = 0; if(self->uinput_fd > 0) { + ioctl(self->uinput_fd, UI_DEV_DESTROY); close(self->uinput_fd); self->uinput_fd = -1; } |