-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
[UI] Frameless window option (with theme support) #3066
[UI] Frameless window option (with theme support) #3066
Conversation
so good! this should be the norm for all apps possible for linux controls i'd suggest a box icon for the maximize instead, since that's a better looking/more common design choice |
Tried the appimage as well and same result. I am on KDE 5.27. |
@flavioislima Indeed, can confirm, looks like the most recent commit accidentally broke this. I just pushed a fix for this, would you mind giving it another try? |
Ok, can do. I was wondering whether it would make sense to put a dialog box here anyways to ask the user whether they want to relaunch the application right away after changing this setting. Could put a notice on that and remove it later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on linux with cinnamon and it works all good here 👍
I left 2 comments
I'm only a bit concerned that the window drag is now in the sidebar and I don't know how discoverable that is for users
maybe the cursor can change when hovering the draggable areas of the sidebar and not just when actually dragging?? that way when you are using the app, you hover, it changes the icon and you have a visual hint that you can drag
One I idea I want to implement is to inject some static information already in the preload script when we create the main window. if you add something like this in src/backend/preload.ts: contextBridge.exposeInMainWorld(
'isSteamDeckGameMode',
process.env.XDG_CURRENT_DESKTOP === 'gamescope'
) then you can use these system information will never change so it's safe to just inject like that and way simpler I want to include more things there in the future but I think it's fine to start with that now that it's needed and can be refactored later |
Ah that's very interesting, I could have made use of that for the Would it make sense to add another file to hold any other constants that might need to be made available on the frontend in the future? And should I use the same approach for |
That's what I want to do eventually so I think it's fine, anything that is constant that we need to expose to the frontend we could add that there and avoid a lot of boilerplate. And I was thinking that even for non-constant values, we could always inject the initial state of the app with that to avoid the first IPC calls to get the initial states ready even before react loads. |
Yeah, that would be neat, the problem is what to name that file? There already is a We could put another Not quite sure what to do here. I'm quite tempted to just put that snippet into |
I'll start with this, just add: contextBridge.exposeInMainWorld(
'isSteamDeckGameMode',
process.env.XDG_CURRENT_DESKTOP === 'gamescope'
) to preload.ts, we can refactor that into other files if we need to in the future |
@0xCmdrKeen I believe we can merge this one before the next release, just need to fix the conflicts now. |
there's an issue with electron 27 where the buttons just scroll up with the content, would be nice if that got fixed, I think it's the only issue |
@Etaash-mathamsetty I can't seem to be able to reproduce this, however, after pulling the merge commit I am noticing that some screens are no longer using the full window height (see screenshot). |
make sure to pull the latest latest changes from main, that should be fixed (that last merge is from before the fix I guess) |
@Etaash-mathamsetty @arielj okay, this should take care of it. |
With this feature enabled "Exit to System Tray" stops working on Linux (though I've not tested it on other platforms). EDIT: But using Alt+F4 works correctly every time |
Yep I can reproduce this, nice catch |
Hmm, I was using the same |
Another thing I found, not a huge deal since it is still experimental and optional. But it is not possible to resize the sidebar anymore. Also, the only way to move the window is by clicking don't the sidebar as well. But that's ok, we can improve it later :) |
Yes, I also suggested this here, but @arielj was against it. As far as not being able to resize the sidebar goes, that's a good catch. Might be a result of making it a draggable area, so I'm not entirely sure what if anything can be done about this, but honestly, I didn't even know the sidebar was resizable for the longest time, and I never really missed that feature, because the initial size seemed entirely appropriate to me. |
it's just that adding it as a experimental feature is more to enable disable components, feels weird to enable the feature to show the toggle and then have to also enable the toggle? |
also, the only reason I asked for that is because I had one issue that rendered heroic unusable, but I was not able to reproduce it in any way after that, so it was more to cover ourselves |
@arielj I'm not trying to blame you, just pointing out a part of the discussion that @flavioislima might have missed. Since it's just a simple toggle, it COULD go into the experimental features section, but I'm fine with either solution. Just cool to finally see this merged. |
First PR, requesting feedback.
Summary
This adds a new setting "Use frameless window", which, if active during startup, will make Heroic create a frameless main window (i.e. no titlebar, window controls overlaid onto web content, see https://www.electronjs.org/docs/latest/tutorial/window-customization#create-frameless-windows).
Features
Theming Support
The following variables can be set in a custom theme in order to change the appearance of the window controls:
--titlebar-height: <number>
will set the height of the window controls in pixels--titlebar-color: <hex color>
will set the background color of the window controls (defaults to--body-background
)--titlebar-symbol-color: <hex color>
will set the foreground color of the window controls (defaults to--accent
)Also, the following variables are available to CSS authors for accommodating the presence of overlay controls:
--overlay-controls-height
: the actual height of the overlay controls, if present--overlay-controls-width
: the actual width of the overlay controls, if presentNote that these variables are set regardless of whether frameless mode is active. If it IS enabled, an additional class
frameless
is added to the<App>
element.Screenshots
Windows 11, using Old School Heroic theme. Header automatically accommodates for missing space on the right.
Linux, using Old School Heroic theme and custom window controls.
MacOS, using Old School Heroic theme. No header adjustments necessary since window controls are on the left.
To Do
A couple of things I'm looking to improve on right off the bat:
getThemeCSS
handler inmain.ts#1578-1588
Checklist