feat(session): switch desktop environments through logind sessions
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.
This commit is contained in:
11 files changed
+883
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fws {
|
||||
|
||||
struct DesktopEntry {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string exec;
|
||||
std::string desktops;
|
||||
bool wayland = false;
|
||||
};
|
||||
|
||||
struct SessionInfo {
|
||||
std::string id;
|
||||
std::string user;
|
||||
std::string seat;
|
||||
std::string tty;
|
||||
std::string type; // x11, wayland, tty, ...
|
||||
std::string desktop; // KDE, GNOME, Hyprland, ...
|
||||
bool active = false;
|
||||
bool graphical = false;
|
||||
};
|
||||
|
||||
// Reads /usr/share/xsessions and /usr/share/wayland-sessions.
|
||||
std::vector<DesktopEntry> listInstalledDesktops();
|
||||
|
||||
// Reads the current user's graphical sessions from systemd-logind.
|
||||
std::vector<SessionInfo> listGraphicalSessions();
|
||||
|
||||
std::string currentSessionId();
|
||||
std::string currentDesktopName();
|
||||
|
||||
} // namespace fws
|
||||
Reference in new issue
Block a user