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 Power Management menu gives you a clean, keyboard-driven interface for safely shutting down or rebooting the computer. It is reached by selecting Power from the start menu, which runs os/.powerManagement. Like the start menu it draws a centred, boxed option list with a live clock in the top bar, and it supports the same Up/Down/Enter navigation. Choosing Shutdown or Reboot triggers a graceful goodbye animation before the computer actually powers off or restarts.
OptionBehaviour
ShutdownCalls cosUtils.goodByeSetup(term) to position the cursor centrally, then executes shutdown — which internally calls os.shutdown()
RebootCalls cosUtils.goodByeSetup(term) to position the cursor centrally, then executes reboot — which internally calls os.reboot()
BackReturns to the start menu by running shell.run(".menu")

Keyboard Navigation

Navigation is identical to the start menu. cosUtils.menuKeyUpDownManagement handles Up/Down arrow keys and wraps the selection at both ends. Press Enter to confirm the highlighted option.
1

Move the selection

Press the Up or Down arrow key to move the highlight between Shutdown, Reboot, and Back.
2

Confirm

Press Enter. If you selected Shutdown or Reboot the goodbye animation plays before the computer halts.

The Goodbye Animation

Both os.reboot and os.shutdown are replaced at startup by startup/replacements.lua. The replacements wrap the original CC:Tweaked functions with a short goodbye sequence: the screen is cleared, the cursor is moved to the vertical centre by cosUtils.goodByeSetup(term), the word “Goodbye” is printed in yellow, and the computer waits one second before calling the original function.
os.reboot = function()
    cosUtils.goodByeSetup(term)
    if term.isColor() then
        term.setTextColor(colors.yellow)
    end
    print("Goodbye")
    term.setTextColor(colors.white)
    sleep(1)
    return originalreboot()
end
os.shutdown follows the same pattern, calling originalShutdown() in place of originalreboot(). The original functions are captured into originalreboot and originalShutdown before the replacements are installed, so the underlying CC:Tweaked behaviour is preserved. cosUtils.goodByeSetup(device) calculates the horizontal and vertical centre of the terminal before clearing the screen and positioning the cursor, ensuring the “Goodbye” message always appears in the middle of the display regardless of terminal size:
function cosUtils.goodByeSetup(device)
    local w, h = device.getSize()
    local x = math.floor((w - string.len("Goodbye")) / 2)
    local y = math.floor(h / 2)
    cosUtils.resetScreen(device)
    device.setCursorPos(x, y)
end
Because os.reboot and os.shutdown are replaced globally at startup, calling either function directly from your own scripts — or from the CC:Tweaked shell — will always trigger the goodbye animation. You do not need to call cosUtils.goodByeSetup yourself.

Build docs developers (and LLMs) love