Last active
August 29, 2015 14:04
-
-
Save vrs/9622b96a0d3842ec812b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# fix shift+ins pasting on gtk apps | |
# use by binding to shift+ins globally like so: ("S-<Insert>", spawn "pastefix") | |
# depends: xclip, xdotool | |
# inspired by https://github.com/wh5a/arch/commit/623faac500a0eeb31477b0374b3080eaf2ed3685 | |
clipboard=$(xclip -o -selection clipboard) | |
xclip -o | xclip -selection clipboard | |
pid=$(xdotool getwindowfocus getwindowpid) | |
if head -c 1 >/dev/null 2>/dev/null /proc/$pid/maps && \ | |
grep -q libgtk-x11 /proc/$pid/maps && \ | |
[ x$(ps -p $pid -o comm=) != xvim ] | |
then | |
xdotool getwindowfocus key --clearmodifiers ctrl+v | |
else | |
xdotool getwindowfocus key --clearmodifiers shift+Insert | |
fi | |
echo -n "$clipboard" | xclip -selection clipboard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment