Portal Windows for Electron

61 points by rajivayyangar 3 years ago | 47 comments
  • 0xDEEPFAC 3 years ago
    Why not just write a native application?
    • afavour 3 years ago
      Because it's cheaper, quicker and the vast majority of users are fine with it.

      I'm not excusing it, I curse Slack every day I have to use their Electron app (though mostly just use it in a browser tab now) but we have this exact same conversation every time anything about Electron is posted on HN. None of the parameters for making the choice have changed since the last time we did.

      • Const-me 3 years ago
        > I curse Slack every day I have to use their Electron app

        I did that too for the last couple of years, but recently switched to this client: https://cancel.fm/ripcord/ Found the link in comments here on HN.

        Works well so far. There’re couple minor UX issues, e.g. hard to react to messages with these modern hieroglyphs, also images are loaded in web browser, but I can live with them. The upsides (ability to setup font faces and sizes, resource usage, GUI latency) are far more important for me.

        • ISO-morphism 3 years ago
          It's been a couple years since my workplace migrated away from slack, but I found weeslack [1], a plugin for weechat, to be sufficient.
          • 3 years ago
            • 3 years ago
              • CyberDildonics 3 years ago
                The real reason is that the people making electron apps don't know how to make stuff in C++ and don't want to try. This might be a little more excusable before C++11 or if trying to avoid MFC and/or doing everything with win32, but modern C++ and GUI libraries like FLTK, Juce, Qt, etc. are a pretty great way to make something. A FLTK program can start at 100KB without dependencies.
                • afavour 3 years ago
                  These aren’t developer choices being made. They’re product choices by product managers. I bet there are plenty of JS developers that would be interested in picking up C++ or something like Rust but don’t have the option.
                  • friedman23 3 years ago
                    In what world is building an application in a language like C++ when the rest of your tech is built on javascript/java/go ever economical or excusable for a business?

                    And don't tell me development time will be remotely similar either.

                • stnmtn 3 years ago
                  Here's a few very valid reasons imo

                  - Easy cross platform support

                  - Singular language/framework (typescript/react) for everything you're doing

                  - Can share a lot of components/logic with mobile apps if you use React Native

                  • a4isms 3 years ago
                    The nice thing about this question for old-timers is that we can recycle the answers we already heard about using Java for cross-platform desktop development from 20+ years ago. Or the rationale for using a cross-platform toolkit with C++ from 30+ years ago.

                    You get substandard desktop applications that tend to frustrate people who are deeply immersed in any one ecosystem and expect native applications to have deep integration with each platform and comply with each platform’s design sensibilities.

                    But history shows that applications written against cross-platform toolkits have done just fine, as have applications that completely embraced “going native” on particular platforms.

                    I’m left with the thought that either strategy works if you go “all in,” the mistakes come from:

                    1. Going cross-platform but then doing ridiculous back-flips to try to make the app feel really, really native. Just take what the platform gives you, and accept that you’re giving people a web-like experience that happens to have some native affordances. Learn to live with the few complaints from retro-grouches.

                    Or, 2. Going native, but skimping on deep integration and fully embracing the look and feel of each platform. This is one of those “penny-wise, pound-foolish’ strategies: You ship faster, but you lose the big benefits of a cross-platform tool, and you don’t satisfy the users that appreciate what a native app offers in look, feel, and integration.

                    • stnmtn 3 years ago
                      I think Discord strikes the balance of your two mistakes well.
                    • egypturnash 3 years ago
                      - you want to make sure that people respect the importance of your app by not running it along with everything else because it needs 10x the amount of resources a native app would
                      • adamdusty 3 years ago
                        Users don't care anymore. Phones have 12GB of RAM. A $500 laptop will have plenty of RAM, CPU power, and storage for the average user to not even notice anything. HN and reddit are the only ones who can't seem to grasp the idea that it's not 1995 anymore, and apps taking even 1-2 GB of RAM isn't that big of a deal for the average user.

                        Do I want my CAD software as an electron app. Obviously not, but for most applications electron is just as good an option as anything else.

                        • 3 years ago
                          • Veuxdo 3 years ago
                            It's a consideration.
                          • 0xDEEPFAC 3 years ago
                            Yea, these are poor reasons imho. Relying on mommy Chrome and the hellscape of ECMA transpilers seems like the opposite of "cross platform" since you rely on a much more unstable foundation...
                          • nyanpasu64 3 years ago
                            No, really why not write a native application? If I'm understanding it correctly, Electron is depending on third-party libraries like Portal Windows to get functionality like "create new windows, treat them as objects, and poke around in them" which comes for free in single-process GUI libraries like Qt.
                            • 3 years ago
                            • handrous 3 years ago
                              Because it's cheaper and very few users will realize that you're the reason their whole computer is slow.
                              • Kiro 3 years ago
                                I don't know how. I only know JavaScript.
                                • semireg 3 years ago
                                  You forgot to pluralize applicationS…
                                  • reaperducer 3 years ago
                                    The go-to excuses for this are "easier," "cheaper," and "good enough for the users."

                                    Also known as "laziness," "greed," and "lack of pride in one's work."

                                    I'm OK with some rando startup using something like Electron in their formative years. But companies like Microsoft have no excuse other than some middle manager's desire to buy a new boat.

                                    • EvilEy3 3 years ago
                                      > other than some middle manager's desire to buy a new boat.

                                      Good enough for me to consider tech. Means you can have acceptable result without spending more money.

                                      • wayneftw 3 years ago
                                        Microsoft understands the value of being able to develop once and run everywhere. That's why both Java and the web almost upended their business.

                                        It's not just a monetary/time/effort value to Microsoft or other developers either. It has value to me a user. I prefer applications that I can take with me anywhere I go and they'll be exactly the same on every type of desktop that I use them on.

                                        The list of native desktop applications which can actually do this well for me is pretty short.

                                    • arc-in-space 3 years ago
                                      I do so enjoy observing the 'birth & death' of javascript unfolding
                                      • zeusk 3 years ago
                                        It can't be just me, that demo is so janky - exactly how I expect most electron apps to turn out.
                                        • smoldesu 3 years ago
                                          The current version being shown off here is extremely stuttery, is there a way to smooth the animation yet?
                                          • cyrusroshan 3 years ago
                                            Hey! Author here: this demo is just the most extreme example I could quickly write to show the power of this library.

                                            Realistically, you won’t need to chain window movement like this in most cases (other than our chatbox, I think none of our windows stay open when their parent window is moved). Fast auto-resizing, on the other hand, is more common, and works great.

                                            • vxNsr 3 years ago
                                              I'm not the OP but even the demos with the actual software are kinda stuttery. Like the one where you move the outlined spotify window, it's just not great. It's cool that you were able to make it simple to do, and not worry about it, and it's really impressive work, but I guess still feels off a little.
                                              • cyrusroshan 3 years ago
                                                Ah, I know the one you’re referring to—-that purple window actually isn’t using this library.

                                                We can get the position of our _own_ windows easily, but when it comes to getting Spotify’s position, we need to do some more complex polling, which is slower (and only works when the 3rd-party window is in focus).

                                            • tfsh 3 years ago
                                              This is a constraint of the APIs provided by MacOS, they allow you to position by (x,y) coordinate and resize by width/height, but there's no way to tween these values...and nor should there be.

                                              What's Tandem are doing here is (interesting, but) atypical behaviour.

                                              • q-rews 3 years ago
                                                I don’t think that's entirely correct. While you can't ask the OS to tween the values, nothing prevents you from doing that, other than likely a reduced frame rate.

                                                See this demo: http://stewd.io/pong/

                                                It's still not 100% smooth, but it seems slightly better and demonstrates the ability to manually tween values. Similar performance in both Chrome and Safari.

                                                • meibo 3 years ago
                                                  On Windows, you can update these as often as you want to and the compositor will handle it fine - you can do a lot of cool animations/demos with it.

                                                  Is this a macOS specific issue, or is the JS API these guys are providing not able to catch up quickly enough?

                                                  • cyrusroshan 3 years ago
                                                    Mostly a lack of need-it’s a contrived example I wrote to show a large window count, with child windows spawning nested child windows of their own.

                                                    In the actual Tandem app, windows moving like this is uncommon.

                                                  • smoldesu 3 years ago
                                                    It's curious to me, because I've seen compositors in both Linux and Windows handle it perfectly, but I admittedly haven't played with MacOS more than I'm forced to. I'm not very familiar with Quartz, I sorta assumed it would cover x11 functionality by default.
                                                • kevin_thibedeau 3 years ago
                                                  Ironic that the CSS is broken on an article about Electron.