From 888c9f4dbbf1d581c6b0b1e25fe1763a73f0f662 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sat, 27 Aug 2022 13:58:34 +0200 Subject: [PATCH] reduce indent to 2 spaces --- herbstluftwm/hl_start_urxvt_cwd.py | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/herbstluftwm/hl_start_urxvt_cwd.py b/herbstluftwm/hl_start_urxvt_cwd.py index 2dbc4ea..6db565a 100755 --- a/herbstluftwm/hl_start_urxvt_cwd.py +++ b/herbstluftwm/hl_start_urxvt_cwd.py @@ -13,36 +13,36 @@ out = shexec('xdpyinfo').split('\n') ############ GET FOCUSED WINDOW ID ############## window = -1 for l in out: - if l.startswith('focus:'): - for field in l.split(' '): - field = field.rstrip(',') - if(field.startswith('0x')): - window = int(field,16) - if window == -1: - error("Failed to get window_focus\n") + if l.startswith('focus:'): + for field in l.split(' '): + field = field.rstrip(',') + if(field.startswith('0x')): + window = int(field,16) + if window == -1: + error("Failed to get window_focus\n") if window==-1: - sys.exit() + sys.exit() ############ IF URXVT GET PID ########### pid = -1 out = subprocess.check_output(['xprop','-id',hex(window)]).decode().split('\n') #out = shexec('xprop -id '+hex(window)).split('\n') #not working for l in out: - if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l: - break; + if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l: + break; else: - sys.exit(); + sys.exit(); for l in out: - if l.startswith('_NET_WM_PID(CARDINAL)'): - pid = int(l.split(' ')[-1]) + if l.startswith('_NET_WM_PID(CARDINAL)'): + pid = int(l.split(' ')[-1]) if pid==-1: - error("Failed to get PID") + error("Failed to get PID") ############ START NEW TERMINAL ############ process = psutil.Process(pid) for p in process.children(): #recursive=false - if p.name() in ['zsh','bash']: - subprocess.Popen(shlex.split('urxvt -cd ' + p.cwd())) - break + if p.name() in ['zsh','bash']: + subprocess.Popen(shlex.split('urxvt -cd ' + p.cwd())) + break sys.exit()