mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-20 04:24:18 +02:00
Integrate library into example scripts.
- example scripts are now standalone. - consistency enforced via test
This commit is contained in:
parent
d0770ffb19
commit
c34057db8f
5 changed files with 48 additions and 7 deletions
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2023 - 2024, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
named_pipe_send="$(mktemp -u)"
|
||||
named_pipe_recv="$(mktemp -u)"
|
||||
mkfifo "${named_pipe_send}"
|
||||
mkfifo "${named_pipe_recv}"
|
||||
nc -U "${CAGEBREAK_SOCKET}" < "${named_pipe_send}" > "${named_pipe_recv}"&
|
||||
# The file descriptor 3 is set up to send commands to cagebreak and file
|
||||
# descriptor 4 can be used to read events. Notice that events will pile up in
|
||||
# file descriptor 4, so it is a good idea to continuously read from it or to
|
||||
# clear it before starting a new transaction.
|
||||
exec 3>"${named_pipe_send}"
|
||||
exec 4<"${named_pipe_recv}"
|
||||
# When the script exits, the os will clean up the pipe
|
||||
rm "${named_pipe_recv}"
|
||||
rm "${named_pipe_send}"
|
||||
15
example_scripts/screenshot_script
Normal file → Executable file
15
example_scripts/screenshot_script
Normal file → Executable file
|
|
@ -10,7 +10,20 @@
|
|||
# Example:
|
||||
# screenshot_script "gwenview"
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/cb_script_header.sh"
|
||||
named_pipe_send="$(mktemp -u)"
|
||||
named_pipe_recv="$(mktemp -u)"
|
||||
mkfifo "${named_pipe_send}"
|
||||
mkfifo "${named_pipe_recv}"
|
||||
nc -U "${CAGEBREAK_SOCKET}" < "${named_pipe_send}" > "${named_pipe_recv}"&
|
||||
# The file descriptor 3 is set up to send commands to cagebreak and file
|
||||
# descriptor 4 can be used to read events. Notice that events will pile up in
|
||||
# file descriptor 4, so it is a good idea to continuously read from it or to
|
||||
# clear it before starting a new transaction.
|
||||
exec 3>"${named_pipe_send}"
|
||||
exec 4<"${named_pipe_recv}"
|
||||
# When the script exits, the os will clean up the pipe
|
||||
rm "${named_pipe_recv}"
|
||||
rm "${named_pipe_send}"
|
||||
|
||||
if [[ ${#} -lt 1 ]]
|
||||
then
|
||||
|
|
|
|||
18
example_scripts/show_workspace_views
Normal file → Executable file
18
example_scripts/show_workspace_views
Normal file → Executable file
|
|
@ -1,11 +1,23 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2020 - 2024, 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"
|
||||
named_pipe_send="$(mktemp -u)"
|
||||
named_pipe_recv="$(mktemp -u)"
|
||||
mkfifo "${named_pipe_send}"
|
||||
mkfifo "${named_pipe_recv}"
|
||||
nc -U "${CAGEBREAK_SOCKET}" < "${named_pipe_send}" > "${named_pipe_recv}"&
|
||||
# The file descriptor 3 is set up to send commands to cagebreak and file
|
||||
# descriptor 4 can be used to read events. Notice that events will pile up in
|
||||
# file descriptor 4, so it is a good idea to continuously read from it or to
|
||||
# clear it before starting a new transaction.
|
||||
exec 3>"${named_pipe_send}"
|
||||
exec 4<"${named_pipe_recv}"
|
||||
# When the script exits, the os will clean up the pipe
|
||||
rm "${named_pipe_recv}"
|
||||
rm "${named_pipe_send}"
|
||||
|
||||
echo "dump" >&3
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue