doesn't work in ubuntu 16.04
Opened this issue · 2 comments
For example, create a text file named bla that contains 'blablabla' in ~/.texpander/
When I run texpander with debugging on
sh -x texpander.sh
I get
+ base_dir=/home/stefan/.texpander/
+ zenity --entry --title=Texpander --text=Abbreviation
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
+ name=bla
+ path=/home/stefan/.texpander/bla
+ path+=.txt
texpander.sh: 7: texpander.sh: path+=.txt: not found
+ [[ bla ]]
texpander.sh: 9: texpander.sh: [[: not found
For debugging purposes I simplified things a bit:
- I omitted the 'txt' from the file so it is just named bla
- I stripped down texpander for testing that is:
base_dir="${HOME}/.texpander/"
name=$(zenity --entry --title="Texpander" --text="Abbreviation")
path=$base_dir$name
if [ -e "$path" ]
then
xclip -selection clipboard -i "$path"
xdotool key shift+ctrl+v
else
zenity --error --text="Abbreviation not found:\n$name"
fi
The output in terminal is:
stefan@16:~/bin$ sh -x texpander.sh
+ base_dir=/home/stefan/.texpander/
+ zenity --entry --title=Texpander --text=Abbreviation
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
+ name=bla
+ path=/home/stefan/.texpander/bla
+ [ -e /home/stefan/.texpander/bla ]
+ xclip -selection clipboard -i /home/stefan/.texpander/bla
+ xdotool key shift+ctrl+v
blablablablablabla
stefan@16:~/bin$ blablablablablabla
So the idea works in terminal. Change the 'shift+ctrl+v' to 'ctrl+v' like so
#!/bin/bash
base_dir="${HOME}/.texpander/"
name=$(zenity --entry --title="Texpander" --text="Abbreviation")
path=$base_dir$name
if [ -e "$path" ]
then
xclip -selection clipboard -i "$path"
xdotool key ctrl+v
else
zenity --error --text="Abbreviation not found:\n$name"
fi
and run texpander in gedit using a hot key.
Nothing happens. And the clipboard is empty.
So, the first problem is the string concatenation not working.
path+=".txt"
The second problem of it not working in gedit--I have no idea.
Looks like the first part solved in the comments section of the blog post; http://leehblue.com/ubuntu-text-expander/
I just made some updates that improve the reliability of determining the name of the window and process name. Trying to figure out the ctrl+v
vs ctrl+shift+v
thing can be problematic sometimes. Please try out the latest version (1.2.1) and let me know if you have any trouble.