initial commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
SCRIPTLOC="$HOME/.local/bin/textmagicscripts"
|
||||
|
||||
printResult () {
|
||||
scriptname="$1"
|
||||
script=$(echo $scriptname | head -c -3)
|
||||
eval "xclip -o | $SCRIPTLOC"/"$script | xclip -sel c"
|
||||
active_window_id=$(xdotool getactivewindow)
|
||||
if [ -z "$(xprop -id $active_window_id WM_CLASS | grep -o terminal | head -n 1)" ]
|
||||
then
|
||||
xdotool key ctrl+v
|
||||
else
|
||||
xdotool key ctrl+shift+v
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
export -f printResult
|
||||
|
||||
|
||||
find $SCRIPTLOC -maxdepth 1 -type f -exec basename {} \; | while read line;
|
||||
do
|
||||
for i in {p,c}
|
||||
do
|
||||
echo ${line}_$i
|
||||
done
|
||||
done | \
|
||||
rofi -dmenu --window-title "TexMagics" -matching regex | \
|
||||
while read scriptname;
|
||||
do
|
||||
insertmode=$(echo $scriptname | tail -c 2)
|
||||
|
||||
case $insertmode in
|
||||
p)
|
||||
printResult $scriptname;;
|
||||
c)
|
||||
script=$(echo $scriptname | head -c -3)
|
||||
eval "xclip -o | $SCRIPTLOC"/"$script | xclip -sel c";;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user