Skip to content

Commit

Permalink
- Wayland Support for Gnome3 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rbreaves committed Oct 28, 2020
1 parent 77ba71e commit c3083ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions xkeysnail/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@
def update_modifier_key_pressed(key, action):
if key in Modifier.get_all_keys():
if action.is_pressed():
print('modifier add: ' + str(key))
_pressed_modifier_keys.add(key)
else:
_pressed_modifier_keys.discard(key)
print('modifier discard: ' + str(key))

def update_pressed_keys(key, action):
if action.is_pressed():
_pressed_keys.add(key)
print('add: ' + str(key))
else:
_pressed_keys.discard(key)
print('discard: ' + str(key))

def is_pressed(key):
return key in _pressed_keys
Expand Down
22 changes: 12 additions & 10 deletions xkeysnail/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@
import Xlib.display


def get_active_window_wm_class(display=Xlib.display.Display()):
"""Get active window's WM_CLASS"""
current_window = display.get_input_focus().focus
pair = get_class_name(current_window)
if pair:
# (process name, class name)
return str(pair[1])
else:
return ""

# def get_active_window_wm_class(display=Xlib.display.Display()):
# """Get active window's WM_CLASS"""
# current_window = display.get_input_focus().focus
# pair = get_class_name(current_window)
# if pair:
# # (process name, class name)
# return str(pair[1])
# else:
# return ""

def get_active_window_wm_class():
return "Sublime_text"

def get_class_name(window):
"""Get window's class name (recursively checks parents)"""
Expand Down

0 comments on commit c3083ff

Please sign in to comment.