mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
system-tools: only execute "st" on X11 platform
This commit is contained in:
@@ -4,9 +4,16 @@
|
||||
import xbmcaddon
|
||||
import xbmcgui
|
||||
import subprocess
|
||||
import os.path
|
||||
import re
|
||||
import csv
|
||||
|
||||
if os.path.exists(os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'bin/st')):
|
||||
with open('/etc/os-release') as stream:
|
||||
contents = stream.read().strip()
|
||||
vars = re.findall(r"^[a-zA-Z0-9_]+=.*$", contents, flags=re.MULTILINE)
|
||||
reader = csv.reader(vars, delimiter="=")
|
||||
osrelease = dict(reader)
|
||||
|
||||
if osrelease['LIBREELEC_ARCH'] == 'x11.x86_64' or osrelease['LIBREELEC_ARCH'] == 'Generic-legacy.x86_64':
|
||||
yes = xbmcgui.Dialog().yesno('System Tools', 'This is a console-only addon.[CR][CR]Open a terminal window?',nolabel='No',yeslabel='Yes')
|
||||
if yes:
|
||||
subprocess.Popen(["systemd-run","sh","-c",". /etc/profile;cd;exec st -e sh -l"], shell=False, close_fds=True)
|
||||
|
||||
Reference in New Issue
Block a user