Friday, November 18, 2016

Auto-Hide Desktop

Auto-Hide Desktop

There is a basic feature in Windows 7 and 10 (though there are more options for tablets in 10) that allows the user to automatically hide the taskbar until you hover at the bottom. This is okay for some, but I have always wanted my desktop to behave differently and so I have written a new program that does exactly what I want.

Auto-Hide Desktop! will automatically hide the task bar and all desktop icons when no physical input has been received by a user after a user defined amount of time. Unlike the normal behavior you do not have to hover at the taskbar region, all you have to do is touch the mouse or keyboard and everything will automatically reappear for you as long as you have input.

Usage

This runs and has been tested in Windows 7 64 bit and Windows 10 32 bit tablet, but though it won't cause any issues you might not like the result mixed with the systems Windows 10 tablet mode. Though you may. ShowDesk.exe is a child process of the main program and ensures that if for some unknown reason the main program fails while all is hidden then it will show everything upon failure. I have tested on tons of force closes and works everytime. If all else fails just reboot your system.

The only gui is the settings which can be found in the system tray icon by right clicking on it and selecting 'Settings'. In settings you can set the idle delay and also choose to auto-run the program at Windows startup or not. Default idle delay is 3 seconds, but can be set up to 9999 seconds (lol) and, of course, auto-run is disabled by default.

Images & Screens

Downloads

Script - main function library

RR(path,name){
 RegRead,a,% path, % name
 Return a
}
Settings(){
 Global delay,runState
 Gui, Settings:New
 Gui, Settings: Color, 0xFFFFFF, 0xFEFEFA
 Gui, Settings:Font,s11,Segoe UI
 Gui, Settings:Add, Text,Section h24 0x200 w300,Delay before hiding the desktop in seconds: 
 Gui, Settings:Add, Edit, w65 x+8
 Gui, Settings:Add, UpDown, vdelay Range3-9999 0x80 gDelayChange, %delay%
 Gui, Settings:Add, Text, h24 0x200 xs w300,Run at Windows start up: 
 Gui, Settings:Add, Checkbox, x+8 vrunState gRunState Checked%runState%
 Gui, Settings:Show, AutoSize, Auto-Hide Desktop Settings
 ControlSend, Edit1, {End},Auto-Hide Desktop Settings
}
ShowDesk(){
 DetectHiddenWindows, on
    id:=WinExist("ahk_class Shell_TrayWnd")
    ControlGet,id2,Hwnd,,SysListView321,ahk_class Progman
    If !id2
        ControlGet,id2,Hwnd,,SysListView321,ahk_class WorkerW
 ControlGet,id3,Hwnd,,,ahk_class Button
 If !IsVisible(id)
  WinShow, ahk_id %id%
 If !IsVisible(id2)
  WinShow, ahk_id %id2%
 If !IsVisible(id3)
  WinShow, ahk_id %id3%
}
ToggleDeskIcons(idle_time){
 DetectHiddenWindows, On
    ControlGet,id,Hwnd,,SysListView321,ahk_class Progman
    If !id
        ControlGet,id,Hwnd,,SysListView321,ahk_class WorkerW
 If (A_TimeIdlePhysical >= idle_time)
  {
   If IsVisible(id)
    WinHide, ahk_id %id%
   Return "Desktop icons are hidden." 
  }
    Else
        {
   If !IsVisible(id)
    WinShow, ahk_id %id%
   Return
        }
}
ToggleTaskbar(idle_time){
 DetectHiddenWindows, on
    id:=WinExist("ahk_class Shell_TrayWnd")
 ControlGet,id2,Hwnd,,,ahk_class Button
 If (A_TimeIdlePhysical >= idle_time)
  {
   If IsVisible(id)
    WinHide, ahk_id %id%
   If IsVisible(id2)
    WinHide, ahk_id %id2%
   Return "Taskbar is hidden." 
  }
    Else
        {
   If !IsVisible(id)
    WinShow, ahk_id %id%
   If !IsVisible(id2)
    WinShow, ahk_id %id2% 
   Return
        }
}
IsVisible(id){
 Return DllCall("IsWindowVisible","UInt",id)
}

No comments: