mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
33 lines
639 B
Bash
Executable File
33 lines
639 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Copy a file to the clipboard and paste it
|
|
# omarchy:group=clipboard
|
|
# omarchy:args=[--copy-only] <mime-type> <path>
|
|
# omarchy:examples=omarchy clipboard paste file image/png /tmp/screenshot.png
|
|
|
|
copy_only=false
|
|
|
|
if [[ ${1:-} == "--copy-only" ]]; then
|
|
copy_only=true
|
|
shift
|
|
fi
|
|
|
|
mime=${1:-}
|
|
path=${2:-}
|
|
|
|
if [[ -z $mime || -z $path ]]; then
|
|
echo "Usage: omarchy-clipboard-paste-file [--copy-only] <mime-type> <path>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
[[ -r $path ]] || exit 1
|
|
|
|
wl-copy --type "$mime" < "$path"
|
|
|
|
if [[ $copy_only == "true" ]]; then
|
|
exit
|
|
fi
|
|
|
|
sleep 0.15
|
|
wtype -M shift -k Insert -m shift 2>/dev/null || true
|