From 88caa3dc96ae0bc8fd236b809e8bf3ba43e62df3 Mon Sep 17 00:00:00 2001 From: buenosairesam Date: Mon, 29 Dec 2025 14:17:17 -0300 Subject: [PATCH] shit insert works --- dmapp/dmos/datetime-clipboard.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dmapp/dmos/datetime-clipboard.py b/dmapp/dmos/datetime-clipboard.py index f3def73..debea6d 100644 --- a/dmapp/dmos/datetime-clipboard.py +++ b/dmapp/dmos/datetime-clipboard.py @@ -8,6 +8,7 @@ Usage: datetime-clipboard.py 3t # 360-time format (0-359) datetime-clipboard.py uid # UUID first 8 chars """ + import sys import subprocess from datetime import datetime @@ -15,18 +16,25 @@ import uuid def copy_to_clipboard(text): - """Copy text to clipboard using wl-copy (Wayland) or xclip (X11) as fallback.""" + """Copy text to both clipboard and primary selection (for Shift+Insert in terminals).""" try: # Try wl-copy first (Wayland) - subprocess.run(['wl-copy'], input=text.encode(), check=True) + subprocess.run(["wl-copy"], input=text.encode(), check=True) + subprocess.run(["wl-copy", "--primary"], input=text.encode(), check=True) except FileNotFoundError: # Fallback to xclip (X11) try: - subprocess.run(['xclip', '-selection', 'clipboard'], - input=text.encode(), check=True) + subprocess.run( + ["xclip", "-selection", "clipboard"], input=text.encode(), check=True + ) + subprocess.run( + ["xclip", "-selection", "primary"], input=text.encode(), check=True + ) except FileNotFoundError: - print("Error: Neither wl-copy nor xclip found. Install wl-clipboard or xclip.", - file=sys.stderr) + print( + "Error: Neither wl-copy nor xclip found. Install wl-clipboard or xclip.", + file=sys.stderr, + ) sys.exit(1) @@ -55,9 +63,9 @@ def main(): format_type = sys.argv[1].lower() formatters = { - 'wd': get_weekday, - '3t': get_360time, - 'uid': get_uid, + "wd": get_weekday, + "3t": get_360time, + "uid": get_uid, } if format_type not in formatters: @@ -72,5 +80,5 @@ def main(): print(f"Copied to clipboard: {text}") -if __name__ == '__main__': +if __name__ == "__main__": main()