Skip to content

Commit

Permalink
Improved UX (close window CTRL-W or CTRL-W instead of DEL). Fixed arr…
Browse files Browse the repository at this point in the history
…ow up and down button bug that moved the cursor in the search box.
  • Loading branch information
Guillermo Janner Acero committed Sep 24, 2018
1 parent c487ee3 commit 230449f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ Here is a simple demo of how Sprung works:
## Shortcuts
There are two shortcuts:
- `Alt+Space`: Open Sprung Window Switcher
- `Alt+Shift+Space`: Open Sprung Window Switcher and list tabs for each browser as own windows
- `Alt+Shift+Space`: Open Sprung Window Switcher and list tabs for each browser as own windows
- `Ctrl+D` or `Ctrl+W` close selected window

## Controls
Once Sprung was opened with the Shortcut you can navigate with the following keys:
- `Arrow Down`: Select next window
- `Arrow Up`: Select previous window
- `Return`: Focus currently selected window and close Sprung
- `Delete`: Close currently selected window and focus Sprung
- `Escape`: Close Sprung
- `Escape`: Hide sprung
- `Click on a window item`: Select the window clicked on
- `Ctrl+D` or `Ctrl+W` close selected window

## Tabs support
## Tabs support (Beta)
With sprung you can also switch to any tab openend in a browser by using the shortcut `Alt+Shift+Space` or if you have tabs enabled by default in the settings (See settings section).
To enable tab support you have to install the sprung extension for your specific browser.

Expand Down
34 changes: 23 additions & 11 deletions Sprung/SprungForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,25 @@ private void SearchBoxKeyDown(object sender, KeyEventArgs e)
HideBox();
SendSelectedWindowToFront();
}
else if (e.KeyCode == Keys.Down && this.windowListBox.SelectedIndex < (this.windowListBox.Items.Count - 1))
else if (e.KeyCode == Keys.Down)
{
this.windowListBox.SelectedIndex++;
}
else if (e.KeyCode == Keys.Up && this.windowListBox.Items.Count > 0 && this.windowListBox.SelectedIndex > 0)
{
this.windowListBox.SelectedIndex--;
if (this.windowListBox.SelectedIndex < (this.windowListBox.Items.Count - 1))
{
this.windowListBox.SelectedIndex++;
}

e.Handled = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Delete)
else if (e.KeyCode == Keys.Up)
{
CloseSelectedWindow();

// Mark the event as handled, otherwise the search input
// will be modified and the list will be reloaded
if (this.windowListBox.Items.Count > 0 && this.windowListBox.SelectedIndex > 0)
{
this.windowListBox.SelectedIndex--;
}

e.Handled = true;
e.SuppressKeyPress = true;
}
}

Expand All @@ -365,6 +369,14 @@ private void SearchBoxKeyPress(object sender, KeyPressEventArgs e)

e.Handled = true;
}
else if (e.KeyChar == 4 || e.KeyChar == 23)
{
// CTRL-D or CTRL-W closes window
CloseSelectedWindow();
e.Handled = true;
}

Console.WriteLine((int)e.KeyChar);
}

private void HideBox()
Expand Down
5 changes: 3 additions & 2 deletions Sprung/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"excluded": [
"excluded": [
"^$",
"^Sprung$",
"^Window$",
"^Program Manager - explorer$",
"^Start - explorer$",
"^AMD:CCC-AEMCapturingWindow$",
"^Windows Shell Experience Host - ShellExperienceHost$"
],
],
"list_tabs_as_windows": false,
"open_window_list": "Alt+Space",
"open_window_list_with_tabs" : "Alt+Shift+Space"
Expand Down

0 comments on commit 230449f

Please sign in to comment.