@@ -122,7 +122,8 @@ def type_entry(entry, db_autotype=None):
122122 'xdotool' : type_entry_xdotool ,
123123 'ydotool' : type_entry_ydotool ,
124124 'wtype' : type_entry_wtype ,
125- 'dotool' : type_entry_dotool }
125+ 'dotool' : type_entry_dotool ,
126+ 'dotoolc' : type_entry_dotoolc }
126127 library = keepmenu .CONF .get ('database' , 'type_library' , fallback = 'pynput' )
127128 libraries .get (library , type_entry_pynput )(entry , tokens )
128129
@@ -340,6 +341,35 @@ def type_entry_dotool(entry, tokens):
340341 _ = run (['dotool' ], check = True , encoding = keepmenu .ENC , input = f"type { token } " )
341342
342343
344+ def type_entry_dotoolc (entry , tokens ):
345+ """Auto-type entry entry using dotoolc (client for dotoold daemon)
346+
347+ """
348+ from .tokens_dotool import AUTOTYPE_TOKENS
349+ for token , special in tokens :
350+ if special :
351+ cmd = token_command (token )
352+ if callable (cmd ):
353+ to_type = cmd (entry ) # pylint: disable=not-callable
354+ if to_type is not None :
355+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = f"type { to_type } " )
356+ elif token in PLACEHOLDER_AUTOTYPE_TOKENS :
357+ to_type = PLACEHOLDER_AUTOTYPE_TOKENS [token ](entry )
358+ if to_type :
359+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = f"type { to_type } " )
360+ elif token in STRING_AUTOTYPE_TOKENS :
361+ to_type = STRING_AUTOTYPE_TOKENS [token ]
362+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = f"type { to_type } " )
363+ elif token in AUTOTYPE_TOKENS :
364+ to_type = " " .join (AUTOTYPE_TOKENS [token ])
365+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = to_type )
366+ else :
367+ dmenu_err (f"Unsupported auto-type token (dotoolc): \" { token } \" " )
368+ return
369+ else :
370+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = f"type { token } " )
371+
372+
343373def type_text (data ):
344374 """Type the given text data
345375
@@ -358,6 +388,8 @@ def type_text(data):
358388 call (['wtype' , '--' , data ])
359389 elif library == 'dotool' :
360390 _ = run (['dotool' ], check = True , encoding = keepmenu .ENC , input = f"type { data } " )
391+ elif library == 'dotoolc' :
392+ _ = run (['dotoolc' ], check = True , encoding = keepmenu .ENC , input = f"type { data } " )
361393 else :
362394 try :
363395 from pynput import keyboard
0 commit comments