From d6a4d78d31ffa57e00a7d5b0a87baa38156cee06 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 20 Aug 2024 20:07:40 -0300 Subject: Move some scripts to the utils-x11 repository --- screenshot | 13 -------- xclip-ssh | 106 ------------------------------------------------------------- xdg-add | 16 ---------- 3 files changed, 135 deletions(-) delete mode 100755 screenshot delete mode 100755 xclip-ssh delete mode 100755 xdg-add diff --git a/screenshot b/screenshot deleted file mode 100755 index 75a9895..0000000 --- a/screenshot +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# Wrapper around scrot - -# Workaround -# See https://bbs.archlinux.org/viewtopic.php?id=86507 -# https://groups.google.com/forum/#!msg/linux.debian.bugs.dist/_tmJIFYBfZo/F7x5WFEQCMsJ -if echo "$*" | grep -q -- '-s'; then - sleep 0.2 -fi - -# Take a screenshot -scrot '%Y-%m-%d-%H:%M:%S_$wx$h.png' -e 'mv $f ~/load/' $* diff --git a/xclip-ssh b/xclip-ssh deleted file mode 100755 index 46c94b3..0000000 --- a/xclip-ssh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env bash -# -# Intersystem communication via clipboard over SSH! -# Transmits data using the clipboard via SSH session. -# -# Description: -# -# xclip-ssh does what the same says - xclip over SSH. -# Works even with a remote host in a .onion service! -# And even between virtual machines! -# -# Works around the following PoC: -# -# ssh -X # log in the remote system -# DISPLAY=:0 xclip -o # extracts remote's clipboard -# -# Usage: -# -# xclip-ssh send [stdin|data] -# xclip-ssh receive [stdout|xclip] -# -# Examples: -# -# cat /path/to/file | xclip-ssh send server -# xclip-ssh send server "some text" -# xclip-ssh receive server stdout > saved.txt - -# Parameters -BASENAME="`basename $0`" -ACTION="$1" -SERVER="$2" -STORE="$3" - -# Display usage -function xclip_ssh_usage { - echo "usage: $BASENAME [data]" - exit 1 -} - -# Send data -function xclip_ssh_send { - if [ -z "$STORE" ]; then - STORE="xclip" - fi - - if [ "$STORE" == "xclip" ]; then - CONTENT="`xclip -o`" - elif [ "$STORE" == "stdin" ]; then - mapfile -t CONTENT - #printf '%s\n' "${CONTENT[@]}" - else - shift 2 - CONTENT="$*" - fi - - # See https://askubuntu.com/questions/804095/how-do-i-disable-the-message-of-the-day-motd-on-ubuntu-14-04 - ssh -q -X $SERVER bash < /dev/null; then - echo "$BASENAME: missing xclip in the remote server" - else - echo ${CONTENT[@]} | DISPLAY=:0 xclip - fi - ##### END REMOTE SCRIPT ####### -EOF -} - -# Receive data helper -function xclip_ssh_helper { - ssh -q -X $SERVER bash < /dev/null; then - echo "$BASENAME: missing xclip in the remote server" - else - DISPLAY=:0 xclip -o - fi - ##### END REMOTE SCRIPT ####### -EOF -} - -# Receive data -function xclip_ssh_receive { - if [ -z "$STORE" ]; then - STORE="xclip" - fi - - if [ "$STORE" == "stdout" ]; then - xclip_ssh_helper - echo "" - else - xclip_ssh_helper | xclip -i - fi -} - -# Check -if [ -z "$2" ]; then - xclip_ssh_usage -elif [ "$ACTION" != "send" ] && [ "$ACTION" != "receive" ]; then - xclip_ssh_usage -elif ! which xclip &> /dev/null; then - echo "$BASENAME: please install xclip" - exit 1 -fi - -# Dispatch -xclip_ssh_$ACTION $* diff --git a/xdg-add b/xdg-add deleted file mode 100755 index d572ba9..0000000 --- a/xdg-add +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# A xdg-mime shortcut. -# - -# Parameters -APP="$1" -FILETYPE="$2" - -# Check if second param is a file -if [ -e "$FILETYPE" ]; then - FILETYPE="`xdg-mime query filetype $FILETYPE`" -fi - -# Make association -xdg-mime default ${APP}.desktop $FILETYPE -- cgit v1.2.3