ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Make it easy to close the window #69

Open edencaldas opened 7 years ago

edencaldas commented 7 years ago

Since the cursor is inside the terminal after executing code, control-w to close the window doesn't work, so we have to use the mouse.

ioquatix commented 7 years ago

Ah, that is annoying. Can you submit a PR or propose a way this could be improved?

edencaldas commented 7 years ago

In #67 I proposed F5 key to run, maybe pressing F5 again would close it, making it a toggle button.

ioquatix commented 7 years ago

Would it make more sense for repeated presses to re-run the script?

edencaldas commented 7 years ago

I would be good, but the problem to close the window would still exist.

Maybe if you do the geany aproach on this, the window poping up, all would be solved.

Here's a video showing how it works. https://vid.me/uqa0

ioquatix commented 7 years ago

I used to use Geany and also TextMate. They both had similar popup windows. On Mac, Command-R was intuitive and close to Command-W for closing the window. Pressing Command-R multiple times would run the script.

I'd like to reproduce the same on Linux, but the beauty of the Command key for GUI operations is lost on these systems.

The value of the Command key vs Control key becomes apparent once you consider that mixing a terminal and window commands. Ctrl-C for copy? Or for SIGINT?

The window pop up doesn't work very well in Atom AFAIK. It's not a good multi-window editor.

Additionally, I tend to use Atom in full screen. If it was possible, it would at least need to be a configurable option I guess?

One thing I agree on, is that the current output window is a bit crappy. We could probably just make it a full terminal emulator rather than the weird box thing that it currently is. With that, assessing how the keys work, whether it takes focus, etc could be reevaluated.

I'm open to ideas, but I really want something that works well. You are totally right, the current UI is a bit sub-standard.

edencaldas commented 7 years ago

I never said the output window was crappy. But yeah its theme doesn't match very well with atom. control-w already closes windows in atom, it just doesn't work with script-runner because the cursor is trapped in the terminal. F5 to run, F5 to run again and control-w to close (consistent with atom) would be perfect.

When F5 is ran in geany, it creates a temporary script in /tmp that deletes itself. I was able to capture it before deletion. Maybe it will help.

ps ux eden 28086 0.0 0.0 4488 744 pts/10 Ss+ 20:37 0:00 /bin/sh /tmp/geany_run_script_83W4VY.sh

script

#!/bin/sh

rm $0

cd '/home/eden'

ruby "untitled.rb"

echo "

------------------
(program exited with code: $?)"         

echo "Press return to continue"
#to be more compatible with shells like dash
dummy_var=""
read dummy_var
ioquatix commented 7 years ago

On Mac, though, it's not Control-W but Command-W. Just FYI. Keyboard shortcuts are not simple when trying to make it cross-platform :(

ioquatix commented 7 years ago

I'm doing some work on the output window and I'll try to make it better taking into account what you've said.

ioquatix commented 7 years ago

You can now use the pane:close command which is ctrl-k ctrl-w. That's the atom default. You can change it to something else, but keep in mind, ctrl- commands are reserved for the terminal. I'll think about if we can improve this a bit.

ioquatix commented 7 years ago

I was thinking, perhaps after the process has exited, if it exits with status 0, we could just make the pane go away, e.g. "Press ESC to close" or something. Ideas?

wjandrea commented 4 years ago

You can now use the pane:close command which is ctrl-k ctrl-w.

How exactly do you do this? I tried this but it didn't work:

'.script-runner':
    'ctrl-w': 'pane:close'