New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple windows #607

Open
net opened this Issue Jun 11, 2017 · 36 comments

Comments

Projects
None yet
@net

net commented Jun 11, 2017

I use a window manager instead of tmux. With other terminal emulators when I want a new terminal instance, I simply open a new window. As far as I can tell, the only way to accomplish this with Alacritty is to open a new instance of the application. This is inferior for three reasons:

  1. Load times when opening a new instance of Alacritty are subpar. For a program that prides itself on being the fastest, opening new terminals should be no exception. (Loading a new instance of Alacritty lasts about 1 second for me vs instant when opening a new window in iTerm.)

  2. On macOS opening multiple instances of Alacritty fills up the Dock and Application Switcher.

  3. Currently, such behavior must be implemented manually by the user.

From what I can tell from other issues, using window managers as a replacement for tmux is within Alacritty's scope. Even when using tmux, it can be desirable to open a second tmux instance for an unrelated session without detaching from the current session. I think multiple windows should be supported natively by Alacritty.

@maximbaz

This comment has been minimized.

Show comment
Hide comment
@maximbaz

maximbaz Jun 11, 2017

Contributor

Related: #241 (daemon mode)

Contributor

maximbaz commented Jun 11, 2017

Related: #241 (daemon mode)

@robertgzr

This comment has been minimized.

Show comment
Hide comment
@robertgzr

robertgzr Jun 11, 2017

Contributor

I add this to get a 'new window' command.

It's not very nice but it works when I need two tmux sessions in seperate windows...

Contributor

robertgzr commented Jun 11, 2017

I add this to get a 'new window' command.

It's not very nice but it works when I need two tmux sessions in seperate windows...

@blark

This comment has been minimized.

Show comment
Hide comment
@blark

blark Jun 30, 2017

It would be nice to get "new window" support. Nesting tmux is terrible, and I use it remotely via SSH a lot. Maybe someone can help me out here, is there a good way to do this?

blark commented Jun 30, 2017

It would be nice to get "new window" support. Nesting tmux is terrible, and I use it remotely via SSH a lot. Maybe someone can help me out here, is there a good way to do this?

@tbodt

This comment has been minimized.

Show comment
Hide comment
@tbodt

tbodt Jul 13, 2017

Contributor

My opinion on this is alacritty should become a sort of terminal emulator UI component, so other programs could use alacritty as a renderer and provide tabs, split panes, multiple windows, GUI configuration, and all that cool stuff.

Contributor

tbodt commented Jul 13, 2017

My opinion on this is alacritty should become a sort of terminal emulator UI component, so other programs could use alacritty as a renderer and provide tabs, split panes, multiple windows, GUI configuration, and all that cool stuff.

@mkeeler

This comment has been minimized.

Show comment
Hide comment
@mkeeler

mkeeler Aug 24, 2017

The main reason I would like multi-window is I ran into some scenarios where I wanted to monitor a whole lot of panes simultaneously and wanted a window on one monitor and one on another. Ideally after starting the Alacritty.app there would be some hotkey to spawn a new window.

mkeeler commented Aug 24, 2017

The main reason I would like multi-window is I ran into some scenarios where I wanted to monitor a whole lot of panes simultaneously and wanted a window on one monitor and one on another. Ideally after starting the Alacritty.app there would be some hotkey to spawn a new window.

@brycefisher

This comment has been minimized.

Show comment
Hide comment
@brycefisher

brycefisher Aug 25, 2017

Contributor

Quoting from #674:

While I can create some alias to launch a new alacritty window easily, we still cannot:

  • use spotlight to bring a running version of alacritty to the front - which I guess should be the default behaviour.
  • open a new alacritty window without dropping to a shell first - maybe the macOS app should have a "new window" menu item, seems like it might be a common usage.

These two things are surmountable, but would greatly improve the UX on macOS (I have no idea the difficulty of implementation however)

I feel the same way!

My current workaround for having no way to launch a second alacritty window from SpotLight is to launch terminal.app for times I would use a secondary alacritty window.

Contributor

brycefisher commented Aug 25, 2017

Quoting from #674:

While I can create some alias to launch a new alacritty window easily, we still cannot:

  • use spotlight to bring a running version of alacritty to the front - which I guess should be the default behaviour.
  • open a new alacritty window without dropping to a shell first - maybe the macOS app should have a "new window" menu item, seems like it might be a common usage.

These two things are surmountable, but would greatly improve the UX on macOS (I have no idea the difficulty of implementation however)

I feel the same way!

My current workaround for having no way to launch a second alacritty window from SpotLight is to launch terminal.app for times I would use a secondary alacritty window.

@jwilm jwilm added the help wanted label Aug 25, 2017

@OJFord

This comment has been minimized.

Show comment
Hide comment
@OJFord

OJFord Sep 10, 2017

Contributor

On macOS opening multiple instances of Alacritty fills up the Dock and Application Switcher

How did you even do it? When I try to open the second I get:

LSOpenURLsWithRole() failed for the application .../Alacritty.app with error -600

Edit:
Sorry, I just saw #674 which contains the solution: open -n. (I also did badly at reading open --help apparently!)

Contributor

OJFord commented Sep 10, 2017

On macOS opening multiple instances of Alacritty fills up the Dock and Application Switcher

How did you even do it? When I try to open the second I get:

LSOpenURLsWithRole() failed for the application .../Alacritty.app with error -600

Edit:
Sorry, I just saw #674 which contains the solution: open -n. (I also did badly at reading open --help apparently!)

@brycefisher

This comment has been minimized.

Show comment
Hide comment
@brycefisher

brycefisher Sep 13, 2017

Contributor

Based on @OJFord's comment, here's a super hacky way to implement this on MacOS. In your alacritty_macos.yml, add a new key_bindings like this:

key_bindings:
  - { key: N,        mods: Command, command: { program: "open", args: ["-n", "/Applications/Alacritty.app"] } }

Now, pressing Command + N will open a new window. It works how you'd expect, except that Command + Q will only kill one window (since each window is run as a separate desktop application).

Contributor

brycefisher commented Sep 13, 2017

Based on @OJFord's comment, here's a super hacky way to implement this on MacOS. In your alacritty_macos.yml, add a new key_bindings like this:

key_bindings:
  - { key: N,        mods: Command, command: { program: "open", args: ["-n", "/Applications/Alacritty.app"] } }

Now, pressing Command + N will open a new window. It works how you'd expect, except that Command + Q will only kill one window (since each window is run as a separate desktop application).

@asilvadesigns

This comment has been minimized.

Show comment
Hide comment
@asilvadesigns

asilvadesigns Oct 23, 2017

@brycefisher cool! Now how to switch between them using cmd + `...?

asilvadesigns commented Oct 23, 2017

@brycefisher cool! Now how to switch between them using cmd + `...?

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm Oct 23, 2017

Owner

@brycefisher have you run into any issues using this strategy?

Owner

jwilm commented Oct 23, 2017

@brycefisher have you run into any issues using this strategy?

@sodiumjoe

This comment has been minimized.

Show comment
Hide comment
@sodiumjoe

sodiumjoe Oct 23, 2017

Contributor

I've run into the same thing @asilvadesigns has, i.e. you can't switch between alacritty windows with cmd + `. It's a small but annoying artifact of it not being a real window, I think.

Also, FYI, this isn't solved by using winit's actual multi-window api. The same thing happens when you run winit's multiwindow example. This is one of the things I investigated that led me to make this comment.

Contributor

sodiumjoe commented Oct 23, 2017

I've run into the same thing @asilvadesigns has, i.e. you can't switch between alacritty windows with cmd + `. It's a small but annoying artifact of it not being a real window, I think.

Also, FYI, this isn't solved by using winit's actual multi-window api. The same thing happens when you run winit's multiwindow example. This is one of the things I investigated that led me to make this comment.

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm Oct 23, 2017

Owner

@sodiumjoe thanks for the feedback! It seems to me that this use case ought to be supported by winit. Are you familiar enough with Cocoa to have any idea what's going wrong? The main thing preventing better support on macOS so far is lack of experience on my side.

Owner

jwilm commented Oct 23, 2017

@sodiumjoe thanks for the feedback! It seems to me that this use case ought to be supported by winit. Are you familiar enough with Cocoa to have any idea what's going wrong? The main thing preventing better support on macOS so far is lack of experience on my side.

@sodiumjoe

This comment has been minimized.

Show comment
Hide comment
@sodiumjoe

sodiumjoe Oct 23, 2017

Contributor

@jwilm I'm not really, I just started looking into some of the cocoa api when I started investigating this and some of the titlebar issues, but from my cursory investigation, it seems like it would increase the surface area of winit a lot, and also there would be some leaking in the abstraction, since some of the behavior that should be configurable is incompatible with linux.

I think it also discourages contribution by people who are familiar with cocoa, since they have to go through cocoa-rs through winit, meaning they have to know both rust and cocoa. It limits the potential contributor pool. But I guess I'm repeating myself.

Contributor

sodiumjoe commented Oct 23, 2017

@jwilm I'm not really, I just started looking into some of the cocoa api when I started investigating this and some of the titlebar issues, but from my cursory investigation, it seems like it would increase the surface area of winit a lot, and also there would be some leaking in the abstraction, since some of the behavior that should be configurable is incompatible with linux.

I think it also discourages contribution by people who are familiar with cocoa, since they have to go through cocoa-rs through winit, meaning they have to know both rust and cocoa. It limits the potential contributor pool. But I guess I'm repeating myself.

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm Oct 23, 2017

Owner

It's ok to have things that aren't compatible with Linux. These are generally implemented behind some sort of extension trait which can either be conditionally compiled or simple made into no-ops on unsupported platforms.

You make a good point about it being difficult to contribute to even if you have cocoa experience. It seems to me though that this is just a bug with winit's multiple window support on macOS.

@mitchmindtree hope you don't mind being pinged here. Curious about your take on this since you're responsible for much of winit's macOS support. TLDR is that multiple windows with winit don't behave the same as in a normal cocoa app, specifically Command + ` alt-tab within single process behavior.

Owner

jwilm commented Oct 23, 2017

It's ok to have things that aren't compatible with Linux. These are generally implemented behind some sort of extension trait which can either be conditionally compiled or simple made into no-ops on unsupported platforms.

You make a good point about it being difficult to contribute to even if you have cocoa experience. It seems to me though that this is just a bug with winit's multiple window support on macOS.

@mitchmindtree hope you don't mind being pinged here. Curious about your take on this since you're responsible for much of winit's macOS support. TLDR is that multiple windows with winit don't behave the same as in a normal cocoa app, specifically Command + ` alt-tab within single process behavior.

@cyphactor

This comment has been minimized.

Show comment
Hide comment
@cyphactor

cyphactor Nov 22, 2017

Contributor

@jwilm how is #912 related to this? Was the change in behavior #912 is outlining a work around for this?

Contributor

cyphactor commented Nov 22, 2017

@jwilm how is #912 related to this? Was the change in behavior #912 is outlining a work around for this?

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm Nov 22, 2017

Owner

@cyphactor This issue captures proper multi-window support for macOS. Please see item 2.

Owner

jwilm commented Nov 22, 2017

@cyphactor This issue captures proper multi-window support for macOS. Please see item 2.

@mkeeler

This comment has been minimized.

Show comment
Hide comment
@mkeeler

mkeeler Jan 28, 2018

one window has been a minor annoyance but not huge. I would recommend always running tmux within alacritty. It provides you everything you might need with tabs (windows in tmux parlance) and additionally you can split an individual window into panes. You would have to learn or customize some tmux key bindings for “tab” navigation but after that it’s simple.

mkeeler commented Jan 28, 2018

one window has been a minor annoyance but not huge. I would recommend always running tmux within alacritty. It provides you everything you might need with tabs (windows in tmux parlance) and additionally you can split an individual window into panes. You would have to learn or customize some tmux key bindings for “tab” navigation but after that it’s simple.

@michaelfresco

This comment has been minimized.

Show comment
Hide comment
@michaelfresco

michaelfresco Jan 28, 2018

(Tmux would indeed be a solution. But I also noticed that tmux slows down vim performance.)

  • update 12 hours later: I have given in and tmux is indeed very nice. Thanks!

michaelfresco commented Jan 28, 2018

(Tmux would indeed be a solution. But I also noticed that tmux slows down vim performance.)

  • update 12 hours later: I have given in and tmux is indeed very nice. Thanks!
@mathstuf

This comment has been minimized.

Show comment
Hide comment
@mathstuf

mathstuf Jan 29, 2018

But I also noticed that tmux slows down vim performance

Do you have actual numbers for this or is it a "it feels like it" kind of thing? IME, it depends more on the backing terminal than tmux itself.

mathstuf commented Jan 29, 2018

But I also noticed that tmux slows down vim performance

Do you have actual numbers for this or is it a "it feels like it" kind of thing? IME, it depends more on the backing terminal than tmux itself.

@michaelfresco

This comment has been minimized.

Show comment
Hide comment
@michaelfresco

michaelfresco Jan 29, 2018

@mathstuf: no hard numbers, but it is possible to check it for yourself. If you open a large document in vim, and quickly scroll up and down, you will see the occasionally 'jagged' frame with tmux. It's 99% the same though, and not a big issue. I made a video to show it:

https://www.youtube.com/watch?v=V1jWaxoAF3g

michaelfresco commented Jan 29, 2018

@mathstuf: no hard numbers, but it is possible to check it for yourself. If you open a large document in vim, and quickly scroll up and down, you will see the occasionally 'jagged' frame with tmux. It's 99% the same though, and not a big issue. I made a video to show it:

https://www.youtube.com/watch?v=V1jWaxoAF3g

@mathstuf

This comment has been minimized.

Show comment
Hide comment
@mathstuf

mathstuf Jan 29, 2018

I opened an amalgamated sqlite.c file (200k lines), turned syntax highlighting off (because Vim's C highlighting is…slow to say the least) in both tmux on urxvt256c and urxvt256c by itself. Both took about 10 seconds (I'd guess non-tmux got there a bit later, but it's within the error bars) to get to 10% by holding down PgDn, but without tmux the redraw was flickering quite a bit (so much so that it actually looked dimmer). I suspect the terminal is more to blame than tmux itself. It may also have to do with the non-standard fonts in use and the use of higher Unicode planes for the "fancy" stuff :) . My status bar is just a single color with information.

mathstuf commented Jan 29, 2018

I opened an amalgamated sqlite.c file (200k lines), turned syntax highlighting off (because Vim's C highlighting is…slow to say the least) in both tmux on urxvt256c and urxvt256c by itself. Both took about 10 seconds (I'd guess non-tmux got there a bit later, but it's within the error bars) to get to 10% by holding down PgDn, but without tmux the redraw was flickering quite a bit (so much so that it actually looked dimmer). I suspect the terminal is more to blame than tmux itself. It may also have to do with the non-standard fonts in use and the use of higher Unicode planes for the "fancy" stuff :) . My status bar is just a single color with information.

@mathstuf

This comment has been minimized.

Show comment
Hide comment
@mathstuf

mathstuf Jan 29, 2018

I repeated it with syntax highlighting on and folding completely expanded. Still about the same time between the two (11 seconds this time), but even more flickering without tmux.

mathstuf commented Jan 29, 2018

I repeated it with syntax highlighting on and folding completely expanded. Still about the same time between the two (11 seconds this time), but even more flickering without tmux.

@sodiumjoe

This comment has been minimized.

Show comment
Hide comment
@sodiumjoe

sodiumjoe Mar 16, 2018

Contributor

Update: in recent versions of winit, the multiwindow now works as expected for a macos application. I.e. `Cmd-`` works correctly, as does the focus api.

The example just creates multiple windows like this:

    let window1 = winit::Window::new(&events_loop).unwrap();
    let window2 = winit::Window::new(&events_loop).unwrap();
    let window3 = winit::Window::new(&events_loop).unwrap();

However, it doesn't look like it'd be trivial to refactor run to do this. I tried just throwing run inside of a thread::spawn just to see if this would work at all, but I got

thread '<unnamed>' panicked at 'Windows can only be created on the main thread on macOS'

I would think implementing this would fix #1137 as well.

Contributor

sodiumjoe commented Mar 16, 2018

Update: in recent versions of winit, the multiwindow now works as expected for a macos application. I.e. `Cmd-`` works correctly, as does the focus api.

The example just creates multiple windows like this:

    let window1 = winit::Window::new(&events_loop).unwrap();
    let window2 = winit::Window::new(&events_loop).unwrap();
    let window3 = winit::Window::new(&events_loop).unwrap();

However, it doesn't look like it'd be trivial to refactor run to do this. I tried just throwing run inside of a thread::spawn just to see if this would work at all, but I got

thread '<unnamed>' panicked at 'Windows can only be created on the main thread on macOS'

I would think implementing this would fix #1137 as well.

@chrisduerr

This comment has been minimized.

Show comment
Hide comment
@chrisduerr

chrisduerr Mar 16, 2018

Collaborator

That sounds like something that can be used from inside the code to open a second window, but I feel like we would want to start a completely different alacritty instance.

I don't think opening multiple windows from inside of alacritty is the right approach, but I'm no macos user. I'm not sure if this is related to #1137 either.

Collaborator

chrisduerr commented Mar 16, 2018

That sounds like something that can be used from inside the code to open a second window, but I feel like we would want to start a completely different alacritty instance.

I don't think opening multiple windows from inside of alacritty is the right approach, but I'm no macos user. I'm not sure if this is related to #1137 either.

@cyphactor

This comment has been minimized.

Show comment
Hide comment
@cyphactor

cyphactor Mar 16, 2018

Contributor

Being a macOS user and developer. And the ways that Terminal, the default macOS terminal app works is that you open new windows or new tabs from within the app.

It is NOT launching separate instances of the binary.

This is how apps work in general on macOS

Contributor

cyphactor commented Mar 16, 2018

Being a macOS user and developer. And the ways that Terminal, the default macOS terminal app works is that you open new windows or new tabs from within the app.

It is NOT launching separate instances of the binary.

This is how apps work in general on macOS

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm Mar 16, 2018

Owner

Yeah, we'll want to spawn multiple windows. I imagine the story is similar on Windows, and it's just Linux where separate processes are desirable. There's a bit of refactoring needed to support this, though.

Owner

jwilm commented Mar 16, 2018

Yeah, we'll want to spawn multiple windows. I imagine the story is similar on Windows, and it's just Linux where separate processes are desirable. There's a bit of refactoring needed to support this, though.

@michaelfresco

This comment has been minimized.

Show comment
Hide comment
@michaelfresco

michaelfresco Mar 23, 2018

MacOs:

open -n /Applications/Alacritty.app/

This will start a second instance. Perhaps not the ideal but still quite handy at times!

michaelfresco commented Mar 23, 2018

MacOs:

open -n /Applications/Alacritty.app/

This will start a second instance. Perhaps not the ideal but still quite handy at times!

@sodiumjoe

This comment has been minimized.

Show comment
Hide comment
@sodiumjoe

sodiumjoe Mar 23, 2018

Contributor

That has already been suggested in this thread as have the various issues with it.

Contributor

sodiumjoe commented Mar 23, 2018

That has already been suggested in this thread as have the various issues with it.

@michaelfresco

This comment has been minimized.

Show comment
Hide comment
@michaelfresco

michaelfresco Mar 23, 2018

Right right, I actually forgot myself that you could do this. I mainly posted that 'oneliner' above for the benefit of others. This way you can at least get a 2nd window, even if there are issues associated with it.

michaelfresco commented Mar 23, 2018

Right right, I actually forgot myself that you could do this. I mainly posted that 'oneliner' above for the benefit of others. This way you can at least get a 2nd window, even if there are issues associated with it.

@dgtlmoon

This comment has been minimized.

Show comment
Hide comment
@dgtlmoon

dgtlmoon Apr 11, 2018

This would be perfect...

dgtlmoon commented Apr 11, 2018

This would be perfect...

@13k

This comment has been minimized.

Show comment
Hide comment
@13k

13k May 10, 2018

just a FYI, open -nb io.alacritty doesn't need a hardcoded path to Alacritty.app (I'm using this now with an Alfred workflow)

13k commented May 10, 2018

just a FYI, open -nb io.alacritty doesn't need a hardcoded path to Alacritty.app (I'm using this now with an Alfred workflow)

@adrigzr

This comment has been minimized.

Show comment
Hide comment
@adrigzr

adrigzr Jul 19, 2018

Thanks @13k, adding this to alacritty.yml key_bindings:

  - { key: N,        mods: Command, command: { program: "open", args: ["-nb", "io.alacritty"] } }

So easy to open new instances with Command + N.

adrigzr commented Jul 19, 2018

Thanks @13k, adding this to alacritty.yml key_bindings:

  - { key: N,        mods: Command, command: { program: "open", args: ["-nb", "io.alacritty"] } }

So easy to open new instances with Command + N.

@Avamander

This comment has been minimized.

Show comment
Hide comment
@Avamander

Avamander Aug 7, 2018

Is there an issue about alacritty getting tabbing support? If not should I make it? For discussion for the very least, as in my opinion tabbing (for ex. Konsole) offers two (in my opinion) great features when dealing with more than one session that multiple windows just can't solve in any way:

  • Not cluttering alt-tab and thus simplifying switching between windows and/or terminal sessions
  • Significantly simplifying keeping terminal windows on top of other windows, if you have more than one alacritty open it starts to become really tedious to mark all the windows to stay on top or to fall behind.

Avamander commented Aug 7, 2018

Is there an issue about alacritty getting tabbing support? If not should I make it? For discussion for the very least, as in my opinion tabbing (for ex. Konsole) offers two (in my opinion) great features when dealing with more than one session that multiple windows just can't solve in any way:

  • Not cluttering alt-tab and thus simplifying switching between windows and/or terminal sessions
  • Significantly simplifying keeping terminal windows on top of other windows, if you have more than one alacritty open it starts to become really tedious to mark all the windows to stay on top or to fall behind.
@mkeeler

This comment has been minimized.

Show comment
Hide comment
@mkeeler

mkeeler Aug 7, 2018

@Avamander I think the general idea (and its one I prefer) is to use your favorite terminal multiplexor like tmux for "tabs". The windowing issue for me is a bit different because there are times you may want to have alacritty on multiple monitors at once.

mkeeler commented Aug 7, 2018

@Avamander I think the general idea (and its one I prefer) is to use your favorite terminal multiplexor like tmux for "tabs". The windowing issue for me is a bit different because there are times you may want to have alacritty on multiple monitors at once.

@Avamander

This comment has been minimized.

Show comment
Hide comment
@Avamander

Avamander Aug 7, 2018

@mkeeler tmux doesn't integrate with DEs as well as say Konsole does though and as people have previously said it carries a performance penalty.

he windowing issue for me is a bit different because there are times you may want to have alacritty on multiple monitors at once.

Having both new window and tabs as an option would not cause this to be an issue.

Avamander commented Aug 7, 2018

@mkeeler tmux doesn't integrate with DEs as well as say Konsole does though and as people have previously said it carries a performance penalty.

he windowing issue for me is a bit different because there are times you may want to have alacritty on multiple monitors at once.

Having both new window and tabs as an option would not cause this to be an issue.

@sodiumjoe

This comment has been minimized.

Show comment
Hide comment
@sodiumjoe

sodiumjoe Aug 7, 2018

Contributor

@Avamander I think jwilm has decided against tabs at least for now (search the issues). If you really want, you could probably start another issue about it, but I think it's certainly out of scope for this issue.

One thing you might find interesting is: #450, and the related PR, which presumably would allow for a different UI on top of alacritty-core that could have tabs.

Contributor

sodiumjoe commented Aug 7, 2018

@Avamander I think jwilm has decided against tabs at least for now (search the issues). If you really want, you could probably start another issue about it, but I think it's certainly out of scope for this issue.

One thing you might find interesting is: #450, and the related PR, which presumably would allow for a different UI on top of alacritty-core that could have tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment