Nice error message when dynamic_background_opacity is not set

This commit is contained in:
Kovid Goyal 2018-05-23 08:16:22 +05:30
parent c0f790c928
commit 95de39feb9
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -21,6 +21,11 @@ def __init__(self, expression, target='windows'):
ValueError.__init__(self, 'No matching {} for expression: {}'.format(target, expression))
class OpacityError(ValueError):
hide_traceback = True
def cmd(short_desc, desc=None, options_spec=None, no_response=False, argspec='...', string_return_is_error=False):
def w(func):
@ -612,6 +617,8 @@ def cmd_set_background_opacity(global_opts, opts, args):
def set_background_opacity(boss, window, payload):
if not boss.opts.dynamic_background_opacity:
raise OpacityError('You must turn on the dynamic_background_opacity option in kitty.conf to be able to set background opacity')
if payload['all']:
windows = tuple(boss.all_windows)
else: