| Summary: | feature suggestion: playback streams shortcuts | ||
|---|---|---|---|
| Product: | [Plasma] plasmashell | Reporter: | Simon99DE <app-simon7891> |
| Component: | Audio Volume widget | Assignee: | Plasma Bugs List <plasma-bugs-null> |
| Status: | CONFIRMED --- | ||
| Severity: | wishlist | CC: | isma.af, kdedev, nate |
| Priority: | NOR | ||
| Version First Reported In: | 6.4.4 | ||
| Target Milestone: | 1.0 | ||
| Platform: | Bazzite | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Simon99DE
2025-08-30 10:34:44 UTC
For per-app shortcuts, it's up to each application to provide them. If an application provides the ability to set shortcuts for certain actions, the controls will appear in the app in System Settings - Shortcuts under Applications as you suggest. For instance, the strawberry music player has shortcuts for Next, Previous, Play/Pause and Stop. If the application you're working with doesn't provide shortcuts, you'll need to reach out to the maintainers for it to request them to add this functionality. Plasma can only allow you to create shortcuts for applications that are developed to have them. You mention a second, separate idea to have media controls be able to affect the current stream rather than the global stream, or the default device. This might be actionable for us, I'll pass this along to the developers to see what we might be able to do there. (In reply to TraceyC from comment #1) > For per-app shortcuts, it's up to each application to provide them. If an > application provides the ability to set shortcuts for certain actions, the > controls will appear in the app in System Settings - Shortcuts under > Applications as you suggest. For instance, the strawberry music player has > shortcuts for Next, Previous, Play/Pause and Stop. > > If the application you're working with doesn't provide shortcuts, you'll > need to reach out to the maintainers for it to request them to add this > functionality. Plasma can only allow you to create shortcuts for > applications that are developed to have them. > > You mention a second, separate idea to have media controls be able to affect > the current stream rather than the global stream, or the default device. > This might be actionable for us, I'll pass this along to the developers to > see what we might be able to do there. I did not mean for the applications Play/Stop etc. I just meant for one source to turn the volume up/down/mute with one button/shotcut. This is currently already a function in KDE in the settings without shotcut You could also add a new command for the streams to make the audio sources louder/quieter/mute. In that case, you should not specify the ID, which changes, but the name. It would also be good if the volume display is shown when you activate it and display above/below it (text) what/which source is currently being changed. I once had a script written by ki so that I could use it as I wanted. Unfortunately, it doesn't show that I'm changing the source (on the screen, as with the global volume) and what source I'm changing (I can't get it to work). I don't know if it's possible to create a kind of folder for shortcuts/commands and then insert, for example, 3 commands for me there, as in other apps, e.g., system settings. It's slowly becoming confusing for me with 19 commands. I would like a command so that I no longer need the script. :) I currently use it in combination with my 17B06E Macropad: https://github.com/Simon99de/17B06E-Macropad app_volume_control.sh #!/usr/bin/env bash # Controls the volume of an application or Bluetooth device in fixed increments. # Usage: # ./app_volume_control.sh <appname|device> <up|down|mute> # # Settings: # - STEP: Step size in percent (e.g., 2, 5, 10) # - MAX / MIN: upper/lower volume limit # # CLI-Tip: # - Find out app names: # pw-cli ls Node APP="$1" ACTION="$2" # ------------------- Settings ------------------- STEP=2 # Step size in % MAX=100 MIN=2 # ------------------------------------------------ if [ -z "$APP" ] || [ -z "$ACTION" ]; then echo "Usage: $0 <appname> <up|down|mute>" exit 1 fi # Find PipeWire nodes that match the app name find_nodes() { pw-cli list-objects Node | awk -v app="$APP" ' /id [0-9]+/ {id=$2; mc=""; an=""; nd=""} /media.class/ {mc=$0} /application.name/ {an=$0} /node.description/ {nd=$0} # Apps: APP without spaces -> match application.name (app !~ /[ _]/) { if (id && index(tolower(an), tolower(app))>0 && mc ~ /Stream\/Output\/Audio/) print id } # Devices: APP with space/underscore -> match node.description (app ~ /[ _]/) { if (id && index(tolower(nd), tolower(app))>0 && mc ~ /Stream\/(Output|Input)\/Audio/) print id } ' | sort -u | tr -d ',' | tr -d ' ' } get_volume() { local node="$1" # Extract only the first number, remove all non-numbers vol=$(wpctl get-volume "$node" 2>/dev/null | grep -oE '[0-9]*\.[0-9]+' | head -n1) # Fallback if empty if [[ -z "$vol" ]]; then vol=0 fi # convert to percent pct=$(awk -v v="$vol" 'BEGIN { printf "%.0f", v*100 }') echo "$pct" } set_volume() { local node="$1" local percent="$2" if [ "$percent" -lt "$MIN" ]; then percent=$MIN; fi if [ "$percent" -gt "$MAX" ]; then percent=$MAX; fi linear=$(echo "scale=3; $percent / 100" | bc -l) wpctl set-volume "$node" "$linear" >/dev/null 2>&1 } adjust_volume() { local node="$1" if [ "$ACTION" = "mute" ]; then wpctl set-mute "$node" toggle echo "Node $node: mute toggled" return fi current=$(get_volume "$node") # Jump to the next STEP if [ "$ACTION" = "up" ]; then new=$((current + STEP)) else new=$((current - STEP)) fi set_volume "$node" "$new" final=$(get_volume "$node") echo "Node $node Volume: ${final}%" } # ---------------- MAIN ---------------- NODES=$(find_nodes) if [ -z "$NODES" ]; then echo "No audio nodes found for: $APP" exit 1 fi echo "Nodes found: $NODES" for N in $NODES; do adjust_volume "$N" done |