From 28190c055c1a5419f8e15fd06810a46f1d4f4555 Mon Sep 17 00:00:00 2001 From: Jafner <40403594+Jafner@users.noreply.github.com> Date: Thu, 11 Nov 2021 12:32:28 -0800 Subject: [PATCH] Improve docs --- README.md | 38 +++++++++---------------------- install_daemon_systemd.sh | 14 ++++++++++++ pa_xtouch_control.service | 8 ------- pamidi.service | 8 +++++++ pa_xtouch_control.sh => pamidi.sh | 11 +++++++++ 5 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 install_daemon_systemd.sh delete mode 100644 pa_xtouch_control.service create mode 100644 pamidi.service rename pa_xtouch_control.sh => pamidi.sh (98%) diff --git a/README.md b/README.md index db94e58..79a25ac 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,22 @@ -# pa-xtouch-control - Control PulseAudio and X with a Behringer X-Touch Mini +# pamidi + Control PulseAudio and X with a Behringer X-Touch Mini (or other MIDI controllers, with some customization). - # Dependencies - This program was written to work within the stock Pop!_OS desktop environment (running X and PulseAudio) with the `xdotool` package installed to enable binding the currently-focused application to a column. +# Dependencies +This program was written to work within the stock Pop!_OS desktop environment (running X and PulseAudio) with the `xdotool` package installed to enable binding the currently-focused application to a column. I am open to supporting other window systems if there is sufficient interest. # Installation as a foreground script -Download the script (via `curl` or `wget`) and `chmod +x pa_xtouch_control` to make it executable. Then run it with `./pa_xtouch_control` and test your Behringer X-Touch Mini to make sure everything is working. +1. Clone this repository. `git clone https://github.com/Jafner/pamidi.git` +2. Make the script executable. `chmod +x pamidi.sh` +3. Run the script. `./pamidi.sh` -# Installation as a daemon (`systemd`) -1. Download the `pa_xtouch_control.sh` and `pa_xtouch_control.service` files. -2. Make the `pa_xtouch_control.sh` script executable with `chmod +x pa_xtouch_control.sh`. -3. Place `pa_xtouch_control.sh` into `/usr/bin/` with `mv pa_xtouch_control.sh /usr/bin/`. -4. Place `pa_xtouch_control.service` into `~/.config/systemd/user/` (just 'user', not your username) with `mv pa_xtouch_control.service ~/.config/systemd/user/` -5. Create this directory if it does not already exist `mkdir -p ~/.config/systemd/user/`. -6. Reload systemd with `systemctl --user daemon-reload`. -7. Enable autostart of the systemd service with `systemctl --user enable pa_xtouch_control.service`. -8. Start the service with `systemctl --user start pa_xtouch_control.service`. +# Installation as a daemon with `systemd` +1. Clone this repository. `git clone https://github.com/Jafner/pamidi.git` +2. Make the installation script executable with `chmod +x install_daemon_systemd.sh` +3. Run the installation script with `./install_daemon_systemd.sh` -You can do all of these steps with: - -```bash -curl -o /usr/bin/pa_xtouch_control.sh https://raw.githubusercontent.com/Jafner/pa-xtouch-control/main/pa_xtouch_control.sh && \ -chmod +x /usr/bin/pa_xtouch_control.sh && \ -mkdir -p ~/.config/systemd/user && \ -curl -o ~/.config/systemd/user/pa_xtouch_control.service https://raw.githubusercontent.com/Jafner/pa-xtouch-control/main/pa_xtouch_control.service && \ -systemctl --user daemon-reload && \ -systemctl --user enable pa_xtouch_control.service && \ -systemctl --user start pa_xtouch_control.service -``` - - # Modifying the script I've done my best to make the script readable and modifyable. Here is a summary of how the script is laid out: diff --git a/install_daemon_systemd.sh b/install_daemon_systemd.sh new file mode 100644 index 0000000..db914e1 --- /dev/null +++ b/install_daemon_systemd.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "Installing script..." +chmod +x pamidi.sh +cp pamidi.sh /usr/bin/pamidi +echo "Installing daemon..." +mkdir -p ~/.config/systemd/user/ +cp pamidi.service ~/.config/systemd/user/ +echo "Enabling systemd daemon..." +systemctl --user daemon-reload +systemctl --user enable pamidi.service +systemctl --user start pamidi.service + +edho "Done!" \ No newline at end of file diff --git a/pa_xtouch_control.service b/pa_xtouch_control.service deleted file mode 100644 index 62b4d8f..0000000 --- a/pa_xtouch_control.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=PulseAudio X-Touch control daemon - -[Service] -ExecStart=/usr/bin/pa_xtouch_control.sh - -[Install] -WantedBy=default.target \ No newline at end of file diff --git a/pamidi.service b/pamidi.service new file mode 100644 index 0000000..2121570 --- /dev/null +++ b/pamidi.service @@ -0,0 +1,8 @@ +[Unit] +Description=Control PulseAudio with a Midi device + +[Service] +ExecStart=/usr/bin/pamidi.sh + +[Install] +WantedBy=default.target diff --git a/pa_xtouch_control.sh b/pamidi.sh similarity index 98% rename from pa_xtouch_control.sh rename to pamidi.sh index 02b244b..a483f91 100644 --- a/pa_xtouch_control.sh +++ b/pamidi.sh @@ -48,6 +48,7 @@ initialize(){ col_8_app_pid=-1 assign_profile_1 print_col_app_ids + notify-send "Initialized pamidi" } assign_profile_1() { @@ -122,6 +123,16 @@ change_volume_standard() { done } +change_mic_volume_standard(){ + # take the stream ID of a microphone and change its volume + + new_vol=$2 + + mic_sid=$1 + + +} + toggle_mute() { # take the pid of an app # toggle mute all streams for that app