qvm-start-daemon: improve parsing args for setting keyboard layout

This commit is contained in:
Frédéric Pierret (fepitre) 2020-03-17 13:23:53 +01:00
parent c13097d458
commit 023d94a0b3
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -478,7 +478,8 @@ parser.add_argument('--notify-monitor-layout', action='store_true',
help='Notify running instance in --watch mode' help='Notify running instance in --watch mode'
' about changed monitor layout') ' about changed monitor layout')
parser.add_argument('--set-keyboard-layout', action='store_true', parser.add_argument('--set-keyboard-layout', action='store_true',
help='Set keyboard layout values into GuiVM features') help='Set keyboard layout values into GuiVM features.'
'This option is implied by --watch')
# Add it for the help only # Add it for the help only
parser.add_argument('--force', action='store_true', default=False, parser.add_argument('--force', action='store_true', default=False,
help='Force running daemon without enabled services' help='Force running daemon without enabled services'
@ -499,8 +500,8 @@ def main(args=None):
parser.error('--watch option must be used with --all') parser.error('--watch option must be used with --all')
if args.watch and args.notify_monitor_layout: if args.watch and args.notify_monitor_layout:
parser.error('--watch cannot be used with --notify-monitor-layout') parser.error('--watch cannot be used with --notify-monitor-layout')
if not args.set_keyboard_layout: if args.watch and 'guivm-gui-agent' in enabled_services:
args.set_keyboard_layout = args.watch args.set_keyboard_layout = True
if args.set_keyboard_layout or os.path.exists('/etc/qubes-release'): if args.set_keyboard_layout or os.path.exists('/etc/qubes-release'):
guivm = args.app.domains[args.app.local_name] guivm = args.app.domains[args.app.local_name]
set_keyboard_layout(guivm) set_keyboard_layout(guivm)