Files
gKeyMapper/shared/ipc_ids.h
2026-10-18 22:58:08 +02:00

40 lines
1.8 KiB
C++

// gKeyMapper - identifiers shared by the GUI and the daemon.
//
// The D-Bus channel is control plane only: status, an explicit reload and
// notifications. A keypress never crosses it, so a slow or absent GUI cannot
// delay an action.
#ifndef GKEYMAPPER_IPC_IDS_H
#define GKEYMAPPER_IPC_IDS_H
namespace gkeymapper::ipc {
// Application id: GApplication id, the name of the installed .desktop file's
// window class, and the well-known bus name the daemon owns.
inline constexpr const char* kAppId = "dev.rager.gkeymapper";
// Reported by GetStatus and shown in the About dialog.
inline constexpr const char* kVersion = "0.1.1";
// The daemon owns this name; the GUI talks to it via the object below.
//
// It is deliberately not the plain app id: GtkApplication owns the app id
// itself (that is how it detects a second GUI instance), so a daemon on the
// same name would make every GUI start look like a duplicate and exit.
inline constexpr const char* kBusName = "dev.rager.gkeymapper.Daemon";
inline constexpr const char* kObjectPath = "/dev/rager/gkeymapper/Daemon";
inline constexpr const char* kInterface = "dev.rager.gkeymapper.Daemon";
// Where the GUI answers a second start (see src/singleinstance and src/main.cpp):
// it hands out the rows its window shows, so an instance that is replaced does not
// take unsaved edits with it. The name is the app id itself - GtkApplication owns
// that (see kBusName above), and the GUI is not a service, it only answers while a
// window is up.
inline constexpr const char* kWindowObjectPath = "/dev/rager/gkeymapper/Window";
inline constexpr const char* kWindowInterface = "dev.rager.gkeymapper.Window";
// The one method: no arguments, the rows as the mappings text (the file format).
inline constexpr const char* kWindowRowsMethod = "GetRows";
} // namespace gkeymapper::ipc
#endif // GKEYMAPPER_IPC_IDS_H