How to Automatically Hide the Taskbar When Idle in Windows 11?

0
16
Asked By CuriousCoder92 On

I'm using Windows 11 and I've been trying to find a way to autohide my taskbar when no windows are open and there's no keyboard or mouse activity. I've used some apps before, but they ended up hiding the taskbar at the wrong times, which wasn't useful. I thought about using AutoHotkey, but I'm not sure how to code or set it up to run on startup. Any advice would be much appreciated!

3 Answers

Answered By TechieTinker On

By default, if you set the taskbar to autohide in Windows, it'll only show when you hover over it, even when windows are open. It sounds like you're looking for something a bit different. It won't behave like that out of the box, unfortunately.

Answered By CodeWhisperer On

You can use the AutoHotkey script to achieve this! Here’s a simple one:

```ahk
Persistent
DetectHiddenWindows True
SetTimer(CheckTaskbar, 500)

CheckTaskbar() {
TaskbarClass := "ahk_class Shell_TrayWnd"
IsDesktopActive := WinActive("ahk_class WorkerW") or WinActive("ahk_class Progman")
if (IsDesktopActive and A_TimeIdle > 3000) {
if WinExist(TaskbarClass)
WinHide(TaskbarClass)
} else if (!IsDesktopActive or A_TimeIdle < 500) {
if WinExist(TaskbarClass)
WinShow(TaskbarClass)
}
}
```

This script will hide the taskbar after 3 seconds of inactivity. You can tweak the `3000` value to adjust the idle time in milliseconds! As for running it at startup, you can place your AutoHotkey script in the startup folder.

Answered By GratefulGamer On

Thanks a lot, the script works like a charm! Just curious, how do I set this script to run automatically every time I start my PC? And is there a specific line I should change to adjust the time before the taskbar disappears?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.