mouse: settings page for clicks, middle click and side buttons
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
5e42b203f8
commit
b7d46fe2b8
3 changed files with 91 additions and 2 deletions
79
crates/tunal/ui/dialogs/mouse-page.slint
Normal file
79
crates/tunal/ui/dialogs/mouse-page.slint
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Theme } from "../theme.slint";
|
||||
import { ChoiceSetting } from "setting-rows.slint";
|
||||
|
||||
// The Mouse settings page: what clicks and the side buttons do, and how executable files
|
||||
// open. Each value is an index into its row's choices (config.rs has the meanings);
|
||||
// `picked(row, value)` reports a change, rows in the order shown.
|
||||
export component MousePage inherits VerticalLayout {
|
||||
in property <int> click;
|
||||
in property <int> middle-item;
|
||||
in property <int> middle-empty;
|
||||
in property <int> side-buttons;
|
||||
in property <int> empty-double;
|
||||
in property <int> executables;
|
||||
callback picked(row: int, value: int);
|
||||
|
||||
alignment: start;
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Open items with";
|
||||
names: ["Double click", "Single click"];
|
||||
current: root.click;
|
||||
picked(i) => {
|
||||
root.picked(0, i);
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Middle click on an item";
|
||||
names: ["New tab, or Open with…", "Open", "Nothing"];
|
||||
current: root.middle-item;
|
||||
picked(i) => {
|
||||
root.picked(1, i);
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Middle click on empty space";
|
||||
names: ["Nothing", "Paste", "New tab here"];
|
||||
current: root.middle-empty;
|
||||
picked(i) => {
|
||||
root.picked(2, i);
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Back and forward buttons";
|
||||
names: ["Back, forward", "Up a folder", "Switch tabs", "Nothing"];
|
||||
current: root.side-buttons;
|
||||
picked(i) => {
|
||||
root.picked(3, i);
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Double click on empty space";
|
||||
names: ["Nothing", "Select all", "Up a folder", "New folder"];
|
||||
current: root.empty-double;
|
||||
picked(i) => {
|
||||
root.picked(4, i);
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceSetting {
|
||||
title: "Opening a program or script";
|
||||
names: ["Ask first", "Run it", "Open it as a file"];
|
||||
current: root.executables;
|
||||
picked(i) => {
|
||||
root.picked(5, i);
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "A folder opened with the middle button goes to a new tab; a file shows the Open with dialog.";
|
||||
color: Theme.on-surface-variant;
|
||||
font-size: Theme.body-small.size;
|
||||
font-weight: Theme.body-small.weight;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { Theme } from "../theme.slint";
|
||||
import { Motion } from "../motion.slint";
|
||||
import { Icon } from "../components/icon.slint";
|
||||
import { DetailRow, FolderState, NavKey, SortColumn } from "../views/details-view.slint";
|
||||
import { DetailRow, FolderActions, FolderState, NavKey, SortColumn } from "../views/details-view.slint";
|
||||
import { GridRow } from "../views/grid-view.slint";
|
||||
import { FolderView } from "../views/view-switch.slint";
|
||||
import { DropTarget, DropZone } from "../components/drop-menu.slint";
|
||||
|
|
@ -72,11 +72,18 @@ export component Pane inherits Rectangle {
|
|||
root.activated();
|
||||
root.focus-view();
|
||||
}
|
||||
double-clicked => {
|
||||
FolderActions.empty-double-clicked(root.index);
|
||||
}
|
||||
pointer-event(event) => {
|
||||
if event.button == PointerEventButton.right && event.kind == PointerEventKind.down {
|
||||
root.activated();
|
||||
root.context-menu(-1, self.absolute-position.x + self.mouse-x, self.absolute-position.y + self.mouse-y);
|
||||
}
|
||||
if event.button == PointerEventButton.middle && event.kind == PointerEventKind.up {
|
||||
root.activated();
|
||||
FolderActions.middle-clicked(root.index, -1);
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { Preview } from "../components/thumb.slint";
|
|||
import { RenameField } from "../components/rename-field.slint";
|
||||
import { IconButton } from "../components/icon-button.slint";
|
||||
import {
|
||||
Columns, DetailRow, FilterChip, FolderKeys, FolderMessages, FolderState, HeaderCell, NavKey,
|
||||
Columns, DetailRow, FilterChip, FolderActions, FolderKeys, FolderMessages, FolderState, HeaderCell, NavKey,
|
||||
SortColumn,
|
||||
} from "details-view.slint";
|
||||
import { Dnd, DropTarget, DropZone } from "../components/drop-menu.slint";
|
||||
|
|
@ -437,6 +437,9 @@ export component GridView inherits Rectangle {
|
|||
if event.button == PointerEventButton.right && event.kind == PointerEventKind.down {
|
||||
root.context-menu(cell.index, self.absolute-position.x + self.mouse-x, self.absolute-position.y + self.mouse-y);
|
||||
}
|
||||
if event.button == PointerEventButton.middle && event.kind == PointerEventKind.up {
|
||||
FolderActions.middle-clicked(root.pane, cell.index);
|
||||
}
|
||||
}
|
||||
clicked => {
|
||||
keys.focus();
|
||||
|
|
|
|||
Loading…
Reference in a new issue