Skip to content

Instantly share code, notes, and snippets.

@orazdow
Created January 2, 2024 09:19
Show Gist options
  • Save orazdow/8d6cac9b03115edee041435b8c46c8ec to your computer and use it in GitHub Desktop.
Save orazdow/8d6cac9b03115edee041435b8c46c8ec to your computer and use it in GitHub Desktop.
ahk v2 nighlight, wintop, hidebar
;tray icon tooltip
A_IconTip := "alt-l: nightlight`nctl-alt-up: winontop`nctl-alt-b: hidebar"
;*********** Alt-l : open night light *********************;
!l:: Run "ms-settings:nightlight"
;*********** Ctl-Alt-Up : pin window on top ***************;
^!Up:: WinSetAlwaysOnTop -1, "A"
;*********** Ctl-Alt-b : hide/show taskbar ****************;
^!b:: {
static hide := 0
HideShowTaskbar(hide := !hide)
}
HideShowTaskbar(action) {
static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
APPBARDATA := Buffer(size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
NumPut("UInt", size, APPBARDATA), NumPut("Ptr", WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
NumPut("UInt", action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
DllCall("Shell32\SHAppBarMessage", "UInt", ABM_SETSTATE, "Ptr", APPBARDATA)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment