All of lore.kernel.org
 help / color / mirror / Atom feed
* vi-like key bindings for alsamixer
@ 2009-04-01 19:58 Simon Hengel
  2009-04-01 19:58 ` [PATCH - alsa-utils] Added vi-like key bindings to alsamixer Simon Hengel
  2009-04-02  6:56 ` vi-like key bindings for alsamixer Clemens Ladisch
  0 siblings, 2 replies; 7+ messages in thread
From: Simon Hengel @ 2009-04-01 19:58 UTC (permalink / raw)
  To: alsa-devel

Hello List,
I realized that 'j' and 'k' are not used nor reserved for future use
with alsamixer. So I decided to use them as aliases for 'up' and 'down'.
Is this deemed suitable for the masses?

Cheers,
Simon Hengel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH - alsa-utils] Added vi-like key bindings to alsamixer.
  2009-04-01 19:58 vi-like key bindings for alsamixer Simon Hengel
@ 2009-04-01 19:58 ` Simon Hengel
  2009-04-02  6:56 ` vi-like key bindings for alsamixer Clemens Ladisch
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Hengel @ 2009-04-01 19:58 UTC (permalink / raw)
  To: alsa-devel; +Cc: Simon Hengel

* Added 'j' as an alias for KEY_DOWN
* Added 'k' as an alias for KEY_UP

Signed-off-by: Simon Hengel <simon.hengel@gmx.net>

diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c
index 414033e..c65c22d 100644
--- a/alsamixer/alsamixer.c
+++ b/alsamixer/alsamixer.c
@@ -2113,11 +2113,13 @@ mixer_iteration (void)
 	mixer_hscroll_delta -= 1;
 	break;
       case KEY_UP:
+      case 'k':
       case 'w':
       case 'W':
 	mixer_vscroll_delta -= 1;
 	break;
       case KEY_DOWN:
+      case 'j':
       case 'x':
       case 'X':
 	mixer_vscroll_delta += 1;
@@ -2179,12 +2181,14 @@ mixer_iteration (void)
 	break;
       case 'w':
       case KEY_UP:
+      case 'k':
         mixer_set_delta(1);
       case 'W':
         mixer_add_delta(1);
 	break;
       case 'x':
       case KEY_DOWN:
+      case 'j':
         mixer_set_delta(-1);
       case 'X':
         mixer_add_delta(-1);
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: vi-like key bindings for alsamixer
  2009-04-01 19:58 vi-like key bindings for alsamixer Simon Hengel
  2009-04-01 19:58 ` [PATCH - alsa-utils] Added vi-like key bindings to alsamixer Simon Hengel
@ 2009-04-02  6:56 ` Clemens Ladisch
  2009-04-02 15:50   ` Simon Hengel
  1 sibling, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2009-04-02  6:56 UTC (permalink / raw)
  To: Simon Hengel; +Cc: alsa-devel

Simon Hengel wrote:
> I realized that 'j' and 'k' are not used nor reserved for future use
> with alsamixer. So I decided to use them as aliases for 'up' and 'down'.

But 'h' and 'l' are already used for other purposes, so these keys
cannot be used to give a consistent vi-like behaviour.

> Is this deemed suitable for the masses?

_Undocumented_ commands certainly aren't.  ;-)


Best regards,
Clemens

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: vi-like key bindings for alsamixer
  2009-04-02  6:56 ` vi-like key bindings for alsamixer Clemens Ladisch
@ 2009-04-02 15:50   ` Simon Hengel
  2009-04-02 16:05     ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Simon Hengel
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Hengel @ 2009-04-02 15:50 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Thu, Apr 02, 2009 at 08:56:21AM +0200, Clemens Ladisch wrote:
> > Is this deemed suitable for the masses?
> 
> _Undocumented_ commands certainly aren't.  ;-)
This is certainly true.

While working on documentation I realized that '+' and KEY_UP, contrary
to what is documented, do different things.

'+' increases volume by 1% whereas KEY_UP increases volume by 2%.

So actually it is like:

W | +           increase volume by 1%
w | KEY_UP      increase volume by 2%
X | -           decrease volume by 1%
x | KEY_DOWN    decrease volume by 2%

Still this makes no difference with my hardware, as the granularity is >
3% (e.g. snd_mixer_selem_get_playback_volume_range gives {0, 31} or {0,
15} for {min, max}).

I wonder if it would be a good idea to unify it. Consequently one could
do the same for left & right levels.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys.
  2009-04-02 15:50   ` Simon Hengel
@ 2009-04-02 16:05     ` Simon Hengel
  2009-04-02 16:05       ` [PATCH - alsa-utils 2/2] alsamixer - unified behavior of volume keys for left & right levels Simon Hengel
  2009-04-20 12:56       ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Takashi Iwai
  0 siblings, 2 replies; 7+ messages in thread
From: Simon Hengel @ 2009-04-02 16:05 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Simon Hengel

Contrary to what is documented '+' and KEY_UP did not the same thing.
The behavior was as follows:

W | +           increase volume by 1%
w | KEY_UP      increase volume by 2%
X | -           decrease volume by 1%
x | KEY_DOWN    decrease volume by 2%

Now all of them change the volume by only 1%.

Signed-off-by: Simon Hengel <simon.hengel@gmx.net>

diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c
index 414033e..554326f 100644
--- a/alsamixer/alsamixer.c
+++ b/alsamixer/alsamixer.c
@@ -1916,15 +1916,6 @@ mixer_set_delta(int delta)
     mixer_volume_delta[grp] = delta;
 }
 
-static void
-mixer_add_delta(int delta)
-{
-  int grp;
-  
-  for (grp = 0; grp < 2; grp++)
-    mixer_volume_delta[grp] += delta;
-}
-
 static int
 mixer_iteration (void)
 {
@@ -2172,22 +2163,16 @@ mixer_iteration (void)
         mixer_set_delta(-100);
 	break;
       case '+':
-        mixer_set_delta(1);
-	break;
-      case '-':
-        mixer_set_delta(-1);
-	break;
       case 'w':
+      case 'W':
       case KEY_UP:
         mixer_set_delta(1);
-      case 'W':
-        mixer_add_delta(1);
 	break;
+      case '-':
       case 'x':
+      case 'X':
       case KEY_DOWN:
         mixer_set_delta(-1);
-      case 'X':
-        mixer_add_delta(-1);
 	break;
       case '0':
       case '1':
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH - alsa-utils 2/2] alsamixer - unified behavior of volume keys for left & right levels.
  2009-04-02 16:05     ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Simon Hengel
@ 2009-04-02 16:05       ` Simon Hengel
  2009-04-20 12:56       ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Hengel @ 2009-04-02 16:05 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Simon Hengel

Contrary to what is documented 'q', 'e', 'z' and 'c' did different
things as there upper case counterparts. The lower case versions
changed volume by 2%, whereas the upper case commands changed volume by
1%.

Now all of them change the volume by only 1%.

Signed-off-by: Simon Hengel <simon.hengel@gmx.net>

diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c
index 554326f..51cd97e 100644
--- a/alsamixer/alsamixer.c
+++ b/alsamixer/alsamixer.c
@@ -2187,26 +2187,22 @@ mixer_iteration (void)
 	mixer_volume_absolute = 10 * (key - '0');
 	break;
       case 'q':
-	mixer_volume_delta[MIXER_CHN_LEFT] = 1;
       case 'Q':
-	mixer_volume_delta[MIXER_CHN_LEFT] += 1;
+	mixer_volume_delta[MIXER_CHN_LEFT] = 1;
 	break;
       case 'y':
       case 'z':
-	mixer_volume_delta[MIXER_CHN_LEFT] = -1;
       case 'Y':
       case 'Z':
-	mixer_volume_delta[MIXER_CHN_LEFT] += -1;
+	mixer_volume_delta[MIXER_CHN_LEFT] = -1;
 	break;
       case 'e':
-	mixer_volume_delta[MIXER_CHN_RIGHT] = 1;
       case 'E':
-	mixer_volume_delta[MIXER_CHN_RIGHT] += 1;
+	mixer_volume_delta[MIXER_CHN_RIGHT] = 1;
 	break;
       case 'c':
-	mixer_volume_delta[MIXER_CHN_RIGHT] = -1;
       case 'C':
-	mixer_volume_delta[MIXER_CHN_RIGHT] += -1;
+	mixer_volume_delta[MIXER_CHN_RIGHT] = -1;
 	break;
       case 'm':
       case 'M':
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys.
  2009-04-02 16:05     ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Simon Hengel
  2009-04-02 16:05       ` [PATCH - alsa-utils 2/2] alsamixer - unified behavior of volume keys for left & right levels Simon Hengel
@ 2009-04-20 12:56       ` Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2009-04-20 12:56 UTC (permalink / raw)
  To: Simon Hengel; +Cc: alsa-devel

At Thu,  2 Apr 2009 18:05:29 +0200,
Simon Hengel wrote:
> 
> Contrary to what is documented '+' and KEY_UP did not the same thing.
> The behavior was as follows:
> 
> W | +           increase volume by 1%
> w | KEY_UP      increase volume by 2%
> X | -           decrease volume by 1%
> x | KEY_DOWN    decrease volume by 2%
> 
> Now all of them change the volume by only 1%.

Then rather fix the man page?


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-20 12:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-01 19:58 vi-like key bindings for alsamixer Simon Hengel
2009-04-01 19:58 ` [PATCH - alsa-utils] Added vi-like key bindings to alsamixer Simon Hengel
2009-04-02  6:56 ` vi-like key bindings for alsamixer Clemens Ladisch
2009-04-02 15:50   ` Simon Hengel
2009-04-02 16:05     ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Simon Hengel
2009-04-02 16:05       ` [PATCH - alsa-utils 2/2] alsamixer - unified behavior of volume keys for left & right levels Simon Hengel
2009-04-20 12:56       ` [PATCH - alsa-utils 1/2] alsamixer - unified behavior of volume control keys Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.