1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-01-10 13:17:58 +03:00

Added method for determining the numeric group of desktop wallpaper settings

This commit is contained in:
Данила Скачедубов 2023-11-24 12:28:02 +04:00
parent 2fb59a1b7c
commit 209e4e3128

View File

@ -256,3 +256,19 @@ def apply_for_wallpaper(value, data, file_cache):
except Exception as exc:
logdata['exc'] = exc
log('E67', logdata)
def get_id_desktop(path_to_wallpaper):
'''
Method for getting desktop id. It is currently accepted that this number is one of the sections in the configuration file.
'''
pattern = r'\[Containments\]\[(\d+)\](?:.*\n)+?activityId=[a-f0-9-]+'
try:
with open(path_to_wallpaper, 'r') as file:
file_content = file.read()
match = re.search(pattern, file_content)
if match:
return match.group(1)
else:
return None
except:
return None