Hi,
is it possible to start creating a new file in an existing instance from shell? I'd like to use a keyboard shortcut to start a new file, but `geany` with no arguments opens a new instance (not useful).
If it can't be done, how likely are you to implement it? Ideally, this would be a commandline parameter (something like the opposite of `-i`).
It should be opened in an opened window if it exists. I always have only one instance.
Hm. When I call `geany` from shell (either from a new one or using `geany &` repeatedly) it spawns a new instance every time.
When I call `geany <filename>` it opens the file in the first instance that was opened. (Thinking of which, that also isn't too good - I'd expect it to appear in the last one).
No geany cannot open a new file from the command line, if a filename is given geany attempts to open it and complains if it doesn't exist since its most likely a typo. A command line option to specify this is a new file would be needed, but nobody has written it.
Running Geany on the command line without a filename creates a new instance as you have observed, this is intended behaviour documented in the manual.
Running Geany from the command line with at least one filename more than once defaults to opening all files in the first instance as you observed, this is also intended and documented behaviour. If you want a new instance use the -i option.
I always warn about running more than one instance of Geany using the same configuration, there is no sharing of changes and the last one to write its version of the configuration "wins" at shutdown.
Cheers Lex
On 9 June 2017 at 00:14, Anna Frankova notifications@github.com wrote:
Hm. When I call geany from shell (either from a new one or using geany & repeatedly) it spawns a new instance every time.
When I call geany <filename> it opens the file in the first instance that was opened. (Thinking of which, that also isn't too good - I'd expect it to appear in the last one).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/geany/geany/issues/1512#issuecomment-307116588, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxgTVimeOtXGlCrdtgNo7Nzvv356iF8ks5sCAHNgaJpZM4N0F8M .
No geany cannot open a new file from the command line, if a filename is given geany attempts to open it and complains if it doesn't exist since its most likely a typo.
Here it behaves just like nano or vim and opens a new unsaved file with the given filename.
@codebrainz weird
``` lex@fred7 ~ $ ./geany -c /tmp/foo bash: ./geany: No such file or directory lex@fred7 ~ $ ```
Ahh, couldn't find geany, ok, now it works :)
Although technically it opens a new buffer, it doesn't actually create the file until you save the buffer, either in the running instance by default, or in a new instance with the -i option.
Yeah, that's the usual behaviour, it would be annoying if created the file, for example if you made or a typo or decided you didn't want to save the file, you'd have to go into terminal/file manager and manually delete it.
I think this issue could probably be closed as you can do what the title says already.
You can use the `--socket-file` option to open a file in a specific instance of Geany. For example, if you execute these two commands:
``` geany --socket-file=/tmp/geany1 /tmp/foo geany --socket-file=/tmp/geany1 /tmp/bar ```
you get one instance of Geany with two open documents, `/tmp/foo` and `/tmp/bar`.
Here’s a script I use (on Linux) to have one instance of Geany per workspace: https://gist.github.com/vfaronov/6843c6bc817521bfab7e58fff139c525
Thanks for the replies, but none of the suggestions are helpful with what I'm trying to do, which is to **open a new tab** (empty "untitled" file, or a new buffer as @elextr said) **in an existing instance** (any existing instance, I just don't want to spawn a new one).
technically it opens a new buffer, it doesn't actually create the file until you save the buffer
And thanks for that, because I tried calling `geany ""` and it started editing `/home/<username>` which... ouch. XD
I think this issue could probably be closed as you can do what the title says already.
...no, I can't? Unless you choose to interpret it as "open existing file in a new tab" which, okay, but not what I meant.
Oh, well. Is there any official way of submitting a feature request for this?
Oh, well. Is there any official way of submitting a feature request for this?
You have :smile:
I don't get it, you can open a new empty file from the command line, and @vfaronov showed how to open that new file in any existing instance instead of just the first one. What more is needed?
@corvidism is it that you don't want to choose a name for the new file up-front but rather later using the Save As dialog?
If so, [this patch](https://gist.github.com/codebrainz/71d761e2cfd7e7519106ce4f731dd5ee) should work, but it doesn't since Geany ignores request to use existing socket file when no filenames are given, so it always opens a new instance. I have no idea where that code is, but something like this should work with the patch if it was fixed:
```bash $ geany -u # or $ geany --socket-file=/what/ever -u ```
is it that you don't want to choose a name for the new file up-front but rather later using the Save As dialog?
Yes, that's it.
@corvidism @LarsGit223 has implemented this in #1811, but I'm wondering what is the actual use case for *not* choosing the filename? It eludes me why one would like to create a new empty document from outside Geany without anything, be it content or even path. Once I'm convinced it does have a use case, I'll properly test and merge the mentioned PR (which looks OK).
Well, to be honest, I abandoned Geany since then, but the use case was this:
I wanted to use a keyboard shortcut to open a new file - for notes and such. The problem was, that calling "geany" with no params would spawn a new instance, which was pretty slow (not "loading an IDE" slow, but still too much for regular use). It would be much better to just create a new file within an existing Geany instance. But that requires a filename, which brings its own list of problems:
- where should the file be located? - how to keep the file name unique?
and so on. So I would have to write an actual script to do something that I still feel is basic functionality. And if I remember correctly, when saving a new file created through the GUI, the Save as... dialog would remember last used location, whereas with an auto filename it would open at the file's location.
Closed #1512.
Closing for now, if somebody wants the feature again, there is an implementation in #1811. Feel free to ask for it, we'll merge it then.
github-comments@lists.geany.org