Activate the target graphical session instead of rebooting, so a KDE or GNOME session stays alive while another one is used. Switching relies on logind VT activation, which needs no root privileges and never restarts the display manager.
24 lines
573 B
C++
24 lines
573 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace fws {
|
|
|
|
struct CommandResult {
|
|
bool started = false;
|
|
int exitCode = -1;
|
|
std::string output;
|
|
};
|
|
|
|
// Runs an executable directly (no shell) and captures stdout and stderr.
|
|
CommandResult runCommand(const std::vector<std::string>& arguments);
|
|
|
|
// Resolves a program name against PATH, returning an empty string when absent.
|
|
std::string findExecutable(const std::string& name);
|
|
|
|
std::string trim(const std::string& value);
|
|
std::vector<std::string> splitLines(const std::string& text);
|
|
|
|
} // namespace fws
|