class ExecutorState: running = dbus_attr(Int16()) processes = dbus_attr(List(ProcessState)) @classmethod def from_executor(cls, executor): monitor = executor.monitor.asdict() return cls( running=monitor.get("running", -1), processes=[ ProcessState.from_procmon_state(state) for state in monitor.get("processes", {}).values() ], )
class BaseConfig: applications = subconfig(ApplicationsConfig) autostart = subconfig(AutostartConfig) dbus = subconfig(DBusConfig) executors = subconfig(ExecutorsConfig) format = subconfig(FormatConfig) logger = subconfig(LoggerConfig) menu = subconfig(MenuConfig) meta = subconfig(MetaConfig) mime = subconfig(MimeConfig) urls = dbus_attr(Dict(Str(), Str()))
class ProcessConfig: argv = dbus_attr(List(Str())) monitor = dbus_attr(Bool(), default=False) restart = dbus_attr(Bool(), default=False) cleanup = dbus_attr(Bool(), default=False) env = dbus_attr(Dict(Str(), Str())) cwd = dbus_attr(Str())
class ProcessState: name = dbus_attr(Str(), default="???") state = dbus_attr(Str(), default="UNKNOWN") restart = dbus_attr(Bool(), default=False) threshold = dbus_attr(Int64()) killTime = dbus_attr(Int64()) minRestartDelay = dbus_attr(Int64()) maxRestartDelay = dbus_attr(Int64()) @classmethod def from_procmon_state(cls, state): return cls( name=state.name, state=state.state.value, restart=state.settings.restart, threshold=state.settings.threshold or -1, killTime=state.settings.killTime or -1, minRestartDelay=state.settings.minRestartDelay or -1, maxRestartDelay=state.settings.maxRestartDelay or -1, )
class SessionState: running = dbus_attr(Bool(), default=False) loaded_at = dbus_attr(DateTime()) started_at = dbus_attr(DateTime()) stopped_at = dbus_attr(DateTime()) config = dbus_attr(BaseConfig) critical_executor = dbus_attr(ExecutorState) primary_executor = dbus_attr(ExecutorState) @classmethod def from_session(cls, session): return cls( running=session.running, loaded_at=session.loaded_at, started_at=session.started_at, stopped_at=session.stopped_at, config=session.config, critical_executor=ExecutorState.from_executor(session.critical_executor), primary_executor=ExecutorState.from_executor(session.primary_executor), )
class Thing: string = dbus_attr(Str())
class NestedContainer: list_of = dbus_attr(List(SimpleContainer)) dict_of = dbus_attr(Dict(Str(), SimpleContainer))
class SimpleContainer: some_str = dbus_attr(Str()) some_int32 = dbus_attr(Int32()) some_list = dbus_attr(List(Str())) some_dict = dbus_attr(Dict(Str(), Int32()))
class MimeConfig: cache = dbus_attr(Str(), default="/usr/share/applications/mimeinfo.cache") environment = dbus_attr(Str(), default=XDG_CURRENT_DESKTOP)
class MenuConfig: filename = dbus_attr(Str())
class LoggerConfig: level = dbus_attr(Str(), default="debug")
class FormatConfig: pygments_formatter = dbus_attr(Str(), default="trac")
class DBusConfig: namespace = dbus_attr(Str(), default="org.jfhbrook.korbenware")
class AutostartConfig: directories = dbus_attr(List(Str()), default=XDG_AUTOSTART_DIRS) environment_name = dbus_attr(Str(), default=XDG_CURRENT_DESKTOP) skip_unparsed = dbus_attr(Bool(), default=False) skip_invalid = dbus_attr(Bool(), default=False)
class ApplicationsConfig: directories = dbus_attr(List(Str()), default=XDG_APPLICATIONS_DIRS) skip_unparsed = dbus_attr(Bool(), default=False) skip_invalid = dbus_attr(Bool(), default=False)
class MetaConfig: config_filename = dbus_attr(Str(), default="????")
class ExecutorsConfig: primary = dbus_attr(Dict(Str(), ProcessConfig)) critical = dbus_attr(Dict(Str(), CriticalProcessConfig))