aboutsummaryrefslogtreecommitdiff
path: root/osc
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-01-13 00:01:56 +0100
committernea <romangraef@gmail.com>2022-01-13 00:01:56 +0100
commitd9031203e22e4ef381c482b4594521323647487e (patch)
tree1ea7dcfb53840a42f10d19cf25317138e497911a /osc
downloadscripts-d9031203e22e4ef381c482b4594521323647487e.tar.gz
scripts-d9031203e22e4ef381c482b4594521323647487e.tar.bz2
scripts-d9031203e22e4ef381c482b4594521323647487e.zip
Initial commit
Diffstat (limited to 'osc')
-rwxr-xr-xosc25
1 files changed, 25 insertions, 0 deletions
diff --git a/osc b/osc
new file mode 100755
index 0000000..d3b0e3a
--- /dev/null
+++ b/osc
@@ -0,0 +1,25 @@
+#!/bin/bash
+esc() {
+ python -c "import sys;print('\x1b]'+';'.join(sys.argv[1:]), end='\x07')" "$@"
+}
+if [ "$1" = "notify" ]; then
+ esc 777 notify "$2" "$3"
+elif [ "$1" = "anchor" ] || [ "$1" = "url" ]; then
+ esc 8 "" "$2"
+ echo -n "$3"
+ esc 8 "" ""
+elif [ "$1" = "showimg" ]; then
+ printf "\e]1337;File=inline=1;preserveAspectRatio=1:"
+ base64 -w 0
+ printf "\a"
+else
+ cat >&2 <<EOF
+Usage: $0 <action> [args]
+
+Actions:
+
+notify [notification title] [notification text] - Show system notification
+anchor [url] [text] - Show hyperlink
+showimg - Show an image from STDIN (NOT base64-encoded)
+EOF
+fi