Toggle mute for audio Line In from Windows command line - audio

I'm looking for a way to mute/unmute audio Line-In from command line.
I'm trying to use NirCmd and so far to no avail.
I've tried the following:
This just toggles mute for all audio. I want to mute/unmute only the "Line In". (Reference: mutesysvolume)
nircmd.exe mutesysvolume 2 "Line In"
This does nothing in my case. (Reference: mutesubunitvolume)
nircmd.exe mutesubunitvolume "Speakers" "Line In" 2
My devices have generic names. I haven't changed them:
What am I doing wrong?

Related

Bash script udev play sound

I have a problem with my script. I added a rule which detect if a unique USB if plugged in. These part works fine. My idea was after I did some things on the stick, I make a sound so the user know when he can unplugged the stick.
I like to use espeak and tried it without the rule and it is working, but only without the trigger.
Here is my usb.sh:
echo "Pluged in" >>/tmp/usb.log
espeak "Backup done"
And here is the rule i added:
ACTION=="add",KERNEL=="sdb1", SUBSYSTEM=="block" ,ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1666" ,RUN+="/home/user/usb/usb.sh"

How to run selected text using keyboard shortcut joined together with a command in background?

I am trying to be able to select text anywhere within my manjaro linux system and run it along with a TTS text to speech program. The program is called google_speech and it got a really clear default voice and is really easy to use, however I am finding it hard to implement what I want to do with it...
The program is ran by the following command:
$ google_speech -l en "I am just a robot but one day I plan to rule humans"
so I am trying to be able to select text and press a keyboard shortcut and the text will automatically be importing here:
$ google_speech -l en "HERE"
and ran as a command in the background hopefully without having to open a terminal window but if so then thats totally fine... I was thinking xclip would be able to do this but I can figure out what command or options I need to be using... my research so farhas gotten me nowhere...
Thanks you so much for your time and skills...

How can I enter text into Launchy and append it to the end of a text file?

I'm a Debian Stretch user coming from Windows. In Windows with the launchy app (also available for Linux), I had a method of entering text into launchy that was then appended to the end of a .txt or .md file.
To do this in Windows, I created a file called note.bat that contained the following:
echo %*>>"C:\collectednotes.md"
I'd make launchy aware of note.bat by adding its containing folder to “Launchy” → “Settings” → “Catalog” and adding filetype *.bat.
From there, I'd launch launchy, type note, hit Tab, enter some text, hit Enter, and then the text would be added to the end of collectednotes.md.
A mostly working process is detailed in my answer below. I'll give the green checkmark answer to anyone that can adjust this process (via note.sh and/or launchy plugin setup detailed below) to appropriately handle all special characters.
This may contain the solution to this question:
Which characters need to be escaped in Bash? How do we know it?
Solved (almost). I'm keeping this question unanswered and will give to whoever completes the remaining ~5%. Steps to get the 95% solution with xfce4-terminal version 0.8.3-1:
Install launchy and launchy-plugins (both are version 2.5-4 for me):
apt-get install launchy
apt-get install launchy-plugins
Open terminal to default location of ~/ and create collectednotes.md:
echo "# Launchy Notes Collected Here" > collectednotes.md
Create note.sh shell script:
echo '#!/bin/sh' > note.sh
Create shell script line 2:
echo ALL_ARGUMENTS='"$#"' >> note.sh
Create shell script line 3:
echo 'echo "$ALL_ARGUMENTS" >> ~/collectednotes.md' >> note.sh
If you open note.sh, it will look like:
#!/bin/sh
ALL_ARGUMENTS="$#"
echo "$ALL_ARGUMENTS" >> ~/collectednotes.md
Make note.sh executable:
chmod +x note.sh
Launch launchy and click the gear icon in upper right for settings. If consistency with launchy for Windows is desired, set launchy Hotkey to Alt+Space. If you receive a keyboard shortcut conflict message as I do on Debian with Xfce, first go to Settings, Window Manager, Keyboard tab, and clear Alt+Space as the shortcut for Window operations menu.
Next in launchy settings, go to Plugins tab and enable the plugin Runner. Click the + button and create a new Runner custom command as follows:
- Name: note
- Program: /home/YOURUSERNAMEHERE/note.sh (launchy does not like Program path of ~/note.sh, so a specific path with username is required)
- Arguments: '$$'
Click the Catalog tab and hit Rescan Catalog just in case. Hit OK to close launchy settings.
Now let's test it.
- launch launchy with Alt+Space or your hotkey
- type note (You may have to wait 10 second or so on first run. You'll know things are as expected when you see the text "note" with a orange/yellow icon containing silhouette of a person.)
- hit Tab
- enter some text (no need for single or double quotes or escapes), e.g.: Remember to donate at least $3 to Josh at Launchy https://www.launchy.net/donate.php
- hit Enter
Now open collectednotes.md to confirm the text was captured.
The remaining issues seem to be dealing with single quotes and double quotes. For example, consider the following note:
I don't know what I'd do without Launchy.
Which results in the following in collectednotes.md:
I dont know what Id do without Launchy.
Or:
Would David Allen like universal text capture from anywhere in Linux? My bet is "yes!"
Results in the following in collectednotes.md:
Would David Allen like universal text capture from anywhere in Linux? My bet is \yes!\
Single quoting and/or double quoting the input to launchy doesn't solve it. Note the launchy Runner custom plugin construction component of '$$' is a piece of this puzzle.
I'll give the answer to anyone that can adjust this process (via note.sh and/or launchy plugin setup) to appropriately handle all special characters. Maybe this would add proper escapes to user input with something like gsub.
The rationale for being exacting regarding proper character handling is that this process is useful for copying and logging random chunks of text from web pages, but if common characters like single quotes are not handled as expected, confidence in the system is much reduced.

Linux text match beep

I want to have some utility that check my console output, and in case of some text match like "ERROR" make a beep or other type of event. Can somebody help me to find some?
Here's what I would do:
Redirect your output to a file.
Run a diff on that file versus the "truth data". See here on how to use diff in an if statement: Bash: using the result of a diff in a if statement
If diff returns nothing, play a sound. Details for sound playing can be found here: https://unix.stackexchange.com/questions/8607/how-can-i-play-a-sound-when-script-execution-is-ready
Good luck!
Go one step further and make a monitoring utility that will email you after an error. Your email program will have a lot of beeps and popups for alerts.

use of --output-fd parameter in dialog utility

I'm working on an embedded linux system; my console is a serial port and there is a VGA video output at /dev/tty0.
I am trying to use the 'dialog' (1) utility to display menu-like displays on the VGA screen.
I can get dialog output on the console:
dialog --inputbox "Hello Dialog World" 10 30
and I can get something similar on the VGA screen by redirection:
dialog --inputbox "Hello Dialog World" 10 30 >/dev/tty0
But I want to use the '--output-fd' parameter to dialog to achieve a similar result and I can't get it to work.
I've tried things in a bash script like:
exec 4>/dev/tty0
dialog --output-fd 4 --inputbox "Hello Dialog World" 10 30
exec 4>&-
but this seems to write to the console as previously.
I seem to be misunderstanding the operation of the --output-fd parameter - can anyone help?
(in actual fact, I want to use the python-dialog wrapper for dialog; but I need to understand how to use the underlying dialog utility before I take the next step)
Quote from the manual page:
Some widgets, e.g., checklist, will write text to dialog’s output.
Normally that is the standard error, but there are options for
changing this: "--out-put-fd", "--stderr" and "--stdout".
This means that the --output-fd option does not specify a file descriptor for any output but only for the data generated by some widgets.

Resources