mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Force no cursor in capture when using region/window screenshot hotkey
This commit is contained in:
@@ -3091,7 +3091,6 @@ namespace gsr {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hotkey_window_capture = false;
|
|
||||||
std::string record_area_option;
|
std::string record_area_option;
|
||||||
switch(force_type) {
|
switch(force_type) {
|
||||||
case ScreenshotForceType::NONE:
|
case ScreenshotForceType::NONE:
|
||||||
@@ -3102,7 +3101,6 @@ namespace gsr {
|
|||||||
break;
|
break;
|
||||||
case ScreenshotForceType::WINDOW:
|
case ScreenshotForceType::WINDOW:
|
||||||
record_area_option = gsr_info.system_info.display_server == DisplayServer::X11 ? "window" : "portal";
|
record_area_option = gsr_info.system_info.display_server == DisplayServer::X11 ? "window" : "portal";
|
||||||
hotkey_window_capture = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3133,10 +3131,11 @@ namespace gsr {
|
|||||||
|
|
||||||
// TODO: Validate input, fallback to valid values
|
// TODO: Validate input, fallback to valid values
|
||||||
const std::string output_file = config.screenshot_config.save_directory + "/Screenshot_" + get_date_str() + "." + config.screenshot_config.image_format; // TODO: Validate image format
|
const std::string output_file = config.screenshot_config.save_directory + "/Screenshot_" + get_date_str() + "." + config.screenshot_config.image_format; // TODO: Validate image format
|
||||||
|
const bool capture_cursor = force_type == ScreenshotForceType::NONE && config.screenshot_config.record_cursor;
|
||||||
|
|
||||||
std::vector<const char*> args = {
|
std::vector<const char*> args = {
|
||||||
"gpu-screen-recorder", "-w", screenshot_capture_target.c_str(),
|
"gpu-screen-recorder", "-w", screenshot_capture_target.c_str(),
|
||||||
"-cursor", config.screenshot_config.record_cursor ? "yes" : "no",
|
"-cursor", capture_cursor ? "yes" : "no",
|
||||||
"-v", "no",
|
"-v", "no",
|
||||||
"-q", config.screenshot_config.image_quality.c_str(),
|
"-q", config.screenshot_config.image_quality.c_str(),
|
||||||
"-o", output_file.c_str()
|
"-o", output_file.c_str()
|
||||||
@@ -3150,7 +3149,7 @@ namespace gsr {
|
|||||||
args.push_back(size);
|
args.push_back(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.screenshot_config.restore_portal_session && !hotkey_window_capture) {
|
if(config.screenshot_config.restore_portal_session && force_type != ScreenshotForceType::WINDOW) {
|
||||||
args.push_back("-restore-portal-session");
|
args.push_back("-restore-portal-session");
|
||||||
args.push_back("yes");
|
args.push_back("yes");
|
||||||
}
|
}
|
||||||
@@ -3158,7 +3157,7 @@ namespace gsr {
|
|||||||
const std::string hotkey_window_capture_portal_session_token_filepath = get_config_dir() + "/gpu-screen-recorder/gsr-ui-window-capture-token";
|
const std::string hotkey_window_capture_portal_session_token_filepath = get_config_dir() + "/gpu-screen-recorder/gsr-ui-window-capture-token";
|
||||||
if(record_area_option == "portal") {
|
if(record_area_option == "portal") {
|
||||||
hide_ui = true;
|
hide_ui = true;
|
||||||
if(hotkey_window_capture) {
|
if(force_type == ScreenshotForceType::WINDOW) {
|
||||||
args.push_back("-portal-session-token-filepath");
|
args.push_back("-portal-session-token-filepath");
|
||||||
args.push_back(hotkey_window_capture_portal_session_token_filepath.c_str());
|
args.push_back(hotkey_window_capture_portal_session_token_filepath.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
20
src/main.cpp
20
src/main.cpp
@@ -102,24 +102,6 @@ static void rpc_add_commands(gsr::Rpc *rpc, gsr::Overlay *overlay) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_gsr_ui_virtual_keyboard_running() {
|
|
||||||
FILE *f = fopen("/proc/bus/input/devices", "rb");
|
|
||||||
if(!f)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool virtual_keyboard_running = false;
|
|
||||||
char line[1024];
|
|
||||||
while(fgets(line, sizeof(line), f)) {
|
|
||||||
if(strstr(line, "gsr-ui virtual keyboard")) {
|
|
||||||
virtual_keyboard_running = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
return virtual_keyboard_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void install_flatpak_systemd_service() {
|
static void install_flatpak_systemd_service() {
|
||||||
const bool systemd_service_exists = system(
|
const bool systemd_service_exists = system(
|
||||||
"data_home=$(flatpak-spawn --host -- /bin/sh -c 'echo \"${XDG_DATA_HOME:-$HOME/.local/share}\"') && "
|
"data_home=$(flatpak-spawn --host -- /bin/sh -c 'echo \"${XDG_DATA_HOME:-$HOME/.local/share}\"') && "
|
||||||
@@ -228,7 +210,7 @@ int main(int argc, char **argv) {
|
|||||||
auto rpc = std::make_unique<gsr::Rpc>();
|
auto rpc = std::make_unique<gsr::Rpc>();
|
||||||
const gsr::RpcOpenResult rpc_open_result = rpc->open("gsr-ui");
|
const gsr::RpcOpenResult rpc_open_result = rpc->open("gsr-ui");
|
||||||
|
|
||||||
if(is_gsr_ui_virtual_keyboard_running() || rpc_open_result == gsr::RpcOpenResult::OK) {
|
if(rpc_open_result == gsr::RpcOpenResult::OK) {
|
||||||
if(launch_action == LaunchAction::LAUNCH_DAEMON)
|
if(launch_action == LaunchAction::LAUNCH_DAEMON)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user