diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index d1667c01..9c31b24f 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -37,6 +37,10 @@ MENU_ACTIONS = ( 'Network Test', 'Start', 'Quit') +MENU_ACTIONS_SECRET = ( + 'Matrix', + 'Tubes', + ) MENU_OPTIONS = ( 'CPU & Cooling', 'Disk Attributes', @@ -161,6 +165,8 @@ def build_menu(quick_mode=False): # Add actions, options, etc for action in MENU_ACTIONS: menu.add_action(action) + for action in MENU_ACTIONS_SECRET: + menu.add_action(action, {'Hidden': True}) for option in MENU_OPTIONS: menu.add_option(option, {'Selected': True}) for toggle in MENU_TOGGLES: @@ -179,6 +185,9 @@ def build_menu(quick_mode=False): if platform.system() != 'Linux': for name in ('Audio Test', 'Keyboard Test', 'Network Test'): menu.actions[name]['Disabled'] = True + if platform.system() not in ('Darwin', 'Linux'): + for name in ('Matrix', 'Tubes'): + menu.actions[name]['Disabled'] = True # Done return menu @@ -250,6 +259,13 @@ def main(): std.print_standard('') std.pause('Press Enter to return to main menu...') + # Secrets + if 'Matrix' in selection: + screensaver('matrix') + elif 'Tubes' in selection: + # Tubes ≈≈ Pipes? + screensaver('pipes') + # Quit if 'Quit' in selection: break @@ -293,5 +309,26 @@ def network_test(): std.pause('Press Enter to return to main menu...') +def screensaver(name): + """Show screensaver""" + if name == 'matrix': + cmd = ['cmatrix', '-abs'] + elif name == 'pipes': + cmd = [ + 'pipes' if platform.system() == 'Linux' else 'pipes.sh', + '-t', '0', + '-t', '1', + '-t', '2', + '-t', '3', + '-t', '5', + '-R', '-r', '4000', + ] + + # Switch pane to fullscreen and start screensaver + tmux.zoom_pane() + exe.run_program(cmd, check=False, pipe=False) + tmux.zoom_pane() + + if __name__ == '__main__': print("This file is not meant to be called directly.") diff --git a/scripts/wk/tmux.py b/scripts/wk/tmux.py index 186878d9..525b42a8 100644 --- a/scripts/wk/tmux.py +++ b/scripts/wk/tmux.py @@ -197,5 +197,15 @@ def respawn_pane(pane_id, **action): run_program(cmd, check=False) +def zoom_pane(pane_id=None): + """Toggle zoom status for current or target pane.""" + cmd = ['tmux', 'resize-pane', '-Z'] + if pane_id: + cmd.extend(['-t', pane_id]) + + # Toggle + run_program(cmd, check=False) + + if __name__ == '__main__': print("This file is not meant to be called directly.")