You are not logged in.

#1 2008-01-23 14:18:38

bionnaki
Member
Registered: 2006-09-05
Posts: 289

help with a conky script

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

#2 2008-01-23 14:46:07

lzs
Member
Registered: 2008-01-23
Posts: 39

Re: help with a conky script

#!/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. smile

Offline

#3 2008-01-23 14:54:44

zyghom
Member
From: Poland/currently Africa
Registered: 2006-05-11
Posts: 432
Website

Re: help with a conky script

small things make me extremely happy ;-)


Zygfryd Homonto

Offline

#4 2008-01-23 22:43:43

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: help with a conky script

lzs wrote:

#!/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. smile

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

#5 2008-01-23 23:43:30

_adam_
Member
From: Dora, Alabama
Registered: 2006-05-18
Posts: 94

Re: help with a conky script

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

#6 2008-01-24 10:58:17

lzs
Member
Registered: 2008-01-23
Posts: 39

Re: help with a conky script

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

#7 2008-01-24 13:04:47

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: help with a conky script

working great - thanks everyone.

v2v0v9.png

Offline

#8 2008-01-24 22:09:09

Sjoden
Member
From: WA
Registered: 2007-08-16
Posts: 380
Website

Re: help with a conky script

Could you show us your finished script?

Offline

#9 2008-01-25 11:12:36

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: help with a conky script

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

#10 2008-05-15 20:48:23

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: help with a conky script

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

#11 2008-05-15 23:06:12

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: help with a conky script

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

#12 2008-08-20 18:46:56

semperfiguy
Member
Registered: 2007-12-03
Posts: 224

Re: help with a conky script

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

#13 2008-08-21 05:20:39

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: help with a conky script

Thanks for the pacman sync script link bionnaki !!

I was looking around for something like that !


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#14 2008-08-21 05:22:37

arch0r
Member
From: From the Chron-o-John
Registered: 2008-05-13
Posts: 597

Re: help with a conky script

me too and the weather script is also awesome. just upgraded my .conkyrc file smile

Offline

#15 2008-08-29 15:22:55

baghera
Member
Registered: 2007-08-26
Posts: 19

Re: help with a conky script

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 smile

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

#16 2009-01-28 11:26:23

barzam
Member
From: Sweden
Registered: 2009-01-27
Posts: 277

Re: help with a conky script

I am using $mixerbar for a bar showing the volume, works great!

Offline

#17 2010-03-19 12:09:08

Ventil1
Member
Registered: 2010-03-17
Posts: 140

Re: help with a conky script

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 smile

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

#18 2010-04-07 14:03:46

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: help with a conky script

Ventil1 wrote:
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 smile

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

#19 2010-11-09 12:38:58

FlawS
Member
Registered: 2010-11-08
Posts: 1

Re: help with a conky script

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 ? smile

Offline

#20 2010-11-09 13:42:38

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: help with a conky script

FlawS wrote:

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 ? smile

Seach for mixer (device) in man conky

Offline

#21 2010-11-09 13:48:47

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: help with a conky script

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

Board footer

Powered by FluxBB