You are not logged in.
Pages: 1
Topic closed
I'd like my conky to echo alsamixer's volume level (pcm), but I am new to writing scripts. not exactly sure how I can do this. any tips?
thanks
Offline
#!/bin/sh
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}'`
echo Vol $vol
Dirty, but it works. Just exchange "Master" with "PCM" and use the exec command in conky's config.
However i'd be happy to have a more efficient script, too.
Offline
small things make me extremely happy ;-)
Zygfryd Homonto
Offline
#!/bin/sh
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}'`
echo Vol $volDirty, but it works. Just exchange "Master" with "PCM" and use the exec command in conky's config.
However i'd be happy to have a more efficient script, too.
that works great - thank you very much.
however, the changes are not close enough to real time. there is a delay of about 5-6 seconds before conky reflects the change in volume. I have the update_interval in .conkyrc set to 1 and I am using this:
Volume: ${texeci 1 /home/bionnaki/scripts/vol.sh}
but yet, there is still a delay. can anything to be modified to change this...or is this simply a limitation of conky?
edit: the volume seems to be echoing faster now. the delay is about 2 seconds and that's acceptable.
how would 0% be echoed as [Mute]
Last edited by bionnaki (2008-01-23 23:26:03)
Offline
how would 0% be echoed as [Mute]
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}'`
if [ $vol == "[0%]" ]
then
echo "[Mute]"
else
echo Vol $vol
fi
Offline
the delay is about 2 seconds and that's acceptable.
Have you tried the plain exec command? On my machine it's faster than texeci.
Offline
working great - thanks everyone.
Offline
sure.
.conkyrc =
# set to yes if you want Conky to be forked in the background
background no
cpu_avg_samples 2
net_avg_samples 2
#out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont snap:Bold:size=10
own_window_colour 222222
# Text alpha when using Xft
xftalpha 0.8
# Update interval in seconds
update_interval 2
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar
own_window_type desktop
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 300
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders no
# border margins
border_margin 3
# border width
border_width 3
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
alignment top_left
#alignment bottom_left
#alignment bottom_right
#alignment top_right
# Gap between borders of screen and text
gap_x 3
gap_y 3
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# boinc (seti) dir
# seti_dir /opt/seti
TEXT
${font Arial-size=10}┌─${font}${color FA07CC}[${color} Archlinux + Openbox ${kernel}
${font Arial-size=10}├────${font}[ CPU: ${cpu}%
${font Arial-size=10}├────${font}[ RAM: ${mem}
${font Arial-size=10}├────${font}[ Uptime: ${uptime}
${font Arial-size=10}├────${font}[ Download: ${downspeed eth0} k/s
${font Arial-size=10}├────${font}[ Upload: ${upspeed eth0} k/s
${font Arial-size=10}└────${font}[ ${texeci 43200 perl ~/scripts/conky-updates.pl}
${font Arial-size=10}┌─${font}${color FA07CC}[ ${color}Disk
${font Arial-size=10}├────${font}[ Root: ${fs_used /}/${fs_size /}
${font Arial-size=10}├────${font}[ Home: ${fs_used /home}/${fs_size /home}
${font Arial-size=10}└────${font}[ Media: ${fs_used /media/disk}/${fs_size /media/disk}
${font Arial-size=10}┌─${font}${color FA07CC}[${color} Music
${font Arial-size=10}├────${font}[ Volume: ${execi 2 ~/scripts/vol.sh}
${font Arial-size=10}└────${font}[ ${execi 5 ~/scripts/moc.sh | fold -w200 -s}
${font Arial-size=10}┌─${font}${color FA07CC}[${color} Local
${font Arial-size=10}├────${font}[ Chicago: ${execi 300 ~/scripts/weather.sh 60647}
${font Arial-size=10}└────${font}[ ${time %A %B %d %Y}
scripts used =
volume from this thread [thanks again]
pacman sync
moc script
and weather script by buttons
Last edited by bionnaki (2008-01-25 12:43:47)
Offline
Hey, this is exactly what I was looking for....is there a way to make it display just the percentage without the brackets ?
Last edited by moljac024 (2008-05-15 22:17:57)
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Got it! Not sure how clean it is though....
#!/bin/sh
vol=`amixer get Front | grep "Front Left:" | awk '{print $5}' | grep -oE "[[:digit:]]{1,}"`
echo $vol
I had to use grep in the end, just couldn't figure out how to filter it in awk, it's midnight for crying out loud! :-D Will try tomorrow or the next chance I have some free time..
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Ran across this thread and was almost exactly what I was looking for. Changed slightly to recognize when the volume is toggled off, and removed the brackets.
#!/bin/bash
mute=`amixer get Master | grep "Front Left:" | awk '{print $7}'`
if [ $mute == "[on]" ]
then
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]'`
if [ $vol == "0%" ]
then
echo "Mute"
else
echo $vol
fi
else
echo "Mute"
fi
[semperfiguy: ~]$ volumeLevel.sh
49%
Offline
Thanks for the pacman sync script link bionnaki !!
I was looking around for something like that !
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
me too and the weather script is also awesome. just upgraded my .conkyrc file
Offline
i just compiled conky 1.6.1 and browsing the sources i found a new variable (still not documented): mixer
so ${mixer} in conkyrc returns percent value of mixer main channel, and it's a lot faster than using a script
bye!!
EDIT: looking at this page
http://conky.sourceforge.net/changelog.html
i found that mixer variables have been added on 2004-07-05 ! don't know why I can't find it in the docs...
Last edited by baghera (2008-08-29 15:35:08)
Offline
I am using $mixerbar for a bar showing the volume, works great!
Offline
i just compiled conky 1.6.1 and browsing the sources i found a new variable (still not documented): mixer
so ${mixer} in conkyrc returns percent value of mixer main channel, and it's a lot faster than using a script
bye!!
EDIT: looking at this page
http://conky.sourceforge.net/changelog.html
i found that mixer variables have been added on 2004-07-05 ! don't know why I can't find it in the docs...
${mixer} doesn't return percent for me. How did you do it?
Offline
baghera wrote:i just compiled conky 1.6.1 and browsing the sources i found a new variable (still not documented): mixer
so ${mixer} in conkyrc returns percent value of mixer main channel, and it's a lot faster than using a script
bye!!
EDIT: looking at this page
http://conky.sourceforge.net/changelog.html
i found that mixer variables have been added on 2004-07-05 ! don't know why I can't find it in the docs...
${mixer} doesn't return percent for me. How did you do it?
As of conky 1.8.0 ${mixer} now returns a percentage. As a related note, ${mixerbar} doesnt report the correct value anymore... see bug ID: 2980280 on the conky tracker for more details. The quick and dirty patch by ichelm610x works fine for now.
BTW: This post really is too old to be digging up again...
Offline
Hi everyone.
I'd like to display on my conky the microphone's volume level : external and internal microphone's. Is that possible ? And if it is, please how ?
Offline
I'd like to display on my conky the microphone's volume level : external and internal microphone's. Is that possible ? And if it is, please how ?
Seach for mixer (device) in man conky
Offline
Welcome to the forums FlawS. Please read our Forum Etiquette, especially the part about Necro-Bumping. If you have a question, start a new thread and link to the old if relevant.
Closing.
ᶘ ᵒᴥᵒᶅ
Offline
Pages: 1
Topic closed