[ui] Add auto-mount on first launch functionality #52

This commit is contained in:
2025-09-06 08:08:26 -05:00
parent 78abe1ed8f
commit 13fbcbab9a
7 changed files with 238 additions and 188 deletions

View File

@@ -27,6 +27,19 @@
#include "utils/config.hpp"
namespace repertory::utils {
#if defined(__linux__)
struct create_autostart_opts final {
std::string app_name;
std::optional<std::string> comment;
bool enabled{true};
std::vector<std::string> exec_args;
std::string exec_path;
std::optional<std::string> icon_path;
std::vector<std::string> only_show_in;
bool terminal{false};
};
#endif // defined(__linux__)
using passwd_callback_t = std::function<void(struct passwd *pass)>;
#if defined(__APPLE__)
@@ -37,6 +50,10 @@ template <typename thread_t>
[[nodiscard]] auto convert_to_uint64(const pthread_t &thread) -> std::uint64_t;
#endif // defined(__APPLE__)
#if defined(__linux__)
[[nodiscard]] auto create_autostart_entry(create_autostart_opts opts) -> bool;
#endif // defined(__linux__)
[[nodiscard]] auto get_last_error_code() -> int;
[[nodiscard]] auto get_thread_id() -> std::uint64_t;
@@ -48,6 +65,10 @@ void set_last_error_code(int error_code);
[[nodiscard]] auto use_getpwuid(uid_t uid, passwd_callback_t callback)
-> utils::result;
#if defined(__linux__)
[[nodiscard]] auto remove_autostart_entry(std::string_view name) -> bool;
#endif // defined(__linux__)
// template implementations
#if defined(__APPLE__)
template <typename thread_t>

View File

@@ -50,6 +50,10 @@ auto create_shortcut(const std::wstring &exe_path,
const std::wstring &location = get_startup_folder())
-> bool;
[[nodiscard]] auto
remove_shortcut(std::wstring shortcut_name,
const std::wstring &location = get_startup_folder()) -> bool;
void set_last_error_code(DWORD error_code);
} // namespace repertory::utils