Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# terminal = <xterm, urxvt> <options if necessary>. 'xterm' by default
# gui_editor = <path/to/editor> <options> e.g. gui_editor = gvim -f
# type_library = pynput (default), xdotool (for alternate keyboard layout support), ydotool (for Wayland), wtype (also for Wayland), dotool, or dotoolc (dotool client for dotoold daemon)
# ydotool_key_delay = <milliseconds> delay between keystrokes for ydotool (default: ydotool's built-in default)
# hide_groups = Recycle Bin <Note formatting for adding multiple groups>
# Group 2
# Group 3
Expand Down
1 change: 1 addition & 0 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Alternatively you can specify the file path to your config.ini using the -c/--co
| | `terminal` | `xterm` | |
| | `gui_editor` | None | |
| | `type_library` | `pynput` | xdotool, ydotool, wtype, dotool, dotoolc or pynput |
| | `ydotool_key_delay` | None | Delay between keystrokes in ms (ydotool only) |
| | `hide_groups` | None | See below for formatting of multiple groups |
| | `autotype_default` | `{USERNAME}{TAB}{PASSWORD}{ENTER}` | [Keepass autotype sequences][1] |
| | `type_url` | `False` | |
Expand Down
22 changes: 17 additions & 5 deletions keepmenu/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ def type_entry_xdotool(entry, tokens):
call(['xdotool', 'type', '--', token])


def _ydotool_type(to_type):
"""Type a string using ydotool with optional --key-delay

"""
cmd = ['ydotool', 'type', '-e', '0']
key_delay = keepmenu.CONF.get('database', 'ydotool_key_delay', fallback=None)
if key_delay is not None:
cmd.extend(['--key-delay', key_delay])
cmd.extend(['--', to_type])
call(cmd)


def type_entry_ydotool(entry, tokens):
"""Auto-type entry entry using ydotool

Expand All @@ -265,22 +277,22 @@ def type_entry_ydotool(entry, tokens):
if callable(cmd):
to_type = cmd(entry) # pylint: disable=not-callable
if to_type is not None:
call(['ydotool', 'type', '-e', '0', '--', to_type])
_ydotool_type(to_type)
elif token in PLACEHOLDER_AUTOTYPE_TOKENS:
to_type = PLACEHOLDER_AUTOTYPE_TOKENS[token](entry)
if to_type:
call(['ydotool', 'type', '-e', '0', '--', to_type])
_ydotool_type(to_type)
elif token in STRING_AUTOTYPE_TOKENS:
to_type = STRING_AUTOTYPE_TOKENS[token]
call(['ydotool', 'type', '-e', '0', '--', to_type])
_ydotool_type(to_type)
elif token in AUTOTYPE_TOKENS:
cmd = ['ydotool'] + AUTOTYPE_TOKENS[token]
call(cmd)
else:
dmenu_err(f"Unsupported auto-type token (ydotool): \"{token}\"")
return
else:
call(['ydotool', 'type', '-e', '0', '--', token])
_ydotool_type(token)


def type_entry_wtype(entry, tokens):
Expand Down Expand Up @@ -383,7 +395,7 @@ def type_text(data):
if library == 'xdotool':
call(['xdotool', 'type', '--', data])
elif library == 'ydotool':
call(['ydotool', 'type', '-e', '0', '--', data])
_ydotool_type(data)
elif library == 'wtype':
call(['wtype', '--', data])
elif library == 'dotool':
Expand Down
Loading