mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 22:42:31 +08:00
🔥 update virtual console status
This commit is contained in:
parent
92dd1f53df
commit
9ff974c100
@ -73,7 +73,7 @@ TODO: should be simple as calamares
|
|||||||
Main Menu
|
Main Menu
|
||||||
|
|
|
|
||||||
├── Prepare Installation
|
├── Prepare Installation
|
||||||
| ├── Set Virtual Console (TODO)
|
| ├── Set Virtual Console
|
||||||
| ├── List Devices
|
| ├── List Devices
|
||||||
| ├── Partition Disk
|
| ├── Partition Disk
|
||||||
| ├── RAID (WIP)
|
| ├── RAID (WIP)
|
||||||
|
@ -103,8 +103,6 @@ bool luks_open() noexcept {
|
|||||||
if (!tui::get_crypt_password(luks_password)) { return false; }
|
if (!tui::get_crypt_password(luks_password)) { return false; }
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
spdlog::info("partition: {}, luks_root_name: {}, luks_password: {}", partition, luks_root_name, luks_password);
|
|
||||||
|
|
||||||
// Try to open the luks partition with the credentials given. If successful show this, otherwise
|
// Try to open the luks partition with the credentials given. If successful show this, otherwise
|
||||||
// show the error
|
// show the error
|
||||||
detail::infobox_widget("\nPlease wait...\n");
|
detail::infobox_widget("\nPlease wait...\n");
|
||||||
@ -207,8 +205,9 @@ void luks_menu_advanced() noexcept {
|
|||||||
screen.ExitLoopClosure()();
|
screen.ExitLoopClosure()();
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto& content = fmt::format("\n{}\n \n{}\n \n{}\n", luks_menu_body, luks_menu_body2, luks_menu_body3);
|
const auto& content = fmt::format("\n{}\n \n{}\n \n{}\n", luks_menu_body, luks_menu_body2, luks_menu_body3);
|
||||||
detail::menu_widget(menu_entries, ok_callback, &selected, &screen, content);
|
const auto& content_size = size(HEIGHT, LESS_THAN, 10) | size(WIDTH, GREATER_THAN, 40);
|
||||||
|
detail::menu_widget(menu_entries, ok_callback, &selected, &screen, content, {.content_size = content_size});
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
if (!success) { return; }
|
if (!success) { return; }
|
||||||
|
|
||||||
|
29
src/tui.cpp
29
src/tui.cpp
@ -269,6 +269,32 @@ void set_xkbmap() noexcept {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void select_keymap() noexcept {
|
||||||
|
auto* config_instance = Config::instance();
|
||||||
|
auto& config_data = config_instance->data();
|
||||||
|
auto& keymap = std::get<std::string>(config_data["KEYMAP"]);
|
||||||
|
|
||||||
|
// does user want to change the default settings?
|
||||||
|
static constexpr auto default_keymap = "Currently configured keymap setting is:";
|
||||||
|
const auto& content = fmt::format("\n {}\n \n[ {} ]\n", default_keymap, keymap);
|
||||||
|
const auto& keep_default = detail::yesno_widget(content, size(HEIGHT, LESS_THAN, 15) | size(WIDTH, LESS_THAN, 75));
|
||||||
|
/* clang-format off */
|
||||||
|
if (!keep_default) { return; }
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
|
const auto& keymaps = utils::make_multiline(utils::exec("ls -R /usr/share/kbd/keymaps | grep \"map.gz\" | sed 's/\\.map\\.gz//g' | sort"));
|
||||||
|
|
||||||
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
std::int32_t selected{226};
|
||||||
|
auto ok_callback = [&] {
|
||||||
|
keymap = keymaps[static_cast<std::size_t>(selected)];
|
||||||
|
screen.ExitLoopClosure()();
|
||||||
|
};
|
||||||
|
static constexpr auto vc_keymap_body = "\nA virtual console is a shell prompt in a non-graphical environment.\nIts keymap is independent of a desktop environment / terminal.\n";
|
||||||
|
const auto& content_size = size(HEIGHT, GREATER_THAN, 10) | size(WIDTH, GREATER_THAN, 40) | vscroll_indicator | yframe | flex;
|
||||||
|
detail::menu_widget(keymaps, ok_callback, &selected, &screen, vc_keymap_body, {content_size, size(HEIGHT, GREATER_THAN, 1)});
|
||||||
|
}
|
||||||
|
|
||||||
// Set Zone and Sub-Zone
|
// Set Zone and Sub-Zone
|
||||||
bool set_timezone() noexcept {
|
bool set_timezone() noexcept {
|
||||||
std::string zone{};
|
std::string zone{};
|
||||||
@ -1993,7 +2019,8 @@ void prep_menu() noexcept {
|
|||||||
auto ok_callback = [&] {
|
auto ok_callback = [&] {
|
||||||
switch (selected) {
|
switch (selected) {
|
||||||
case 0:
|
case 0:
|
||||||
SPDLOG_ERROR("Implement me!");
|
tui::select_keymap();
|
||||||
|
utils::set_keymap();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tui::show_devices();
|
tui::show_devices();
|
||||||
|
@ -632,6 +632,14 @@ void show_iwctl() noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_keymap() noexcept {
|
||||||
|
auto* config_instance = Config::instance();
|
||||||
|
auto& config_data = config_instance->data();
|
||||||
|
const auto& keymap = std::get<std::string>(config_data["KEYMAP"]);
|
||||||
|
|
||||||
|
utils::exec(fmt::format("loadkeys {}", keymap));
|
||||||
|
}
|
||||||
|
|
||||||
void parse_config() noexcept {
|
void parse_config() noexcept {
|
||||||
using namespace simdjson;
|
using namespace simdjson;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ void id_system() noexcept;
|
|||||||
[[nodiscard]] bool handle_connection() noexcept;
|
[[nodiscard]] bool handle_connection() noexcept;
|
||||||
void show_iwctl() noexcept;
|
void show_iwctl() noexcept;
|
||||||
|
|
||||||
|
void set_keymap() noexcept;
|
||||||
void parse_config() noexcept;
|
void parse_config() noexcept;
|
||||||
void setup_luks_keyfile() noexcept;
|
void setup_luks_keyfile() noexcept;
|
||||||
void final_check() noexcept;
|
void final_check() noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user