Comments (2)
Sorry, I haven't used this script in a while and am unable to help :(
from dotfiles.
@mnissov It's pretty easy.
You need to chande that 5 line to this
my $sink=$ARGV[0];
Because in if statement 0 == false
thats the reason why it died.
Also at the end is missing exit command.
So after 43 line we need to exit 0;
So in the end whole script will look like
#!/usr/bin/env perl
## The sink we are interested in should be given as the
## 1st argument to the script. (No die because 0 is allowed)
my $sink=$ARGV[0];
## If the script has been run with a second argument,
## that argument will be the volume threshold we are checking
my $volume_limit=$ARGV[1]||undef;
## Run the pactl command and save the output in
## ther filehandle $fh
open(my $fh, '-|', 'pactl list sinks');
## Set the record separator to consecutive newlines (same as -000)
## this means we read the info for each sink as a single "line".
$/="\n\n";
## Go through the pactl output
while (<$fh>) {
## If this is the sink we are interested in
if (/#$sink/) {
## Extract the current colume of this sink
/Volume:.*?(\d+)%/;
my $volume=$1;
## If the script has been run with a second argument,
## check whether the volume is above or below that
if ($volume_limit) {
## If the volume os greater than or equal to the
## value passed, print "y"
if ($volume >= $volume_limit) {
print "y\n";
exit 0;
}
else {
print "n\n";
exit 1;
}
}
## Else, if the script has been run with just one argument,
## print the current volume + exit
else {
print "$volume%\n";
exit 0;
}
}
}
Buala. Enjoy working volume 🙂
from dotfiles.
Related Issues (20)
- Todo
- Rofi
- Compton
- Fix Tty Resoloution and Font HOT 1
- Put VPN Status in the Bar HOT 3
- Confugre Custom DNS
- Change Default Output Device HOT 1
- i3blocks.conf - volume command script HOT 3
- How can I install your .dotfiles? HOT 2
- what is the `jump` command HOT 3
- Having issues getting rofi theming to work HOT 2
- What colorscheme for editor
- Rofi customization is not working now
- Rxvt Has the Most Hideous Border HOT 4
- Certain Font Awesome Characters Do Not Render at All on Arch.
- Need a Better Screenshot Tool HOT 4
- GNOME Keyring Shouldn't Need Me to Enter My Password Every Time I Login
- Enable Media Keys via Playerctl
- Dunst
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotfiles.