DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: Auto-hide window borders when not hovering over/near them (SCREENSHOT)  (Read 9,066 times)

tmpusr

  • Instantiation stuck in meatspace with no backup
  • Member
  • Joined in 2005
  • **
  • Posts: 154
To take a step toward the clean, minimalist look you see in the Microsoft 2019 video, hide window borders when not hovering the cursor over them (or near them, user adjustable option). Either by making them transparent, or if that's not possible, overlay with some user-selectable solid color (usually the desktop background color), like in this mockup:



When hovering over or near the border, the color would be removed but could also be changed to transparent and tinted so that the borders "glow" or simply changed to some other solid color (width and position adjustable - if not using the border width system variable - so you could cover only parts of the border, for example leaving the outermost or innermost line visible). If you can actually remove them so that the windows would tile seamlessly, that would be an option, but just hiding them would be fine.

It certainly can be done as seen in this tiling window manager:

http://hashtwm.demonastery.org/

This http://www.autohotkey.com/docs/commands/WinSet.htm would seem to do the job (though I'm not sure) and has even rounded corners which would be a bonus (user option, adjustable roundness).

http://www.donationcoder.com/forum/index.php?topic=19584.msg179289#msg179289 lets you blank out the window titlebar (and taskbar) icons and buttons when not hovering over the titlebar. It seems you'd only have to change a bit of code there to get this app done.

That app is needed for getting that ultra-minimalistic look. Perhaps it and this one could be combined.

The app could, optionally, also hide the window titlebar, and also the statusbar, and scrollbars, when not hovering near them. It would optionally actually remove the titlebar like in the tiling window manager, but when the cursor is near the titlebar area, it pops up.

A separate bonus snack:

To get rid of the last piece of visual clutter, I'd also like to have the My Computer/Internet icon removed from the Explorer statusbar. Simply filling that area with a solid color would be an acceptable solution. The user would have to match the color and perhaps the height to the visual style - unless there are system variables for those.


Also see http://homepage1.nifty.com/kazubon/tclocklight/ for getting rid of the visual junk in the taskbar.
« Last Edit: September 30, 2009, 03:35 PM by tmpusr »

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Code: (autoit)
F1:: ; Remove caption and sizing border from the active window.
{
    WinSet, Style, -0xC00000, A    
    WinSet, Style, -0x40000, A    
}
Return

F2:: ; Return active window to normal.
{
    WinSet, Style, +0xC00000, A    
    WinSet, Style, +0x40000, A
}
Return

tmpusr

  • Instantiation stuck in meatspace with no backup
  • Member
  • Joined in 2005
  • **
  • Posts: 154
Thanks. I pasted the titlebar hiding line into the other app, and instead of just hiding the buttons, now the whole titlebar vanishes, which is fine, but it screws up the taskbar and desktop when near their top so they should be excluded (you can actually see the caption of the desktop 'Program Manager').

The border removal needs code that restores them when you're near them. And it doesn't always achieve the visual goal completely because it leaves vertical and horizontal lines e.g. in Explorer and Notepad. It would need to remove a few more pixels inside, 2 more to be precise. The solid color rectangle would be a solution, which of course requires using a solid desktop color to give the correct visual impression, but that's how I'm willing to operate.
« Last Edit: September 30, 2009, 06:07 PM by tmpusr »

tmpusr

  • Instantiation stuck in meatspace with no backup
  • Member
  • Joined in 2005
  • **
  • Posts: 154
I don't really know what I'm doing, and there are problems, but this is semi-usable. I just added the lines here and tweaked the titlebar activation area. The taskbar, desktop, and menus should be excluded and the logic of the auto-hide could be better. It should work as you expect it to; when you go near the top the titlebar should pop up but the window shouldn't move.

Code: (autoit)
/*
Author:  Jody Holmes (Skwire)
Date:    2009-08-23
Contact: skwire@skwire.net


v0.0.0.3 - 2009-09-29
    + Added optional showing/hiding of titlebar min/max/close buttons.

v0.0.0.2 - 2009-08-28
    * Hook now fires on two additional messages.
        HSHELL_REDRAW
        HSHELL_RUDEAPPACTIVATED

v0.0.0.1 - 2009-08-23
    + Initial build.

*/

#NoTrayIcon
#Persistent
#NoEnv
#SingleInstance, Force
SetWorkingDir, %A_ScriptDir%
DetectHiddenWindows, Off
OnExit, Cleanup
SysGet, TBarHeight, 4

Menu, Tray, NoStandard
Menu, Tray, Add, Exit, Cleanup

Gui +LastFound
hWnd := WinExist()

; Hook the shell.
; http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323
DllCall( "RegisterShellHookWindow", UInt, hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str, "SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )

; Create a blank cursor for use instead of a blank icon file.
; http://www.autohotkey.com/forum/viewtopic.php?p=220113#220113
VarSetCapacity( AndMask, 32*4, 0xFF ), VarSetCapacity( XorMask, 32*4, 0 )
hIcon := DllCall( "CreateCursor", Uint, 0, Int, 0, Int, 0, Int, 32, Int, 32, Uint, &AndMask, Uint, &XorMask )

; Initial loop to blank out existing windows.
WinGet, s, List
Loop, % s
{
    s := s%A_Index%
    ;SendMessage, 0x80, 0, hIcon, , % "ahk_id " . s
}

; MsgBox, 36, TBarIconBlanker, Would you like to enable the min/max/close buttons tweak as well?
; IfMsgBox, Yes
; {
;     MinMaxCloseOption := 1
;     SetTimer, WatchCursor, 100
; }
MinMaxCloseOption := 1
SetTimer, WatchCursor, 100

Return ; End of auto-execute section.


; ------------------------------------------------------------------------
; Subroutines ------------------------------------------------------------
; ------------------------------------------------------------------------

Cleanup:
{
    If ( MinMaxCloseOption = 1 ) ; Restore titlebar buttons on close.
    {
        WinGet, s, List
        Loop, % s
        {
            s := s%A_Index%
            WinSet, Style, +0x80000, % "ahk_id " . s ; Restore min/max/close buttons.
        }
    }
    ExitApp
}
Return


WatchCursor:
{
    MouseGetPos, , yPos, CurrID,
    If ( yPos >= -36 and yPos < 86 )

    {
        WinSet, Style, +0x80000, % "ahk_id " . CurrID ; Restore min/max/close buttons.
        SendMessage, 0x80, 0, hIcon, , % "ahk_id " . CurrID ; Blank out titlebar and taskbar icons.
        WinSet, Style, +0xC00000, % "ahk_id " . CurrID ; titlebar
        WinSet, Style, +0x40000, % "ahk_id " . CurrID ; borders
    }
    Else
    {
        WinSet, Style, -0x80000, % "ahk_id " . PrevID ; Get rid of min/max/close buttons.
        WinSet, Style, -0x80000, % "ahk_id " . CurrID ; Get rid of min/max/close buttons.
        SendMessage, 0x80, 0, hIcon, , % "ahk_id " . CurrID ; Blank out titlebar and taskbar icons.
        WinSet, Style, -0xC00000, % "ahk_id " . PrevID ; titlebar
        WinSet, Style, -0xC00000, % "ahk_id " . CurrID ; titlebar
        WinSet, Style, -0x40000, % "ahk_id " . PrevID ; borders
        WinSet, Style, -0x40000, % "ahk_id " . CurrID ; borders
    }
}
Return


; ------------------------------------------------------------------------
; Functions --------------------------------------------------------------
; ------------------------------------------------------------------------

; Shell hook to blank out windows that are subsequently created.
ShellMessage( wParam, lParam )
{
    Global hIcon, MinMaxCloseOption, PrevID
    If wParam in 1,6,32772
    {
        SendMessage, 0x80, 0, hIcon, , % "ahk_id " . lParam ; Blank out titlebar and taskbar icons.
        If ( MinMaxCloseOption = 1 )
        {
            WinSet, Style, -0x80000, % "ahk_id " . lParam ; Get rid of min/max/close buttons.
        }
    }
    PrevID := lParam
}
« Last Edit: September 30, 2009, 07:16 PM by tmpusr »

Original address: https://www.donationcoder.com/forum/index.php?topic=20124.0