Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebbadeb53b | ||
|
|
697f3f3e85 | ||
|
|
2d77d5b57d | ||
|
|
8de8654d64 | ||
|
|
59becfd7c9 |
No files matched your search
Generated
+1
-1
@@ -3856,7 +3856,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rmcl"
|
name = "rmcl"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64",
|
"base64",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rmcl"
|
name = "rmcl"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
authors = ["objz"]
|
authors = ["objz"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A fully featured Minecraft TUI launcher"
|
description = "A fully featured Minecraft TUI launcher"
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ Browse Modrinth and CurseForge modpacks or import Modrinth, CurseForge, and Mult
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## navigation
|
||||||
|
|
||||||
|
Use `Ctrl` + arrow keys to move between the Instances, Content, Accounts,
|
||||||
|
Settings, and Overview panels. In Content, use plain `Left` / `Right` or `h` / `l`
|
||||||
|
to switch tabs, and `Tab` to switch between installed content and discovery.
|
||||||
|
|
||||||
## authentication
|
## authentication
|
||||||
|
|
||||||
rmcl uses its own Microsoft client ID for Minecraft account authentication.
|
rmcl uses its own Microsoft client ID for Minecraft account authentication.
|
||||||
|
|||||||
@@ -13,19 +13,29 @@
|
|||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
# release binaries have the curseforge key compiled in; source builds
|
|
||||||
# don't, so forward the caller's key when building impurely.
|
|
||||||
curseforgeApiKey = builtins.getEnv "CURSEFORGE_API_KEY";
|
curseforgeApiKey = builtins.getEnv "CURSEFORGE_API_KEY";
|
||||||
# minecraft's bundled lwjgl natives dlopen the host's x11 stack, which
|
# minecraft's lwjgl/sdl natives dlopen the host's x11, opengl, vulkan,
|
||||||
# isn't on the default loader path on nixos. java is spawned as a child
|
# input and audio stack, which isn't on the default loader path on nixos.
|
||||||
# of rmcl, so a wrapper LD_LIBRARY_PATH propagates all the way down.
|
# java is spawned as a child of rmcl, so a wrapper LD_LIBRARY_PATH
|
||||||
runtimeLibs = pkgs.lib.makeLibraryPath (with pkgs; [
|
# propagates all the way down. /run/opengl-driver/lib holds the mesa
|
||||||
libX11
|
# drivers that libglvnd dispatches to.
|
||||||
libXext
|
runtimeLibs =
|
||||||
libXcursor
|
pkgs.lib.makeLibraryPath (with pkgs; [
|
||||||
libXrandr
|
libX11
|
||||||
libXxf86vm
|
libXext
|
||||||
]);
|
libXcursor
|
||||||
|
libXrandr
|
||||||
|
libXxf86vm
|
||||||
|
libXi
|
||||||
|
libXinerama
|
||||||
|
libGL
|
||||||
|
vulkan-loader
|
||||||
|
libxkbcommon
|
||||||
|
udev
|
||||||
|
alsa-lib
|
||||||
|
libpulseaudio
|
||||||
|
])
|
||||||
|
+ ":/run/opengl-driver/lib";
|
||||||
in {
|
in {
|
||||||
packages.default = pkgs.rustPlatform.buildRustPackage {
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
||||||
pname = "rmcl";
|
pname = "rmcl";
|
||||||
@@ -50,5 +60,15 @@
|
|||||||
mainProgram = "rmcl";
|
mainProgram = "rmcl";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# `nix develop` + `cargo run --release` spawns java directly, bypassing
|
||||||
|
# the wrapper above, so expose the same runtime libs in the dev shell.
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [cargo rustc rustfmt clippy jdk pkg-config];
|
||||||
|
buildInputs = [pkgs.libxcb];
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${runtimeLibs}:$LD_LIBRARY_PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -763,6 +763,19 @@ impl App {
|
|||||||
if text_input_active {
|
if text_input_active {
|
||||||
return repeatable_text_key(key);
|
return repeatable_text_key(key);
|
||||||
}
|
}
|
||||||
|
if key.modifiers.contains(KeyModifiers::CONTROL)
|
||||||
|
&& matches!(key.code, KeyCode::Left | KeyCode::Right)
|
||||||
|
&& matches!(
|
||||||
|
self.focused,
|
||||||
|
FocusedArea::Instances
|
||||||
|
| FocusedArea::Content
|
||||||
|
| FocusedArea::Account
|
||||||
|
| FocusedArea::Settings
|
||||||
|
| FocusedArea::Overview
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if vertical_navigation {
|
if vertical_navigation {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -522,6 +522,48 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if key_event.modifiers.contains(KeyModifiers::CONTROL)
|
||||||
|
&& matches!(
|
||||||
|
key_event.code,
|
||||||
|
KeyCode::Up | KeyCode::Down | KeyCode::Left | KeyCode::Right
|
||||||
|
)
|
||||||
|
&& match self.focused {
|
||||||
|
FocusedArea::Instances => self.instances_state.renaming.is_none(),
|
||||||
|
FocusedArea::Content => !self.active_discovery_state().is_some_and(|state| {
|
||||||
|
state.version_popup.is_some() || state.project_page_open()
|
||||||
|
}),
|
||||||
|
FocusedArea::Account => {
|
||||||
|
matches!(self.account_state.add_mode, widgets::account::AddMode::None)
|
||||||
|
}
|
||||||
|
FocusedArea::Settings => {
|
||||||
|
matches!(
|
||||||
|
self.settings_state.add_mode,
|
||||||
|
widgets::settings::AddMode::None
|
||||||
|
)
|
||||||
|
}
|
||||||
|
FocusedArea::Overview => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
{
|
||||||
|
self.focused =
|
||||||
|
match (self.focused, key_event.code) {
|
||||||
|
(FocusedArea::Instances, KeyCode::Right) => FocusedArea::Content,
|
||||||
|
(FocusedArea::Content, KeyCode::Left)
|
||||||
|
| (FocusedArea::Account, KeyCode::Left) => FocusedArea::Instances,
|
||||||
|
(FocusedArea::Content, KeyCode::Down)
|
||||||
|
| (FocusedArea::Settings, KeyCode::Left) => FocusedArea::Account,
|
||||||
|
(FocusedArea::Account, KeyCode::Right)
|
||||||
|
| (FocusedArea::Overview, KeyCode::Left) => FocusedArea::Settings,
|
||||||
|
(FocusedArea::Settings, KeyCode::Right) => FocusedArea::Overview,
|
||||||
|
(
|
||||||
|
FocusedArea::Account | FocusedArea::Settings | FocusedArea::Overview,
|
||||||
|
KeyCode::Up,
|
||||||
|
) => FocusedArea::Content,
|
||||||
|
(focused, _) => focused,
|
||||||
|
};
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if self.focused == FocusedArea::Content
|
if self.focused == FocusedArea::Content
|
||||||
&& self.content_mode == widgets::content::ContentMode::Installed
|
&& self.content_mode == widgets::content::ContentMode::Installed
|
||||||
&& let Some(state) = self.active_discovery_state_mut()
|
&& let Some(state) = self.active_discovery_state_mut()
|
||||||
|
|||||||
+86
-1
@@ -1,7 +1,9 @@
|
|||||||
// SPDX-FileCopyrightText: 2026 Constantin Bauer
|
// SPDX-FileCopyrightText: 2026 Constantin Bauer
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, MouseButton, MouseEvent, MouseEventKind};
|
use crossterm::event::{
|
||||||
|
KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEvent, MouseEventKind,
|
||||||
|
};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use super::harness::UiHarness;
|
use super::harness::UiHarness;
|
||||||
@@ -34,6 +36,85 @@ fn remote_project_links_use_http_urls_and_encode_shell_metacharacters() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ctrl_arrows_navigate_adjacent_panels_without_changing_content_tabs() {
|
||||||
|
let mut ui = UiHarness::new();
|
||||||
|
let panels = [
|
||||||
|
FocusedArea::Instances,
|
||||||
|
FocusedArea::Content,
|
||||||
|
FocusedArea::Account,
|
||||||
|
FocusedArea::Settings,
|
||||||
|
FocusedArea::Overview,
|
||||||
|
];
|
||||||
|
let directions = [KeyCode::Up, KeyCode::Down, KeyCode::Left, KeyCode::Right];
|
||||||
|
let destinations = [
|
||||||
|
[panels[0], panels[0], panels[0], panels[1]],
|
||||||
|
[panels[1], panels[2], panels[0], panels[1]],
|
||||||
|
[panels[1], panels[2], panels[0], panels[3]],
|
||||||
|
[panels[1], panels[3], panels[2], panels[4]],
|
||||||
|
[panels[1], panels[4], panels[3], panels[4]],
|
||||||
|
];
|
||||||
|
for (panel, expected) in panels.into_iter().zip(destinations) {
|
||||||
|
for (direction, destination) in directions.into_iter().zip(expected) {
|
||||||
|
for kind in [KeyEventKind::Press, KeyEventKind::Repeat] {
|
||||||
|
ui.app.focused = panel;
|
||||||
|
assert!(ui.key_event(KeyEvent::new_with_kind(
|
||||||
|
direction,
|
||||||
|
KeyModifiers::CONTROL,
|
||||||
|
kind,
|
||||||
|
)));
|
||||||
|
assert_eq!(ui.app.focused, destination, "{panel:?} {direction:?}");
|
||||||
|
assert_eq!(ui.app.content_tab, ContentTab::Mods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.app.focused = FocusedArea::Content;
|
||||||
|
for mode in [ContentMode::Installed, ContentMode::Discover] {
|
||||||
|
ui.app.content_mode = mode;
|
||||||
|
ui.key(KeyCode::Right);
|
||||||
|
assert_eq!(ui.app.content_tab, ContentTab::ResourcePacks);
|
||||||
|
ui.key(KeyCode::Left);
|
||||||
|
assert_eq!(ui.app.content_tab, ContentTab::Mods);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ctrl_arrows_do_not_escape_modal_input() {
|
||||||
|
let mut ui = UiHarness::new();
|
||||||
|
for panel in [FocusedArea::ConfirmDelete, FocusedArea::OverviewExpanded] {
|
||||||
|
ui.app.focused = panel;
|
||||||
|
ui.key_with(KeyCode::Down, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.app.focused = FocusedArea::Instances;
|
||||||
|
ui.key(KeyCode::Char('a'));
|
||||||
|
ui.key_with(KeyCode::Down, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Popup);
|
||||||
|
ui.key(KeyCode::Esc);
|
||||||
|
ui.key(KeyCode::Char('m'));
|
||||||
|
ui.key_with(KeyCode::Down, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::ImportPopup);
|
||||||
|
ui.key(KeyCode::Esc);
|
||||||
|
|
||||||
|
ui.app.focused = FocusedArea::Account;
|
||||||
|
ui.key(KeyCode::Char('a'));
|
||||||
|
ui.key_with(KeyCode::Right, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Account);
|
||||||
|
|
||||||
|
ui.app.focused = FocusedArea::Settings;
|
||||||
|
ui.key(KeyCode::Char('a'));
|
||||||
|
ui.key_with(KeyCode::Right, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Settings);
|
||||||
|
|
||||||
|
ui.app.focused = FocusedArea::Instances;
|
||||||
|
ui.app.instances_state.renaming = Some("Renaming".to_owned());
|
||||||
|
ui.key_with(KeyCode::Right, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Instances);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn global_navigation_returns_from_log_overlay() {
|
fn global_navigation_returns_from_log_overlay() {
|
||||||
let mut ui = UiHarness::new();
|
let mut ui = UiHarness::new();
|
||||||
@@ -170,6 +251,10 @@ fn installed_popup_navigation_preserves_local_filters() {
|
|||||||
assert!(ui.app.mods_discovery_state.local_mode);
|
assert!(ui.app.mods_discovery_state.local_mode);
|
||||||
let filters_before = ui.app.mods_discovery_state.filters.clone();
|
let filters_before = ui.app.mods_discovery_state.filters.clone();
|
||||||
|
|
||||||
|
ui.key_with(KeyCode::Left, KeyModifiers::CONTROL);
|
||||||
|
assert_eq!(ui.app.focused, FocusedArea::Content);
|
||||||
|
assert!(ui.app.mods_discovery_state.version_popup.is_some());
|
||||||
|
|
||||||
// Navigating the popup versions must not flip the state into discovery
|
// Navigating the popup versions must not flip the state into discovery
|
||||||
// mode (which used to swap the filters and refresh the background list).
|
// mode (which used to swap the filters and refresh the background list).
|
||||||
ui.key(KeyCode::Char('j'));
|
ui.key(KeyCode::Char('j'));
|
||||||
|
|||||||
Reference in new issue
Block a user