mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-19 16:35:49 +09:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ee2b95384 | ||
|
|
d610a980f8 | ||
|
|
70780ae14e | ||
|
|
5f7cb94f4e | ||
|
|
748c51e2b6 | ||
|
|
3ba9ce771b | ||
|
|
c18b062180 | ||
|
|
705da21363 | ||
|
|
609a3e54fd | ||
|
|
4e62d12e8c | ||
|
|
b4e003c8f7 | ||
|
|
9efe9d3c91 | ||
|
|
ef4a0fe7cb |
14
README.md
14
README.md
@@ -4,18 +4,18 @@
|
|||||||
A fullscreen overlay UI for [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/about/) in the style of ShadowPlay.\
|
A fullscreen overlay UI for [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/about/) in the style of ShadowPlay.\
|
||||||
The application is currently primarly designed for X11 but it can run on Wayland as well through XWayland, with some caveats because of Wayland limitations.
|
The application is currently primarly designed for X11 but it can run on Wayland as well through XWayland, with some caveats because of Wayland limitations.
|
||||||
|
|
||||||
# Usage
|
|
||||||
You can start the overlay UI and make it start automatically on system startup by running `systemctl enable --now --user gpu-screen-recorder-ui`.
|
|
||||||
Alternatively you can run `gsr-ui` and go into settings and enable start on system startup setting.\
|
|
||||||
Press `Left Alt+Z` to show/hide the UI. Go into settings to view all of the different hotkeys configured.\
|
|
||||||
If you use a non-systemd distro and want to start the UI on system startup then you have to manually add `gsr-ui` to your system startup script.\
|
|
||||||
A program called `gsr-ui-cli` is also installed when installing this software. This can be used to remotely control the UI. Run `gsr-ui-cli --help` to list the available commands.
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
If you are using an Arch Linux based distro then you can find gpu screen recorder ui on aur under the name gpu-screen-recorder-ui (`yay -S gpu-screen-recorder-ui`).\
|
If you are using an Arch Linux based distro then you can find gpu screen recorder ui on aur under the name gpu-screen-recorder-ui (`yay -S gpu-screen-recorder-ui`).\
|
||||||
If you are running another distro then you can run `sudo ./install.sh`, but you need to manually install the dependencies, as described below.\
|
If you are running another distro then you can run `sudo ./install.sh`, but you need to manually install the dependencies, as described below.\
|
||||||
You can also install gpu screen recorder from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder) which includes this UI.
|
You can also install gpu screen recorder from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder) which includes this UI.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
Press `Left Alt+Z` to show/hide the UI. Go into settings (the icon on the right) to view all of the different hotkeys configured.\
|
||||||
|
You can start the overlay UI and make it start automatically on system startup by running `systemctl enable --now --user gpu-screen-recorder-ui`.
|
||||||
|
Alternatively you can run `gsr-ui` and go into settings and enable start on system startup setting.\
|
||||||
|
If you use a non-systemd distro and want to start the UI on system startup then you have to manually add `gsr-ui launch-daemon` to your system startup script.\
|
||||||
|
A program called `gsr-ui-cli` is also installed when installing this software. This can be used to remotely control the UI. Run `gsr-ui-cli --help` to list the available commands.
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
GPU Screen Recorder UI uses meson build system so you need to install `meson` to build GPU Screen Recorder UI.
|
GPU Screen Recorder UI uses meson build system so you need to install `meson` to build GPU Screen Recorder UI.
|
||||||
|
|
||||||
|
|||||||
5
TODO
5
TODO
@@ -206,3 +206,8 @@ Support localization.
|
|||||||
Add option to not capture cursor in screenshot when doing region/window capture.
|
Add option to not capture cursor in screenshot when doing region/window capture.
|
||||||
|
|
||||||
Window selection doesn't work when a window is fullscreen on x11.
|
Window selection doesn't work when a window is fullscreen on x11.
|
||||||
|
|
||||||
|
Make it possible to change replay duration of the "save 1 min" and "save 10 min" by adding them to the replay settings as options.
|
||||||
|
|
||||||
|
If replay duration is set below the "save 1 min" or "save 10 min" then gray them out and when hovering over those buttons
|
||||||
|
show a tooltip that says that those buttons cant be used because the replay duration in replay settings is set to a lower value than that (and display the replay duration there).
|
||||||
Submodule depends/mglpp updated: 8489234dcb...6e720fe411
@@ -19,7 +19,9 @@ namespace gsr {
|
|||||||
void draw(mgl::Window &window, mgl::vec2f offset) override;
|
void draw(mgl::Window &window, mgl::vec2f offset) override;
|
||||||
|
|
||||||
void add_item(const std::string &text, const std::string &id);
|
void add_item(const std::string &text, const std::string &id);
|
||||||
|
// The item can only be selected if it's enabled
|
||||||
void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true);
|
void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true);
|
||||||
|
void set_item_enabled(const std::string &id, bool enabled);
|
||||||
const std::string& get_selected_id() const;
|
const std::string& get_selected_id() const;
|
||||||
|
|
||||||
mgl::vec2f get_size() override;
|
mgl::vec2f get_size() override;
|
||||||
@@ -36,6 +38,7 @@ namespace gsr {
|
|||||||
mgl::Text text;
|
mgl::Text text;
|
||||||
std::string id;
|
std::string id;
|
||||||
mgl::vec2f position;
|
mgl::vec2f position;
|
||||||
|
bool enabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
mgl::vec2f max_size;
|
mgl::vec2f max_size;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
project('gsr-ui', ['c', 'cpp'], version : '1.7.4', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
|
project('gsr-ui', ['c', 'cpp'], version : '1.7.7', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
|
||||||
|
|
||||||
add_project_arguments('-D_FILE_OFFSET_BITS=64', language : ['c', 'cpp'])
|
add_project_arguments('-D_FILE_OFFSET_BITS=64', language : ['c', 'cpp'])
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ datadir = get_option('datadir')
|
|||||||
gsr_ui_resources_path = join_paths(prefix, datadir, 'gsr-ui')
|
gsr_ui_resources_path = join_paths(prefix, datadir, 'gsr-ui')
|
||||||
|
|
||||||
add_project_arguments('-DGSR_UI_VERSION="' + meson.project_version() + '"', language: ['c', 'cpp'])
|
add_project_arguments('-DGSR_UI_VERSION="' + meson.project_version() + '"', language: ['c', 'cpp'])
|
||||||
add_project_arguments('-DGSR_FLATPAK_VERSION="5.7.6"', language: ['c', 'cpp'])
|
add_project_arguments('-DGSR_FLATPAK_VERSION="5.8.2"', language: ['c', 'cpp'])
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
meson.project_name(),
|
meson.project_name(),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gsr-ui"
|
name = "gsr-ui"
|
||||||
type = "executable"
|
type = "executable"
|
||||||
version = "1.7.4"
|
version = "1.7.7"
|
||||||
platforms = ["posix"]
|
platforms = ["posix"]
|
||||||
|
|
||||||
[lang.cpp]
|
[lang.cpp]
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ namespace gsr {
|
|||||||
hide();
|
hide();
|
||||||
|
|
||||||
if(notification_process > 0) {
|
if(notification_process > 0) {
|
||||||
kill(notification_process, SIGKILL);
|
kill(notification_process, SIGINT);
|
||||||
int status;
|
int status;
|
||||||
if(waitpid(notification_process, &status, 0) == -1) {
|
if(waitpid(notification_process, &status, 0) == -1) {
|
||||||
perror("waitpid failed");
|
perror("waitpid failed");
|
||||||
@@ -959,6 +959,7 @@ namespace gsr {
|
|||||||
const bool is_kwin = wm_name == "KWin";
|
const bool is_kwin = wm_name == "KWin";
|
||||||
const bool is_wlroots = wm_name.find("wlroots") != std::string::npos;
|
const bool is_wlroots = wm_name.find("wlroots") != std::string::npos;
|
||||||
const bool is_hyprland = wm_name.find("Hyprland") != std::string::npos;
|
const bool is_hyprland = wm_name.find("Hyprland") != std::string::npos;
|
||||||
|
//const bool is_smithay = wm_name.find("Smithay") != std::string::npos;
|
||||||
const bool hyprland_waybar_is_dock = is_hyprland && is_hyprland_waybar_running_as_dock();
|
const bool hyprland_waybar_is_dock = is_hyprland && is_hyprland_waybar_running_as_dock();
|
||||||
|
|
||||||
std::optional<CursorInfo> cursor_info;
|
std::optional<CursorInfo> cursor_info;
|
||||||
@@ -986,8 +987,7 @@ namespace gsr {
|
|||||||
// Wayland doesn't allow XGrabPointer/XGrabKeyboard when a wayland application is focused.
|
// Wayland doesn't allow XGrabPointer/XGrabKeyboard when a wayland application is focused.
|
||||||
// If the focused window is a wayland application then don't use override redirect and instead create
|
// If the focused window is a wayland application then don't use override redirect and instead create
|
||||||
// a fullscreen window for the ui.
|
// a fullscreen window for the ui.
|
||||||
// TODO: (x11_cursor_window && is_window_fullscreen_on_monitor(display, x11_cursor_window, *focused_monitor))
|
const bool prevent_game_minimizing = gsr_info.system_info.display_server != DisplayServer::WAYLAND || (x11_cursor_window && is_window_fullscreen_on_monitor(display, x11_cursor_window, *focused_monitor)) || is_wlroots || is_hyprland;
|
||||||
const bool prevent_game_minimizing = gsr_info.system_info.display_server != DisplayServer::WAYLAND || x11_cursor_window || is_wlroots || is_hyprland;
|
|
||||||
|
|
||||||
if(prevent_game_minimizing) {
|
if(prevent_game_minimizing) {
|
||||||
window_pos = focused_monitor->position;
|
window_pos = focused_monitor->position;
|
||||||
@@ -1700,7 +1700,7 @@ namespace gsr {
|
|||||||
notification_args[arg_index++] = nullptr;
|
notification_args[arg_index++] = nullptr;
|
||||||
|
|
||||||
if(notification_process > 0) {
|
if(notification_process > 0) {
|
||||||
kill(notification_process, SIGKILL);
|
kill(notification_process, SIGINT);
|
||||||
int status = 0;
|
int status = 0;
|
||||||
waitpid(notification_process, &status, 0);
|
waitpid(notification_process, &status, 0);
|
||||||
}
|
}
|
||||||
@@ -1828,8 +1828,6 @@ namespace gsr {
|
|||||||
result += std::to_string(seconds) + " second" + (seconds == 1 ? "" : "s");
|
result += std::to_string(seconds) + " second" + (seconds == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "to duration string: %f, %d, %d, %d\n", duration_sec, seconds, minutes, hours);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2560,6 +2558,14 @@ namespace gsr {
|
|||||||
*container = change_container_if_codec_not_supported(*video_codec, *container);
|
*container = change_container_if_codec_not_supported(*video_codec, *container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string get_framerate_mode_validate(const RecordOptions &record_options, const GsrInfo &gsr_info) {
|
||||||
|
(void)gsr_info;
|
||||||
|
std::string framerate_mode = record_options.framerate_mode;
|
||||||
|
if(framerate_mode == "auto")
|
||||||
|
framerate_mode = "vfr";
|
||||||
|
return framerate_mode;
|
||||||
|
}
|
||||||
|
|
||||||
bool Overlay::on_press_start_replay(bool disable_notification, bool finished_selection) {
|
bool Overlay::on_press_start_replay(bool disable_notification, bool finished_selection) {
|
||||||
if(region_selector.is_started() || window_selector.is_started())
|
if(region_selector.is_started() || window_selector.is_started())
|
||||||
return false;
|
return false;
|
||||||
@@ -2632,7 +2638,7 @@ namespace gsr {
|
|||||||
const std::string video_bitrate = std::to_string(config.replay_config.record_options.video_bitrate);
|
const std::string video_bitrate = std::to_string(config.replay_config.record_options.video_bitrate);
|
||||||
const std::string output_directory = config.replay_config.save_directory;
|
const std::string output_directory = config.replay_config.save_directory;
|
||||||
const std::vector<std::string> audio_tracks = create_audio_tracks_cli_args(config.replay_config.record_options.audio_tracks_list, gsr_info);
|
const std::vector<std::string> audio_tracks = create_audio_tracks_cli_args(config.replay_config.record_options.audio_tracks_list, gsr_info);
|
||||||
const std::string framerate_mode = config.replay_config.record_options.framerate_mode == "auto" ? "vfr" : config.replay_config.record_options.framerate_mode;
|
const std::string framerate_mode = get_framerate_mode_validate(config.replay_config.record_options, gsr_info);
|
||||||
const std::string replay_time = std::to_string(config.replay_config.replay_time);
|
const std::string replay_time = std::to_string(config.replay_config.replay_time);
|
||||||
const char *container = config.replay_config.container.c_str();
|
const char *container = config.replay_config.container.c_str();
|
||||||
const char *video_codec = config.replay_config.record_options.video_codec.c_str();
|
const char *video_codec = config.replay_config.record_options.video_codec.c_str();
|
||||||
@@ -2829,7 +2835,7 @@ namespace gsr {
|
|||||||
const std::string video_bitrate = std::to_string(config.record_config.record_options.video_bitrate);
|
const std::string video_bitrate = std::to_string(config.record_config.record_options.video_bitrate);
|
||||||
const std::string output_file = config.record_config.save_directory + "/Video_" + get_date_str() + "." + container_to_file_extension(config.record_config.container.c_str());
|
const std::string output_file = config.record_config.save_directory + "/Video_" + get_date_str() + "." + container_to_file_extension(config.record_config.container.c_str());
|
||||||
const std::vector<std::string> audio_tracks = create_audio_tracks_cli_args(config.record_config.record_options.audio_tracks_list, gsr_info);
|
const std::vector<std::string> audio_tracks = create_audio_tracks_cli_args(config.record_config.record_options.audio_tracks_list, gsr_info);
|
||||||
const std::string framerate_mode = config.record_config.record_options.framerate_mode == "auto" ? "vfr" : config.record_config.record_options.framerate_mode;
|
const std::string framerate_mode = get_framerate_mode_validate(config.record_config.record_options, gsr_info);
|
||||||
const char *container = config.record_config.container.c_str();
|
const char *container = config.record_config.container.c_str();
|
||||||
const char *video_codec = config.record_config.record_options.video_codec.c_str();
|
const char *video_codec = config.record_config.record_options.video_codec.c_str();
|
||||||
const char *encoder = "gpu";
|
const char *encoder = "gpu";
|
||||||
@@ -3005,7 +3011,7 @@ namespace gsr {
|
|||||||
// But we check it anyways as streaming on some sites can fail if there is more than one audio track
|
// But we check it anyways as streaming on some sites can fail if there is more than one audio track
|
||||||
if(audio_tracks.size() > 1)
|
if(audio_tracks.size() > 1)
|
||||||
audio_tracks.resize(1);
|
audio_tracks.resize(1);
|
||||||
const std::string framerate_mode = config.streaming_config.record_options.framerate_mode == "auto" ? "vfr" : config.streaming_config.record_options.framerate_mode;
|
const std::string framerate_mode = get_framerate_mode_validate(config.streaming_config.record_options, gsr_info);
|
||||||
const char *container = "flv";
|
const char *container = "flv";
|
||||||
if(config.streaming_config.streaming_service == "custom")
|
if(config.streaming_config.streaming_service == "custom")
|
||||||
container = config.streaming_config.custom.container.c_str();
|
container = config.streaming_config.custom.container.c_str();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace gsr {
|
|||||||
for(size_t i = 0; i < items.size(); ++i) {
|
for(size_t i = 0; i < items.size(); ++i) {
|
||||||
Item &item = items[i];
|
Item &item = items[i];
|
||||||
item_size.y = padding_top + item.text.get_bounds().size.y + padding_bottom;
|
item_size.y = padding_top + item.text.get_bounds().size.y + padding_bottom;
|
||||||
if(mgl::FloatRect(item.position, item_size).contains(mouse_pos)) {
|
if(mgl::FloatRect(item.position, item_size).contains(mouse_pos) && item.enabled) {
|
||||||
const size_t prev_selected_item = selected_item;
|
const size_t prev_selected_item = selected_item;
|
||||||
selected_item = i;
|
selected_item = i;
|
||||||
show_dropdown = false;
|
show_dropdown = false;
|
||||||
@@ -93,7 +93,7 @@ namespace gsr {
|
|||||||
void ComboBox::set_selected_item(const std::string &id, bool trigger_event, bool trigger_event_even_if_selection_not_changed) {
|
void ComboBox::set_selected_item(const std::string &id, bool trigger_event, bool trigger_event_even_if_selection_not_changed) {
|
||||||
for(size_t i = 0; i < items.size(); ++i) {
|
for(size_t i = 0; i < items.size(); ++i) {
|
||||||
auto &item = items[i];
|
auto &item = items[i];
|
||||||
if(item.id == id) {
|
if(item.id == id && item.enabled) {
|
||||||
const size_t prev_selected_item = selected_item;
|
const size_t prev_selected_item = selected_item;
|
||||||
selected_item = i;
|
selected_item = i;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
@@ -106,6 +106,22 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComboBox::set_item_enabled(const std::string &id, bool enabled) {
|
||||||
|
for(size_t i = 0; i < items.size(); ++i) {
|
||||||
|
auto &item = items[i];
|
||||||
|
if(item.id == id) {
|
||||||
|
item.enabled = enabled;
|
||||||
|
item.text.set_color(item.enabled ? mgl::Color(255, 255, 255, 255) : mgl::Color(255, 255, 255, 80));
|
||||||
|
if(selected_item == i) {
|
||||||
|
selected_item = 0;
|
||||||
|
show_dropdown = false;
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& ComboBox::get_selected_id() const {
|
const std::string& ComboBox::get_selected_id() const {
|
||||||
if(items.empty()) {
|
if(items.empty()) {
|
||||||
static std::string dummy;
|
static std::string dummy;
|
||||||
@@ -150,7 +166,7 @@ namespace gsr {
|
|||||||
Item &item = items[i];
|
Item &item = items[i];
|
||||||
item_size.y = padding_top + item.text.get_bounds().size.y + padding_bottom;
|
item_size.y = padding_top + item.text.get_bounds().size.y + padding_bottom;
|
||||||
|
|
||||||
if(!cursor_inside) {
|
if(!cursor_inside && item.enabled) {
|
||||||
cursor_inside = mgl::FloatRect(items_draw_pos, item_size).contains(mouse_pos);
|
cursor_inside = mgl::FloatRect(items_draw_pos, item_size).contains(mouse_pos);
|
||||||
if(cursor_inside) {
|
if(cursor_inside) {
|
||||||
mgl::Rectangle item_background(items_draw_pos.floor(), item_size.floor());
|
mgl::Rectangle item_background(items_draw_pos.floor(), item_size.floor());
|
||||||
|
|||||||
@@ -568,6 +568,10 @@ namespace gsr {
|
|||||||
framerate_mode_box->add_item("Auto (Recommended)", "auto");
|
framerate_mode_box->add_item("Auto (Recommended)", "auto");
|
||||||
framerate_mode_box->add_item("Constant", "cfr");
|
framerate_mode_box->add_item("Constant", "cfr");
|
||||||
framerate_mode_box->add_item("Variable", "vfr");
|
framerate_mode_box->add_item("Variable", "vfr");
|
||||||
|
if(gsr_info->system_info.display_server == DisplayServer::X11)
|
||||||
|
framerate_mode_box->add_item("Sync to content", "content");
|
||||||
|
else
|
||||||
|
framerate_mode_box->add_item("Sync to content (Only X11 or desktop portal capture)", "content");
|
||||||
framerate_mode_box_ptr = framerate_mode_box.get();
|
framerate_mode_box_ptr = framerate_mode_box.get();
|
||||||
return framerate_mode_box;
|
return framerate_mode_box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,9 @@ enum class LaunchAction {
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
setlocale(LC_ALL, "C"); // Sigh... stupid C
|
setlocale(LC_ALL, "C"); // Sigh... stupid C
|
||||||
|
#ifdef __GLIBC__
|
||||||
mallopt(M_MMAP_THRESHOLD, 65536);
|
mallopt(M_MMAP_THRESHOLD, 65536);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(geteuid() == 0) {
|
if(geteuid() == 0) {
|
||||||
fprintf(stderr, "Error: don't run gsr-ui as the root user\n");
|
fprintf(stderr, "Error: don't run gsr-ui as the root user\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user