Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PrinceOfCookies/CookieOS/llms.txt

Use this file to discover all available pages before exploring further.

The CookieOS start menu is the central hub of the operating system. It appears automatically after the boot sequence completes and gives you keyboard-driven access to every major area of CookieOS: the command prompt, the programs menu, power management, the uninstaller, and the built-in help system. It stays on screen until you make a selection, and it keeps a live clock running in the top-right corner at all times so you always know the current time.

Screen Layout

The display is split into two layers drawn by cosUtils.drawMenu(term) and cosUtils.centerPrintTable respectively.

Top Bar

cosUtils.drawMenu(term) renders a persistent two-character-wide bar spanning the top two rows of the terminal. It is backed by an off-screen window that is shown only once fully composed, preventing flicker:
  • Left — the version string stored in the global cosv (e.g., CookieOS v2.2.5), written in yellow.
  • Right — the current time in HH:MM AM/PM format (or 24-hour if configured), written in white.
Below the top bar, the menu is rendered using cosUtils.centerPrintTable inside an invisible off-screen window. cosUtils.drawBox draws a border around the items, and each item is horizontally centered on the terminal. The selected item is highlighted with square brackets, for example [ Command ], while all other items appear without decoration.
OptionAction
CommandOpens the command prompt (os/.command)
ProgramsOpens the programs menu (os/.programs)
PowerOpens power management (os/.powerManagement)
UninstallRuns the uninstall script (os/.uninstall)
HelpRuns .help

Keyboard Navigation

Navigation is handled entirely by the keyboard. cosUtils.menuKeyUpDownManagement(key, numOp, max, min) translates key presses into a new selection index, wrapping seamlessly from the last option back to the first and vice versa.
1

Move the selection

Press the Up or Down arrow key to move the highlighted bracket to the previous or next option. The selection wraps around at both ends.
2

Confirm your choice

Press Enter to confirm the currently highlighted option. The menu event loop breaks and the chosen script is launched via shell.run.

Live Clock Refresh

The start menu uses a timer to keep the top-bar clock current without polling continuously. A new timer fires roughly every second; the menu only redraws when the minute value has actually changed since the last redraw, so screen updates are kept to a minimum.
local timerID = os.startTimer(0.1)
while true do
    local e, key = os.pullEvent()
    if e == "timer" and key == timerID then
        local _, minutee = cosUtils.getTime("12", true)
        if lastrefresh ~= minutee then
            drawMenu(term)
            drawFrontEnd(term)
        end
        timerID = os.startTimer(1)
    elseif e == "key" then
        -- handle key navigation
    end
end
The first timer fires after 0.1 seconds to produce a near-instant initial refresh, then every subsequent timer is set to 1 second. cosUtils.getTime("12", true) returns the current hour, minute, and AM/PM indicator; the minute value is stored in lastrefresh after each draw so the comparison is cheap.
The clock format is controlled by the timeFormat CC:Tweaked setting, which is defined and documented by cosUtils. It defaults to "12" for 12-hour display. To switch to 24-hour format, run the following from any shell session:
settings.set("timeFormat", "24")
settings.save()
The new format takes effect the next time the top bar is redrawn.

Build docs developers (and LLMs) love