Skip to content
Merged
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
5 changes: 3 additions & 2 deletions site/src/content/docs/using/home-menu.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Home menu
description: Press Select to open Home, a scanning menu of everything Switchify PC can do, including windows, editing, browser and media actions.
description: Press Select to open Home, a scanning menu of everything Switchify PC can do, including windows, editing, browser, media and zoom actions.
---

Press and release **Select** to open Home. It scans through these items; press Select on the one you want. Home opens whether or not another app is in front, and it never takes focus away from your work. It opens on the display the pointer is on, and moves with the pointer if something moves it to another display while Home is open.
Expand All @@ -12,8 +12,9 @@ Press and release **Select** to open Home. It scans through these items; press S
| **Keyboard** | Open the scanning [keyboard](/using/keyboard/). |
| **Apps and windows** | Switch app forward or backward, open the app overview, show the desktop, minimise, maximise or restore (toggle full screen on a Mac), close the window, and shut down or restart the computer. |
| **Editing** | Copy, cut, paste, select all, undo, redo, save, find. |
| **Browser** | Back, forward, reload, new tab, close tab, reopen a closed tab, next and previous tab, address bar, zoom in, zoom out and reset zoom. |
| **Browser** | Back, forward, reload, new tab, close tab, reopen a closed tab, next and previous tab, address bar. |
| **Media** | Play or pause, next and previous track, volume up and down, mute. |
| **Zoom** | Zoom in, zoom out and reset zoom in the app in front, using the Ctrl or Cmd shortcuts with =, - and 0. Browsers, PDF readers, mail apps and many other apps zoom with these keys. Some apps use them for something else; Word, for example, does not zoom. |
| **Switchify** | Change the scan speed and line speed, switch between line-only and grid-then-line point scanning, change the keyboard layout, pause, reverse direction, and move to the next or previous display. |
| **Close menu** | Close Home without doing anything. |

Expand Down
2 changes: 1 addition & 1 deletion site/src/content/docs/using/mouse-panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Choose **Mouse** from [Home](/using/home-menu/), or give a switch the **Open mou
- **Scroll up** and **Scroll down**.
- **Slower** and **Faster** pointer speed. Each shows the current level, from 1 to 10, and a press moves it half a level.
- **Monitor left, right, up, down** to jump the pointer to another display.
- **Actions** for the same editing, window, browser and media items as Home.
- **Actions** for the same editing, window, browser and media items as Home, and Home itself. Zoom is in Home: choose **Home**, then **Zoom**, and choose **Mouse** afterwards to bring the panel back.
- **Keyboard** to open the scanning [keyboard](/using/keyboard/).
- **Switch to Point** to change to [point scanning](/using/point-scanning/).

Expand Down
2 changes: 1 addition & 1 deletion site/src/content/docs/using/point-scanning.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ With **Auto select** on, a countdown starts at the chosen point and a left click
| **Left click**, **Right click**, **Double click** | Click at the point. |
| **Scroll** | Up, down, left or right at the point, three wheel steps per press. |
| **Drag** | Start a drag here. Nothing is held yet. Point scanning runs again to choose the destination, then **Drag here** performs it, or **New destination** lets you choose again. |
| **More** | Middle click, triple click, Shift-click, Ctrl-click, Alt-click and Windows-click (Option-click and Command-click on a Mac). |
| **More** | Other clicks at the point (middle, triple, Shift, Ctrl, Alt and Windows or Command click), and the same editing, apps and windows, browser, zoom, media, display and scanning items as Home. |
| **Keyboard** | Open the scanning [keyboard](/using/keyboard/) with focus left where it is. |
| **New point** | Start a fresh scan on the same display. |
| **Home**, **Close menu** | Leave the menu. |
Expand Down
14 changes: 7 additions & 7 deletions src-tauri/src/point_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,12 +1727,13 @@ mod tests {
assert!(s.technique.parent_menu.is_empty());
assert!(s.active());

assert_eq!(choose_in(&mut s, 2, 2), None);
// Close menu and Switchify share Home's last row.
assert_eq!(choose_in(&mut s, 3, 1), None);
assert!(!s.active());

let mut s = next_session(&s);
s.action(Action::Select);
assert_eq!(choose_in(&mut s, 2, 1), Some(Request::OpenSwitchify));
assert_eq!(choose_in(&mut s, 3, 0), Some(Request::OpenSwitchify));
assert!(!s.active());

let mut s = next_session(&s);
Expand Down Expand Up @@ -1777,11 +1778,10 @@ mod tests {

#[test]
fn leaving_home_that_fails_returns_to_home_not_to_an_unchosen_point() {
for (column, request) in [(0, Request::OpenPoint), (1, Request::OpenSwitchify)] {
for (row, request) in [(0, Request::OpenPoint), (3, Request::OpenSwitchify)] {
let mut s = home_session();
s.action(Action::Select);
let row = if request == Request::OpenPoint { 0 } else { 2 };
assert_eq!(choose_in(&mut s, row, column), Some(request));
assert_eq!(choose_in(&mut s, row, 0), Some(request));
s.execution_failed("Input could not be released.".into());
assert_eq!(s.technique.menu.kind, Kind::Home, "{request:?}");
assert!(s.technique.home_open());
Expand Down Expand Up @@ -3961,8 +3961,8 @@ mod tests {
.iter()
.filter(|tile| tile.rect.x == first.rect.x)
.count();
// Home and the power confirmation pages keep Close menu in the third column.
let close = if matches!(kind, Kind::Home | Kind::ShutDown | Kind::Restart) {
// The power confirmation pages keep Close menu in the third column.
let close = if matches!(kind, Kind::ShutDown | Kind::Restart) {
2
} else {
1
Expand Down
49 changes: 45 additions & 4 deletions src-tauri/src/scan_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ impl Kind {
Group(Self::Editing),
Group(Self::Browser),
],
vec![Group(Self::Media), Switchify, Cancel],
vec![Group(Self::Media), Group(Self::Zoom)],
vec![Switchify, Cancel],
]
}
Self::Actions => {
Expand All @@ -444,13 +445,14 @@ impl Kind {
Self::ConfirmDrag => {
return vec![vec![DragHere, DestinationAgain], vec![CancelDrag, Cancel]]
}
// Keyboard and the mouse panel sit one level up on the Actions page, which
// keeps this page within four rows with Zoom beside the other app menus.
Self::More => vec![
Keyboard,
MousePanel,
Group(Self::Mouse),
Group(Self::Editing),
Group(Self::Windows),
Group(Self::Browser),
Group(Self::Zoom),
Group(Self::Media),
Group(Self::Displays),
Group(Self::Scanning),
Expand Down Expand Up @@ -512,7 +514,6 @@ impl Kind {
Command(C::BrowserForward),
Command(C::Reload),
Group(Self::Tabs),
Group(Self::Zoom),
Command(C::Address),
Back,
],
Expand All @@ -524,6 +525,7 @@ impl Kind {
Command(C::PreviousTab),
Back,
],
// Ctrl or Cmd with =, - and 0, which most apps honour, not only browsers.
Self::Zoom => vec![
Command(C::ZoomIn),
Command(C::ZoomOut),
Expand Down Expand Up @@ -820,6 +822,44 @@ mod tests {
}
}
}
#[test]
fn zoom_sits_beside_the_other_app_menus_not_inside_browser() {
let items = |kind: Kind| kind.rows().into_iter().flatten().collect::<Vec<_>>();
// Zoom works in most apps, so it is offered wherever Editing and Media are
// offered from a point-free page, and only there.
for kind in [Kind::Home, Kind::More] {
let page = items(kind);
assert!(page.contains(&Item::Group(Kind::Zoom)), "{kind:?}");
assert!(page.contains(&Item::Group(Kind::Editing)), "{kind:?}");
assert!(page.contains(&Item::Group(Kind::Media)), "{kind:?}");
}
for kind in ALL_MENU_KINDS {
assert_eq!(
items(kind).contains(&Item::Group(Kind::Zoom)),
matches!(kind, Kind::Home | Kind::More),
"{kind:?}"
);
}
// The Actions page already offers Keyboard and the mouse panel, so More does not.
let actions = items(Kind::Actions);
assert!(actions.contains(&Item::Keyboard));
assert!(actions.contains(&Item::MousePanel));
let more = items(Kind::More);
assert!(!more.contains(&Item::Keyboard));
assert!(!more.contains(&Item::MousePanel));
assert_eq!(
Kind::Zoom.rows(),
[
vec![
Item::Command(Command::ZoomIn),
Item::Command(Command::ZoomOut),
Item::Command(Command::ZoomReset),
],
vec![Item::Back, Item::Cancel],
]
);
}

#[test]
fn home_offers_modes_and_point_free_actions() {
let home = Kind::Home.rows().into_iter().flatten().collect::<Vec<_>>();
Expand All @@ -833,6 +873,7 @@ mod tests {
Item::Group(Kind::Editing),
Item::Group(Kind::Browser),
Item::Group(Kind::Media),
Item::Group(Kind::Zoom),
Item::Switchify,
Item::Cancel,
]
Expand Down
Loading