-
This is definitely not caused by Autokey, not by Python and not by X-Windows . Nevertheless, its effect is that for the past two months clipboard.get_ selection() gets nothing. So, I did the following: Uninstalled every keyboard and mouse utility, with the exception of xsel. X Windows clipboard manager storage: Diodon displays that Autokey, Python, function with X clipboard, but clipboard.get_selection() just ignores it. There are ~30 short scripts with the similar code structure, enclosing text with wiki codes and none work. But two long scripts using the same structure, do work. My installs of luckyBackup and Xfce4.note also have problem with GTK. Because of recent experiences involving GTK and/or Gnome, I decided to break down the relationship between X11, the keyboard, the mouse, and the interaction with the X clipboard. before considering changing platforms. Posted the following info in Pastebin: Inxi -Fxz System info: https://pastebin.com/9M2bDeBe The standard error:
|
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 25 replies
-
So far, I just looked at the first two scripts briefly. Comments: Let's get past these first few issues (or misunderstandings on my part) and then see what's left to address. First script: The try and except clauses appear to be reversed. When it succeeds (assuming the API call was in the try clause), it emits an empty reference. When it fails, it tries to emit the selection as a reference - which can't work because it failed to get a selection. In your second script, there is no try block (because it just works). If I am reading man xsel correctly: The first script relies on the user making the selection and should emit an empty reference if they don't. The second script selects all the text automatically. |
Beta Was this translation helpful? Give feedback.
-
Interesting. It seems that the middle mouse button accesses #PRIMARY and #SECONDARY. I'm not sure that I'm able to correctly test #SECONDARY since I'm not sure any of my programs support it, but I messed around with both just now as well as I could.
I'm finding that, in either case, the data that's pasted by the middle mouse button depends very much on the program that the selection was made in and on the program that it was pasted into. You can get interesting and sometimes inconsistent results by trying these tests in a variety of programs with either #PRIMARY or #SECONDARY selections or a mixture of both: Test 1You may or may not get the same (original) selection each time instead of getting each of the selections when you try this:
Test 2This gets even more muddy if you jump between programs while making selections or pasting with the middle mouse button:
Even more interesting results can be obtained by testing in more than two programs at once. |
Beta Was this translation helpful? Give feedback.
-
I think we can safely ignore the secondary selection. If it ever was in general use, that was very long ago. If you need more clipboards, make your own with AutoKey global stored values. I made one and use it all the time. Mine stores one string. Super+s is memory store. Super+r is memory recall and I have a memory clear script that I almost never use on some other hotkey. I use it when I'm doing cryptocurrency calculations using kcalc (which does not have a memory register) and I have to convert a number of values in their native token to their equivalent in US dollars so I need the regular clipboard for each of the values and my custom one for the conversion factor. |
Beta Was this translation helpful? Give feedback.
-
Solved! It was quite the puzzle. This was getting weird. I changed the white space in the code (because, although it was fine as is, it was hard for me to look at). I removed all code that wasn't currently being used and ended up with this:
I ran the original edited code: (all testing done in autokey.qt) With no selection, it works as expected adding an empty reference. With some text selected, if replaces the selected text with an empty reference - clearly wrong With some text selected, but also copied to the clipboard, it works perfectly, replacing the selection with a reference containing the selection - This implies that get_selection() is working identically to get_clipboard() - maybe if the primary selection is empty but the clipboard is not, the clipboard becomes the primary selection or something like that. Note: Your code (and the above code) places the result in the clipboard, but never uses it. The send_keys() produces the result. Finally figured it out and now it works! By selecting some text, you filled the primary selection, but the first thing your script does is call xsel which clears the primary selection. Don't do that! LOL |
Beta Was this translation helpful? Give feedback.
-
Much much thanks to both of you. Not realizing that a selection is automatically identified by the PERMANENT clipboard, I defeated my efforts. @Elliria, I loved both your solutions and the scripting style. Much thanks for that. Here is the working script:
|
Beta Was this translation helpful? Give feedback.
-
It looks great, @ineuw. I've added it to my collection. A girl can't have too many wrapper scripts. |
Beta Was this translation helpful? Give feedback.
-
@Elliria Just installed zim (again). I had it long ago, but didn't use it. OFC it uses its own markup language. |
Beta Was this translation helpful? Give feedback.
-
I'll answer this in our Gitter conversation since it's going in a new direction from the original topic here. |
Beta Was this translation helpful? Give feedback.
-
Please close this topic with my sincere thanks for your kind consideration and help. The problems are definitely unrelated to Autokey. I am composing a post for the Linux Mint forum, because I am confident that the developers actively scan the forum posts. Previously, I found a script installed in the .config folder testing LG monitor display problems. I will return later to post a link to the post. |
Beta Was this translation helpful? Give feedback.
Please close this topic with my sincere thanks for your kind consideration and help. The problems are definitely unrelated to Autokey. I am composing a post for the Linux Mint forum, because I am confident that the developers actively scan the forum posts. Previously, I found a script installed in the .config folder testing LG monitor display problems. I will return later to post a link to the post.