From 7a2003c371f632aba0346a51a4be73183ae46ef4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Dec 2021 17:16:17 +0530 Subject: [PATCH] Allow ~/ expansion when specify image paths for @ set-(background|logo) --- kitty/rc/set_background_image.py | 3 ++- kitty/rc/set_window_logo.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/rc/set_background_image.py b/kitty/rc/set_background_image.py index 7a7122ecf..bd17bd59a 100644 --- a/kitty/rc/set_background_image.py +++ b/kitty/rc/set_background_image.py @@ -2,6 +2,7 @@ # License: GPLv3 Copyright: 2020, Kovid Goyal import imghdr +import os import tempfile from base64 import standard_b64decode, standard_b64encode from typing import IO, TYPE_CHECKING, Optional @@ -67,7 +68,7 @@ failed, the command will exit with a success code. def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: if len(args) != 1: self.fatal('Must specify path to exactly one PNG image') - path = args[0] + path = os.path.expanduser(args[0]) ret = { 'match': opts.match, 'configured': opts.configured, diff --git a/kitty/rc/set_window_logo.py b/kitty/rc/set_window_logo.py index 63b849e10..e2a349a2c 100644 --- a/kitty/rc/set_window_logo.py +++ b/kitty/rc/set_window_logo.py @@ -3,6 +3,7 @@ import imghdr +import os import tempfile from base64 import standard_b64decode, standard_b64encode from typing import IO, TYPE_CHECKING, Optional @@ -67,7 +68,7 @@ failed, the command will exit with a success code. def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: if len(args) != 1: self.fatal('Must specify path to exactly one PNG image') - path = args[0] + path = os.path.expanduser(args[0]) ret = { 'match': opts.match, 'self': opts.self,