KeyboardPaster 0.1.27__tar.gz → 0.1.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/PKG-INFO +14 -3
  2. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/PKG-INFO +14 -3
  3. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/README.md +13 -2
  4. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/app.py +138 -15
  5. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/keyboard_input.py +80 -36
  6. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/keyboardpaster_app.kv +18 -10
  7. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/shared_resources.py +1 -1
  8. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/SOURCES.txt +0 -0
  9. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/dependency_links.txt +0 -0
  10. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/entry_points.txt +0 -0
  11. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/requires.txt +0 -0
  12. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/KeyboardPaster.egg-info/top_level.txt +0 -0
  13. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/LICENSE +0 -0
  14. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/__init__.py +0 -0
  15. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/bootstrap.py +0 -0
  16. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/desktop.py +0 -0
  17. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/keyboard_layout_detector.py +0 -0
  18. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/modules/__init__.py +0 -0
  19. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/modules/autoupdate.py +0 -0
  20. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster/res/images/keyboardpaster.png +0 -0
  21. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/keyboardpaster.desktop +0 -0
  22. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/setup.cfg +0 -0
  23. {keyboardpaster-0.1.27 → keyboardpaster-0.1.28}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: KeyboardPaster
3
- Version: 0.1.27
3
+ Version: 0.1.28
4
4
  Summary: A Python package to type text using the keyboard module
5
5
  Home-page: https://github.com/KnutssonDevelopment/KeyboardPaster
6
6
  Author: Brian Knutsson
@@ -45,8 +45,12 @@ Dynamic: summary
45
45
  A Python package to type text using the keyboard module. This is useful in situation where copy and paste is prohibited
46
46
 
47
47
  ## Features
48
- - Paste 10 different strings using the keyboard
49
- - Save string for future usage
48
+ - Dynamic paste slots (grows as you add text)
49
+ - Name slots and save them per profile
50
+ - Multiple profiles (create / switch / delete)
51
+ - Per-profile start delay, modifier delay, and Run checkbox
52
+ - Hide sensitive values in the UI
53
+ - Copy to clipboard or type via keyboard (ydotool on GNOME Wayland)
50
54
 
51
55
  ## Install (Linux / pipx)
52
56
 
@@ -68,6 +72,13 @@ On GNOME Wayland you also need `ydotool` / `ydotoold` for typing into other apps
68
72
  - Paste images as base64 code
69
73
 
70
74
  ## Changes
75
+ ### v0.1.28
76
+ - FEATURE: Name individual slots (saved per profile)
77
+ - FEATURE: Delete profiles from the profile menu
78
+ - FEATURE: Save start delay, modifier delay, and Run checkbox per profile
79
+ - BUGFIX: Modifier delay now correctly holds Shift/AltGr before the key
80
+ - BUGFIX: Spaces no longer introduce an extra typing delay
81
+
71
82
  ### v0.1.27
72
83
  - BUGFIX: App would crash on linux when copying text
73
84
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: KeyboardPaster
3
- Version: 0.1.27
3
+ Version: 0.1.28
4
4
  Summary: A Python package to type text using the keyboard module
5
5
  Home-page: https://github.com/KnutssonDevelopment/KeyboardPaster
6
6
  Author: Brian Knutsson
@@ -45,8 +45,12 @@ Dynamic: summary
45
45
  A Python package to type text using the keyboard module. This is useful in situation where copy and paste is prohibited
46
46
 
47
47
  ## Features
48
- - Paste 10 different strings using the keyboard
49
- - Save string for future usage
48
+ - Dynamic paste slots (grows as you add text)
49
+ - Name slots and save them per profile
50
+ - Multiple profiles (create / switch / delete)
51
+ - Per-profile start delay, modifier delay, and Run checkbox
52
+ - Hide sensitive values in the UI
53
+ - Copy to clipboard or type via keyboard (ydotool on GNOME Wayland)
50
54
 
51
55
  ## Install (Linux / pipx)
52
56
 
@@ -68,6 +72,13 @@ On GNOME Wayland you also need `ydotool` / `ydotoold` for typing into other apps
68
72
  - Paste images as base64 code
69
73
 
70
74
  ## Changes
75
+ ### v0.1.28
76
+ - FEATURE: Name individual slots (saved per profile)
77
+ - FEATURE: Delete profiles from the profile menu
78
+ - FEATURE: Save start delay, modifier delay, and Run checkbox per profile
79
+ - BUGFIX: Modifier delay now correctly holds Shift/AltGr before the key
80
+ - BUGFIX: Spaces no longer introduce an extra typing delay
81
+
71
82
  ### v0.1.27
72
83
  - BUGFIX: App would crash on linux when copying text
73
84
 
@@ -3,8 +3,12 @@
3
3
  A Python package to type text using the keyboard module. This is useful in situation where copy and paste is prohibited
4
4
 
5
5
  ## Features
6
- - Paste 10 different strings using the keyboard
7
- - Save string for future usage
6
+ - Dynamic paste slots (grows as you add text)
7
+ - Name slots and save them per profile
8
+ - Multiple profiles (create / switch / delete)
9
+ - Per-profile start delay, modifier delay, and Run checkbox
10
+ - Hide sensitive values in the UI
11
+ - Copy to clipboard or type via keyboard (ydotool on GNOME Wayland)
8
12
 
9
13
  ## Install (Linux / pipx)
10
14
 
@@ -26,6 +30,13 @@ On GNOME Wayland you also need `ydotool` / `ydotoold` for typing into other apps
26
30
  - Paste images as base64 code
27
31
 
28
32
  ## Changes
33
+ ### v0.1.28
34
+ - FEATURE: Name individual slots (saved per profile)
35
+ - FEATURE: Delete profiles from the profile menu
36
+ - FEATURE: Save start delay, modifier delay, and Run checkbox per profile
37
+ - BUGFIX: Modifier delay now correctly holds Shift/AltGr before the key
38
+ - BUGFIX: Spaces no longer introduce an extra typing delay
39
+
29
40
  ### v0.1.27
30
41
  - BUGFIX: App would crash on linux when copying text
31
42
 
@@ -64,6 +64,12 @@ SLOT_SPACING = int(dp(10))
64
64
  SLOT_AREA_PADDING_V = int(dp(16)) # container padding top+bottom
65
65
  MAX_WINDOW_HEIGHT = int(dp(720))
66
66
 
67
+ # Per-profile settings keys (stored alongside input_text_* entries)
68
+ PROFILE_START_DELAY = "start_delay"
69
+ PROFILE_MOD_DELAY = "mod_delay"
70
+ DEFAULT_START_DELAY = 2.0
71
+ DEFAULT_MOD_DELAY = 0.1
72
+
67
73
  """
68
74
  SPECIAL_CHARS_SPACE = {
69
75
  'EN_US': {},
@@ -173,7 +179,14 @@ class KeyboardPasterApp(MDApp):
173
179
  @staticmethod
174
180
  def _slot_text_input(slot):
175
181
  for child in slot.children:
176
- if isinstance(child, TextInput):
182
+ if isinstance(child, TextInput) and not getattr(child, "name_field", False):
183
+ return child
184
+ return None
185
+
186
+ @staticmethod
187
+ def _slot_name_input(slot):
188
+ for child in slot.children:
189
+ if isinstance(child, TextInput) and getattr(child, "name_field", False):
177
190
  return child
178
191
  return None
179
192
 
@@ -184,11 +197,29 @@ class KeyboardPasterApp(MDApp):
184
197
  return child
185
198
  return None
186
199
 
200
+ @staticmethod
201
+ def _slot_execute_checkbox(slot):
202
+ for child in slot.children:
203
+ if isinstance(child, MDCheckbox) and getattr(child, "execute_checkbox", False):
204
+ return child
205
+ return None
206
+
207
+ @staticmethod
208
+ def _parse_slot_value(value):
209
+ """Return (text, secret, run, name) from legacy or current saved slot values."""
210
+ if isinstance(value, (list, tuple)):
211
+ text = value[0] if len(value) >= 1 else ""
212
+ secret = bool(value[1]) if len(value) >= 2 else False
213
+ run = bool(value[2]) if len(value) >= 3 else False
214
+ name = value[3] if len(value) >= 4 else ""
215
+ return text, secret, run, str(name or "")
216
+ return value, False, False, ""
217
+
187
218
  def _renumber_slots(self):
188
219
  for index, slot in enumerate(self._ordered_slots()):
189
220
  slot.text_input_id = f"input_text_{index}"
190
221
 
191
- def add_slot(self, text: str = "", secret: bool = False):
222
+ def add_slot(self, text: str = "", secret: bool = False, run: bool = False, name: str = ""):
192
223
  container = self._slot_container()
193
224
  index = len(container.children)
194
225
  slot = Factory.InputFieldButton()
@@ -196,16 +227,22 @@ class KeyboardPasterApp(MDApp):
196
227
  container.add_widget(slot)
197
228
 
198
229
  text_input = self._slot_text_input(slot)
230
+ name_input = self._slot_name_input(slot)
199
231
  secret_cb = self._slot_secret_checkbox(slot)
232
+ execute_cb = self._slot_execute_checkbox(slot)
200
233
 
201
234
  previous = self._updating_slots
202
235
  self._updating_slots = True
203
236
  try:
237
+ if name_input is not None:
238
+ name_input.text = name
204
239
  if text_input is not None:
205
240
  text_input.text = text
206
241
  text_input.password = bool(secret)
207
242
  if secret_cb is not None:
208
243
  secret_cb.active = bool(secret)
244
+ if execute_cb is not None:
245
+ execute_cb.active = bool(run)
209
246
  finally:
210
247
  self._updating_slots = previous
211
248
 
@@ -328,6 +365,58 @@ class KeyboardPasterApp(MDApp):
328
365
  )
329
366
  dialog.open()
330
367
 
368
+ def _current_profile_name(self):
369
+ return self.root.ids["profile_selector"].text.strip()
370
+
371
+ def confirm_delete_profile(self):
372
+ self.close_dropdown()
373
+ profile_name = self._current_profile_name()
374
+ if not profile_name:
375
+ return
376
+
377
+ profiles = self.config.get("profiles", {}) if self.config else {}
378
+ if profile_name not in profiles:
379
+ return
380
+ if len(profiles) <= 1:
381
+ MDDialog(
382
+ title="Cannot delete",
383
+ text="You must keep at least one profile.",
384
+ ).open()
385
+ return
386
+
387
+ dialog = MDDialog(
388
+ title="Delete profile",
389
+ text=f"Delete profile '{profile_name}'? This cannot be undone.",
390
+ buttons=[
391
+ MDRaisedButton(
392
+ text="CANCEL",
393
+ on_release=self.close_dialog,
394
+ ),
395
+ MDRaisedButton(
396
+ text="DELETE",
397
+ on_release=lambda x: self.delete_profile(profile_name, x),
398
+ ),
399
+ ],
400
+ )
401
+ dialog.open()
402
+
403
+ def delete_profile(self, profile_name, button_instance=None):
404
+ if button_instance is not None:
405
+ self.close_dialog(button_instance)
406
+
407
+ if not self.config or "profiles" not in self.config:
408
+ return
409
+
410
+ profiles = self.config["profiles"]
411
+ if profile_name not in profiles or len(profiles) <= 1:
412
+ return
413
+
414
+ del profiles[profile_name]
415
+ self.write_config()
416
+
417
+ next_profile = next(iter(profiles.keys()))
418
+ self.set_profile(None, next_profile)
419
+
331
420
  def close_dropdown(self):
332
421
  self.profile_dropdown.dismiss()
333
422
 
@@ -352,6 +441,12 @@ class KeyboardPasterApp(MDApp):
352
441
  btn.bind(on_release=lambda x: self.create_new_profile())
353
442
  profile_dropdown.add_widget(btn)
354
443
 
444
+ btn = MDRaisedButton()
445
+ btn.text = '- Delete -'
446
+ btn.size_hint_y = None
447
+ btn.bind(on_release=lambda x: self.confirm_delete_profile())
448
+ profile_dropdown.add_widget(btn)
449
+
355
450
  for profile in profiles:
356
451
  if len(profile) > max_length:
357
452
  max_length = len(profile)
@@ -382,6 +477,21 @@ class KeyboardPasterApp(MDApp):
382
477
  self.load_inputs()
383
478
  self.generate_profile_selector()
384
479
 
480
+ def _apply_profile_delays(self, profile_values):
481
+ start_delay = profile_values.get(PROFILE_START_DELAY, DEFAULT_START_DELAY)
482
+ mod_delay = profile_values.get(PROFILE_MOD_DELAY, DEFAULT_MOD_DELAY)
483
+ try:
484
+ start_delay = float(start_delay)
485
+ except (TypeError, ValueError):
486
+ start_delay = DEFAULT_START_DELAY
487
+ try:
488
+ mod_delay = float(mod_delay)
489
+ except (TypeError, ValueError):
490
+ mod_delay = DEFAULT_MOD_DELAY
491
+
492
+ self.root.ids["start_delay"].value = start_delay
493
+ self.root.ids["mod_delay"].value = round(mod_delay, 1)
494
+
385
495
  def load_inputs(self):
386
496
  profile_selector = self.root.ids['profile_selector']
387
497
  profile_name = profile_selector.text.strip()
@@ -390,6 +500,8 @@ class KeyboardPasterApp(MDApp):
390
500
  if self.config and profile_name in self.config.get('profiles', {}):
391
501
  profile_values = self.config['profiles'][profile_name] or {}
392
502
 
503
+ self._apply_profile_delays(profile_values)
504
+
393
505
  def sort_key(item):
394
506
  key = item[0]
395
507
  try:
@@ -398,19 +510,18 @@ class KeyboardPasterApp(MDApp):
398
510
  return 0
399
511
 
400
512
  filled = []
401
- for _name, value in sorted(profile_values.items(), key=sort_key):
402
- if isinstance(value, (list, tuple)) and len(value) >= 2:
403
- text, secret_state = value[0], value[1]
404
- else:
405
- text, secret_state = value, False
513
+ for name, value in sorted(profile_values.items(), key=sort_key):
514
+ if not str(name).startswith("input_text_"):
515
+ continue
516
+ text, secret_state, run_state, slot_name = self._parse_slot_value(value)
406
517
  if text:
407
- filled.append((text, bool(secret_state)))
518
+ filled.append((text, bool(secret_state), bool(run_state), slot_name))
408
519
 
409
520
  self.clear_slots()
410
521
  self._updating_slots = True
411
522
  try:
412
- for text, secret_state in filled:
413
- self.add_slot(text=text, secret=secret_state)
523
+ for text, secret_state, run_state, slot_name in filled:
524
+ self.add_slot(text=text, secret=secret_state, run=run_state, name=slot_name)
414
525
  finally:
415
526
  self._updating_slots = False
416
527
  self.ensure_trailing_empty_slot()
@@ -420,20 +531,32 @@ class KeyboardPasterApp(MDApp):
420
531
  profile_selector = self.root.ids['profile_selector']
421
532
  profile_name = profile_selector.text.strip()
422
533
 
423
- input_fields = {}
534
+ profile_data = {
535
+ PROFILE_START_DELAY: float(self.root.ids["start_delay"].value),
536
+ PROFILE_MOD_DELAY: round(float(self.root.ids["mod_delay"].value), 1),
537
+ }
424
538
  for slot in self._ordered_slots():
425
539
  text_input = self._slot_text_input(slot)
426
540
  if text_input is None or not text_input.text:
427
541
  continue
542
+ name_input = self._slot_name_input(slot)
428
543
  secret_cb = self._slot_secret_checkbox(slot)
544
+ execute_cb = self._slot_execute_checkbox(slot)
429
545
  secret_state = bool(secret_cb.active) if secret_cb is not None else False
430
- input_fields[slot.text_input_id] = (text_input.text, secret_state)
546
+ run_state = bool(execute_cb.active) if execute_cb is not None else False
547
+ slot_name = name_input.text.strip() if name_input is not None else ""
548
+ profile_data[slot.text_input_id] = (
549
+ text_input.text,
550
+ secret_state,
551
+ run_state,
552
+ slot_name,
553
+ )
431
554
 
432
555
  if not self.config:
433
556
  self.config = {'profiles': {}}
434
557
  if 'profiles' not in self.config:
435
558
  self.config['profiles'] = {}
436
- self.config['profiles'][profile_name] = input_fields
559
+ self.config['profiles'][profile_name] = profile_data
437
560
  self.write_config()
438
561
 
439
562
  def type_text(self, input_text, _checkbox):
@@ -459,7 +582,7 @@ class KeyboardPasterApp(MDApp):
459
582
  )
460
583
 
461
584
  def show_type_error(self, error):
462
- MDDialog(title="Kan ikke sende tastaturinput", text=str(error)).open()
585
+ MDDialog(title="Cannot send keyboard input", text=str(error)).open()
463
586
 
464
587
  def copy_text(self, input_text, _checkbox):
465
588
  if not input_text:
@@ -467,7 +590,7 @@ class KeyboardPasterApp(MDApp):
467
590
  try:
468
591
  Clipboard.copy(input_text)
469
592
  except Exception as error:
470
- MDDialog(title="Kan ikke kopiere", text=str(error)).open()
593
+ MDDialog(title="Cannot copy", text=str(error)).open()
471
594
 
472
595
  @staticmethod
473
596
  def hide_text(_input_text, _checkbox):
@@ -285,6 +285,22 @@ SHIFT_KEYCODE = 42
285
285
  ALTGR_KEYCODE = 100
286
286
  ENTER_KEYCODE = 28
287
287
 
288
+ # ydotool modifier names (combo left-hand side) → hold via name:1 / name:0
289
+ YDOTOOL_MODIFIER_NAMES = {
290
+ "shift",
291
+ "leftshift",
292
+ "rightshift",
293
+ "ctrl",
294
+ "leftctrl",
295
+ "rightctrl",
296
+ "alt",
297
+ "alt_l",
298
+ "alt_r",
299
+ "altgr",
300
+ "meta",
301
+ "super",
302
+ }
303
+
288
304
  DA_DK_BASE_KEYCODE = {
289
305
  "§": 41,
290
306
  "1": 2,
@@ -466,45 +482,70 @@ def _char_to_ydotool_combo(
466
482
  if len(char) == 1 and char.isascii() and char.isdigit():
467
483
  return char
468
484
 
469
- return None
485
+ # Literal " " is KEY_SPACE in ydotool 0.1.x; keep it in the key batch
486
+ # instead of flushing into a separate `ydotool type` call (extra delay).
487
+ if char == " ":
488
+ return " "
470
489
 
471
-
472
- def _ydotool_press_keycodes(
473
- keycodes: list[str],
474
- env: dict[str, str],
475
- key_delay_ms: int,
476
- mod_delay_ms: int = 0,
477
- ) -> None:
478
- if not keycodes:
479
- return
480
- args = ["ydotool", "key"]
481
- if mod_delay_ms:
482
- args.extend(["--delay", str(mod_delay_ms)])
483
- if key_delay_ms:
484
- args.extend(["--key-delay", str(key_delay_ms)])
485
- args.extend(keycodes)
486
- _run_command(args, env=env)
490
+ return None
487
491
 
488
492
 
489
493
  def _ydotool_press_combos(
490
494
  combos: list[str],
491
495
  env: dict[str, str],
492
- key_delay_ms: int,
493
- mod_delay_ms: int = 0,
496
+ key_delay_ms: int = 0,
494
497
  ) -> None:
495
498
  if not combos:
496
499
  return
497
- args = ["ydotool", "key"]
498
- if mod_delay_ms:
499
- args.extend(["--delay", str(mod_delay_ms)])
500
+ args = ["ydotool", "key", "--delay", "0"]
500
501
  if key_delay_ms:
501
502
  args.extend(["--key-delay", str(key_delay_ms)])
503
+ else:
504
+ args.extend(["--key-delay", "0"])
502
505
  # Needed for literal keys that look like options (e.g. "-").
503
506
  args.append("--")
504
507
  args.extend(combos)
505
508
  _run_command(args, env=env)
506
509
 
507
510
 
511
+ def _combo_parts(combo: str) -> tuple[list[str], str]:
512
+ parts = [part.strip() for part in combo.split("+") if part.strip()]
513
+ if len(parts) <= 1:
514
+ return [], parts[0] if parts else combo
515
+ return parts[:-1], parts[-1]
516
+
517
+
518
+ def _is_modifier_name(name: str) -> bool:
519
+ return name.lower() in YDOTOOL_MODIFIER_NAMES
520
+
521
+
522
+ def _ydotool_press_modifier_combo(
523
+ combo: str,
524
+ env: dict[str, str],
525
+ key_delay_ms: int,
526
+ mod_delay_ms: int,
527
+ ) -> None:
528
+ """Press a modifier combo, honouring mod_delay as inter-event spacing.
529
+
530
+ Debian ydotool 0.1.x only supports combo syntax (e.g. shift+a). The
531
+ keycode form 42:1 / shift:1 is misparsed and types digits/letters instead
532
+ of holding the modifier. --key-delay spaces events inside the combo, so
533
+ shift is held for mod_delay before the key goes down.
534
+
535
+ The CLI returns before delayed daemon events finish, so we sleep for the
536
+ full sequence to avoid overlapping the next character.
537
+ """
538
+ mods, _key = _combo_parts(combo)
539
+ if not mods:
540
+ _ydotool_press_combos([combo], env, key_delay_ms)
541
+ return
542
+
543
+ hold_ms = max(mod_delay_ms if mod_delay_ms > 0 else key_delay_ms, 12)
544
+ _ydotool_press_combos([combo], env, hold_ms)
545
+ # mod↓ → key↓ → key↑ → mod↑ => 3 gaps
546
+ time.sleep((3 * hold_ms) / 1000.0)
547
+
548
+
508
549
  def _ydotool_type_plain(text: str, env: dict[str, str], key_delay_ms: int) -> None:
509
550
  if not text:
510
551
  return
@@ -594,7 +635,7 @@ def _ydotool_send_backslash(
594
635
  _ydotool_type_gnome_backslash(env, key_delay_ms)
595
636
  time.sleep(0.1)
596
637
  return
597
- _ydotool_press_combos(["\\"], env, key_delay_ms, mod_delay_ms)
638
+ _ydotool_press_combos(["\\"], env, key_delay_ms)
598
639
 
599
640
 
600
641
  def type_string_ydotool(
@@ -608,31 +649,37 @@ def type_string_ydotool(
608
649
  ) -> None:
609
650
  socket_path = ensure_ydotoold()
610
651
  env = _ydotool_env(socket_path)
611
- key_delay_ms = max(12, int(delay * 1000))
652
+ key_delay_ms = max(0, int(delay * 1000))
612
653
  mod_delay_ms = max(0, int(mod_delay * 1000))
654
+ # ydotool default key-delay is 12ms; keep a small floor for plain taps.
655
+ plain_key_delay_ms = max(12, key_delay_ms) if key_delay_ms else 12
613
656
  pending: list[str] = []
614
657
 
615
658
  def flush_pending() -> None:
616
659
  if pending:
617
- _ydotool_press_combos(pending, env, key_delay_ms, mod_delay_ms)
660
+ _ydotool_press_combos(pending, env, plain_key_delay_ms)
618
661
  pending.clear()
619
662
 
620
663
  for char in text:
621
664
  if char == "\\":
622
665
  flush_pending()
623
- _ydotool_send_backslash(env, key_delay_ms, mod_delay_ms)
666
+ _ydotool_send_backslash(env, plain_key_delay_ms, mod_delay_ms)
624
667
  continue
625
668
 
626
- keycodes = _char_keycode_sequence(char, layout, special_chars_shift, special_chars_alt_gr)
627
- if keycodes:
669
+ # Skip keycode:1 sequences — broken on ydotool 0.1.x (types digits).
670
+ # Prefer combo syntax (shift+a, alt_r+4) which the daemon handles correctly.
671
+ combo = _char_to_ydotool_combo(char, layout, special_chars_shift, special_chars_alt_gr)
672
+ if combo is None:
628
673
  flush_pending()
629
- _ydotool_press_keycodes(keycodes, env, key_delay_ms, mod_delay_ms)
674
+ _ydotool_type_plain(char, env, plain_key_delay_ms)
630
675
  continue
631
676
 
632
- combo = _char_to_ydotool_combo(char, layout, special_chars_shift, special_chars_alt_gr)
633
- if combo is None:
677
+ mods, _key = _combo_parts(combo)
678
+ if mods:
634
679
  flush_pending()
635
- _ydotool_type_plain(char, env, key_delay_ms)
680
+ _ydotool_press_modifier_combo(combo, env, plain_key_delay_ms, mod_delay_ms)
681
+ if key_delay_ms:
682
+ time.sleep(key_delay_ms / 1000.0)
636
683
  continue
637
684
 
638
685
  pending.append(combo)
@@ -640,10 +687,7 @@ def type_string_ydotool(
640
687
  flush_pending()
641
688
 
642
689
  if end_line:
643
- _run_command(
644
- ["ydotool", "key", f"{ENTER_KEYCODE}:1", f"{ENTER_KEYCODE}:0"],
645
- env=env,
646
- )
690
+ _ydotool_press_combos(["enter"], env, plain_key_delay_ms)
647
691
 
648
692
 
649
693
  def _wayland_backend() -> str:
@@ -21,20 +21,27 @@
21
21
  rounded_rectangle: (self.x, self.y, self.width, self.height, 10)
22
22
  width: 1
23
23
 
24
- MDLabel:
25
- text: (root.text_input_id.rsplit("_", 1)[-1] if root.text_input_id else "")
24
+ MDTextField:
25
+ id: _slot_name
26
+ hint_text: "Name"
27
+ multiline: False
28
+ write_tab: False
26
29
  size_hint_x: None
27
- width: "36dp"
28
- halign: "center"
29
- valign: "middle"
30
- theme_text_color: "Custom"
31
- text_color: get_color_from_hex("#F5A623")
32
- font_size: "15sp"
33
- bold: True
30
+ width: "180dp"
31
+ name_field: True
32
+ mode: "fill"
33
+ fill_color_normal: get_color_from_hex("#262626")
34
+ fill_color_focus: get_color_from_hex("#262626")
35
+ line_color_normal: get_color_from_hex("#333333")
36
+ line_color_focus: get_color_from_hex("#F5A623")
37
+ text_color_normal: get_color_from_hex("#F5A623")
38
+ text_color_focus: get_color_from_hex("#F5A623")
39
+ hint_text_color_normal: get_color_from_hex("#A3A3A3")
40
+ hint_text_color_focus: get_color_from_hex("#F5A623")
34
41
 
35
42
  MDTextField:
36
43
  id: _text_input
37
- hint_text: "Slot " + (root.text_input_id.rsplit("_", 1)[-1] if root.text_input_id else "")
44
+ hint_text: "Value"
38
45
  multiline: False
39
46
  write_tab: False
40
47
  size_hint_x: 1
@@ -53,6 +60,7 @@
53
60
  size_hint: None, None
54
61
  size: "28dp", "28dp"
55
62
  pos_hint: {"center_y": 0.5}
63
+ execute_checkbox: True
56
64
  color_active: get_color_from_hex("#F5A623")
57
65
 
58
66
  MDLabel:
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- app_version = "0.1.27"
3
+ app_version = "0.1.28"
4
4
  APP_WM_CLASS = "keyboardpaster"
5
5
 
6
6
 
File without changes