Add scene queue keyboard shortcuts (#1635)

This commit is contained in:
WithoutPants 2021-08-16 14:14:39 +10:00 committed by GitHub
parent b6d15cc077
commit 0fc5a06332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -7,6 +7,7 @@
* Added not equals/greater than/less than modifiers for resolution criteria. ([#1568](https://github.com/stashapp/stash/pull/1568))
### 🎨 Improvements
* Added keyboard shortcuts for scene queue navigation. ([#1635](https://github.com/stashapp/stash/pull/1635))
* Made performer scrape menu scrollable. ([#1634](https://github.com/stashapp/stash/pull/1634))
* Improve Studio UI. ([#1629](https://github.com/stashapp/stash/pull/1629))
* Improve link styling and ensure links open in a new tab. ([#1622](https://github.com/stashapp/stash/pull/1622))

View file

@ -291,7 +291,9 @@ export const Scene: React.FC = () => {
const { query } = sceneQueue;
const pages = Math.ceil(queueTotal / query.itemsPerPage);
const page = Math.floor(Math.random() * pages) + 1;
const index = Math.floor(Math.random() * query.itemsPerPage);
const index = Math.floor(
Math.random() * Math.min(query.itemsPerPage, queueTotal)
);
const filterCopy = sceneQueue.query.clone();
filterCopy.currentPage = page;
const queryResults = await queryFindScenes(filterCopy);
@ -554,17 +556,25 @@ export const Scene: React.FC = () => {
// set up hotkeys
useEffect(() => {
Mousetrap.bind("a", () => setActiveTabKey("scene-details-panel"));
Mousetrap.bind("q", () => setActiveTabKey("scene-queue-panel"));
Mousetrap.bind("e", () => setActiveTabKey("scene-edit-panel"));
Mousetrap.bind("k", () => setActiveTabKey("scene-markers-panel"));
Mousetrap.bind("f", () => setActiveTabKey("scene-file-info-panel"));
Mousetrap.bind("o", () => onIncrementClick());
Mousetrap.bind("p n", () => onQueueNext());
Mousetrap.bind("p p", () => onQueuePrevious());
Mousetrap.bind("p r", () => onQueueRandom());
return () => {
Mousetrap.unbind("a");
Mousetrap.unbind("q");
Mousetrap.unbind("e");
Mousetrap.unbind("k");
Mousetrap.unbind("f");
Mousetrap.unbind("o");
Mousetrap.unbind("p n");
Mousetrap.unbind("p p");
Mousetrap.unbind("p r");
};
});

View file

@ -54,10 +54,14 @@
| Keyboard sequence | Action |
|-------------------|--------|
| `a` | Details tab |
| `q` | Queue tab |
| `k` | Markers tab |
| `f` | File info tab |
| `e` | Edit tab |
| `o` | Increment O-Counter |
| `p n` | Play next scene in queue |
| `p p` | Play previous scene in queue |
| `p r` | Play random scene in queue |
### Scene Markers tab shortcuts