Expand description
System values (notes/system_signals.md, P136): battery (percent), charging, online and dark mode read the
machine’s state through the host word system_value(name), an i64 (booleans 0 or 1). Listeners on them
(whenever battery < 20% {…}) compare readings at the program’s check points, so a reading is kept for
READING_LIFETIME: a sleeping program polls often, the platform is asked at most once a second per value.
macOS asks pmset and defaults, Linux /sys and gsettings; online is whether a route to the internet exists
(a UDP connect sends nothing). A value the platform cannot give is a loud error, never a made-up reading.
mouse_x, mouse_y, mouse_down: natively the pointer over the paint window (window_input), read each time;
key_down whether a key is held over it, key code held which (lowering/signals/system_values.rs names it held_key);
window_open whether that window shows; read before any paint, it opens the window (blank) where one can show.
window_width, window_height (window.width, card make-width): the paint window’s inner size in points as it reports
it, else as last written, else the view’s; writing one resizes the window through the warp binary’s resizer.
display_width, display_height: the main screen’s size in points, read only; display_dpi its device pixels
per inch (CoreGraphics’ physical size, xrandr’s millimetres), read only.
The clipboard is watched by its change count, which reads no content: macOS asks the user before a program reads
what another one copied, so the text is read only when the program asks for it (clipboard, clipboard_text).
Functions§
- clipboard_
text - The clipboard’s text: macOS
pbpaste, Linuxwl-pasteorxclip - escape_
kept - held_
among - Whether the key of that code is the key held or among the keys held; code 0: whether none is
- key_
held - Whether the key of that code is held now, among others (KEY_HELD); code 0: whether none is
- native_
view - view_width × view_height before any window shows a picture
- notify
notify "text": a desktop notification, macOS through osascript, Linux notify-send; the text goes as an argument, so no quoting can break it- read
- The current value of a system value, read anew at most once per READING_LIFETIME
- tell_
gpu_ drawing - tell_
gpu_ painter - tell_
keys_ held - tell_
window_ input - tell_
window_ key - The key held over the paint window alone, the pointer left as it is
- tell_
window_ open - tell_
window_ opener - tell_
window_ resizer - tell_
window_ size - The window’s size as it reports it (src/graphics/paint_window.rs follow_input)
- window_
input - window_
shows - write
set_system_value(name, value): window.width = 800 resizes the window, display.dpi = 300 dpi sets the dots per inch px count in; the others are read only- write_
clipboard - Puts text on the clipboard: macOS
pbcopy, Linuxwl-copyorxclip