Code:
#SingleInstance force
#NoTrayIcon
DetectHiddenWindows, On
Run, %programfiles%/GIMP-2.0/bin/gimp-2.6.exe, %programfiles%/GIMP-2.0/bin/
WinWait, Toolbox
Sleep, 1000
GIMPHidden = 0
GIMPHidden2 = 0
Hover = 0
Hover2 = 0
SetTimer, AutoHide, 0
SetTimer, FixWindows, 100
SetTimer, CloseCheck, 5000
;Changable variables
TW = 208 ;Default Tool Options width
TH = 30 ;Default Toolbox height
CH = 300 ;Default Color Picker height
;BSize = 1 ;Default work area border size
;BColor = 222222 ;Default 6digit HEX for border color
;Changing these varibale will break the script
WinList = Tool Options|FG/BG|Toolbox|Navigation
CP := A_ScreenHeight - CH - 30 ;Color picker position
TOH := A_ScreenHeight - CH ;Tool options height
NH := A_ScreenHeight - TH - 30 ;Navigator height
NP := A_ScreenWidth - TW ;Navigator position AND Border box width
BH := A_ScreenHeight - TH ;Border box height
;BLw := NP - BSize
;BLh := BH - BSize
;BTw := TW + BSize
;BTh := TH + BSize
;WB := A_ScreenWidth - BSize
;Draw work area border
;Gui, +LastFound +AlwaysOnTop +Toolwindow +Resize -MaximizeBox -Caption
;Gui, Color, %BColor%
;Gui, Show, Hide W%A_ScreenWidth% H%A_ScreenHeight% X0 Y0
;WinSet, Region, %TW%-%TH% %NP%-%TH% %NP%-%BH% %TW%-%BH% %TW%-%TH% %BTw%-%BTh% %BLw%-%BTh% %BLw%-%BLh% %BTw%-%BLh% %BTw%-%BTh%
;Gui, Show, +NoActivate, BorderBox
;;**********Hotkeys**********
;Toggle autohide sidebar feature
#IfWinActive, GNU
Tab::
If GIMPHidden = 0
{
;WinSet, Region, 0-%TH% %A_ScreenWidth%-%TH% %A_ScreenWidth%-%BH% 0-%BH% 0-%TH% %BSize%-%BTh% %WB%-%BTh% %WB%-%BLh% %BSize%-%BLh% %BSize%-%BTh%, BorderBox
WinHide, Navigation
WinHide, Tool Options
WinHide, FG/BG
GIMPHidden = 1
GIMPHidden2 = 1
}
Else
{
;WinSet, Region, %TW%-%TH% %NP%-%TH% %NP%-%BH% %TW%-%BH% %TW%-%TH% %BTw%-%BTh% %BLw%-%BTh% %BLw%-%BLh% %BTw%-%BLh% %BTw%-%BTh%, BorderBox
WinShow, Navigation
WinShow, Tool Options
WinShow, FG/BG
GIMPHidden = 0
GIMPHidden2 = 0
}
return
;;********Subroutines********
;Autohide side bars after tab is activated
AutoHide:
MouseGetPos, XM
If GIMPHidden = 1
{
If (XM <= 10 AND Hover = 0)
{
;WinSet, Region, %TW%-%TH% %A_ScreenWidth%-%TH% %A_ScreenWidth%-%BH% %TW%-%BH% %TW%-%TH% %BTw%-%BTh% %WB%-%BTh% %WB%-%BLh% %BTw%-%BLh% %BTw%-%BTh%, BorderBox
WinShow, Tool Options
WinShow, FG/BG
Hover = 1
}
Else If (XM >= TW AND Hover = 1)
{
;WinSet, Region, 0-%TH% %A_ScreenWidth%-%TH% %A_ScreenWidth%-%BH% 0-%BH% 0-%TH% %BSize%-%BTh% %WB%-%BTh% %WB%-%BLh% %BSize%-%BLh% %BSize%-%BTh%, BorderBox
WinHide, Tool Options
WinHide, FG/BG
Hover = 0
}
}
If GIMPHidden2 = 1
{
If (XM >= A_ScreenWidth - 10 AND Hover2 = 0)
{
;WinSet, Region, 0-%TH% %NP%-%TH% %NP%-%BH% 0-%BH% 0-%TH% %BSize%-%BTh% %BLw%-%BTh% %BLw%-%BLh% %BSize%-%BLh% %BSize%-%BTh%, BorderBox
WinShow, Navigation
Hover2 = 1
}
Else If (XM <= NP AND Hover2 = 1)
{
;WinSet, Region, 0-%TH% %A_ScreenWidth%-%TH% %A_ScreenWidth%-%BH% 0-%BH% 0-%TH% %BSize%-%BTh% %WB%-%BTh% %WB%-%BLh% %BSize%-%BLh% %BSize%-%BTh%, BorderBox
WinHide, Navigation
Hover2 = 0
}
}
return
;Fix window styles and positions
FixWindows:
{
Sleep, 10
Loop, Parse, WinList,|
{
WinSet, Style, -0x800000, %A_LoopField%
WinSet, Style, -0x400000, %A_LoopField%
WinSet, Style, -0x40000, %A_LoopField%
}
WinMove, Toolbox,,0,0,%A_ScreenWidth%,%TH%
WinSet, Region, 0-0 W%A_ScreenWidth% H%TH%, Toolbox
WinMove, Tool Options,,0,%TH%,%TW%,%TOH%
WinSet, Region, 0-0 W%TW% H%TOH%, Tool Options
WinMove, FG/BG,,0,%CP%,%TW%,%CH%
Winset, Region, 0-60 W%TW% H%CH%, FG/BG
WinMove, Navigation,,%NP%,%TH%,%TW%,%NH%
Winset, Region, 0-0 W%TW% H%NH%, Navigation
SetTimer, FixWindows, 1000
return
}
return
;Check if GIMP has closed and close script with it
CloseCheck:
{
IfWinExist, ahk_class gdkWindowToplevel
{
return
}
Else
{
ExitApp
}
}
return
Bookmarks