Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VirtualDestopCycle/Form1.Designer.cs

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

35 changes: 33 additions & 2 deletions VirtualDestopCycle/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public partial class Form1 : Form

private bool useAltKeySettings;

private int previousDesktopIndex;

public Form1()
{
InitializeComponent();
Expand Down Expand Up @@ -82,7 +84,8 @@ private void NumberHotkeyPressed(object sender, KeyPressedEventArgs e)
{
return;
}


previousDesktopIndex = currentDesktopIndex;
desktops.ElementAt(index)?.Switch();
}

Expand Down Expand Up @@ -287,6 +290,8 @@ VirtualDesktop initialDesktopState()

void RightKeyManagerPressed(object sender, KeyPressedEventArgs e)
{
previousDesktopIndex = getCurrentDesktopIndex();

var desktop = initialDesktopState();

if(desktop.GetRight() != null)
Expand All @@ -300,6 +305,8 @@ void RightKeyManagerPressed(object sender, KeyPressedEventArgs e)

void LeftKeyManagerPressed(object sender, KeyPressedEventArgs e)
{
previousDesktopIndex = getCurrentDesktopIndex();

var desktop = initialDesktopState();

if (desktop.GetLeft() != null)
Expand All @@ -326,9 +333,33 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)

private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
openSettings();

}
private void notifyIcon1_Click(object sender, EventArgs e)
{
var currentDesktopIndex = getCurrentDesktopIndex();

MouseEventArgs me = (MouseEventArgs)e;

if (me.Button == MouseButtons.Left)
{
if ( previousDesktopIndex > desktops.Count -1 )
{
previousDesktopIndex = desktops.Count - 1;

if (previousDesktopIndex == currentDesktopIndex)
{
previousDesktopIndex = 0;
}
}
if (previousDesktopIndex != currentDesktopIndex)
{
desktops.ElementAt(previousDesktopIndex)?.Switch();
previousDesktopIndex = currentDesktopIndex;
}
}
}

private void upButton_Click(object sender, EventArgs e)
{
try
Expand Down