stata-exec icon indicating copy to clipboard operation
stata-exec copied to clipboard

Focus error : working with window managers (e.g dwm) on Linux

Open vedshastry opened this issue 3 years ago • 0 comments

I am using dwm on Arch Linux, but I believe this issue might apply to most users working with window managers.

The selected codeblock does not run in Stata until I shift my focused window to Stata, upon which all the text is synced and sent. This is particular to a window manager workflow since only 1 window is considered to be 'in focus' at a time. On desktop environments, this issue does not exist.

I believe the problem is that sendCode.js currently uses the --sync flag on windowactivate.

  1. The selected codeblock is sent to clipboard
  2. The Stata window is activated
  3. Clipboard is pasted, and then the current window is activated again.

I have managed to get this working by modifying the following lines in lib/sendCode.js Here is the diff for fixing this issue. This should not affect compatibility with desktop environments on Linux, but it will be great if this could be tested!

132,133c132,133
<         windowactivate --sync $stata_window \
<         key --clearmodifiers --delay 100 ctrl+v Return \
---
>         windowactivate $stata_window \
>         key --window $stata_window --clearmodifiers --delay 20 ctrl+v Return \

vedshastry avatar Mar 13 '23 05:03 vedshastry