PSR 2 compliance

This commit is contained in:
Simon Vieille 2021-03-09 15:18:28 +01:00
parent b0e0dc33b6
commit e84de66dfa
3 changed files with 9 additions and 10 deletions

View File

@ -47,15 +47,15 @@ function getDefaultFocusWindowNumber($container)
function setFocusToWindow($window)
{
shell_exec(sprintf("i3-msg '[con_id=\"%s\"] focus'", $window->id));
shell_exec(sprintf("i3-msg '[con_id=\"%s\"] focus'", $window->id));
}
$container = getFocusedWindowContainer(getTree());
if ($container !== null) {
if (null !== $container) {
$number = getFocusWindowNumber(getDefaultFocusWindowNumber($container), count($container));
foreach ($container as $k => $window) {
foreach ($container as $k => $window) {
if ($k == $number) {
setFocusToWindow($window);
}

View File

@ -45,7 +45,7 @@ function getVisibleWorkspacesNodes(array $tree, array $workspaces): array
$nodes,
$tree['floating_nodes']
);
} elseif ($output === '__i3' && isset($tree['window'])) {
} elseif ('__i3' === $output && isset($tree['window'])) {
$nodes[] = $tree;
}
}
@ -70,7 +70,6 @@ function getVisibleWorkspacesNodes(array $tree, array $workspaces): array
foreach ($n['floating_nodes'] as $node) {
$nodes[] = $node;
}
}
}

View File

@ -6,7 +6,7 @@ function getOrderedWorkspaces()
$json = shell_exec('i3-msg -t get_workspaces');
$workspaces = json_decode($json);
$ordered = array();
$ordered = [];
foreach ($workspaces as $w) {
$ordered[] = $w->name;
@ -34,7 +34,7 @@ function getMoveOption()
$argv[1] = 'next';
}
return in_array($argv[1], array('next', 'previous')) ? $argv[1] : 'next';
return in_array($argv[1], ['next', 'previous']) ? $argv[1] : 'next';
}
function getNextWorkspace($workspaces)
@ -61,7 +61,7 @@ function getPreviousWorkspace($workspaces)
}
}
return $workspaces[ --$key >= 0 ? $key : $count - 1 ];
return $workspaces[--$key >= 0 ? $key : $count - 1];
}
function moveToWorkspace($workspace)
@ -70,4 +70,4 @@ function moveToWorkspace($workspace)
}
$workspaces = getOrderedWorkspaces();
moveToWorkspace(getMoveOption() === 'next' ? getNextWorkspace($workspaces) : getPreviousWorkspace($workspaces));
moveToWorkspace('next' === getMoveOption() ? getNextWorkspace($workspaces) : getPreviousWorkspace($workspaces));