I currently have two Geany instances open. One is being used for a dedicated project; the other is a "scratch" instance I keep open for general-purpose rapid iteration.
I don't mind using the GNOME filepicker to open/save files when working on dedicated projects, but I tend to prefer the terminal for speed when I'm rapidly opening and closing things or when I need to create quick hacks without breaking mental flow.
Unfortunately, Geany wants to send *everything* to its "first instance" when invoked at the commandline. Due to coincidence, apparently this is the instance with the dedicated project in it. Soooo, I get to use the terminal with my dedicated projects, but am forced to use the filepicker (over NFS!!!) when doing quick hacks. Haha.
So. I found Geany's `--socket-file` parameter, but I do not understand how to use it *as only the master Geany instance has a socket file in `/tmp`!*
``` $ ls .config/geany/ colorschemes filedefs geany.conf geany_socket_darkstar__0 keybindings.conf plugins tags templates $ readlink .config/geany/geany_socket_darkstar__0 /tmp/geany_socket.b5c4f11f $ lsof | grep geany_socket geany 17853 i336 5u unix 0xc2b68240 0t0 4654382 /tmp/geany_socket.b5c4f11f $ ls /tmp/geany_socket* /tmp/geany_socket.b5c4f11f $ ps aux | grep [g]eany i336 17853 0.1 1.7 103224 36696 ? Sl Mar04 74:50 geany i336 17955 0.0 1.6 105060 34036 ? Sl Mar04 25:23 geany $ ```
I'm curious why `--socket-file` exists at all. There are no options that allow me to start an instance with a specified socket file of my own choosing, for instance; I have to rely on Geany creating the socket file itself so I can use it.
The socket file is in /tmp to maximise the chances its on a file system that supports sockets, home directories may be on Samba windows mounts that don't.
To not conflict with other things in /tmp it is a random name created by `tmpfile()`, so Geany locates it by a link which has a known name in the configuration directory you specify with `-c` (or your `~/.config/geany` if no `-c`).
If the configuration does not contain a link with the right name Geany will consider itself a new "master" as you called it, and make another socket. The `--socket_file` option is to allow a command line command to nominate which instance it is to open files in.
In your use-case of one "proper" instance and one scratch instance you would be best to use differing configs for each, so each has a socket and so you can then nominate on the terminal which one to use. If most of the command line opens are in the scratch version, have it use your home config, which is the default, and so you don't have to specify it in the majority of cases on the command line.
...so you don't have to specify it in the majority of cases on the command line.
Or just setup an `alias g='geany -ic /home/.config/geany-scratch'` or such.
@i336 . I believe there is a flag from the command line to open a file in a new instance ( -i ). Does that work for you?
github-comments@lists.geany.org