Skip to content

Commit

Permalink
Merge pull request #3 from martinsmith1968/feature/startup-options
Browse files Browse the repository at this point in the history
Feature/startup options
  • Loading branch information
martinsmith1968 authored Jan 1, 2020
2 parents 1cc3ee9 + 127e905 commit 466ab36
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 11 deletions.
Binary file added Docs/ConfigurationDialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/MainMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Docs/releasenotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Release Notes

## v1.5.0 - 2020-01-01

- Added options for Restore Window Positions on Startup and Restore Desktop Icons on Startup
- Restructured Docs

## v1.4.2 - 2019-12-07

- Major Refactoring into classes and consistent functionality
- Fixed Window spanning
- Introduced Window Position and Desktop Icon functionality
- Added Configuration dialog
8 changes: 8 additions & 0 deletions Docs/todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# To Do

- Move Window Positions Menu to Context Menu (Option?)
- Move Saved Desktop Icon Positions Menu to Context Menu (Option?)
- History list of Saved Window Positions
- History list of Saved Desktop Icon Positions
- Add icons to other context menu items
- Support other config value types as required
4 changes: 4 additions & 0 deletions Lib/UserConfig.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class UserConfig
readValue := defaultValue
}
}
else if (type == "boolean")
{
readValue := (readValue) ? true : false
}
}

return readValue
Expand Down
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
# WindowMenu
AutoHotKey Window Menu for fine grained control of positioning
# Window Extensions

AutoHotKey Window Menu and Extensions for fine grained control of positioning

## Basic Usage:

To invoke:

- Right click the right half of any Window Caption bar
- Press `Win-W`

Brings up the main menu.

Selecting any of the entries applies to the target window, shown at the top of the menu.

> Except: `Save / Restore Window Positions` and `Save / Restore Desktop Icons`
![Main Menu](Docs/MainMenu.png)

A Configuration dialog, available from the tray icon, allows controlling some aspects of the functionality.

![Configuration Dialog](Docs/ConfigurationDialog.png)

## Features

### Optimum Positioning

Window Extensions has menu options dedicated to Optimum positioning.

There are 5 or so menu items that position windows with increasing indentation. (Configurable)

### Window Control

There are other options for controlling window positioning, eg:

- Dedicated positions (Corners, columns, etc.)
- Centring
- Controlling transparency
- Rolling up to just a title bar
- Spanning multiple monitors if more than 1 monitor is available

### Window Positions

Window Extensions has the ability to save window positions and restore them on demand.

This was originally intended as a remedy to the widely known Multi-Monitor bug in Windows that doesn't restore window positions when unlocking or activating / deactivating monitors.

Window positions are saved to a file in the Users data folder (E.g. %APPDATA%\Roaming\WindowExtensions)

### Desktop Icons

Window Extensions has the ability to save desktop icon positions and restore them on demand.

There are other tools available which are dedicated to this task, with perhaps more functionality. This feature was added to Window Extensions due to restrictions in being able to use these tools on some sites that I visit.

Desktop Icon positions are saved to a file in the Users data folder (E.g. %APPDATA%\Roaming\WindowExtensions)

## [To Do](Docs/todo.md)
2 changes: 1 addition & 1 deletion Setup/WindowMenu_Setup.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define AppName "WindowExtensions"
#define AppTitle "Window Extensions"
#define AppVersion "1.4.2"
#define AppVersion "1.5.0"

[Setup]
AppName={#AppName}
Expand Down
7 changes: 1 addition & 6 deletions WindowExtensions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ SetFormat, float, 0.0
SetBatchLines, 10ms
SetTitleMatchMode, 2

;--------------------------------------------------------------------------------
; ToDo
; ====
; Support other config value types

;--------------------------------------------------------------------------------
; Initialisation
AppName := "WindowExtensions"
AppTitle := "Window Extensions"
AppDescription := "Window Extensions Menu and HotKeys"
AppNotes := "Concise and consistent control over Window Positions. Right-click right half of Window Caption bar to invoke, or hit WinKey-W"
AppURL := "https://github.com/martinsmith1968/WindowExtensions"
AppVersion := "1.4.2.0"
AppVersion := "1.5.0.0"

;--------------------------------------------------------------------------------
; Setup Tray Menu
Expand Down
28 changes: 28 additions & 0 deletions WindowExtensionsUserConfig.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ DefaultCascadeGutterSize := 30
DefaultColumnGutterSize := 5
DefaultGridGutterSize := 5
DefaultSpanMonitorGutterSize := 5
DefaultRestoreDesktopIconsOnStartup := false
DefaultWindowPositionsOnStartup := false

__New()
{
Expand All @@ -19,6 +21,8 @@ DefaultSpanMonitorGutterSize := 5
this.Properties.push("ColumnGutterSize")
this.Properties.push("GridGutterSize")
this.Properties.push("SpanMonitorGutterSize")
this.Properties.push("RestoreDesktopIconsOnStartup")
this.Properties.push("RestoreWindowPositionsOnStartup")
}

CascadeGutterSize
Expand Down Expand Up @@ -68,4 +72,28 @@ DefaultSpanMonitorGutterSize := 5
base.SetValue("General", base.GetPropertyNameFromFunc(A_ThisFunc), value)
}
}

RestoreDesktopIconsOnStartup
{
get
{
return base.GetValue("General", base.GetPropertyNameFromFunc(A_ThisFunc), this.DefaultRestoreDesktopIconsOnStartup, "boolean")
}
set
{
base.SetValue("General", base.GetPropertyNameFromFunc(A_ThisFunc), value)
}
}

RestoreWindowPositionsOnStartup
{
get
{
return base.GetValue("General", base.GetPropertyNameFromFunc(A_ThisFunc), this.DefaultWindowPositionsOnStartup, "boolean")
}
set
{
base.SetValue("General", base.GetPropertyNameFromFunc(A_ThisFunc), value)
}
}
}
14 changes: 12 additions & 2 deletions WindowExtensionsUserConfigGui.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ BuildUserConfigGui(windowExtensionsUserConfig)
global columnGutterSize
global gridGutterSize
global spanMonitorGutterSize
global restoreDesktopIconsOnStartup
global restoreWindowPositionsOnStartup

cascadeGutterSize := windowExtensionsUserConfig.CascadeGutterSize
columnGutterSize := windowExtensionsUserConfig.ColumnGutterSize
gridGutterSize := windowExtensionsUserConfig.GridGutterSize
spanMonitorGutterSize := windowExtensionsUserConfig.SpanMonitorGutterSize
restoreDesktopIconsOnStartup := windowExtensionsUserConfig.RestoreDesktopIconsOnStartup ? 1 : 0
restoreWindowPositionsOnStartup := windowExtensionsUserConfig.RestoreWindowPositionsOnStartup ? 1 : 0

Gui, Config:New, -SysMenu
Gui, Config:Add, Text,, Cascade Gutter Size:
Gui, Config:Add, Text,, Column Gutter Size:
Gui, Config:Add, Text,, Grid Gutter Size:
Gui, Config:Add, Text,, Span Monitor Gutter Size:
Gui, Config:Add, Text,, Restore Desktop Icons on Startup:
Gui, Config:Add, Text,, Restore Window Positions on Startup:
Gui, Config:Add, Edit, ym w80
Gui, Config:Add, UpDown, vcascadeGutterSize Range0-100, %cascadeGutterSize%
Gui, Config:Add, Edit, w80
Expand All @@ -30,8 +36,10 @@ BuildUserConfigGui(windowExtensionsUserConfig)
Gui, Config:Add, UpDown, vgridGutterSize Range0-100, %gridGutterSize%
Gui, Config:Add, Edit, w80
Gui, Config:Add, UpDown, vspanMonitorGutterSize Range0-100, %spanMonitorGutterSize%
Gui, Config:Add, Button, default x50 y120 w80, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Config:Add, Button, x140 y120 w80, Cancel ; The label ButtonCancel (if it exists) will be run when the button is pressed.
Gui, Config:Add, Checkbox, vrestoreDesktopIconsOnStartup Checked%restoreDesktopIconsOnStartup%,
Gui, Config:Add, Checkbox, vrestoreWindowPositionsOnStartup Checked%restoreWindowPositionsOnStartup%, `n
Gui, Config:Add, Button, default x50 y180 w80, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Config:Add, Button, x140 y180 w80, Cancel ; The label ButtonCancel (if it exists) will be run when the button is pressed.
}

DestroyConfigGui()
Expand Down Expand Up @@ -79,6 +87,8 @@ ConfigButtonOK:
G_UserConfig.ColumnGutterSize := columnGutterSize
G_UserConfig.GridGutterSize := gridGutterSize
G_UserConfig.SpanMonitorGutterSize := spanMonitorGutterSize
G_UserConfig.RestoreDesktopIconsOnStartup := restoreDesktopIconsOnStartup
G_UserConfig.RestoreWindowPositionsOnStartup := restoreWindowPositionsOnStartup
G_UserConfig.Save()

DestroyConfigGui()
Expand Down
11 changes: 11 additions & 0 deletions WindowMenu.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ menuIndex := AddWindowMenuItem("&Cancel", "NullHandler", "", menuIndex)
; for any reason:
OnExit, ExitSub

;--------------------------------------------------------------------------------
; Apply Startup options ?
if (G_UserConfig.RestoreDesktopIconsOnStartup)
{
RestoreDesktopIcons()
}
if (G_UserConfig.RestoreWindowPositionsOnStartup)
{
RestoreWindowPositions()
}

return ; End of script's auto-execute section.

ExitSub:
Expand Down

0 comments on commit 466ab36

Please sign in to comment.