Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't work in ubuntu 16.04 #1

Open
bwanaaa opened this issue Jul 21, 2016 · 2 comments
Open

doesn't work in ubuntu 16.04 #1

bwanaaa opened this issue Jul 21, 2016 · 2 comments

Comments

@bwanaaa
Copy link

bwanaaa commented Jul 21, 2016

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:

  1. I omitted the 'txt' from the file so it is just named bla
  2. 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.

@Woody2143
Copy link

Looks like the first part solved in the comments section of the blog post; http://leehblue.com/ubuntu-text-expander/

@leehblue
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants