Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:branches:openSUSE:Factory:Rings:1-MinimalX
virt-manager
077-cli-add-show-systray-option.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 077-cli-add-show-systray-option.patch of Package virt-manager
Subject: cli: add --show-systray option From: Gustavo Costa xfgusta@gmail.com Wed Nov 3 21:45:04 2021 -0300 Date: Sun Mar 3 14:17:54 2024 -0500: Git: 69290e0526aa3febf1fd867aa0e285f38df13637 diff --git a/virtManager/engine.py b/virtManager/engine.py index a90b5464..e5aa3eb4 100644 --- a/virtManager/engine.py +++ b/virtManager/engine.py @@ -47,6 +47,7 @@ class vmmEngine(vmmGObject): CLI_SHOW_DOMAIN_CONSOLE = "console" CLI_SHOW_DOMAIN_DELETE = "delete" CLI_SHOW_HOST_SUMMARY = "summary" + CLI_SHOW_SYSTEM_TRAY = "systray" @classmethod def get_instance(cls): @@ -63,6 +64,8 @@ class vmmEngine(vmmGObject): self._exiting = False + self.systray_instance = None + self._window_count = 0 self._gtkapplication = None self._init_gtk_application() @@ -95,7 +98,7 @@ class vmmEngine(vmmGObject): """ Actual startup routines if we are running a new instance of the app """ - vmmSystray.get_instance() + self.systray_instance = vmmSystray.get_instance() vmmInspection.get_instance() self.add_gsettings_handle( @@ -441,6 +444,9 @@ class vmmEngine(vmmGObject): self.CLI_SHOW_DOMAIN_CONSOLE, self.CLI_SHOW_DOMAIN_DELETE]): self._cli_show_vm_helper(uri, clistr, show_window) + elif show_window == self.CLI_SHOW_SYSTEM_TRAY: + log.debug("Showing in the system tray") + self.systray_instance._show_systray() else: # pragma: no cover raise RuntimeError("Unknown cli window command '%s'" % show_window) @@ -461,6 +467,11 @@ class vmmEngine(vmmGObject): log.debug("processing cli command uri=%s show_window=%s domain=%s", uri, show_window, domain) if not uri: + if show_window == self.CLI_SHOW_SYSTEM_TRAY: + log.debug("Launching in the system tray without --connect") + self.systray_instance._show_systray() + return + log.debug("No cli action requested, launching default window") self._get_manager().show() return diff --git a/virtManager/virtmanager.py b/virtManager/virtmanager.py index c358dce9..418fd336 100644 --- a/virtManager/virtmanager.py +++ b/virtManager/virtmanager.py @@ -155,6 +155,8 @@ def parse_commandline(): help="Show domain delete window") parser.add_argument("--show-host-summary", action="store_true", help="Show connection details window") + parser.add_argument("--show-systray", action="store_true", + help="Launch virt-manager in system tray") return parser.parse_known_args() @@ -240,12 +242,16 @@ def main(): elif options.show_domain_delete: show_window = vmmEngine.CLI_SHOW_DOMAIN_DELETE domain = options.show_domain_delete + elif options.show_systray: + show_window = vmmEngine.CLI_SHOW_SYSTEM_TRAY - if show_window and options.uri is None: # pragma: no cover - raise RuntimeError("can't use --show-* options without --connect") + if (show_window and show_window != vmmEngine.CLI_SHOW_SYSTEM_TRAY and + options.uri is None): # pragma: no cover + raise RuntimeError("can't use --show-* options without --connect " + "(except --show-systray)") skip_autostart = False - if show_window: + if show_window and show_window != vmmEngine.CLI_SHOW_SYSTEM_TRAY: skip_autostart = True # Hook libvirt events into glib main loop
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor