cagebreak/example_scripts/show_workspace_views.sh
project-repo 4f7be9d5cd Release 2.1.0
- Add -bs (bad security) option
- Fix Issue 57 (SPDX spelling error #39)
- Fix Issue 59 (meson install settings)
- Fix Issue 55 (npd)
- Fix Issue 56 (npd)
- Fix Issue 58 (#40 config)
- Improve release procedure
- Add miniscule test suite
- Adjust Cagebreak to wlroots 0.16.2
- New GPG Keys
2023-04-04 14:00:31 +02:00

26 lines
964 B
Bash

#!/bin/bash
# Copyright 2020 - 2023, project-repo and the cagebreak contributors
# SPDX-License-Identifier: MIT
# This script displays the process names of the views on the current workspace.
# Start up the ipc link
source "$(dirname "${BASH_SOURCE[0]}")/cb_script_header.sh"
echo "dump" >&3
while IFS= read -r -d $'\0' event
do
# Remove the cg-ipc header
event="${event:6}"
if [[ "$(echo "${event}" | jq ".event_name")" = "\"dump\"" ]]
then
curr_output="$(echo "${event}"|jq ".curr_output")"
curr_workspace="$(echo "${event}"|jq -r ".outputs.${curr_output}.curr_workspace")"
# Print the process names of the view on the current workspace. jq retrieves
# their PID and ps is then used to retrieve the process names.
# shellcheck disable=2046
(echo -n "message ";ps -o comm=Command -p $(echo "${event}"|jq -r ".outputs.${curr_output}.workspaces[$((curr_workspace-1))].views[].pid")|tail +2|sed ':a; N; $!ba; s/\n/||/g') >&3
break
fi
done <&4