Skip to main content

Module daemon

Module daemon 

Expand description

Daemon implementation

ModulesΒ§

grid πŸ”’
Spatial grid model of the client windows.
workspace πŸ”’

StructsΒ§

Client πŸ”’
Representation of a client
Clients πŸ”’
Collection of Clients maintaining insertion order and a PID-indexed lookup table.
Daemon πŸ”’
The daemon is responsible to launch a client for each host, positioning the client windows, forwarding input records to all clients and handling control mode.
HWNDWrapper πŸ”’
Hacky wrapper around a window handle.

EnumsΒ§

ControlModeAction πŸ”’
Top-level control-mode action a keystroke classifies into.
ControlModeState πŸ”’
Enum of all possible control mode states.
EnableDisableSubmenuAction πŸ”’
Enable/disable-submenu action a keystroke classifies into.
NavigationDirection πŸ”’
Direction of a navigation keystroke inside the enable/disable submenu.

ConstantsΒ§

MODIFIER_MASK πŸ”’
Bits in KEY_EVENT_RECORD::dwControlKeyState that represent β€œreal” modifier keys (Ctrl / Alt / Shift) as opposed to lock toggles (CAPSLOCK_ON, NUMLOCK_ON, SCROLLLOCK_ON) or the ENHANCED_KEY flag.
SENDER_CAPACITY πŸ”’
The capacity of the broadcast channel used to send the input records read from the console input buffer to the named pipe servers connected to each client in parallel.

FunctionsΒ§

arrange_client_window πŸ”’
Re-sizes and re-positions the given client window based on the total number of clients, the size of the daemon console window and its index relative to the other client windows.
build_client_grid πŸ”’
Build a ClientGrid from clients and workspace_area using the same aspect-ratio expression the tiler uses.
classify_control_mode_key πŸ”’
Classifies a top-level control-mode keystroke.
classify_enable_disable_submenu_key πŸ”’
Classifies an enable/disable-submenu keystroke.
defer_windows πŸ”’
Move all given windows to the foreground.
determine_client_spatial_attributes πŸ”’
Calculates the position and dimensions for a client window given its index, the total number of clients and the aspect_ratio_adjustment daemon configuration.
ensure_client_z_order_in_sync_with_daemon πŸ”’
Spawns a background thread that ensures the z-order of all client windows is in sync with the daemon window. I.e. if the daemon window is focussed, all clients should be moved to the foreground.
expand_hosts
Resolve cluster tags in hosts and expand brace expressions (e.g. host{1..3}.local) in each resulting hostname.
get_console_rect πŸ”’
Transform the position and dimensions of a console window based on the workspace area.
get_console_window_wrapper πŸ”’
Returns a window handle to the current console window.
get_foreground_window_wrapper πŸ”’
Returns a window handle to the foreground window.
launch_client_console πŸ”’
Launchs a client console process with its own window with the given CLI arguments/options: host, username, port, debug.
launch_clients πŸ”’
Launches a client console for each given host and waits for the client windows to exist before returning their handles.
main
The entrypoint for the daemon subcommand.
named_pipe_server_routine πŸ”’
Correlate the connecting client by PID, then multiplex input records, ClientState updates, and keep-alives onto the named pipe.
next_submenu_selection πŸ”’
Compute the next submenu selection given a grid step.
probe_pipe_alive πŸ”’
Best-effort, non-blocking probe of the named pipe.
read_client_pid πŸ”’
Read the connecting client’s 4 byte little-endian process id from the pipe.
resolve_cluster_tags
Resolve cluster tags into hostnames
restore_if_minimized πŸ”’
Restore window_handle if its current placement reports minimized.
toggle_processed_input_mode πŸ”’
The processed console input mode controls whether special key combinations such as Ctrl + c or Ctrl + BREAK receive special handling or are treated as simple key presses.
workspace_aspect_ratio πŸ”’
Return the workspace area’s aspect ratio (width / height) including the frame padding the tiler accounts for.
write_framed_message πŸ”’
Write all of frame to the named pipe server, retrying partial writes and WouldBlock results until the buffer is fully drained.