LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-17-2018, 03:31 PM   #1
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,397
Blog Entries: 3

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Can't have this script working when launched from acpi event


Hi, I have a small script to mute sound . It works while launched from root but will fail when launched with acpi event.

Notification appears but sound will not be muted.

Any clue ?


The scipt :

Code:
#!/bin/bash

# get user running pulseaudio
user=$(ps aux | grep /usr/bin/pulse | grep -v grep | awk '{print $1}' | head -1)

# Get device name
device=$(su $user -c 'pactl list sinks' | grep -A1 RUNNING | grep Nom | sed -e s/Nom://g | sed 's/^[ \t]*//;s/[ \t]*$//' | awk -F ": " '{ print $2}')

# what to do
su $user -c 'pactl set-sink-mute '$device' toggle'

# notify action
su $user -c "DISPLAY=:0 /usr/bin/notify-send --expire-time=1000 'VOLUME MUTED' 'toggle'"

Last edited by Tonus; 12-17-2018 at 04:05 PM.
 
Old 12-17-2018, 05:03 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
maybe this might help
https://wiki.archlinux.org/index.php/acpid
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Xiaomi Redmi Y And MIUI 9 Launched | Xiaomi Launch Event Highlights LXer Syndicated Linux News 0 11-02-2017 05:50 PM
How to Run an event while another event is running in wxWidgets GUI? Sarathsankar Programming 11 10-24-2017 09:30 AM
Help me master ,i have error in my server "ACPI: resource (null) [io 0x0428-0x042f] conflicts with ACPI region" haswar Linux - Newbie 4 08-19-2016 07:41 AM
Print ID of important event which don't have associated click event raheel_com88 Linux - Server 1 05-31-2013 09:21 AM
Fire Event from other event in Visual C++ Express Edition chrisliando Programming 1 11-08-2007 05:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration