# geany F5 trouble
## Description of problem
F5 - works only the first time restarting F5 is possible only if you press ENTER in the "terminal" window or enter command, example 'clear'
### Video
https://user-images.githubusercontent.com/76629445/106052373-8981ae80-60fa-1...
## What i want
work every time a button F5 is pressed
## Environment
tested on all geany versions geany 0.21, 1.22, 1.23, 1.24
Slackware 12.2 TDE-3.5.12 terminal client: konsole/kde3
Closed #2738.
This is intended behaviour, Geany only allows one execute at a time and you may notice that the menu and toolbar icon changes to some form of stop or cancel icon which if pressed will kill the terminal, and so the running process (in case your new program gets into an infinite loop :) and when you close the terminal (after you have read the messages your program printed) the icon reverts and a new execute can happen.
However some terminal emulators circumvent this behaviour. Instead of running a new window they open a new tab in an existing terminal emulator window and exit immediately, telling Geany that the execute is finished so a new execute can start but losing the kill ability.
IIRC the KDE terminal emulator is one of those, and thats likely the behaviour you have been seeing in the past if there was already a terminal running. But, if the terminal Geany runs happens to be the first one opened, it of course has to open a window and it keeps running, so Geany behaves as expected since the terminal process doesn't close immediately.
Thank @elextr for your detailed answer, if I understood you correctly, it is impossible to run several programs in parallel and I agree with that.
But I would like to avoid pressing the Enter key between two consecutive runs of the same program.
For example, right now it looks like this: 1. press F5. 2. program1 runs and finishes Press Enter for new line or input 'clear' in terminal, because otherwise F5 doesn't work. 4. Press F5 5. Program1 works and finishes
I would like: 1. press F5 2. program1 runs and stops 3. press F5 4. Program1 runs and exits
Is it possible?
Ahh, you are talking about running in the embedded terminal widget (VTE), that wasn't clear from the screenshot and your listing konsole as the terminal.
This is a different problem, Geany just sends a command to VTE, it doesn't run the command, and VTE doesn't run the command either, the shell already running inside it does, and that does not have a way of communicating the process ID back to VTE for it to communicate it back to Geany, so neither VTE nor Geany can wait on completion since they do not know which process ID to wait on. So Geany doesn't wait for completion when running in VTE and the execute icon will never change to kill as Geany has no idea which process ID to kill.
But the user can also type into the VTE widget, and as Geany can't remove those characters, any stray characters will get appended to the command. So there is the concept of the terminal being "clean", where to the best of Geany's knowledge nothing has been typed in VTE since the last command or enter or ctrl+c, all of which should cause any input to be consumed/ignored by the shell. If VTE isn't "clean" Geany asks you to clean it before it will attempt to run the command and confirm by enter or ctrl+c. But this is a bit of a heuristic, its not perfect.
For me it works the way you would like. F5, program runs and finishes, F5, program runs and finishes.
There is a keybinding to switch to the VTE (bound to F4 by default) and there is a keybinding to switch to the editor (bound to F2 by default). But within VTE only the minimal keybindings work, to avoid stealing them from the program running there which may use them. IIRC the (default F2) switch to editor is one of the few that work and F5 deliberately doesn't along with most of the other keybindings.
For me a program that needs user input works as F5, program runs until input needed, F4, type input, enter, program completes, F2, F5 ... rinse and repeat.
So your continual need to clean VTE means somehow you are getting VTE "unclean" by typing in VTE between commands.
github-comments@lists.geany.org