kms: use /tmp directory for temporary unix domain socket to fix too long path with AppImage portable home

This commit is contained in:
dec05eba
2025-07-06 18:00:33 +02:00
parent 2c0c53b5b3
commit 0cda785bc8
2 changed files with 11 additions and 2 deletions

6
TODO
View File

@@ -308,4 +308,8 @@ Add proper check if opengl functions are supported. dlsym for the symbol will re
Colors are offset to bottom left by 1 pixel or so on steam deck in landscape mode.
When constant framerate is used (and for audio) multiple frames need to be encoded after resuming from suspend.
The clock jumps forward by around 2-3 seconds (on my machine). Is there a way to make sure the clock doesn't jump forward?
The clock jumps forward by around 2-3 seconds (on my machine). Is there a way to make sure the clock doesn't jump forward?
Colors are correct, but they look incorrect for thin elements, such as colored text. This can be improved by sampling neighbor pixels for color average.
Record first video/audio frame immediately.

View File

@@ -119,8 +119,11 @@ static int recv_msg_from_server(int server_pid, int server_fd, gsr_kms_response
/* We have to use $HOME because in flatpak there is no simple path that is accessible, read and write, that multiple flatpak instances can access */
static bool create_socket_path(char *output_path, size_t output_path_size) {
const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
const char *home = getenv("HOME");
if(!home)
// Portable home with AppImage can cause the socket path to be longer than 108 characters (unix domain socket path max length).
// Using gsr-kms-socket in $HOME is only needed in flatpak, so use /tmp everywhere else instead.
if(!home || !inside_flatpak)
home = "/tmp";
char random_characters[11];
@@ -318,6 +321,8 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
self->kms_server_pid = pid;
}
// We need this dumb-shit retardation with unix domain socket and then replace it with socketpair because
// pkexec doesn't work with socketpair................
fprintf(stderr, "gsr info: gsr_kms_client_init: waiting for server to connect\n");
struct pollfd poll_fd = {
.fd = self->initial_socket_fd,