Simple mute script for softvol [ALSA]

I noticed that mute is not supported for softvol mixers in ALSA, so I made a simple script to emulate muting. The volume level is stored in volume.txt. I hope somebody finds this useful! This script changes the Master mixer by default.
mute.sh:
#!/bin/bash
var=$(amixer get Master | grep "Front Left:")
var=$(echo "$var" | sed -ne 's/^[^[]*\[\([^]]*\)\].*/\1/p')
if [ $var == "0%" ]
then
volume=`cat volume.txt`
amixer set 'Master' $volume
else
rm volume.txt
echo $var > volume.txt
amixer set 'Master' 0%
fi
You can bind it to mute hotkey for example with xbindkeys:
.xbindkeysrc:
#Mute
"/media/disk/programs/mute.sh"
m:0x0 + c:121
XF86AudioMute
(Change the file path accordingly)

nawitus wrote:That doesn't work for me.
you probably just need to tweak the options slightly. the toggle command simply switches playback off and on for a given control, so you just need to find the control that works on your system.
you can list the controls like this:
$ amixer scontrols
Simple mixer control 'Master',0
Simple mixer control 'Headphone',0
Simple mixer control 'PCM',0
Simple mixer control 'Front',0
on my system, only 'Master' and 'Front' can be used to mute the sound - but every system will differ slightly.
maybe something like this will work for you:
amixer set Front toggle

Similar Messages

  • Simple UCCX script for IVR,Welcome message then press 1 and press 2

    Dear Experts;
    I have uccx 10.5.
    I want to write a simple IVR script as below.
    Step-1- Welcome message.with press 1 for Sales and Press 2 for Marketing
    step-2   User Press 1 then transfer the call to Sales Skill Group.
    Step-3  User press 2 then transfer the call to  Marketing Skill group.
    My doubt is how to accept when user press 1 and match the value and then transfer the call to that skill group.
    Really appreciate any link or script for this.
    Regards
    Debashis

    Dear Martyn;
    Thanks a lot that was very nice and valuable information.
    just want to ask which palette i have to use to save the value 1 or 2 when user press 1 or 2.
    I know using Menu we can create different Menu option.
    After user press 1 it will go SALES skill group and if press 2 Go MARKETING Skill group.
    Appreciate if you can help me in this regard.
    Regards
    Debashis

  • Pywu: Simple python script for Weather Underground's API

    This is a script I wrote several years ago for use with conky. I've cleaned it up some and released it for anyone else who may like to use it. It allows you to pull data from Weather Underground's API.
    You need an API key from here to use it.
    Github repo is here: https://github.com/dh4/pywu
    An AUR package is here: https://aur.archlinux.org/packages/pywu/
    Let me know if you find it useful or have any issues with it.

    dibblethewrecker wrote:i really want to learn python - when ever i think about it i always feel to tired to start!
    just download diveintopython and the official documentation at python.org, that should keep you busy for a while,

  • Could someone please sketch out this simple script for me?

    Could someone please sketch out a simple java script for me. I will have a document with one background
    layer and a layer set (group) called "Analyze" that consists of 63 adjustment layers. The layer names in that "Analyze" group(folder) will be
    "01" ...through "63" with 01 on the bottom and 63 at the top. Initially, all of the adjustment layers will be invisible and  the
    group will be closed (not expanded). I need a simple  script that will check for the first invisible layer in that group
    and make it visible without selecting that layer nor expanding the group. The script has to check
    for the first invisible layer every time it runs because other actions may have turned off a layer in the set.
    The point of this is so I can hotkey flipping on the layers one at a time without expanding the set or
    changing focus off the  background. It seems it should be a simple loop, but I just can't wrap  my head
    around all the objects (e.g. Layer as opposed to Layers  and  Artlayer as opposed to Artlayers)
    and the constants constants.
    for (i = 63; i>0; i--){                 /* I have found layer indexes 0 are the topmost layer */
      if( layerset[i] == INVISIBLE){
               layerset[i] = VISIBLE;
                  break;
    Could someone please write me a simple script that would do this?
    Edit I found this and its very close to what I need:
    var doc = app.activeDocument;
    for(var i = 0 ; i < doc.layers.length;i++){
      doc.layers[i].visible = (i % 2 == 0);
    From here : Function to show/hide layer with Photoshop script (JSX) - Stack Overflow
    In my case I would rewrite it to this
    for(var i = 62; i >=0; i--){
         if(  !doc.layers[i].visible){
              doc.layers[i].visible =TRUE;
              break;
    My problem is I just need  to traverse the layers in my layerset "Analyze"
    How do  I reference just those? Is there a doc.layersets["Analyze"].layers[i].visible = TRUE?
    Message was edited by: Shawn Laughlin To add more information

    Well this works:
    var doc = app.activeDocument;
    var analyze = doc.layerSets.getByName("Analyze").layers
    for(var i = 62 ; i >= 0; i --){
        if (!analyze[i].visible){
            analyze[i].visible =1;
            break;
    Hard to believe TRUE is not a constant in java.

  • How to get SQL script for generating table, constraint, indexes?

    I'd like to get from somewhere Oracle tool for generating simple SQL script for generating table, indexes, constraint (like Toad) and it has to be Oracle tool but not Designer.
    Can someone give me some edvice?
    Thanks!
    m.

    I'd like to get from somewhere Oracle tool for
    generating simple SQL script for generating table,
    indexes, constraint (like Toad) and it has to be
    Oracle tool but not Designer.
    SQL Developer is similar to Toad and is an Oracle tool.
    http://www.oracle.com/technology/products/database/sql_developer/index.html

  • A simple "sudo" script

    Hi, I wrote a simple "sudo" script for people who prefer to use su rather than sudo.
    #!/bin/bash
    while [ -n "$1" ]
    do
    command="${command} $1"
    shift
    done
    su -c "$command"
    Usage:
    put it in /usr/sbin, then for example, do
    sudo pacman -Sy
    Password:
    enter root password
    Advantages:
    for those who don't like sudo, this sudo script is convenient for one line commands
    simple bash completion
    Hope you find it useful

    Xilon wrote:Couldn't you just do:
    alias sudo='su -c'
    That would require you to manually put ' ' around your command, and miss bash completion.
    mucknert wrote:Uh. sudo allows a much finer selection of rights. You can say what user or group is allowed to execute with its own password (or no password at all) instead of the root pw. That's a lot more than your script does and those are good reasons, too. Read up on sudo one day. You will be suprised.
    Thanks for your suggestion, I just had a quick read through sudo and sudoers. This is some stuff I found:
    The time stamp issue was never a big one, and you can configure the time or disable it. I find sudo -k useful too.
    I thought sudo might add security risk if the user password was compromised, but you can configure sudo to ask for the root password. However, this would defeat the purpose for those who disable root.
    I also have a questions: if you want to do access control, why would you prefer sudo over simple file permissions? Or is sudo primarily used as a finer access control scheme?
    Again, thanks for your advice, I really appreciate it. Please point out anything wrong with my questions. The manual was pretty long, so I'm bound to miss something.

  • Help with simple Automator script

    I have a simple Automator script for updating a specified folder with files from another folder. It consists of only two actions:
    1. Get Folder Contents (from the folder I drop on the Automator executable).
    2. Copy Finder Items.
    I left the option "replace existing files" unchecked because there's no point in replacing a bunch of files that already exist (we're talking about 4000-5000 files in the source folder).  I assumed that meant to ignore any existing files but, on the contrary, I found out that the script is copying duplicates of all the existing files -- making my target folder about 9000 files strong!
    How do I get a command into the middle of this script to restrict the Copy Finder Items command to files that do not already exist in the target folder? (It would be even nicer if it could check for files that are older than the files being copied and actually replace (only) those as well.)
    Any ideas?

    If you need the Terminal window to stay open, then you're looking at scripting Terminal. You can do this with Automator's run applescript action, or you can just use Script Editor (in Applications > AppleScript). Either way you will need to save the workflow/script as an application and drag it to your Login Items (in System Preferences > Accounts).
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "Terminal"
    activate
    set commands to "cd /Users/lenny/ventrilo/ 
    /Users/lenny/ventrilo/ventrilo_srv"
    do script commands in front window
    end tell</pre>
    PowerMac G5 (June 2004) 2x1.8GHz 1.25GB, PowerBook G4 (12-inch DVI) 1x1GHz 768MB   Mac OS X (10.4.3)  

  • NX-OS EEM script for SVI

    Hello, 
    I'm looking for a simple eem script for enabling an SVI if its goes down. we have some issue is NX-OS running 6.0.2.(1) where we occure a SVI down for itself.
    Regard
    Adil

    Unfortunately, this is not possible on NX-OS.  EEM on NX-OS is EEM by name only.  The feature is very different than it is on IOS.  What you could do is use an IOS box as a proxy.  That is, send a trap using EEM from your NX-OS box, then have IOS do the telnet to the other NX-OS box to perform the necessary commands.

  • Tool Bar script for generating Email

    Hi experts,
    I have made the following script for sending a custom email.
    And i've the required jar files in the ftp drive on the same server where E-sourcing is installed.
    If anyone can look at this code and tell me whats wrong with it, i'll be realy grateful .
    addClassPath("D:/FTPHOME/MailJar/activation.jar");
    addClassPath("D:/FTPHOME/MailJar/javac.mail.jar");
    addClassPath("D:/FTPHOME/MailJar/mail.jar");
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    // Recipient's email ID needs to be mentioned.
    String to = "Email add of recipient";
    // Sender's email ID needs to be mentioned
    String from = "Email add of sender";
    // Assuming you are sending email from localhost
    String host = "IP address of the host ";
    // Get system properties
    Properties properties = System.getProperties();
    // Setup mail server
    properties.setProperty("mail.smtp.host", host);
    // Get the default Session object.
    Session session1 = Session.getDefaultInstance(properties);
    // Create a default MimeMessage object.
    MimeMessage message = new MimeMessage(session1);
    // Set From: header field of the header.
    message.setFrom(new InternetAddress(from));
    // Set To: header field of the header.
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress(to));
    // Set Subject: header field
    message.setSubject("This is the Subject Line!");
    // Now set the actual message
    message.setText("This is actual message");
    // Send message
    try{
    Transport.send(message);
    catch(Exception e)
    print(e);
    Thanks,
    Abhijit

    I'd like to get from somewhere Oracle tool for
    generating simple SQL script for generating table,
    indexes, constraint (like Toad) and it has to be
    Oracle tool but not Designer.
    SQL Developer is similar to Toad and is an Oracle tool.
    http://www.oracle.com/technology/products/database/sql_developer/index.html

  • HELP!! Need a script for DUMMIES for a simple login/register feature

    I know very little html and am more of a designer, but my programmer has let me me down so I have to take this on myself.
    I want to include a very common feature where visitors register to my site, so I can collect some information and contact details from them, then they can access hidden pages of the site and receive some exclusive download links by email, allowing them to download content (only once). They can then login each time they visit with a userID or email and a password.
    My host supports almost every scripting language.
    I've been told PHP is what I need, but I know absolutley nothing about it. My host said there is templates for such a simple script out there on the net for free but I'm being passed from pillar to post with scripts for much more complicated and rarer scripts than I need.
    Hope you can help.
    LB

    Do I need to create a database to store users info first?
    Yes. Without a database, it won't work.
    Is this a basic html page with a table with lots and lots or rows and columns for each of the details they have entered (e.g Name, DOB, Address.....etc)??
    No, I'm afraid not. Dreamweaver's PHP server behaviors work in conjunction with the MySQL database. If your hosting company supports PHP, you will almost certainly have access to a MySQL database and phpMyAdmin, a web-based program that helps create and maintain MySQL databases. As a minimum, your users table in the database will need three columns:
    user_id (a number that acts as the primary key for each record)
    username
    password
    You can also have other columns to store other details, such as first name, family name, and any other information that you want to store.
    If you have never done any PHP or database development before, this is going to be a major undertaking for you. The Adobe Developer Centre has some articles that show you how to set up a PHP/MySQL testing environment (http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html) and create your first database-driven pages (http://www.adobe.com/devnet/dreamweaver/articles/php_event_registration.html). The Dreamweaver help files also step you through the process of creating a login system (http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WScbb6b82af5544594822510a94ae8d65-7883a .html).
    Working with PHP/MySQL isn't difficult, but there's a lot to absorb. If you're going to start working with login systems and other database-driven features, you might find it useful to take a look at one of my books about Dreamweaver and PHP. I have different editions for Dreamweaver 8, CS3, and CS4. You can find more details at my website (http://foundationphp.com/).
    Good luck.

  • A simple script for you, a giant script for me-

    I like scripts very much but scripting does not seems to like me! Can anyone help me and write a script for me? What I need is this:
    1. Ungroup everything in a spread
    2. A loop that goes through every text frame in the spread and, at the end of the text contained in each of those frames inserts a blank paragraph. (The frames contains text and inline graphics)
    This may seems strange but is what I need.
    Best regards and thank you in advance
    Maria

    I like scripts very much but scripting does not seems to like me! Can anyone help me and write a script for me? What I need is this:
    It's much easier for you to show us what you have and then we'll fix it for you or tell you what is wrong. Then you'll learn something to!
    1. Ungroup everything in a spread 
    This one's easy -- unless you're worried about groups inside groups?
    app.activeWindow.activeSpread.groups.everyItem().ungroup()
    If it's groups all-the-way-down, on the other hand, well, it might be more than one line...

  • Anybody who wants to create a  small and simple Script for me?

    Hi,
    I am kind of new to Mac and totally AppleScript illiterate, but maybe there is a kind soul amongst all of you that can create an "easy" script for me?
    Well, here it goes:
    Every time I boot up my iMac, two things happen, the first is that I programed the "System Preferences" window to open automatically and display the "Energy Saver" section on the "Sleep" sub-section, so far so good and the second thing is that no matter what I have tried to avoid it, the "Customize" window for a program named "Butler" opens also.
    Now for the request:
    I would like the "System Preference window which displays the Energy Saver section" to change from "Sleep" to "Options" and while being there(in options), to tick(select) AND UN-tick(Un-select) immediately after the "Automatically reduce the brightness of the display before display sleep" Option.
    After doing all of this, the window should be closed.
    Now, is it possible to create a Script that performs all of the above and besides closes the "Butler" window afterwards?
    I know I am asking too much, but I know too that maybe there is someone with a heart of gold and the sufficient knowledge to help me.
    Thanks a lot
    Enrique Diazruanova

    ... Every time I boot up my iMac, two things happen, the first is that I programed the "System Preferences" window to open automatically and display the "Energy Saver" section on the "Sleep" sub-section, so far so good and the second thing is that no matter what I have tried to avoid it, the "Customize" window for a program named "Butler" opens also ...
    From your initial post, it appears that you have the Butler application running and have used it to access one of the Energy Saver opptions already. I don't have that particular application or a laptop to test, but if you've gotten it to access one option it should be able to access another one.

  • ITunes Mute Script

    Will someone please write an AppleScript that can mute iTunes for varying periods I specify (from 1 to 15 minutes)? Or is there a simpler approach I should request with Automator, or something else?
    Thanks!

    Oops, looks like streams don't pause, they stop. Here is an updated script that handles streams (I also added more error correction and tweaked the idle handling):
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto">-- pause iTunes playback
    property TimeDelay : 30 -- the number of seconds to delay
    global TimerStarted, IdleTime, InitialState, InitialTrack
    on run
    set TimerStarted to false
    tell application "iTunes"
    set InitialState to player state
    if InitialState is not playing then -- don't do anything if it's not running
    set TimerStarted to true
    set IdleTime to 1
    return
    end if
    set InitialTrack to current track
    end tell
    try
    activate me
    display dialog "Enter the number of seconds to pause:" default answer (TimeDelay as text) buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" with title "iTunes Pause"
    set ValueReturned to (text returned of the result) as integer
    if ValueReturned is greater than 5 then set TimeDelay to ValueReturned
    on error number ErrorNumber
    if ErrorNumber is -128 then -- user cancelled
    set TimerStarted to true
    set IdleTime to 1
    return
    end if
    end try
    tell application "iTunes"
    if InitialState is playing then playpause
    end tell
    end run
    on idle
    if TimerStarted then
    if IdleTime is 1 then
    quit
    else
    set IdleTime to 1 --  reset the idle to prevent a delay when quitting
    end if
    else
    set TimerStarted to true
    set IdleTime to TimeDelay - 1
    end if
    return IdleTime
    end idle
    on quit
    tell application "iTunes"
    if (InitialState is playing) and (player state is in {stopped, paused}) then
    if the kind of the current track contains "stream" then
    play InitialTrack
    else
    playpause
    end if
    end if
    end tell
    continue quit
    end quit
    </pre>

  • Creating SQL-Loader script for more than one table at a time

    Hi,
    I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
    It looks like I can create SQL-Loader scripts for all the tables
    or for one table at a time. If I want to create SQL-Loader
    scripts for 5-6 tables, I have to either create script for all
    the tables and then delete the unwanted tables or create the
    scripts for one table at a time and then merge them.
    Is there a simple way to create migration scripts for more than
    one but not all tables at a time?
    Thanks,
    Prashant Rane

    No there is no multi-select for creating SQL-Loader scripts.
    You can either create them separately or create them all and
    then discard the one you do not need.

  • Simple button script not working

    I am using AS2 and need help figuring out why this simple button script is not working:
    stop();
    buttonWS1.onRelease = function(){
                        gotoAndStop("Stage1and2_Boss",4);
    buttonWS2.onRelease = function(){
                        nextFrame();
    //end
    My buttons are the square letter-puzzles below. They are images that I converted to "symbols" (specifically, buttons). I put their names as above (buttonWS1, buttonWS2, etc.) in the "instance names" boxes.
    I have no idea what is going on. Please help!

    Hi -
    1. Yes, buttonWS2 is the instance name
    2. The only code attached to it is the code I pasted above.
    3. onRelease does not execute because my trace statement does not appear in the output
    Here is the modified code for buttonWS2:
    buttonWS2.onRelease = function(){
                        trace("clicked!");
                        nextFrame();
    Question: It shouldn't matter if I have commented-out code within that set of codes should it?:
    buttonWS2.onRelease = function(){
              //if (puzzleschosenarray[0] == 2 || puzzleschosenarray[1] == 2) {
              // cannot be chosen -- make button non-functional
              //else{
                        //puzzleschosenarray[roundnumber-1] = 2;
                        trace("clicked!");
                        nextFrame();

Maybe you are looking for

  • IChat will not let me log in

    When I got home last night, not logging on for hours. Ichat said i have been trying to login too often in a short period of time, wait a few minutes then try logging in. Okay, so I waited about 30 minutes and still is saying that. When I woke up this

  • Ever Hear of a "CC.0 Document"?

    Here's the sad story: I was downsized from my Graphic Designer job last fall. It seemed like a good time to get out on my own, but perhaps it wasn't. At work we were updated to the CC environment, but at home I was still using CS 3.0 for  freelance w

  • Receiving an 'Error formatting cross-tab object' error when paging through preview

    I have a report with two subreports in the group footer.  One of the subreports contains a cross-tab report.  When I preview the report as a whole, occasionally I get an error formatting cross-tab object and then no more pages of the report are displ

  • Merge modules for Business Objects XI service pack 4

    I am in the process of developing a deployment package in Installshield 2009 - Basic MSI Project.  I tried adding the merge modules I downloaded earlier from the web page, http://support.businessobjects.com/downloads/runtime.asp Currently I do not se

  • Two problems with video

    Can FCE edit MKV files? or is there a GOOD format converter that anyone would recommend. Most of the ones I have tried (on a PC I have to admit) produce banding and video artefacts. Second question: All my video plays fine on a PC but much of it has