This would allow us to force Geany to not open a new instance even if no file arguments are passed in the command-line.
Some tweaks were also added so that the current instance window would activate itself even if no new file arguments are specified whenever this option is used.
This is useful if we want to make sure that we always only have a single instance. And also so we can have easy shortcuts to switch from a virtual terminal to the editor, like this function: `w() { geany -I "$@"; }`,
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1128
-- Commit Summary --
* Add '--no-new-instance' option.
-- File Changes --
M doc/geany.1.in (2) M doc/geany.txt (3) M src/libmain.c (32) M src/main.h (2) M src/socket.c (35) M src/ui_utils.c (2)
-- Patch Links --
https://github.com/geany/geany/pull/1128.patch https://github.com/geany/geany/pull/1128.diff
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128
@@ -38,7 +38,7 @@ gboolean main_is_realized(void);
typedef struct {
- gboolean new_instance;
- gint new_instance;
Don't agree with the use of int and values of 1 and -1, make it an enum with sensible names.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128/files/6f87aaa31fd56846ac533ca4f77ae...
@@ -38,7 +38,7 @@ gboolean main_is_realized(void);
typedef struct {
- gboolean new_instance;
- gint new_instance;
Yes I thought about it. Can you suggest names for it? Basically -1 = forced disabled, 0 = default and disabled (but can be changed to 1 by runtime), and 1 = explicitly enabled.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128/files/6f87aaa31fd56846ac533ca4f77ae...
Single instance should happen if you don't use `-i` (including starting the first instance).
So effectively this becomes just a command for Geany to attempt to raise itself, but couldn't your desktop do it more reliably?
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231319511
@elextr
Single instance should happen if you don't use -i (including starting the first instance).
Single instance doesn't happen if no file arguments are passed. Not using `-i` is not enough.
So effectively this becomes just a command for Geany to attempt to raise itself, but couldn't your desktop do it more reliably?
Maybe we can use some window-searching hacks to do that, like using a shell script and `wmctrl`, but it would better if we incorporate it to Geany itself since Geany already has the mechanism and it's simpler and more reliable that way. Also, not all desktops can support the feature e.g. most X-based desktops.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231324393
Single instance doesn't happen if no file arguments are passed. Not using -i is not enough.
Ok, true.
Geany already has the mechanism and it's simpler and more reliable that way.
I was wondering how well the gtk present() mechanism works on non-gtk desktops? Geany only has special handling for win and x11.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231327529
@konsolebox pushed 1 commit.
9c0d06a Use an enum named NewInstanceMode instead of gint for cl_options.new_instance.
--- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/geany/geany/pull/1128/files/6f87aaa31fd56846ac533ca4f77ae...
I was wondering how well the gtk present() mechanism works on non-gtk desktops? Geany only has special handling for win and x11.
I'm not sure if there would be some desktops that would have that issue, but this feature would at least be helpful to those who are using the major ones, especially X. Besides, same would apply if you're letting the current instance open another file. If the desktop doesn't support `gtk_window_present()`, then the instance window would also not be automatically shown to the foreground, after the files are opened.
I think it's likely that any modern desktop would support it, since it's just about sending an existing window to foreground. Are there other desktops to worry about besides Windows and X? Wayland surely would have that, and Mac probably also does.
I'm using XFCE by the way. It depends on GTK but not on GNOME. And GTK runs/works on top of X.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231347827
@@ -38,7 +38,7 @@ gboolean main_is_realized(void);
typedef struct {
- gboolean new_instance;
- gint new_instance;
make it an enum with sensible names.
I just added a commit for this.
https://github.com/geany/geany/pull/1128/commits/9c0d06ae3de47a6d6adff0eab9b...
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128/files/6f87aaa31fd56846ac533ca4f77ae...
I was thinking of the Qt based DEs, KDE of course and lxqt and others, but I can't test
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231349594
I just tested it with KDE5 and LXQt. It works on both.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1128#issuecomment-231822086
Closing for no further feedback.
Closed #1128.
github-comments@lists.geany.org