- Corrected text editors to open config files, also properly linked system options for KDE. Closes #317

This commit is contained in:
Ben Reaves
2020-11-12 14:48:41 -06:00
parent 1406e3bea5
commit fe0346ea63
2 changed files with 29 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ gi.require_version('Gtk', '3.0')
gi.require_version('Vte', '2.91') gi.require_version('Vte', '2.91')
from gi.repository import Gtk,Gdk,GdkPixbuf from gi.repository import Gtk,Gdk,GdkPixbuf
from gi.repository import Vte,GLib from gi.repository import Vte,GLib
from shutil import which
from subprocess import Popen,PIPE,CalledProcessError from subprocess import Popen,PIPE,CalledProcessError
from distutils.util import strtobool from distutils.util import strtobool
@@ -918,13 +919,13 @@ class MyWindow(Gtk.Window):
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(kate) is not None: elif which('kate') is not None:
Popen(['kate',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['kate',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(kwrite) is not None: elif which('kwrite') is not None:
Popen(['kwrite',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['kwrite',os.environ['HOME']+'/.config/kinto/kinto.py'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
@@ -934,13 +935,13 @@ class MyWindow(Gtk.Window):
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service']) Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit','/lib/systemd/system/xkeysnail.service']) Popen(['gedit','/lib/systemd/system/xkeysnail.service'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad','/lib/systemd/system/xkeysnail.service']) Popen(['mousepad','/lib/systemd/system/xkeysnail.service'])
elif which(kate) is not None: elif which('kate') is not None:
Popen(['kate','/lib/systemd/system/xkeysnail.service']) Popen(['kate','/lib/systemd/system/xkeysnail.service'])
elif which(kwrite) is not None: elif which('kwrite') is not None:
Popen(['kwrite','/lib/systemd/system/xkeysnail.service']) Popen(['kwrite','/lib/systemd/system/xkeysnail.service'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
@@ -949,12 +950,16 @@ class MyWindow(Gtk.Window):
def setSysKB(self,button): def setSysKB(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['xfce4-keyboard-settings']) Popen(['xfce4-keyboard-settings'])
elif self.ostype == "KDE":
self.queryConfig('systemsettings >/dev/null 2>&1 || systemsettings5 >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','keyboard']) Popen(['gnome-control-center','keyboard'])
def setRegion(self,button): def setRegion(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['gnome-language-selector']) Popen(['gnome-language-selector'])
elif self.ostype == "KDE":
self.queryConfig('kcmshell4 kcm_translations >/dev/null 2>&1 || kcmshell5 kcm_translations >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','region']) Popen(['gnome-control-center','region'])

View File

@@ -620,10 +620,14 @@ class Indicator():
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py']) Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kate') is not None:
Popen(['kate',os.environ['HOME']+'/.config/kinto/kinto.py'])
elif which('kwrite') is not None:
Popen(['kwrite',os.environ['HOME']+'/.config/kinto/kinto.py'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -632,10 +636,14 @@ class Indicator():
try: try:
if os.path.exists('/opt/sublime_text/sublime_text'): if os.path.exists('/opt/sublime_text/sublime_text'):
Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service']) Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service'])
elif which(gedit) is not None: elif which('gedit') is not None:
Popen(['gedit','/lib/systemd/system/xkeysnail.service']) Popen(['gedit','/lib/systemd/system/xkeysnail.service'])
elif which(mousepad) is not None: elif which('mousepad') is not None:
Popen(['mousepad','/lib/systemd/system/xkeysnail.service']) Popen(['mousepad','/lib/systemd/system/xkeysnail.service'])
elif which('kate') is not None:
Popen(['kate','/lib/systemd/system/xkeysnail.service'])
elif which('kwrite') is not None:
Popen(['kwrite','/lib/systemd/system/xkeysnail.service'])
except CalledProcessError: # Notify user about error on running restart commands. except CalledProcessError: # Notify user about error on running restart commands.
Popen(['notify-send','Kinto: Error could not open config file!']) Popen(['notify-send','Kinto: Error could not open config file!'])
@@ -690,12 +698,16 @@ class Indicator():
def setSysKB(self,button): def setSysKB(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['xfce4-keyboard-settings']) Popen(['xfce4-keyboard-settings'])
elif self.ostype == "KDE":
self.queryConfig('systemsettings >/dev/null 2>&1 || systemsettings5 >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','keyboard']) Popen(['gnome-control-center','keyboard'])
def setRegion(self,button): def setRegion(self,button):
if self.ostype == "XFCE": if self.ostype == "XFCE":
Popen(['gnome-language-selector']) Popen(['gnome-language-selector'])
elif self.ostype == "KDE":
self.queryConfig('kcmshell4 kcm_translations >/dev/null 2>&1 || kcmshell5 kcm_translations >/dev/null 2>&1')
else: else:
Popen(['gnome-control-center','region']) Popen(['gnome-control-center','region'])