summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-26 23:21:47 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-26 23:21:47 +0400
commitaf86c7d6eba3df9929edb2095d32b2b0e14203ab (patch)
tree56c661e05a2d69edd3cc7cb2651697dc626df6dc /scripts
parentcb78290f31886fb1f9a5e7c2a764dda55a459e50 (diff)
feat(sclip): added
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gui/sclip27
1 files changed, 27 insertions, 0 deletions
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}"