Advertisement
EzFlow997

TaskBar Hider

Dec 13th, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 2.36 KB | Source Code | 0 0
  1. #Requires AutoHotkey v2.0
  2. #SingleInstance Force
  3. PID := DllCall("GetCurrentProcessId")
  4. ProcessSetPriority "High", PID
  5. A_HotkeyInterval := 0
  6. DetectHiddenWindows true
  7.  
  8. Hotkey "^9", Exit
  9. Hotkey "^8", ToggleTaskBarHotkey
  10.  
  11. Exit(ThisHotkey){
  12.     WinShow "ahk_class Shell_TrayWnd"
  13.     ExitApp
  14. }
  15.  
  16. TBH := TaskBarHider()
  17. TBH.getTaskBarRegion()
  18. ToggleTaskBarHotkey(ThisHotkey){
  19.     TBH.toggle()
  20. }
  21.  
  22. class TaskBarHider {
  23.     showStatus := true
  24.     hideTimer := ObjBindMethod(this, "timer")
  25.     timeStarted := A_TickCount
  26.     timeDelay := 1500
  27.     showNow := false
  28.     TBx1 := 0
  29.     TBx2 := 0
  30.     TBy1 := 0
  31.     TBy2 := 0
  32.    
  33.     mEntryRegionTolerance := 0
  34.     mEntryX := 0
  35.     mEntryY := 0
  36.    
  37.     yPassed := false
  38.    
  39.     getTaskBarRegion(){
  40.         WinShow "ahk_class Shell_TrayWnd"
  41.         WinGetPos &X, &Y, &W, &H, "ahk_class Shell_TrayWnd"
  42.         this.TBx1 := X
  43.         this.TBy1 := Y
  44.         this.TBx2 := X + W
  45.         this.TBy2 := Y + H
  46.         ;MsgBox "Taskbar is at " this.TBx1 ", " this.TBy1 " -> " this.TBx2 ", " this.TBy2
  47.     }
  48.    
  49.     changeStatus(){
  50.         if(this.showStatus == true){
  51.             WinHide "ahk_class Shell_TrayWnd"
  52.             SetTimer this.hideTimer, 10
  53.         }
  54.         else{
  55.             WinShow "ahk_class Shell_TrayWnd"
  56.             SetTimer this.hideTimer, 0
  57.         }
  58.     }
  59.    
  60.     toggle(){
  61.         this.showStatus := !(this.showStatus)
  62.         this.changeStatus()
  63.     }
  64.    
  65.     timer(){
  66.         MouseGetPos &xpos, &ypos
  67.         ;Tooltip "ypos: " ypos ", TBy1: " this.TBy1 ", EntryY: " this.mEntryY "`nxpos: " xpos ", EntryX: " this.mEntryX
  68.        
  69.         if(ypos >= this.TBy1 && this.mEntryY == 0){
  70.             this.mEntryX := xpos
  71.             this.mEntryY := ypos
  72.             this.timeStarted := A_TickCount
  73.             ;Tooltip "ypos: " ypos ", TBy1: " this.TBy1 ", Entry: " this.mEntryY
  74.            
  75.         }
  76.         else if(ypos >= this.TBy1 && this.mEntryY != 0){
  77.             if(ypos >= this.mEntryY - this.mEntryRegionTolerance && ypos <= this.mEntryY + this.mEntryRegionTolerance){
  78.                 this.yPassed := true
  79.             }
  80.            
  81.             if(this.showNow == false && this.yPassed == true && A_TickCount - this.timeStarted > this.timeDelay){
  82.                 this.showNow := true
  83.                 WinShow "ahk_class Shell_TrayWnd"
  84.             }
  85.             else if(this.yPassed == false){
  86.                 this.showNow := false
  87.                 this.mEntryX := 0
  88.                 this.mEntryY := 0
  89.                 WinHide "ahk_class Shell_TrayWnd"
  90.             }
  91.         }
  92.         else if(ypos < this.TBy1 && this.mEntryY != 0){
  93.             this.yPassed := false
  94.             this.showNow := false
  95.             this.mEntryX := 0
  96.             this.mEntryY := 0
  97.             this.timeStarted := A_TickCount
  98.             WinHide "ahk_class Shell_TrayWnd"
  99.         }
  100.     }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement