feat(sh): add fastfetch with ASCII art logo and stylish Kali/Powerline terminal prompt

This commit is contained in:
RarDog
2026-09-02 21:28:51 +03:00
parent f751c20439
commit 053be85ff7
2 changed files with 76 additions and 9 deletions
+29
View File
@@ -294,6 +294,35 @@ static void execute_console_command(const char *raw_cmd) {
" clear - Clear terminal screen\n"
" reboot - Reboot system\n"
" poweroff - Power off system\n");
} else if (strcmp(raw_cmd, "fastfetch") == 0 || strcmp(raw_cmd, "neofetch") == 0 || strcmp(raw_cmd, "fetch") == 0) {
sysinfo_data_t info = {0, 0, 0, 0, 0};
register uint64_t rax __asm__("rax") = SYS_SYSINFO;
register uint64_t rdi __asm__("rdi") = (uint64_t)&info;
__asm__ volatile("syscall" : "+r"(rax) : "r"(rdi) : "rcx", "r11", "memory");
uint64_t total_mb = info.total_memory_bytes / (1024 * 1024);
uint64_t free_mb = info.free_memory_bytes / (1024 * 1024);
uint64_t used_mb = (total_mb >= free_mb) ? (total_mb - free_mb) : 0;
uint32_t uptime_sec = (uint32_t)(info.uptime_ticks / 100);
snprintf(buf, sizeof(buf),
" ___ root@opencoreC\n"
" / \\ -----------------\n"
" | (o) | ___ OS: opencoreC Microkernel x86_64\n"
" | | / \\ Kernel: v0.1.0-release (Rust #![no_std])\n"
" \\ ___ / | (o) | Uptime: %u mins, %u secs\n"
" \\___/ Shell: osh (opencore shell)\n"
" [=== opencoreC ===] Display: 1280x800 @ 60Hz 32bpp (Limine FB)\n"
" x86_64 SMP DE/WM: LVGL Desktop Compositor (Ring 3)\n"
" Ring 3 Userspace CPU: QEMU Virtual CPU (4 Cores SMP)\n"
" Fast-Path IPC Cap RAM: %u MiB / %u MiB (%u%%)\n"
" Network: RTL8139 Fast Ethernet (10.0.2.15)\n"
" ACPI: MADT 4 Cores, S5 Power, Hardware Reset\n"
" Security: Ring 3 Fault Isolation (SIGSEGV)\n"
" RNG: Hardware RDRAND / RDSEED Active\n",
uptime_sec / 60, uptime_sec % 60,
(unsigned int)used_mb, (unsigned int)total_mb,
total_mb > 0 ? (unsigned int)(used_mb * 100 / total_mb) : 0);
lv_textarea_add_text(g_txt_term_output, buf);
} else if (strcmp(raw_cmd, "clear") == 0) {
lv_textarea_set_text(g_txt_term_output, "opencoreC Linux-compatible Terminal (osh)\nType 'help' for available commands.\n");
} else if (strcmp(raw_cmd, "uname") == 0 || strcmp(raw_cmd, "uname -a") == 0) {