parkouss / webmacs

webmacs - keyboard driven (emacs key bindings) browser, https://webmacs.readthedocs.io/en/latest/
GNU General Public License v3.0
157 stars 21 forks source link

new-window flag to open window in existing instance. #113

Closed dmille closed 3 years ago

dmille commented 5 years ago

I've added functionality for calling --new-window to open a new window in an existing instance. I'd like to add the same functionality from commands/global.py with the _get_or_create_buffer function, however since the file is global.py in conflicts with built in global and I can't import it. I don't want to duplicate any code obviously. Any suggestions for how to resolve this? Maybe global.py should be renamed in the codebase? @parkouss

dmille commented 5 years ago

Hi Julien, I agree with you, we should not duplicate too much logic! I've reworked it a bit and used your suggestion :). I'd say it's much cleaner now. I've also changed a few things to so that the new-window command line argument replicates the make-window command functionality more closely.

Let me know what you think. Cheers

parkouss commented 5 years ago

Hi David, Thanks for the quick update! :). I find the implementation in ipc.py much cleaner. However I don't think I like much the idea of doing the same thing with new-window and make-window; to me, we should be able to use --new-window with --url, thus opening an url in the new window. So I guess in this case we do not need to move get_or_create_buffer, and in ipc.py the logic should go down to something like:

if url:

display the url in a new buffer of the current window's view

elif new_window

no url and a new window, display the "home" page.

What do you think?

dmille commented 5 years ago

How do you feel about my last change?

Personally, for my usage, I bind webmacs --new-window to a shortcut in my window manager (i3wm) and would like to expect the same behaviour as the make-window command.

However, I agree that the expected behaviour of webmacs --new-window url should open the passed url in a new window instead, so I've added that.

I believe this last change is a good compromise. I'm basing this just on my own usage of webmacs :). If you like, I could change the functionality to display the home page instead? But I would still like to replicate the make-window command from the command line in some way because of how I use my environnment. Also, I feel as if since it's still the same instance, it should still act the same. Maybe for new instances it can be different? Or maybe it should be called webmacs --make-window to be consistent?

Thoughts?