-
Notifications
You must be signed in to change notification settings - Fork 2
/
turkish-deasciify-selection-to-clipboard
executable file
·35 lines (31 loc) · 1.23 KB
/
turkish-deasciify-selection-to-clipboard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# On LINUX:
# Reads the selection clipboard, processes using turkish-deasciify, and then saves it into main clipboard.
#
# To setup a shortcut in Ubuntu, use the following steps:
# - Create keyboard shortcut with name: turkish-deasciify-selection-to-clipboard
# - Command: path-to/bashutils/turkish-deasciify-selection-to-clipboard
# - Shortcut: Something that you can easily paste afterwards. My suggestion: Ctrl-F9.
#
# On MAC:
# Reads the main clipboard, processes using turkish-deasciify, and then saves it into main clipboard.
#
# Gokberk Cinbis, September 2018
# https://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux
unameOut="$(\uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
#echo ${machine}
if [[ $machine == "Mac" ]]; then
pbpaste | turkish-deasciify | pbcopy
echo "The clipboard content has been turkish-deasciify'ed and saved back into the clipboard buffer."
else
xsel -op | turkish-deasciify | xsel -ib
echo "The selection buffer has been turkish-deasciify'ed and saved into the clipboard buffer."
fi