mirror of
https://github.com/FAUSheppy/config
synced 2025-12-07 15:31:35 +01:00
now uses new functions in hlerror
This commit is contained in:
@@ -6,9 +6,9 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import psutil
|
import psutil
|
||||||
from hl_error import error
|
from hl_error import error, shexec
|
||||||
|
|
||||||
out = subprocess.check_output(['xdpyinfo']).decode().split('\n')
|
out = shexec('xdpyinfo').split('\n')
|
||||||
|
|
||||||
############ GET FOCUSED WINDOW ID ##############
|
############ GET FOCUSED WINDOW ID ##############
|
||||||
window = -1
|
window = -1
|
||||||
@@ -25,7 +25,7 @@ if window==-1:
|
|||||||
|
|
||||||
############ IF URXVT GET PID ###########
|
############ IF URXVT GET PID ###########
|
||||||
pid = -1
|
pid = -1
|
||||||
out = subprocess.check_output(shlex.split('xprop -id '+hex(window))).decode().split('\n')
|
out = shexec('xprop -id '+hex(window)).split('\n')
|
||||||
for l in out:
|
for l in out:
|
||||||
if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l:
|
if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l:
|
||||||
break;
|
break;
|
||||||
@@ -38,9 +38,10 @@ for l in out:
|
|||||||
if pid==-1:
|
if pid==-1:
|
||||||
error("Failed to get PID")
|
error("Failed to get PID")
|
||||||
|
|
||||||
|
############ START NEW TERMINAL ############
|
||||||
process = psutil.Process(pid)
|
process = psutil.Process(pid)
|
||||||
for p in process.children(): #recursive=false
|
for p in process.children(): #recursive=false
|
||||||
if p.name()=='zsh' or p.name()=='bash':
|
if p.name() in ['zsh','bash']:
|
||||||
subprocess.Popen(shlex.split('urxvt -cd ' + p.cwd()))
|
subprocess.Popen(shlex.split('urxvt -cd ' + p.cwd()))
|
||||||
break
|
break
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user