Files
mcde/AGENTS.md
T
lotherkandClaude Sonnet 5.5 c01da186a7 MCDE: dtksh is out; dterror.ds is a Motif program; dtterm keeps starting the login shell
Konrad, 2026-11-14: "was soll dtksh ueberhaupt sein... einfach ne shell von
CDE? fuck it. schmeiss das komplett raus aus MCDE."  dtksh is CDE's ksh93
with Motif bindings for scripting dialogs; its bundled ksh93 (AT&T ast's
bin/package) compiles and RUNS test programs while it builds, which a cross
build for NetBSD on a Linux host cannot do -- the reason wm/mcde did not
build for days ("cc: not found", userland-2026-11-14g.log).

- programs/dtksh removed (1204 files); not in programs/Makefile.am,
  configure.ac, the recipe (REPLACE_INTERPRETER dtksh, KSH_CC), PLIST (bin,
  lib, man page, six catalogues), msg.C.am (dtksh.cat), AGENTS.md.
- What used dtksh:
  * dterror.src, dtfile_error.cpp, types/error.ds.src: an error dialog with a
    message.  New programs/dterror/dterror.c (about 70 lines of Motif), built
    as dterror.ds: dterror.ds MESSAGE [TITLE [OK-LABEL]], the convention of
    every caller (the data types, dtopen, dtfile ModAttr.c).  dtfile_error
    was only the 'test' entry of dtfile.config and ModAttr.c's fallback; the
    entry is gone and ModAttr.c calls dterror.ds.
  * dthelpgen.dtsh: the "building help" dialog helpgen.c forked; it runs
    silently now (childPid stays -1).
  * dtprintegrate/dtlp.src: the print dialog (1711 lines of dtksh); printing
    is to come back through CUPS (tasksd t0177, t0193).  dtlp's man page is
    out of the doc build and PLIST with it.
  * The data types DTKSH_SCRIPT (*.ds) and DTKSH_CONV (*.dtsh) in dt.dt.src:
    they would have classed dterror.ds as a script.
- dtterm needs no change: lib/DtTerm/TermPrim/TermPrimSubproc.c takes /usr/bin/zsh,
  then the shell of the passwd entry, then /bin/sh, and never started dtksh.
- ksh93 stays as the NetBSD binary for the scripts that say ksh (Xsession).

Measured: make mcde-linux exit=0 (build/logs/mcde-linux-nodtksh-2026-11-14.log),
autogen picked up programs/dterror; dterror.ds under Xvfb shows the error
icon, a two-line message and one button "Understood", and exits 0 on Return.

Not in this commit: the other agents' pending dtfile edits (Search.c,
Navigation.c) and the regenerated distinfo files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 09:12:55 +00:00

9.5 KiB

ext/src/mcde -- MCDE, the Makronix Common Desktop Environment

What it is for

The Makronix fork of CDE 2.5.3 (IMPORT), on its way to a desktop that works as one (GOAL.md, "MCDE"): one System Settings, a software update, the small things that belong together. Makronix ships it in place of CDE; pkgsrc builds it on any platform. What each program does is in its source and in docs/MCDE-PROGRAMS.md (Makronix root); this file holds the rules. The state of the file before the refactor of 2026-11-13, with the per-feature narratives and test notes, is docs/reference/mcde-agents-history-2026-11-13.txt.

The philosophy -- binding (Konrad, 2026-11-09)

  1. CDE, Motif, Xlib, X11 only. No GTK, no Qt, no compositor, no scripting language as a requirement. Fast, and it runs on machines of 1995. GPU frugal: no compositing or animations, redraw on Expose only.
  2. C99 and POSIX (POSIX.1-2008, XSI where CDE already needs it). New code compiles with -std=c99 -D_POSIX_C_SOURCE=200809L and uses nothing beyond POSIX and the X/Motif libraries. MCDE runs on NetBSD and Linux.
  3. The operating system is behind one layer: lib/McdeSys. Everything that differs between systems (users, network, Wi-Fi, time zone, host name, services, update, power, sound, disks, sharing, backup) goes through the functions of include/Mcde/McdeSys.h. A program never calls useradd, ifconfig, wpa_supplicant, edits /etc/rc.conf or calls systemctl itself, and never has an #ifdef __NetBSD__. Each system has one backend (lib/McdeSys/netbsd.c, linux.c, plus disk_*.c); common.c is POSIX. A backend uses the system's own tools the documented way.
  4. Installed with pkgsrc, in conflict with CDE: pkgsrc/Makefile has CONFLICTS+= cde-[0-9]*.
  5. One look: the MCDE palette generates the X resources and the GTK/Qt themes (programs/dtthemesync, XSETTINGS daemon); MCDE is the reference.
  6. Language: what a user sees may be translated; configuration, bindings and the system below are English only (Mod4<Key>, Shift<Key>, Ctrl<Key> in every app-defaults catalog, never translated).

What is in it

  • The CDE 2.5.3 tree (first commit unchanged) with the fixes of pkgsrc wm/cde folded in. IMPORT says where it came from.
  • pkgsrc/ -- recipe wm/mcde (mcde-0.1.0); pkgsrc-motif/ -- recipe x11/mcde-motif (same archive, WRKSRC motif/, CONFLICTS motif, lesstif, openmotif); tools/ext-sync.sh copies them into pkgsrc.
  • motif/ -- Motif 2.3.8 with pkgsrc x11/motif's patches and MCDE's own fixes (Command key in lib/Xm/Transltns.c, exported menu bars _XmMenuBarSetExported, Xft renditions). Outside pkgsrc MCDE builds it itself (configure.ac, --with-private-motif, the default); through pkgsrc on Makronix it is the system's Motif (--without-private-motif, MOTIFBASE in tools/vmbuild/mk-cde.conf). Konrad, 2026-11-13: MCDE builds its own Motif when it is not Makronix.
  • lib/McdeSys (libMcdeSys; test_sysinfo), lib/McdeSound (include/Mcde/Sound.h), lib/DtSvc/DtUtil2/Mcde*.c (global menu client side, menu model, images, display arithmetic and RandR, WM hints); headers in include/Mcde/. McdeThumb.c (include/Mcde/Thumb.h, test test_thumb) is the miniature: PNG, JPEG, GIF, BMP and XPM read with libpng, libjpeg and C99, scaled with a box filter and cached in ~/.dt/thumbs/<64|128|256>/ -- the one picture reader for dtfile and the programs that show pictures, no gdk-pixbuf, no program per picture.
  • Programs of its own: dtbar (top bar and global menu, protocol include/Mcde/GlobalMenu.h), dtkeys, dtthemesync, dtappscan, dtsystemsettings (panes by category, McdeSys only), dtdiskutility, dtbackup, mcdesoundd, dtphoto, dtpaint, dttoolbox.
  • Changes inside CDE programs, marked "MCDE" in the source: dtfile (Navigation.c, NetView.c, Columns.c, Peek.c -- the preview on Space, with McdeThumb; Trash.c -- the question before the Trash is emptied, Menu.c -- Open Trash/Empty Trash in the File menu), dtterm (Tabs.c, Dropdown.c, Profiles.c, Xft), dtwm (WmMcdeSnap.c, WmMcdePanel.c, WmMcdeDisplays.c, WmSlideshow.c, always-on-top, _NET_ACTIVE_WINDOW, McdeExcludeBar), dtlogin (config/sessionetc.d), the front panel (programs/types/dtwm.fp.src, types/dt.dt.src).
  • programs/icons/MakronixDtlogo.pm -- the Makronix logo, default of dtlogin.

Conventions that bind

  • Session start: the desktop's own programs (mcdesoundd, dtlaunch, dtterm -dropdown, dtbar, login items) are started by dtsession through config/sys.sessionetc and config/sessionetc.d/ (source of the scripts: programs/dtlogin/config/0*), not by Xsession.d. Started before dtsession they took *background from the user's ~/.Xdefaults (purple bar, 2026-11-13). Xsession.d keeps only what must precede it (language, fonts, displays, dtkeys, home folders, dtappscan, dtthemesync: dist_xsess_SCRIPTS).
  • Command key (shortcuts by the place of a key): the key left of the space bar is Command = Mod4 on every keyboard, left of it Option = Alt (Mod1, Motif's mnemonics), then Ctrl. programs/dtkeys exchanges left Alt and left Windows on a PC keyboard; a Macintosh keyboard is already so (mcde_sys_keyboard_is_mac); ~/.dt/keyboard "type: auto|pc|mac". Menu shortcuts on letter keys are Mod4<Key>x showing "Cmd+X" in every catalog. Ctrl+C stays the interrupt in dtterm.
  • Global menu: every Motif program takes part through DtInitialize without its own change; MCDE_NO_GLOBAL_MENU keeps a menu bar in its window. A foreign window is registered with a hidden core widget, never a shell. A program without a global menu in front: the bar shows only the M menu. The bar uses colour set 5 (Dtbar*secondaryColorSetId: 5).
  • Windows: dtwm places and maximizes below the bar; focus follows the pointer without auto-raise by default; zones and full screen use Command+Ctrl keys; the outline is XOR or four thin windows, never FlashOutline. The main display carries bar and front panel, the others the backdrop only; workspaces are shared; MCDE remembers a monitor (EDID) in ~/.dt/displays.
  • Front panel: Files, Mail, Terminal, Network, Desktop Style left of the workspace switch (Konrad, 2026-11-11), running programs and trash right. No clock in the panel (the bar has it). Actions at the end of types/dt.dt.src take no shell variables and no CDE_INSTALLATION_TOP inside '...' (docs/reference/frontpanel.txt).
  • Pictures: PNG goes through McdeImageGetPixmap (libpng), because Motif 2.3.8 draws an RGB PNG as its blue channel only (docs/reference/motif-png.txt); free with McdeImageFreePixmap.
  • Root actions (accounts, network, sharing, time zone, update) run in a terminal after su, via dtsystemsettings -<action>; backup is the exception: dtbackup run from root's crontab, passphrase in /etc/mcde-backup.pass (0600).
  • Reference documents for the system layer: docs/reference/ (borg, netconfig, wifi, sharing, battery, desktop-entry, cde-colorsets, frontpanel, motif-png).

Hazards -- never on the development host or the test VM

  • Power items of dtbar (Restart, Shut Down) tested to the end; the system may let the user do it.
  • Network Apply or Wi-Fi join over the ssh card; switching SSH in the VM (ssh is the way in); any join of Wi-Fi on the development host.
  • Erase, mount or repair in dtdiskutility.
  • Sound tests against the real PulseAudio: use a private one (null sink, own socket).
  • Xvfb loses its keymap and properties when its last client leaves: keep one (xprop -root -spy). XTest drags need -xrm "Dtwm*freezeOnConfig: False".

Building it

Building is cross and native, never in a VM (since 2026-11-13); the VM only tests installs.

  • The recipe is ext/src/mcde/pkgsrc (and pkgsrc-motif); the archive and distinfo come from tools/mcde-dist.sh (git archive of a commit, so after a change: commit, then tools/mcde-dist.sh, then build). The set is made by make userland (root AGENTS.md).
  • On the Linux host, for development: make mcde-linux (tools/mcde-linux.sh; MCDE_DIRS=programs/dtfile for one directory, MCDE_DIRS=install into build/mcde-root/dt), and make mcde-host (tools/mcde-host.sh, the desktop in /usr/mdt).
  • The C dialect is set by configure.ac (-std=gnu11 and five GCC 14 downgrades; MCDE_DIALECT_CFLAGS for a build that ignores CFLAGS); no build system needs to know it.
  • Tests: make check (test_sysinfo, test_menumodel, test_displays, test_items, test_panes, test_profiles).

What may be changed, and how

  • Anything; it is ours. Keep the licence headers (LGPL, COPYING): the "CDE - Common Desktop Environment" lines are attribution, not branding.
  • Branding is what a user sees: names in dialogs, DtVERSION_STRING ("MCDE x.y.z (CDE 2.5.3)"), logos. DtVERSION, DtREVISION, DtUPDATE_LEVEL stay at 2.5.3: they are the API level programs test against.
  • Not yet: the install prefix (${PREFIX}/dt) and the tarname cde (from it come share/cde and etc/cde); they move together with the PLIST.
  • An update of the CDE upstream is a merge, IMPORT renewed (ext/AGENTS.md).

What must not be touched

  • The first commit (upstream archive unchanged); the API level above.
  • The rules above: an #ifdef per OS in a program, a GTK/Qt dependency, or a direct call of a system tool outside lib/McdeSys is a finding, not a patch.
  • pkgsrc itself: a recipe problem is fixed in ext/src/mcde/pkgsrc, not in the root pkgsrc/.