Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebbadeb53b | ||
|
|
697f3f3e85 | ||
|
|
2d77d5b57d | ||
|
|
8de8654d64 | ||
|
|
59becfd7c9 |
No files matched your search
Generated
+1
-1
@@ -3856,7 +3856,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmcl"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rmcl"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
authors = ["objz"]
|
||||
edition = "2024"
|
||||
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
|
||||
|
||||
rmcl uses its own Microsoft client ID for Minecraft account authentication.
|
||||
|
||||
@@ -13,19 +13,29 @@
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
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";
|
||||
# minecraft's bundled lwjgl natives dlopen the host's x11 stack, which
|
||||
# isn't on the default loader path on nixos. java is spawned as a child
|
||||
# of rmcl, so a wrapper LD_LIBRARY_PATH propagates all the way down.
|
||||
runtimeLibs = pkgs.lib.makeLibraryPath (with pkgs; [
|
||||
libX11
|
||||
libXext
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXxf86vm
|
||||
]);
|
||||
# minecraft's lwjgl/sdl natives dlopen the host's x11, opengl, vulkan,
|
||||
# input and audio stack, which isn't on the default loader path on nixos.
|
||||
# java is spawned as a child of rmcl, so a wrapper LD_LIBRARY_PATH
|
||||
# propagates all the way down. /run/opengl-driver/lib holds the mesa
|
||||
# drivers that libglvnd dispatches to.
|
||||
runtimeLibs =
|
||||
pkgs.lib.makeLibraryPath (with pkgs; [
|
||||
libX11
|
||||
libXext
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXxf86vm
|
||||
libXi
|
||||
libXinerama
|
||||
libGL
|
||||
vulkan-loader
|
||||
libxkbcommon
|
||||
udev
|
||||
alsa-lib
|
||||
libpulseaudio
|
||||
])
|
||||
+ ":/run/opengl-driver/lib";
|
||||
in {
|
||||
packages.default = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "rmcl";
|
||||
@@ -50,5 +60,15 @@
|
||||
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 {
|
||||
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 {
|
||||
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
|
||||
&& self.content_mode == widgets::content::ContentMode::Installed
|
||||
&& let Some(state) = self.active_discovery_state_mut()
|
||||
|
||||
+86
-1
@@ -1,7 +1,9 @@
|
||||
// SPDX-FileCopyrightText: 2026 Constantin Bauer
|
||||
// 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 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]
|
||||
fn global_navigation_returns_from_log_overlay() {
|
||||
let mut ui = UiHarness::new();
|
||||
@@ -170,6 +251,10 @@ fn installed_popup_navigation_preserves_local_filters() {
|
||||
assert!(ui.app.mods_discovery_state.local_mode);
|
||||
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
|
||||
// mode (which used to swap the filters and refresh the background list).
|
||||
ui.key(KeyCode::Char('j'));
|
||||
|
||||
Reference in new issue
Block a user