sioyek icon indicating copy to clipboard operation
sioyek copied to clipboard

Option to remove the title bar on macos

Open albert-ying opened this issue 2 years ago • 13 comments

These buttons are not necessary as the sioyek are keyboard-driven. Removing this bar could reduce the distraction and increase the usage of the screen.

Many modern apps already support this (e.g., iterm2)

image

albert-ying avatar Jul 29 '22 14:07 albert-ying

It is also easy to be done https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst

Remove the Title Bar

If you choose to design your window without a title bar, you must remove it from the window. To remove the title bar, set the title bar’s titleVisibility property to UITitlebarTitleVisibility.hidden and the toolbar property to nil. The following code shows how to remove the title bar and its separator from the window during the setup of a new scene.


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    
    guard let windowScene = (scene as? UIWindowScene) else { return }
    
    #if targetEnvironment(macCatalyst)
    if let titlebar = windowScene.titlebar {
        titlebar.titleVisibility = .hidden
        titlebar.toolbar = nil
    }
    #endif


}

albert-ying avatar Jul 29 '22 14:07 albert-ying

Why not just fullscreen the window (toggle_fullscreen command)?

ahrm avatar Jul 29 '22 14:07 ahrm

Why not just fullscreen the window (toggle_fullscreen command)?

Thank you for the reply! The main reason is that I usually have multiple windows side by side on the screen. Those space title bar and status bar took become critical especially when I work with a laptop screen

albert-ying avatar Jul 29 '22 20:07 albert-ying

Added a toggle_titlebar command in 43fbb014a0b20ef970b006279ca7f166e9272116. It is pretty buggy on windows though (doesn't work well with snapped windows). I don't know how well it will work on MacOS.

ahrm avatar Jul 29 '22 20:07 ahrm

Wow, this is quick! I couldn't test it as I encountered some problem when building from the source... Is the prebuilt version available?

albert-ying avatar Jul 30 '22 15:07 albert-ying

There is an experimental build here: https://github.com/hexomancer/sioyek/releases/tag/v0.31.358

ahrm avatar Jul 30 '22 18:07 ahrm

It seems that it is also buggy on MacOS, the window seems cannot be resized after toggle the titlebar

albert-ying avatar Jul 30 '22 20:07 albert-ying

Yes, that is also the case on windows. I don't know if it can be done in a cross-platform way using Qt.

ahrm avatar Jul 30 '22 21:07 ahrm

Yes, it seems that it is a problem. I found this long issue from qutebrowser, as it is also built using Qt and people are asking for the same feature https://github.com/qutebrowser/qutebrowser/issues/4067

It seems that they have a potential fix recently https://github.com/qutebrowser/qutebrowser/pull/7293.

albert-ying avatar Jul 31 '22 18:07 albert-ying

This seems to be a MacOS-specific solution. I can't really test it on my systems.

ahrm avatar Jul 31 '22 19:07 ahrm

I think in Linux, they can control the appearance of the title bar globally through the windows manager, so Linux support is not needed. So if this works in MacOS, it is sort of 'cross-platform' with the exception of windows.

Let me know if I can help with anything, although I don't know Qt but maybe I can help with testing.

albert-ying avatar Jul 31 '22 22:07 albert-ying

Hey! Just saw this linked in the qutebrowser thread. Some good news regarding frameless windows not being resizable:

@ahrm FWIW, you might be able to get a free hosted Mac via Open Source Program - Encouraging Open Innovation | MacStadium. That's what I use for qutebrowser, and it's been a lifesaver for testing macOS-specific stuff.

The-Compiler avatar Aug 23 '22 13:08 The-Compiler

@The-Compiler Thanks for the info, and also for the macstudium suggestion, will definitely check it out. And thanks for your work on qutebrowser.

ahrm avatar Aug 23 '22 13:08 ahrm

I just tested toggle_titlebar in my mac. What ends up happening is my titlebar stays but the tabs are hidden.

faurehu avatar Nov 29 '22 15:11 faurehu

Any update on this, there seems to be some new issue also related to this #862 #860

albert-ying avatar Nov 13 '23 08:11 albert-ying

I have tested it with new Qt versions but it still seems to be buggy.

ahrm avatar Nov 13 '23 09:11 ahrm

@ahrm, I've tested the toggle_titlebar command on the development branch in macOS, and it works fine.

jinjiaodawang avatar Jan 31 '24 13:01 jinjiaodawang