🔥 update virtual console status

This commit is contained in:
Vladislav Nepogodin 2022-01-09 18:02:00 +04:00
parent 92dd1f53df
commit 9ff974c100
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
5 changed files with 41 additions and 6 deletions

View File

@ -73,7 +73,7 @@ TODO: should be simple as calamares
Main Menu
|
├── Prepare Installation
| ├── Set Virtual Console (TODO)
| ├── Set Virtual Console
| ├── List Devices
| ├── Partition Disk
| ├── RAID (WIP)

View File

@ -103,8 +103,6 @@ bool luks_open() noexcept {
if (!tui::get_crypt_password(luks_password)) { return false; }
/* 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
// show the error
detail::infobox_widget("\nPlease wait...\n");
@ -208,7 +206,8 @@ void luks_menu_advanced() noexcept {
};
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 */
if (!success) { return; }

View File

@ -269,6 +269,32 @@ void set_xkbmap() noexcept {
#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
bool set_timezone() noexcept {
std::string zone{};
@ -1993,7 +2019,8 @@ void prep_menu() noexcept {
auto ok_callback = [&] {
switch (selected) {
case 0:
SPDLOG_ERROR("Implement me!");
tui::select_keymap();
utils::set_keymap();
break;
case 1:
tui::show_devices();

View File

@ -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 {
using namespace simdjson;

View File

@ -38,6 +38,7 @@ void id_system() noexcept;
[[nodiscard]] bool handle_connection() noexcept;
void show_iwctl() noexcept;
void set_keymap() noexcept;
void parse_config() noexcept;
void setup_luks_keyfile() noexcept;
void final_check() noexcept;