Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Nelson committed Jun 1, 2020
1 parent 2cfedb8 commit def2033
Show file tree
Hide file tree
Showing 24 changed files with 2,690 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
When working with multiple screens you'll often find that windows don't stay where you put them when you move between monitor changes or even awaking from sleep. This small program allows you to save the location and size of selected windows so you can easily restore their location later. Simply place a shortcut to the program in your startup folder so it runs at boot. Open all the programs you want to save and place them where you want. Right-click the TAN Window Manager icon that will be in your tray and click 'Save Window Locations'. In the popup check the windows you want to save and click 'Save'. Now you can use the 'Restore Window Locations' button to magically move your saved windows back to where you placed them.

Todd Nelson

todd@toddnelson.net

https://toddnelson.net
30 changes: 30 additions & 0 deletions TANWindowMgr.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TANWindowMgr", "TANWindowMgr\TANWindowMgr.vbproj", "{ABECE45D-CD97-4ED6-881E-A0A7C2E7498D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C7DA242F-16B4-401E-8552-FFFBDE5ADC25}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ABECE45D-CD97-4ED6-881E-A0A7C2E7498D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABECE45D-CD97-4ED6-881E-A0A7C2E7498D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABECE45D-CD97-4ED6-881E-A0A7C2E7498D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABECE45D-CD97-4ED6-881E-A0A7C2E7498D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E02CA3D-C984-4452-9164-89530B1264D4}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions TANWindowMgr/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
73 changes: 73 additions & 0 deletions TANWindowMgr/AppContext.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Imports System.Runtime.InteropServices
Imports System.Diagnostics

Public Class AppContext
Inherits ApplicationContext

Private WithEvents Tray As NotifyIcon
Private WithEvents MainMenu As ContextMenuStrip
Private WithEvents mnuSaveSettings As ToolStripMenuItem
Private WithEvents mnuRestoreSettings As ToolStripMenuItem
Private WithEvents mnuHelpAbout As ToolStripMenuItem
Private WithEvents mnuSep1 As ToolStripSeparator
Private WithEvents mnuExit As ToolStripMenuItem

Public Sub New()
'Initialize the menus
mnuSaveSettings = New ToolStripMenuItem("Save Window Locations")
mnuRestoreSettings = New ToolStripMenuItem("Restore Window Locations")
mnuHelpAbout = New ToolStripMenuItem("About TAN Window Manager")
mnuSep1 = New ToolStripSeparator()
mnuExit = New ToolStripMenuItem("Exit")
MainMenu = New ContextMenuStrip
MainMenu.Items.AddRange(New ToolStripItem() {mnuHelpAbout, mnuSaveSettings, mnuRestoreSettings, mnuSep1, mnuExit})

'Initialize the tray
Tray = New NotifyIcon
Tray.Icon = My.Resources.TrayIcon
Tray.ContextMenuStrip = MainMenu
Tray.Text = "TAN Window Manager"

'Display
Tray.Visible = True
End Sub

Private Sub AppContext_ThreadExit(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.ThreadExit
'Guarantees that the icon will not linger.
Tray.Visible = False
End Sub

Private Sub mnuSaveSettings_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles mnuSaveSettings.Click
If Not Form1.Visible Then Form1.Show() : Form1.Activate()
End Sub

Private Sub mnuRestoreSettings_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles mnuRestoreSettings.Click
If My.Computer.FileSystem.FileExists("Settings.ini") Then
Form1.RestoreSettings()
Else
Tray.BalloonTipText = "Settings file does not exist!"
Tray.ShowBalloonTip(5000)
End If
End Sub

Private Sub mnuHelpAbout_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles mnuHelpAbout.Click
If Not frmAbout.Visible Then frmAbout.Show() : frmAbout.Activate()
End Sub

Private Sub mnuExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles mnuExit.Click
Application.Exit()
End Sub

Private Sub Tray_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Tray.DoubleClick

If Not frmAbout.Visible Then frmAbout.Show() : frmAbout.Activate()

End Sub

End Class
109 changes: 109 additions & 0 deletions TANWindowMgr/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit def2033

Please sign in to comment.