From 164bda54620e9b9cbd77ca5bba156d2676065e7e Mon Sep 17 00:00:00 2001 From: Chea Vuthearith <159639139+chea-vuthearith@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:53:27 +0700 Subject: [PATCH] record: add arg to copy screen recording to clipboard (#83) --- completions/caelestia.fish | 1 + src/caelestia/parser.py | 1 + src/caelestia/subcommands/record.py | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/completions/caelestia.fish b/completions/caelestia.fish index 5257f3f..80f177c 100644 --- a/completions/caelestia.fish +++ b/completions/caelestia.fish @@ -105,6 +105,7 @@ complete -c caelestia -n "$seen screenshot" -s 'f' -l 'freeze' -d 'Freeze while # Record complete -c caelestia -n "$seen record" -s 'r' -l 'region' -d 'Capture region' complete -c caelestia -n "$seen record" -s 's' -l 'sound' -d 'Capture sound' +complete -c caelestia -n "$seen record" -s 'c' -l 'clipboard' -d 'Copy recording path to clipboard' # Clipboard complete -c caelestia -n "$seen clipboard" -s 'd' -l 'delete' -d 'Delete from cliboard history' diff --git a/src/caelestia/parser.py b/src/caelestia/parser.py index 840ead5..110e065 100644 --- a/src/caelestia/parser.py +++ b/src/caelestia/parser.py @@ -71,6 +71,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace): record_parser.add_argument("-r", "--region", nargs="?", const="slurp", help="record a region") record_parser.add_argument("-s", "--sound", action="store_true", help="record audio") record_parser.add_argument("-p", "--pause", action="store_true", help="pause/resume the recording") + record_parser.add_argument("-c", "--clipboard", action="store_true", help="copy recording path to clipboard") # Create parser for clipboard opts clipboard_parser = command_parser.add_parser("clipboard", help="open clipboard history") diff --git a/src/caelestia/subcommands/record.py b/src/caelestia/subcommands/record.py index 867eb1b..1e651d7 100644 --- a/src/caelestia/subcommands/record.py +++ b/src/caelestia/subcommands/record.py @@ -1,3 +1,4 @@ +from pathlib import Path import json import re import shutil @@ -108,6 +109,10 @@ class Command: except IOError: pass + if self.args.clipboard: + file_uri = Path(new_path).resolve().as_uri() + "\n" + subprocess.run(["wl-copy", "--type", "text/uri-list"], input=file_uri.encode()) + action = notify( "--action=watch=Watch", "--action=open=Open",