Home /Modules/operating-system/SLDesktopSpec.sleela

SLDesktopSpec.sleela

lib/operating-system/SLDesktopSpec.sleela · 121 line(s) · sleela

<< lib/operating-system/SLDesktopSpec.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLDesktopSpec โ€” the desktop/session layer of an OS being
     constructed: the graphics stack, display server/compositor, session shell,
     and widget toolkit that sit on top of the kernel and system services. The
     three shapes present their native stacks โ€” GNOME Shell on a Wayland
     compositor for Linux, Explorer/DWM for Windows, Aqua on WindowServer for
     macOS โ€” but the layer is explicitly OPTIONAL: a server edition composes an
     OS with no desktop at all.
   
   In the firmware -> boot -> kernel -> userspace -> desktop model, this is the
   topmost node. The design principle it encodes is that the desktop is NOT the
   operating system: it is a replaceable stack above Linux/NT/XNU and the
   userspace services, so it can be swapped (GNOME for KDE/Xfce) or omitted.
   
   Family: operating-system. Pure design model; no native bridge calls. >>
#sleela 2.5
material;
class SLDesktopSpec {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10886;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < 1 if the OS has a desktop at all (0 = server/headless) >
  int enabled;
  < "Wayland" / "DWM" / "WindowServer" >
  String displayServer;
  < "GNOME Shell" / "Explorer" / "Aqua" >
  String sessionShell;
  < "GTK" / "Win32/WinUI" / "AppKit" >
  String toolkit;
  < login/greeter >
  String displayManager;
  < the desktop appearance/theme (null on a headless edition) >
  SLDesktopTheme appearance;
  int configured;

  << A headless (no desktop) configuration -- valid for a server edition. A
     headless edition has no desktop, hence no theme. >>
  void headless() {
    enabled = 0; displayServer = ""; sessionShell = "";
    toolkit = ""; displayManager = ""; appearance = null; configured = 1;
  }

  void configure(String server, String shell, String kit, String greeter) {
    enabled = 1; displayServer = server; sessionShell = shell;
    toolkit = kit; displayManager = greeter; configured = 1;
  }

  < Seed the native desktop stack for a shape, including its default theme. >
  void forShape(SLOSShape shape) {
    appearance = new SLDesktopTheme();
    appearance.forShape(shape);
    if (shape.isWindows()) {
      configure("DWM", "Explorer", "Win32/WinUI", "LogonUI"); return;
    }
    if (shape.isMac()) {
      configure("WindowServer", "Aqua", "AppKit", "loginwindow"); return;
    }
    configure("Wayland", "GNOME Shell", "GTK", "GDM");
  }

  << Apply a specific theme to the desktop (e.g. the White Edition look). A
     headless edition cannot carry a theme. >>
  void applyTheme(SLDesktopTheme t) {
    if (enabled == 1) { appearance = t; }
  }

  < The desktop theme, or null when headless / not yet seeded. >
  SLDesktopTheme theme() { return appearance; }
  boolean hasTheme()     { return appearance != null; }

  < Swap the Linux desktop for an alternate (the desktop is replaceable). >
  void useAlternate(String shell, String kit) {
    sessionShell = shell; toolkit = kit;
  }

  boolean hasDesktop()      { return enabled == 1; }
  String server()           { return displayServer; }
  String shell()            { return sessionShell; }
  String widgetToolkit()    { return toolkit; }
  String greeter()          { return displayManager; }
}