feat(gui): ship a themed single-binary desk manager
The CLI, the separate helper and the GUI duplicated entry points, so a launch required two installed executables. pkexec now reuses the same binary through --privileged-launch, and the window adopts the dark landing-page look of the project site instead of the default GTK styling.
This commit is contained in:
10 files changed
+326
-678
No files matched your search
+10
-11
@@ -26,7 +26,9 @@ constexpr int kPollIntervalMs = 250;
|
||||
// unit stops, SDDM starts, PAM opens the session and the desktop paints.
|
||||
constexpr int kLoginTimeoutMs = 90000;
|
||||
|
||||
constexpr const char* kHelperName = "fws-deskmanager-launch";
|
||||
constexpr const char* kHelperName = "fws-deskmanager";
|
||||
// Hidden switch that turns the single binary into the privileged helper.
|
||||
constexpr const char* kHelperMode = "--privileged-launch";
|
||||
|
||||
std::string lower(std::string value) {
|
||||
std::transform(value.begin(), value.end(), value.begin(),
|
||||
@@ -107,19 +109,16 @@ std::string currentUserName() {
|
||||
return account != nullptr ? std::string(account->pw_name) : std::string();
|
||||
}
|
||||
|
||||
// The helper is installed next to the caller (build tree included) and has to be
|
||||
// an absolute path for pkexec.
|
||||
// The privileged mode lives in the same executable, so pkexec has to run this
|
||||
// very binary; it needs an absolute path either way.
|
||||
std::string launchHelperPath() {
|
||||
char buffer[PATH_MAX] = {};
|
||||
const ssize_t length = readlink("/proc/self/exe", buffer, sizeof(buffer) - 1);
|
||||
if (length > 0) {
|
||||
const std::filesystem::path sibling =
|
||||
std::filesystem::path(std::string(buffer, static_cast<std::size_t>(length)))
|
||||
.parent_path() /
|
||||
kHelperName;
|
||||
const std::filesystem::path self(std::string(buffer, static_cast<std::size_t>(length)));
|
||||
std::error_code code;
|
||||
if (std::filesystem::is_regular_file(sibling, code) && access(sibling.c_str(), X_OK) == 0) {
|
||||
return sibling.string();
|
||||
if (std::filesystem::is_regular_file(self, code) && access(self.c_str(), X_OK) == 0) {
|
||||
return self.string();
|
||||
}
|
||||
}
|
||||
return findExecutable(kHelperName);
|
||||
@@ -272,7 +271,7 @@ LaunchOutcome launchDesktop(const DesktopProfile& profile) {
|
||||
|
||||
const std::string helper = launchHelperPath();
|
||||
if (helper.empty()) {
|
||||
outcome.error = std::string(kHelperName) + " est introuvable a cote de l'application.";
|
||||
outcome.error = std::string(kHelperName) + " est introuvable.";
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@@ -283,7 +282,7 @@ LaunchOutcome launchDesktop(const DesktopProfile& profile) {
|
||||
}
|
||||
|
||||
const CommandResult result =
|
||||
runCommand({"pkexec", helper, "launch", user, sessionFile});
|
||||
runCommand({"pkexec", helper, kHelperMode, user, sessionFile});
|
||||
if (!result.started) {
|
||||
outcome.error = "Impossible de lancer pkexec pour preparer la connexion automatique.";
|
||||
return outcome;
|
||||
|
||||
Reference in new issue
Block a user