mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Flatpak improvement: add command to add xdg autostart, add startup command string
This commit is contained in:
@@ -1353,8 +1353,10 @@ namespace gsr {
|
||||
return;
|
||||
|
||||
if(exit_status == 67) {
|
||||
const bool is_flatpak = getenv("FLATPAK_ID") != nullptr;
|
||||
const char *startup_command = is_flatpak ? "flatpak run com.dec05eba.gpu_screen_recorder gsr-ui" : "gsr-ui launch-daemon";
|
||||
show_notification(
|
||||
TR("To enable autorun: install and configure 'dex' (recommended), or manually add 'gsr-ui launch-daemon' to your desktop autostart entries."),
|
||||
TRF("To enable autorun: install and configure 'dex' (recommended), or manually add '%s' to your desktop autostart entries.", startup_command).c_str(),
|
||||
10.0,
|
||||
mgl::Color(255, 255, 255),
|
||||
mgl::Color(255, 0, 0),
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace gsr {
|
||||
|
||||
const bool is_flatpak = getenv("FLATPAK_ID") != nullptr;
|
||||
const char *exec_line = is_flatpak
|
||||
? "Exec=flatpak run com.dec05eba.gpu_screen_recorder gsr-ui launch-daemon"
|
||||
? "Exec=flatpak run com.dec05eba.gpu_screen_recorder gsr-ui"
|
||||
: "Exec=gsr-ui launch-daemon";
|
||||
|
||||
std::string content =
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -149,7 +149,8 @@ enum class LaunchAction {
|
||||
LAUNCH_SHOW,
|
||||
LAUNCH_HIDE,
|
||||
LAUNCH_HIDE_ANNOUNCE,
|
||||
LAUNCH_DAEMON
|
||||
LAUNCH_DAEMON,
|
||||
INSTALL_STARTUP
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -190,6 +191,8 @@ int main(int argc, char **argv) {
|
||||
launch_action = LaunchAction::LAUNCH_HIDE_ANNOUNCE;
|
||||
} else if(strcmp(launch_action_opt, "launch-daemon") == 0) {
|
||||
launch_action = LaunchAction::LAUNCH_DAEMON;
|
||||
} else if(strcmp(launch_action_opt, "install-startup") == 0) {
|
||||
launch_action = LaunchAction::INSTALL_STARTUP;
|
||||
} else {
|
||||
printf("error: invalid action \"%s\", expected \"launch-show\", \"launch-hide\", \"launch-hide-announce\" or \"launch-daemon\".\n", launch_action_opt);
|
||||
usage();
|
||||
@@ -198,6 +201,9 @@ int main(int argc, char **argv) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if(launch_action == LaunchAction::INSTALL_STARTUP)
|
||||
return gsr::set_xdg_autostart(true);
|
||||
|
||||
set_display_server_environment_variables();
|
||||
|
||||
const std::string gsr_icon_path = resources_path + "images/gpu_screen_recorder_logo.png";
|
||||
@@ -306,8 +312,10 @@ int main(int argc, char **argv) {
|
||||
if(gsr::is_systemd_service_enabled(deprecated_systemd_service_name)) {
|
||||
const int autostart_result = gsr::set_xdg_autostart(true);
|
||||
if(autostart_result == 67) {
|
||||
const bool is_flatpak = getenv("FLATPAK_ID") != nullptr;
|
||||
const char *startup_command = is_flatpak ? "flatpak run com.dec05eba.gpu_screen_recorder gsr-ui" : "gsr-ui launch-daemon";
|
||||
overlay->show_notification(
|
||||
TR("GPU Screen Recorder UI autostart via systemd is deprecated.\nTo migrate: install and configure 'dex' (recommended),\nor manually add 'gsr-ui launch-daemon' to your desktop autostart entries."),
|
||||
TRF("GPU Screen Recorder UI autostart via systemd is deprecated.\nTo migrate: install and configure 'dex' (recommended),\nor manually add '%s' to your desktop autostart entries.", startup_command).c_str(),
|
||||
10.0, mgl::Color(255, 255, 255), mgl::Color(255, 0, 0),
|
||||
gsr::NotificationType::NOTICE, nullptr, gsr::NotificationLevel::ERROR);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user