From af86c7d6eba3df9929edb2095d32b2b0e14203ab Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Sun, 26 Oct 2025 23:21:47 +0400 Subject: feat(sclip): added --- scripts/gui/sclip | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 scripts/gui/sclip diff --git a/scripts/gui/sclip b/scripts/gui/sclip new file mode 100755 index 0000000..ac664cc --- /dev/null +++ b/scripts/gui/sclip @@ -0,0 +1,27 @@ +#!/bin/sh + +. slib + +help() { +cat << EOF +${0}: Copy the content of filepath into clipboard +options: + -h Print this message and exit +EOF + +exit 0 +} + +check_program "xclip" + +[ "${#}" != 1 ] && invalid_use +[ "${1}" = "-h" ] && help + + +FILE="${1}" + +[ ! -f "${FILE}" ] && err "${FILE} not found" + +MIME_TYPE=$(file --mime-type -b "${FILE}") + +run "xclip -selection clipboard -t ${MIME_TYPE} -i ${FILE}" -- cgit v1.2.3