Make clip agnostic to clipboard.
This commit is contained in:
parent
d8d0a04556
commit
fa7d18e179
1 changed files with 22 additions and 1 deletions
23
.aliases
23
.aliases
|
@ -64,7 +64,28 @@ itks() {
|
||||||
xdg-open "https://google.com/search?q=$1+site%3Aitk.samfundet.no"
|
xdg-open "https://google.com/search?q=$1+site%3Aitk.samfundet.no"
|
||||||
}
|
}
|
||||||
|
|
||||||
alias clip="wl-copy"
|
clip() {
|
||||||
|
input=$(cat)
|
||||||
|
|
||||||
|
if [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null 2>&1; then
|
||||||
|
printf "%s" "$input" | wl-copy
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$DISPLAY" ] && command -v xclip >/dev/null 2>&1; then
|
||||||
|
printf "%s" "$input" | xclip -selection clipboard
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$TERM" ]; then
|
||||||
|
esc="$(printf "%s" "$input" | base64 | tr -d '\r\n')"
|
||||||
|
printf "\033]52;c;%s\a" "$esc"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "No clipboard method available" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
dchmod () {
|
dchmod () {
|
||||||
find $2 -type d -exec chmod $1 {} +
|
find $2 -type d -exec chmod $1 {} +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue