mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Show error notification if another gpu screen recorder process is running when starting the ui
This commit is contained in:
4
TODO
4
TODO
@@ -180,4 +180,6 @@ Support vector graphics. Maybe support svg, rendering it to a texture for better
|
|||||||
|
|
||||||
Support freetype for text rendering. Maybe load freetype as runtime (with dlopen) and use that when available and fallback to stb_freetype if not available.
|
Support freetype for text rendering. Maybe load freetype as runtime (with dlopen) and use that when available and fallback to stb_freetype if not available.
|
||||||
|
|
||||||
Show .webm container option. It's currently chosen automatically if vp8/vp9 is chosen. The available containers should automatically switch depending on the video codec.
|
Show .webm container option. It's currently chosen automatically if vp8/vp9 is chosen. The available containers should automatically switch depending on the video codec.
|
||||||
|
|
||||||
|
In settings show audio levels for each audio. Maybe show audio level image beside the audio name in the dropdown box and switch to a different image (have 3-4 different images for each level) depending on the volume.
|
||||||
|
|||||||
@@ -176,11 +176,21 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *get_basename(const char *path, int size) {
|
||||||
|
for(int i = size - 1; i >= 0; --i) {
|
||||||
|
if(path[i] == '/')
|
||||||
|
return path + i + 1;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// |output_buffer| should be at least PATH_MAX in size
|
// |output_buffer| should be at least PATH_MAX in size
|
||||||
bool read_cmdline_arg0(const char *filepath, char *output_buffer, int output_buffer_size) {
|
bool read_cmdline_arg0(const char *filepath, char *output_buffer, int output_buffer_size) {
|
||||||
output_buffer[0] = '\0';
|
output_buffer[0] = '\0';
|
||||||
|
|
||||||
|
const char *arg0_start = NULL;
|
||||||
const char *arg0_end = NULL;
|
const char *arg0_end = NULL;
|
||||||
|
int arg0_size = 0;
|
||||||
int fd = open(filepath, O_RDONLY);
|
int fd = open(filepath, O_RDONLY);
|
||||||
if(fd == -1)
|
if(fd == -1)
|
||||||
return false;
|
return false;
|
||||||
@@ -190,13 +200,16 @@ namespace gsr {
|
|||||||
if(bytes_read == -1)
|
if(bytes_read == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
arg0_end = (const char*)memchr(buffer, '\0', bytes_read);
|
arg0_start = buffer;
|
||||||
|
arg0_end = (const char*)memchr(arg0_start, '\0', bytes_read);
|
||||||
if(!arg0_end)
|
if(!arg0_end)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if((arg0_end - buffer) + 1 <= output_buffer_size) {
|
arg0_start = get_basename(arg0_start, arg0_end - arg0_start);
|
||||||
memcpy(output_buffer, buffer, arg0_end - buffer);
|
arg0_size = arg0_end - arg0_start;
|
||||||
output_buffer[arg0_end - buffer] = '\0';
|
if(arg0_size + 1 <= output_buffer_size) {
|
||||||
|
memcpy(output_buffer, arg0_start, arg0_size);
|
||||||
|
output_buffer[arg0_size] = '\0';
|
||||||
close(fd);
|
close(fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,6 +240,11 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(gsr::pidof("gpu-screen-recorder", getpid()) != -1) {
|
||||||
|
const char *args[] = { "gsr-notify", "--text", "GPU Screen Recorder is already running in another process.\nPlease close it before using GPU Screen Recorder UI.", "--timeout", "5.0", "--icon-color", "ff0000", "--bg-color", "ff0000", nullptr };
|
||||||
|
gsr::exec_program_daemonized(args);
|
||||||
|
}
|
||||||
|
|
||||||
if(is_flatpak())
|
if(is_flatpak())
|
||||||
install_flatpak_systemd_service();
|
install_flatpak_systemd_service();
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user