#!/usr/bin/env php $n) { if (!isset($n['window'])) { unset($nodes[$k]); foreach ($n['nodes'] as $node) { $nodes[] = $node; } foreach ($n['floating_nodes'] as $node) { $nodes[] = $node; } } } return $nodes; } $node = getVisibleWorkspacesNodes(getTree(), getVisibleWorkspaces())[$windowKey] ?? null; if (!$node) { die(0); } $title = $node['window_properties']['title']; $instance = $node['window_properties']['instance']; $window = $node['window']; $focused = $node['focused']; $urgent = $node['urgent']; $scratchpad = $node['output'] === '__i3'; if (mb_strlen($title) > 25) { $title = mb_substr($title, 0, 22).'…'; } $foreground = '#9cb7d1'; $background = '#222222'; if ($focused) { $foreground = '#07c0d4'; $background = '#333333'; } elseif ($scratchpad) { $foreground = '#bababa'; $background = '#222222'; } if ($urgent) { if (date('s') % 2) { $foreground = '#ffffff'; $background = '#87af15'; } else { $foreground = '#ffffff'; $background = '#07c0d4'; } } $fullText = pspan(mb_strtoupper($title), $foreground, $background).' '; if ($blockButton) { shell_exec(sprintf('i3-msg "[id=%s] focus"', $window)); } echo block( 'workspace_apps_'.$windowKey, [ 'full_text' => $fullText, 'color' => color('normal'), 'separator' => false, 'separator_block_width' => 0, 'min_width' => 1, 'align' => 'left', ] );