feat: split About view into separate app; bump ramdisk in-memory file limit
This commit is contained in:
1 parent
b8085e0e2a
commit
6665750528
13 files changed
+205
-70
No files matched your search
@@ -45,7 +45,7 @@ BINDIR := bin$(ARCH_SUFFIX)
|
||||
PROGRAMS := $(notdir $(wildcard src/*))
|
||||
|
||||
# Programs with custom Makefiles (built separately).
|
||||
CUSTOM_BUILDS := 2048 files settings fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard sshserver terminal syslog procmgr powermgr calculator charmap desktop login shell paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs libloader crashpad sshd rtlsdr sdr firstboot
|
||||
CUSTOM_BUILDS := 2048 files settings fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard about sshserver terminal syslog procmgr powermgr calculator charmap desktop login shell paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs libloader crashpad sshd rtlsdr sdr firstboot
|
||||
SYSTEM_PROGRAMS := $(filter-out $(CUSTOM_BUILDS),$(PROGRAMS))
|
||||
|
||||
# Build targets: system programs go to bin/os/, apps go to bin/apps/<name>/.
|
||||
@@ -92,7 +92,7 @@ WPDIR := data/wallpapers
|
||||
WPSRC := $(wildcard $(WPDIR)/*.jpg)
|
||||
WPDST := $(patsubst $(WPDIR)/%,$(BINDIR)/os/wallpapers/%,$(WPSRC))
|
||||
|
||||
.PHONY: all clean 2048 files settings fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard sshserver sshd terminal syslog procmgr powermgr calculator charmap login desktop shell paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs icons fonts configs osdata bearssl libc tls libjpeg libjpegwrite install-apps libloader crashpad rtlsdr sdr check-syscalls gen-syscalls rust firstboot
|
||||
.PHONY: all clean 2048 files settings fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard about sshserver sshd terminal syslog procmgr powermgr calculator charmap login desktop shell paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs icons fonts configs osdata bearssl libc tls libjpeg libjpegwrite install-apps libloader crashpad rtlsdr sdr check-syscalls gen-syscalls rust firstboot
|
||||
|
||||
# The on-OS SDK, tcc (an x86 code generator) and the Rust programs exist
|
||||
# for x86_64 only.
|
||||
@@ -252,6 +252,10 @@ capabilities: libc
|
||||
keyboard: libc
|
||||
$(MAKE) -C src/keyboard
|
||||
|
||||
# Build About applet (depends on libc).
|
||||
about: libc
|
||||
$(MAKE) -C src/about
|
||||
|
||||
# Build the Settings app (depends on libc, bearssl for user.h).
|
||||
settings: libc bearssl
|
||||
$(MAKE) -C src/settings
|
||||
@@ -421,7 +425,7 @@ crashpad: libc
|
||||
$(MAKE) -C src/crashpad
|
||||
|
||||
# Install app bundles (manifests, icons, data files) into bin/apps/<name>/.
|
||||
install-apps: 2048 files settings paint spreadsheet wordprocessor weather wikipedia imageviewer fontpreview pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard sshserver terminal syslog procmgr powermgr calculator charmap screenshot texteditor mandelbrot printers timezone crashpad
|
||||
install-apps: 2048 files settings paint spreadsheet wordprocessor weather wikipedia imageviewer fontpreview pdfviewer disks devexplorer installer audio music video bluetooth network display capabilities keyboard about sshserver terminal syslog procmgr powermgr calculator charmap screenshot texteditor mandelbrot printers timezone crashpad
|
||||
PROGRAMS_BIN=$(BINDIR) ../scripts/install_apps.sh
|
||||
|
||||
# Copy man pages into bin/os/man/ so mkramdisk.sh picks them up.
|
||||
@@ -576,6 +580,7 @@ clean:
|
||||
$(MAKE) -C src/bluetooth clean
|
||||
$(MAKE) -C src/network clean
|
||||
$(MAKE) -C src/keyboard clean
|
||||
$(MAKE) -C src/about clean
|
||||
$(MAKE) -C src/settings clean
|
||||
$(MAKE) -C src/terminal clean
|
||||
$(MAKE) -C src/syslog clean
|
||||
|
||||
@@ -275,7 +275,8 @@ namespace user {
|
||||
hash_password(password, u->salt, u->password_hash);
|
||||
|
||||
count++;
|
||||
save_users(users, count);
|
||||
// A full or read-only volume must not look like a created account.
|
||||
if (save_users(users, count) < 0) return false;
|
||||
|
||||
// Create home directory structure
|
||||
char dir[128];
|
||||
@@ -321,8 +322,7 @@ namespace user {
|
||||
|
||||
hash_password(new_password, users[i].salt, users[i].password_hash);
|
||||
|
||||
save_users(users, count);
|
||||
return true;
|
||||
return save_users(users, count) >= 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Makefile for the About applet on MontaukOS
|
||||
|
||||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
|
||||
include ../../mk/arch.mk
|
||||
ifeq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
|
||||
CXX = $(error $(TOOLCHAIN_MISSING))
|
||||
else
|
||||
CXX := $(TOOLCHAIN_PREFIX)g++
|
||||
endif
|
||||
|
||||
PROG_INC := ../../include
|
||||
LINK_LD := ../../link.ld
|
||||
BINDIR := ../../bin$(ARCH_SUFFIX)
|
||||
OBJDIR := obj$(ARCH_SUFFIX)
|
||||
LIBDIR := ../../lib
|
||||
|
||||
CXXFLAGS := -std=gnu++20 -g -O2 -pipe -Wall -Wextra -Wno-unused-parameter \
|
||||
-Wno-unused-function -ffreestanding -fno-stack-protector -fno-stack-check \
|
||||
-fno-rtti -fno-exceptions -ffunction-sections -fdata-sections $(ARCH_FP_FLAGS) \
|
||||
-MMD -MP -I $(PROG_INC) -isystem $(PROG_INC)/libc
|
||||
LDFLAGS := -nostdlib -Wl,--gc-sections -T $(LINK_LD)
|
||||
|
||||
SRCS := main.cpp stb_truetype_impl.cpp
|
||||
OBJS := $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o))
|
||||
TARGET := $(BINDIR)/apps/about/about.elf
|
||||
LIBS := $(LIBDIR)/libc/$(ARCH_OUT)liblibc.a
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) $(LINK_LD) Makefile $(LIBS)
|
||||
mkdir -p $(BINDIR)/apps/about
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp Makefile
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
-include $(OBJS:.o=.d)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR) $(TARGET)
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* main.cpp
|
||||
* MontaukOS About applet: OS name, version, build number, architecture and uptime.
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#include <montauk/syscall.h>
|
||||
#include <montauk/string.h>
|
||||
#include <gui/mtk.hpp>
|
||||
#include <gui/standalone.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
}
|
||||
|
||||
using namespace gui;
|
||||
|
||||
static constexpr int WIN_W = 460;
|
||||
static constexpr int WIN_H = 260;
|
||||
|
||||
static WsWindow g_win;
|
||||
static montauk::abi::SysInfo g_info = {};
|
||||
static Color g_accent = colors::ACCENT;
|
||||
|
||||
// Userspace is built per architecture and only runs on a matching kernel,
|
||||
// so the compile target is the running system's architecture.
|
||||
#if defined(__x86_64__)
|
||||
static constexpr const char* OS_VARIANT = "MontaukOS for x86_64";
|
||||
#elif defined(__aarch64__)
|
||||
static constexpr const char* OS_VARIANT = "MontaukOS for AArch64 (ARM 64-bit)";
|
||||
#else
|
||||
static constexpr const char* OS_VARIANT = "MontaukOS (unknown platform)";
|
||||
#endif
|
||||
static uint64_t g_drawn_sec = 0; // uptime second the window last showed
|
||||
|
||||
static void render() {
|
||||
mtk::StandaloneHost host(&g_win);
|
||||
Canvas c = host.canvas();
|
||||
mtk::Theme theme = mtk::make_theme(g_accent);
|
||||
c.fill(theme.window_bg);
|
||||
|
||||
int x = 16;
|
||||
int y = 20;
|
||||
char line[128];
|
||||
int line_h = system_font_height() + 6;
|
||||
|
||||
c.text_2x(x, y, g_info.osName, theme.accent);
|
||||
int large_h = (fonts::system_font && fonts::system_font->valid)
|
||||
? fonts::system_font->get_line_height(fonts::LARGE_SIZE) : (FONT_HEIGHT * 2);
|
||||
y += large_h + 8;
|
||||
|
||||
snprintf(line, sizeof(line), "%s", OS_VARIANT);
|
||||
c.kv_line(x, &y, line, theme.text, line_h);
|
||||
|
||||
snprintf(line, sizeof(line), "Version %s (Build %u)",
|
||||
g_info.osVersion, (unsigned)g_info.buildNumber);
|
||||
c.text(x, y, line, theme.text);
|
||||
y += line_h + 8;
|
||||
|
||||
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
|
||||
y += 12;
|
||||
|
||||
snprintf(line, sizeof(line), "Build number: %u", (unsigned)g_info.buildNumber);
|
||||
c.kv_line(x, &y, line, theme.text, line_h);
|
||||
|
||||
g_drawn_sec = montauk::get_milliseconds() / 1000;
|
||||
int up_sec = (int)g_drawn_sec;
|
||||
int up_min = up_sec / 60;
|
||||
int up_hr = up_min / 60;
|
||||
snprintf(line, sizeof(line), "Uptime: %d:%02d:%02d", up_hr, up_min % 60, up_sec % 60);
|
||||
c.kv_line(x, &y, line, theme.text, line_h);
|
||||
y += 8;
|
||||
|
||||
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
|
||||
y += 12;
|
||||
|
||||
c.text(x, y, "Copyright © 2025-2026 Montauk Operating System Project", theme.text_muted);
|
||||
|
||||
g_win.present();
|
||||
}
|
||||
|
||||
extern "C" void _start() {
|
||||
if (!fonts::init()) montauk::exit(1);
|
||||
g_accent = mtk::load_system_accent();
|
||||
montauk::get_info(&g_info);
|
||||
|
||||
if (!g_win.create("About", WIN_W, WIN_H)) montauk::exit(1);
|
||||
render();
|
||||
while (g_win.id >= 0 && !g_win.closed) {
|
||||
montauk::abi::WinEvent ev;
|
||||
int result = g_win.poll(&ev);
|
||||
if (result < 0) break;
|
||||
if (result == 0) {
|
||||
// Keep the uptime line ticking.
|
||||
if (montauk::get_milliseconds() / 1000 != g_drawn_sec) render();
|
||||
montauk::sleep_ms(16);
|
||||
continue;
|
||||
}
|
||||
if (ev.type == 3) break;
|
||||
if (ev.type == 0 && ev.key.pressed && ev.key.scancode == 0x01)
|
||||
g_win.closed = true;
|
||||
else if (ev.type == 2 || ev.type == 4)
|
||||
render();
|
||||
}
|
||||
g_win.destroy();
|
||||
montauk::exit(0);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
[app]
|
||||
id = "about"
|
||||
name = "About"
|
||||
binary = "about.elf"
|
||||
icon = "help-about.svg"
|
||||
|
||||
[menu]
|
||||
category = "System"
|
||||
visible = false
|
||||
|
||||
[desktop]
|
||||
section = "settings"
|
||||
admin_only = false
|
||||
|
||||
# Where the Settings app lists this page and what its search matches.
|
||||
[settings]
|
||||
category = "System"
|
||||
description = "OS version, build number and uptime"
|
||||
keywords = "about version build number uptime system information montauk copyright"
|
||||
@@ -0,0 +1,2 @@
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include <gui/stb_truetype.h>
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* about.cpp
|
||||
* About tab for the embedded desktop settings app
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#include "settings_internal.hpp"
|
||||
|
||||
namespace settings_app {
|
||||
|
||||
void settings_draw_about(Canvas& c, SettingsState* st) {
|
||||
st->uptime_ms = montauk::get_milliseconds();
|
||||
|
||||
mtk::Theme theme = settings_theme(st);
|
||||
int x = 16;
|
||||
int y = 20;
|
||||
char line[128];
|
||||
int sfh = system_font_height();
|
||||
int line_h = sfh + 6;
|
||||
|
||||
c.text_2x(x, y, st->sys_info.osName, theme.accent);
|
||||
int large_h = (fonts::system_font && fonts::system_font->valid)
|
||||
? fonts::system_font->get_line_height(fonts::LARGE_SIZE) : (FONT_HEIGHT * 2);
|
||||
y += large_h + 8;
|
||||
|
||||
snprintf(line, sizeof(line), "Version %s (Build %u)",
|
||||
st->sys_info.osVersion, (unsigned)st->sys_info.buildNumber);
|
||||
c.text(x, y, line, theme.text);
|
||||
y += line_h + 8;
|
||||
|
||||
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
|
||||
y += 12;
|
||||
|
||||
snprintf(line, sizeof(line), "Build number: %u", (unsigned)st->sys_info.buildNumber);
|
||||
c.kv_line(x, &y, line, theme.text, line_h);
|
||||
|
||||
int up_sec = (int)(st->uptime_ms / 1000);
|
||||
int up_min = up_sec / 60;
|
||||
int up_hr = up_min / 60;
|
||||
snprintf(line, sizeof(line), "Uptime: %d:%02d:%02d", up_hr, up_min % 60, up_sec % 60);
|
||||
c.kv_line(x, &y, line, theme.text, line_h);
|
||||
y += 8;
|
||||
|
||||
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
|
||||
y += 12;
|
||||
|
||||
c.text(x, y, "Copyright \u00A9 2025-2026 Montauk Operating System Project", theme.text_muted);
|
||||
}
|
||||
|
||||
} // namespace settings_app
|
||||
@@ -26,7 +26,6 @@ static void settings_on_draw(Window* win, Framebuffer& fb) {
|
||||
case 0: settings_draw_appearance(content, st); break;
|
||||
case 1: settings_draw_display(content, st); break;
|
||||
case 2: settings_draw_widgets(content, st); break;
|
||||
case 3: settings_draw_about(content, st); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +88,6 @@ void open_settings(DesktopState* ds) {
|
||||
montauk::memset(st, 0, sizeof(settings_app::SettingsState));
|
||||
st->desktop = ds;
|
||||
st->active_tab = 0;
|
||||
montauk::get_info(&st->sys_info);
|
||||
st->uptime_ms = montauk::get_milliseconds();
|
||||
st->wp_scanned = false;
|
||||
st->wp_files.count = 0;
|
||||
st->status_msg[0] = '\0';
|
||||
|
||||
@@ -17,9 +17,7 @@ namespace settings_app {
|
||||
|
||||
struct SettingsState {
|
||||
DesktopState* desktop;
|
||||
int active_tab; // 0=Appearance, 1=Display, 2=Widgets, 3=About
|
||||
montauk::abi::SysInfo sys_info;
|
||||
uint64_t uptime_ms;
|
||||
int active_tab; // 0=Appearance, 1=Display, 2=Widgets
|
||||
WallpaperFileList wp_files;
|
||||
bool wp_scanned;
|
||||
|
||||
@@ -68,8 +66,8 @@ inline const Color accent_palette[SWATCH_COUNT] = {
|
||||
};
|
||||
|
||||
inline constexpr int TAB_BAR_H = 36;
|
||||
inline constexpr int TAB_COUNT = 4;
|
||||
inline constexpr const char* tab_labels[TAB_COUNT] = { "Appearance", "Display", "Widgets", "About" };
|
||||
inline constexpr int TAB_COUNT = 3;
|
||||
inline constexpr const char* tab_labels[TAB_COUNT] = { "Appearance", "Display", "Widgets" };
|
||||
|
||||
inline constexpr int WP_ITEM_H = 24;
|
||||
|
||||
@@ -93,8 +91,6 @@ bool settings_handle_display_click(SettingsState* st, int mx, int cy);
|
||||
void settings_draw_widgets(Canvas& c, SettingsState* st);
|
||||
bool settings_handle_widgets_click(Window* win, SettingsState* st, int mx, int cy);
|
||||
|
||||
void settings_draw_about(Canvas& c, SettingsState* st);
|
||||
|
||||
void settings_persist(SettingsState* st);
|
||||
|
||||
} // namespace settings_app
|
||||
Reference in new issue
Block a user