mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 15:29:18 +00:00
Implement Virtual Terminal and fix /dev/kcon
This commit is contained in:
@ -21,6 +21,5 @@
|
||||
|
||||
void cmd_clear(const char *)
|
||||
{
|
||||
Display->SetBufferCursor(0, 0);
|
||||
Display->ClearBuffer();
|
||||
printf("\x1b[2J");
|
||||
}
|
||||
|
@ -26,19 +26,19 @@ using namespace vfs;
|
||||
const char *ColorNodeType(FileNode *node)
|
||||
{
|
||||
if (node->IsRegularFile())
|
||||
return "\eCCCCCC";
|
||||
return "\x1b[32m";
|
||||
else if (node->IsDirectory())
|
||||
return "\e3871F5";
|
||||
return "\x1b[34m";
|
||||
else if (node->IsBlockDevice())
|
||||
return "\eE8CD1E";
|
||||
return "\x1b[33m";
|
||||
else if (node->IsCharacterDevice())
|
||||
return "\e86E01F";
|
||||
return "\x1b[33m";
|
||||
else if (node->IsFIFO())
|
||||
return "\eE0991F";
|
||||
return "\x1b[33m";
|
||||
else if (node->IsSymbolicLink())
|
||||
return "\e1FB9E0";
|
||||
return "\x1b[35m";
|
||||
else
|
||||
return "\eF72020";
|
||||
return "\x1b[0m";
|
||||
}
|
||||
|
||||
__no_sanitize("alignment") size_t MaxNameLength(FileNode *nodes)
|
||||
@ -100,7 +100,7 @@ __no_sanitize("alignment") void PrintLS(FileNode *node)
|
||||
offset += read / sizeof(kdirent);
|
||||
}
|
||||
|
||||
printf("\eCCCCCC\n");
|
||||
printf("\x1b[0m\n");
|
||||
delete[] dirBuffer;
|
||||
}
|
||||
|
||||
|
25
kshell/commands/theme.cpp
Normal file
25
kshell/commands/theme.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../cmds.hpp"
|
||||
|
||||
#include "../../kernel.h"
|
||||
|
||||
void cmd_theme(const char *args)
|
||||
{
|
||||
KernelConsole::SetTheme(args);
|
||||
}
|
@ -41,16 +41,16 @@ const char *TaskStateStrings[] = {
|
||||
|
||||
void cmd_top(const char *)
|
||||
{
|
||||
printf("\e9400A1PID \e9CA100Name \e00A15BState \eCCCCCCPriority Memory Usage CPU Usage\n");
|
||||
printf("PID Name State Priority Memory Usage CPU Usage\n");
|
||||
foreach (auto Proc in TaskManager->GetProcessList())
|
||||
{
|
||||
#if defined(a64)
|
||||
printf("\e9400A1%-4d \e9CA100%-20s \e00A15B%s \eCCCCCC%d %ld KiB %ld\n",
|
||||
printf("%-4d %-20s %s %d %ld KiB %ld\n",
|
||||
Proc->ID, Proc->Name, TaskStateStrings[Proc->State.load()],
|
||||
Proc->Info.Priority, TO_KiB(Proc->GetSize()),
|
||||
Proc->Info.UserTime + Proc->Info.KernelTime);
|
||||
#elif defined(a32)
|
||||
printf("\e9400A1%-4d \e9CA100%-20s \e00A15B%s \eCCCCCC%d %lld KiB %lld\n",
|
||||
printf("%-4d %-20s %s %d %lld KiB %lld\n",
|
||||
Proc->ID, Proc->Name, TaskStateStrings[Proc->State.load()],
|
||||
Proc->Info.Priority, TO_KiB(Proc->GetSize()),
|
||||
Proc->Info.UserTime + Proc->Info.KernelTime);
|
||||
@ -59,12 +59,12 @@ void cmd_top(const char *)
|
||||
foreach (auto Thrd in Proc->Threads)
|
||||
{
|
||||
#if defined(a64)
|
||||
printf(" \eA80011%-4d \e9CA100%-20s \e00A15B%s \eCCCCCC%d %ld KiB %ld\n",
|
||||
printf(" %-4d %-20s %s %d %ld KiB %ld\n",
|
||||
Thrd->ID, Thrd->Name, TaskStateStrings[Thrd->State.load()],
|
||||
Thrd->Info.Priority, TO_KiB(Thrd->GetSize()),
|
||||
Thrd->Info.UserTime + Thrd->Info.KernelTime);
|
||||
#elif defined(a32)
|
||||
printf(" \eA80011%-4d \e9CA100%-20s \e00A15B%s \eCCCCCC%d %lld KiB %lld\n",
|
||||
printf(" %-4d %-20s %s %d %lld KiB %lld\n",
|
||||
Thrd->ID, Thrd->Name, TaskStateStrings[Thrd->State.load()],
|
||||
Thrd->Info.Priority, TO_KiB(Thrd->GetSize()),
|
||||
Thrd->Info.UserTime + Thrd->Info.KernelTime);
|
||||
|
Reference in New Issue
Block a user