mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-05 14:59:29 -05:00
record: add arg to copy screen recording to clipboard (#83)
This commit is contained in:
@@ -105,6 +105,7 @@ complete -c caelestia -n "$seen screenshot" -s 'f' -l 'freeze' -d 'Freeze while
|
|||||||
# Record
|
# Record
|
||||||
complete -c caelestia -n "$seen record" -s 'r' -l 'region' -d 'Capture region'
|
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 's' -l 'sound' -d 'Capture sound'
|
||||||
|
complete -c caelestia -n "$seen record" -s 'c' -l 'clipboard' -d 'Copy recording path to clipboard'
|
||||||
|
|
||||||
# Clipboard
|
# Clipboard
|
||||||
complete -c caelestia -n "$seen clipboard" -s 'd' -l 'delete' -d 'Delete from cliboard history'
|
complete -c caelestia -n "$seen clipboard" -s 'd' -l 'delete' -d 'Delete from cliboard history'
|
||||||
|
|||||||
@@ -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("-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("-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("-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
|
# Create parser for clipboard opts
|
||||||
clipboard_parser = command_parser.add_parser("clipboard", help="open clipboard history")
|
clipboard_parser = command_parser.add_parser("clipboard", help="open clipboard history")
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@@ -108,6 +109,10 @@ class Command:
|
|||||||
except IOError:
|
except IOError:
|
||||||
pass
|
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 = notify(
|
||||||
"--action=watch=Watch",
|
"--action=watch=Watch",
|
||||||
"--action=open=Open",
|
"--action=open=Open",
|
||||||
|
|||||||
Reference in New Issue
Block a user