Skip to content

Commit

Permalink
detect if no window is active and set the current focussed window to …
Browse files Browse the repository at this point in the history
…[Desktop]
  • Loading branch information
swissiety committed Oct 26, 2022
1 parent 08b79ea commit 4fc70aa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libinput-gestures
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ def get_active_window_title():
m = re.search(b'^_NET_ACTIVE_WINDOW.* ([\w]+)$', stdout)
if m != None:
window_id = m.group(1)
window = subprocess.Popen(['xprop', '-id', window_id, 'WM_NAME'], stdout=subprocess.PIPE)
stdout, stderr = window.communicate()
if window_id != '0x0':
if args.verbose:
print(f'window id: {window_id} from: {stdout}');
window = subprocess.Popen(['xprop', '-id', window_id, 'WM_NAME'], stdout=subprocess.PIPE)
stdout, stderr = window.communicate()
else:
window = 'Desktop'
else:
return None

Expand Down Expand Up @@ -459,7 +464,7 @@ class GESTURE:
appname = appname_cache[appl];

if args.debug:
print('current active window ',appname)
print(f'current active window [{appname}]')

'Action a motion command for this gesture'
command = self.motions.get((appname, motion, self.fingers)) or \
Expand Down

0 comments on commit 4fc70aa

Please sign in to comment.