Added possibility to set shortcut, misc extra variables and grids into blocks

This commit is contained in:
Andreas Strauman 2020-11-07 09:04:58 +01:00
parent f431b8a8ed
commit 67578fd7c1
4 changed files with 357 additions and 19 deletions

View File

@ -15,6 +15,12 @@ CalcEval(X)
Global Monitor2Bottom
Global Monitor2Width
Global Monitor2Height
Global M2L
Global M2R
Global M2T
Global M2B
Global M2W
Global M2H
Global Monitor3Left
Global Monitor3Right
Global Monitor3Top

View File

@ -275,10 +275,10 @@ MoveToGrid(GridToMove)
}
return
}
GridTop := round(GridTop)
GridLeft := round(GridLeft)
GridRight := round(GridRight)
GridBottom := round(GridBottom)
; GridTop := round(GridTop)
; GridLeft := round(GridLeft)
; GridRight := round(GridRight)
; GridBottom := round(GridBottom)
GridWidth := GridRight - GridLeft
GridHeight := GridBottom - GridTop

View File

@ -2,7 +2,6 @@
;By jgpaiva
;date: May 2006
;function: Adjusts windows to a predefined or user-defined desktop grid.
;;options:
MButtonDrag := True ;to be able to drag a window using the 3rd mouse button
LButtonDrag:=True ;to be able to drag a window by its title
@ -1211,15 +1210,29 @@ ApplyGrid:
else
GoSub, CreateGridFromFile
return
; RegisterGridTile()
GetMonitorScale()
{
global
Sysget,MonitorCount,MonitorCount
Loop,%MonitorCount%
{
Monitor%A_Index%Scale := 1
_monscalevar = Monitor%A_Index%Scale
IniRead,%_monscalevar%,%A_ScriptDir%\%GridName%,Groups,%_monscalevar%,1
}
}
CreateGridFromFile:
Menu,templates_menu,DeleteAll
createTemplatesMenu()
GoSub, HideGroups
Gui,destroy
Gui,2:destroy
GetMonitorScale()
GetMonitorSizes()
IniRead,NGroups,%A_ScriptDir%\%GridName%,Groups,NumberOfGroups,Error
IniRead,Blocksize,%A_ScriptDir%\%GridName%,Groups,Blocksize,5
SetBlocks()
If (NGroups = "error")
{
MsgBox,%error_ngroups% %GridName%
@ -1227,7 +1240,6 @@ CreateGridFromFile:
return
}
ErrorLevel := False
NShortCuts := %NGroups%
loop,%NGroups%
{
if a_index = "0"
@ -1248,17 +1260,24 @@ CreateGridFromFile:
GridRight = %PosIndex%GridRight
GridLeft = %PosIndex%GridLeft
IniRead,%TriggerTop% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerTop,Error
IniRead,%TriggerBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerBottom,Error
IniRead,%TriggerLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerLeft,Error
IniRead,%TriggerRight% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerRight,Error
IniRead,ShowGrid ,%A_ScriptDir%\%GridName%,%A_Index%,ShowGrid,"0"
IniRead,%TriggerTop% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerTop,0
IniRead,%TriggerBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerBottom,0
IniRead,%TriggerLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerLeft,0
IniRead,%TriggerRight% ,%A_ScriptDir%\%GridName%,%A_Index%,TriggerRight,0
IniRead,%GridTop% ,%A_ScriptDir%\%GridName%,%A_Index%,GridTop,Error
IniRead,%GridBottom% ,%A_ScriptDir%\%GridName%,%A_Index%,GridBottom,Error
IniRead,%GridLeft% ,%A_ScriptDir%\%GridName%,%A_Index%,GridLeft,Error
IniRead,%GridRight% ,%A_ScriptDir%\%GridName%,%A_Index%,GridRight,Error
; IniRead,%PosNum% ,%A_ScriptDir%\%GridName%,%PosIndex%,PosNum,%PosIndex%
If (ShowGrid=1 AND %TriggerTop%="0" AND %TriggerBottom%="0" AND %TriggerLeft%="0" AND %TriggerRight%="0")
{
%TriggerTop% := %GridTop%
%TriggerBottom% := %GridBottom%
%TriggerLeft% := %GridLeft%
%TriggerRight% := %GridRight%
}
If (%TriggerTop%="Error" OR %TriggerBottom%="Error"
OR %TriggerLeft%="Error" OR %TriggerRight%="Error" )
{
@ -1300,6 +1319,7 @@ GetScreenSize()
Loop,%MonitorCount%
{
SysGet,monitor,Monitor,%A_Index%
Monitor%A_Index%Scale=1
If (monitorLeft<ScreenLeft)
ScreenLeft:=monitorLeft
If (monitorTop<ScreenTop)
@ -1449,7 +1469,36 @@ evaluateGrid()
}
ngroups -= count
}
SetBlocks()
{
global
bs := Blocksize + 1
; Use monitor 2 as standard
loop,%bs%
{
_safe_pads = 0
; if (A_Index=1)
; {
; _safe_pads=5
; }
B%A_Index%L := M2L + _safe_pads + (A_Index-1) * M2W / blocksize
B%A_Index% := M2L + _safe_pads + (A_Index-1) * M2W / blocksize
B%A_Index%R := M2L + _safe_pads + (A_Index) * M2W / blocksize
}
sysget,monitorCount,MonitorCount
loop,%monitorCount%
{
mtr := A_Index
loop,%bs%
{
M%mtr%B%A_Index%L := Monitor%mtr%Left + (A_Index-1) * Monitor%mtr%Width / blocksize
M%mtr%B%A_Index% := Monitor%mtr%Left + (A_Index-1) * Monitor%mtr%Width / blocksize
M%mtr%B%A_Index%R := Monitor%mtr%Left + (A_Index) * Monitor%mtr%Width / blocksize
}
}
}
Getmonitorsizes()
{
global
@ -1459,12 +1508,25 @@ Getmonitorsizes()
{
sysget,monitorReal,Monitor,%A_Index%
sysget,monitor,MonitorWorkArea,%A_Index%
monitor%a_Index%Left :=MonitorLeft
monitor%a_Index%Bottom :=MonitorBottom
monitor%a_Index%Right :=MonitorRight
monitor%a_Index%Top :=MonitorTop
monitor%a_Index%Width :=MonitorRight - MonitorLeft
monitor%a_Index%Height :=MonitorBottom - MonitorTop
scalefactor := Monitor%A_Index%Scale
MonitorHeight := (MonitorBottom - MonitorTop)
MonitorWidth := (MonitorRight - MonitorLeft)
monitor%A_Index%Left :=MonitorLeft
monitor%A_Index%Bottom :=MonitorHeight
monitor%A_Index%Right :=MonitorWidth
monitor%A_Index%Top :=MonitorTop
monitor%A_Index%Width :=MonitorWidth
monitor%A_Index%Height :=MonitorHeight
M%A_Index%M := MonitorTop + monitor%A_Index%Height/2
M%A_Index%L := MonitorLeft
M%A_Index%B := MonitorBottom
M%A_Index%R := MonitorRight
M%A_Index%T := MonitorTop
M%A_Index%W := MonitorRight - MonitorLeft
M%A_Index%H := MonitorBottom - MonitorTop
monitorreal%A_Index%Left :=MonitorRealLeft
monitorreal%A_Index%Bottom :=MonitorRealBottom

270
Grids/main.grid Normal file
View File

@ -0,0 +1,270 @@
[Groups]
NumberOfGroups = 25
Blocksize = 7
Monitor1Scale = 1.25
[1]
GridTop = [Monitor2Top] + [Monitor2Height] /2
GridBottom = [Monitor2Bottom]
GridLeft = [B1]
GridRight = [B3]
ShowGrid = 0
[2]
GridTop = [Monitor2Top] + [Monitor2Height] /2
GridBottom = [Monitor2Bottom]
GridLeft = [B3]
GridRight = [B6]
ShowGrid = 0
[3]
GridTop = [Monitor2Top] + [Monitor2Height] /2
GridBottom = [Monitor2Bottom]
GridLeft = [B6]
GridRight = [B7R] - 5.5
ShowGrid = 0
[4]
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B1]
GridRight = [B3]
ShowGrid = 0
[5]
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B3]
GridRight = [B6]
ShowGrid = 0
[19]#55
ShortCutNum = 55
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B3]
GridRight = [B6]
ShowGrid = 0
[6]
GridTop = [M2T]
GridBottom = [M2B]
GridLeft = [M2L] + [M2W] * 5/7
GridRight = [M2R] - 5.5
ShowGrid = 0
[7]
GridTop = [Monitor2Top]
GridBottom = [Monitor2Top] + [Monitor2Height] /2
GridLeft = [B1]
GridRight = [B3]
ShowGrid = 0
[8]
GridTop = [Monitor2Top]
GridBottom = [Monitor2Top] + [Monitor2Height] /2
GridLeft = [B3]
GridRight = [B6]
ShowGrid = 0
[9]
GridTop = [Monitor2Top]
GridBottom = [Monitor2Top] + [Monitor2Height] /2
GridLeft = [B6]
GridRight = [B7R] - 5.5
ShowGrid = 0
[10]
GridTop = [Monitor2Top] - 2*[Monitor2Height]
GridBottom = [Monitor2Top] - 1.5*[Monitor2Height]
GridLeft = WindowWidth
GridRight = WindowWidth
ShowGrid = 0
## Left quadrants
[11]
# LEFT: Bottom left
GridTop = [M2T] + [M2H]/2
GridBottom = [M2B]
GridLeft = [B1]
GridRight = [B2]
ShowGrid = 1
[12]#13
# LEFT: Bottom right
ShortCutNum = 13
GridTop = [M2T] + [M2H]/2
GridBottom = [M2B]
GridLeft = [B2]
GridRight = [B3]
ShowGrid = 1
[13]#17
# LEFT: Top left
ShortCutNum = 17
GridTop = [M2T]
GridBottom = [M2B] - [M2H]/2
GridLeft = [B1]
GridRight = [B2]
ShowGrid = 1
[14]#19
# LEFT: Top right
ShortCutNum = 19
GridTop = [M2T]
GridBottom = [M2M]
GridLeft = [B2]
GridRight = [B3]
ShowGrid = 1
## Right part of screen
[15]#39
# RIGHT: Top right
ShortCutNum = 39
GridTop = [M2T]
GridBottom = [M2M]
GridLeft = [B7]
GridRight = [B8]
ShowGrid = 1
[22]#99
# RIGHT: Top right
ShortCutNum = 99
GridTop = [M2T]
GridBottom = [M2M]
GridLeft = [B7]
GridRight = [B8]
ShowGrid = 1
[16]#77
# RIGHT: Top left
ShortCutNum = 37
GridTop = [M2T]
GridBottom = [M2M]
GridLeft = [B6]
GridRight = [B7]
ShowGrid = 1
[17]#97
# RIGHT: Bottom right
ShortCutNum = 33
GridTop = [M2M]
GridBottom = [M2B]
GridLeft = [B7]
GridRight = [B8]
ShowGrid = 1
[18]#91
# RIGHT: Bottom left
ShortCutNum = 31
GridTop = [M2M]
GridBottom = [M2B]
GridLeft = [B6]
GridRight = [B7]
ShowGrid = 1
[21]#44
# Big editor
ShortCutNum = 44
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B1]
GridRight = [B6]
ShowGrid = 0
[23]#66
# Big pyconsole
ShortCutNum = 66
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B5]
GridRight = [M2R] - 10
ShowGrid = 0
#[23]#66
# # Big VSCode
# ShortCutNum = 66
# GridTop = [Monitor2Top]
# GridBottom = [Monitor2Bottom]
# GridLeft = [B3]
# GridRight = [M2R] - 10
##
# ShowGrid = 0
[24]#65
# Editor with big console
ShortCutNum = 65
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B2]
GridRight = [B5]
ShowGrid = 0
[25]#64
# Left with big console
ShortCutNum = 64
GridTop = [Monitor2Top]
GridBottom = [Monitor2Bottom]
GridLeft = [B1]
GridRight = [B2]
ShowGrid = 0
## Monitor 1
[20]#56
# M1: RightQ
ShortCutNum = 56
GridTop = ([Monitor1Top])
GridBottom = ([Monitor1Top]+[Monitor1Height])
GridLeft = ([Monitor1Left] + [Monitor1Width] * 5/7)
GridRight = ([Monitor1Left] + [Monitor1Width])
ShowGrid = 1
##### REMEMBER TO CHECK NumberOfGroups on top!!! #####
#[12]
#
# GridTop = [Monitor2Top] - 2*[Monitor2Height]
# GridBottom = [Monitor2Top] - 1.5*[Monitor2Height]
# GridLeft = WindowWidth
# GridRight = WindowWidth
#
# TriggerTop = 0
# TriggerBottom = 0
# TriggerLeft = 0
# TriggerRight = 0