File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import argparse
6
6
import utils
7
7
from schemeconfigs import ThemeConfig
8
8
if __name__ == '__main__' :
9
+ #kill existing instance if found
10
+ utils .kill_existing ()
9
11
# Make sure the schemes path exists
10
12
if not os .path .exists (utils .USER_SCHEMES_PATH ):
11
13
os .makedirs (utils .USER_SCHEMES_PATH )
Original file line number Diff line number Diff line change @@ -875,3 +875,13 @@ def timeout_set(time_s=3):
875
875
876
876
def timeout_reset ():
877
877
signal .alarm (0 )
878
+
879
+ def kill_existing ():
880
+ get_pids = subprocess .check_output ("ps -e -f | grep [/]usr/bin/kde-material-you-colors | awk '{print $2}'" ,
881
+ shell = True , stderr = subprocess .PIPE ,universal_newlines = True ).strip ().splitlines ()
882
+ current_pid = os .getpid ()
883
+ for pid in get_pids :
884
+ pid = int (pid )
885
+ if pid != current_pid :
886
+ logging .debug (f"Found existing process with PID: '{ pid } ' killing..." )
887
+ subprocess .Popen ("kill -9 " + str (pid ),shell = True )
You can’t perform that action at this time.
0 commit comments