i3bar-workspace-protocol: Make examples (more) POSIX compliant (#6029)

See https://unix.stackexchange.com/a/581410, `read` needs a variable
name.

Came up in #5939
This commit is contained in:
Orestis Floros 2024-04-30 13:41:45 +02:00 committed by GitHub
parent e020701df1
commit d54a10b200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,7 @@ i3-msg -t subscribe -m '["workspace", "output"]' | {
# avoids having an empty bar when starting up.
i3-msg -t get_workspaces;
# Then, while we receive events, update the workspace information.
while read; do i3-msg -t get_workspaces; done;
while read EVENT; do i3-msg -t get_workspaces; done;
}
------------------------------
@ -139,7 +139,7 @@ i3-msg -t subscribe -m '["workspace", "output"]' | {
#!/bin/sh
i3-msg -t subscribe -m '["workspace", "output"]' | {
i3-msg -t get_workspaces;
while read; do i3-msg -t get_workspaces; done;
while read EVENT; do i3-msg -t get_workspaces; done;
} | jq --unbuffered -c '[ .[] | select(.name != "foo" or .focused) ]'
------------------------------
@ -153,7 +153,7 @@ might mean that you are getting an empty bar until enough events are written.
#!/bin/sh
i3-msg -t subscribe -m '["workspace", "output"]' | {
i3-msg -t get_workspaces;
while read; do i3-msg -t get_workspaces; done;
while read EVENT; do i3-msg -t get_workspaces; done;
} | jq --unbuffered -c '
def fake_ws(name): {
name: name,
@ -169,7 +169,7 @@ i3-msg -t subscribe -m '["workspace", "output"]' | {
#!/bin/sh
i3-msg -t subscribe -m '["workspace", "output"]' | {
i3-msg -t get_workspaces;
while read; do i3-msg -t get_workspaces; done;
while read EVENT; do i3-msg -t get_workspaces; done;
} | jq --unbuffered -c 'sort_by(.name) | reverse'
------------------------------
@ -179,6 +179,6 @@ i3-msg -t subscribe -m '["workspace", "output"]' | {
#!/bin/sh
i3-msg -t subscribe -m '["workspace", "output"]' | {
i3-msg -t get_workspaces;
while read; do i3-msg -t get_workspaces; done;
while read EVENT; do i3-msg -t get_workspaces; done;
} | jq --unbuffered -c '[ .[] | .name |= . + " foo" ]'
------------------------------