unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* query: remapping a mouse press
@ 2018-08-23 20:58 allan gottlieb
  2018-08-23 23:08 ` Tak Kunihiro
  2018-08-26 18:10 ` hw
  0 siblings, 2 replies; 10+ messages in thread
From: allan gottlieb @ 2018-08-23 20:58 UTC (permalink / raw)
  To: help-gnu-emacs

I am having trouble enabling mouse-wheel-tilt-scroll

Currently I have

    mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
    Its value is t
    Original value was nil

Possibly it is because my logitech mouse has many buttons and tilting
the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
variations on

   (define-key global-map <mouse-6> 'scroll-left)

but with no success.

Any help would be appreciated.

thanks,
allan

PS emacs 26.1



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

* Re: query: remapping a mouse press
  2018-08-23 20:58 query: remapping a mouse press allan gottlieb
@ 2018-08-23 23:08 ` Tak Kunihiro
       [not found]   ` <87h8jkzaw2.fsf@nyu.edu>
  2018-08-26 18:10 ` hw
  1 sibling, 1 reply; 10+ messages in thread
From: Tak Kunihiro @ 2018-08-23 23:08 UTC (permalink / raw)
  To: allan gottlieb; +Cc: help-gnu-emacs, tkk

> I am having trouble enabling mouse-wheel-tilt-scroll
>
> Currently I have
>
>     mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
>     Its value is t
>     Original value was nil
>
> Possibly it is because my logitech mouse has many buttons and tilting
> the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
> and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
> variations on
>
>    (define-key global-map <mouse-6> 'scroll-left)

Disable mouse-wheel-mode by `M-x mouse-wheel-mode' then see if tilting
gives `<wheel-right> is undefined' or `<wheel-left> is undefined'.  If
not, configure Logitech mouse.

Following is not necessary.

    (define-key global-map [mouse-6] 'mwheel-scroll)



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

* Re: query: remapping a mouse press
       [not found]   ` <87h8jkzaw2.fsf@nyu.edu>
@ 2018-08-25  5:15     ` Tak Kunihiro
  2018-08-25 15:38       ` allan gottlieb
  0 siblings, 1 reply; 10+ messages in thread
From: Tak Kunihiro @ 2018-08-25  5:15 UTC (permalink / raw)
  To: gottlieb; +Cc: help-gnu-emacs

>>> I am having trouble enabling mouse-wheel-tilt-scroll
>>>
>>> Currently I have
>>>
>>>     mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
>>>     Its value is t
>>>     Original value was nil
>>>
>>> Possibly it is because my logitech mouse has many buttons and tilting
>>> the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
>>> and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
>>> variations on
>>>
>>>    (define-key global-map <mouse-6> 'scroll-left)
>>
>> Disable mouse-wheel-mode by `M-x mouse-wheel-mode' then see if tilting
>> gives `<wheel-right> is undefined' or `<wheel-left> is undefined'.  If
>> not, configure Logitech mouse.
>>
>> Following is not necessary.
>>
>>     (define-key global-map [mouse-6] 'mwheel-scroll)
> 
> Thanks.  I hadn't realized I need to also set mouse-wheel mode.
> Now is works.

Is `mouse-wheel-mode' ON by default, isn't it?
Anyway, it is good to hear that it works for you.

If you like operation by mouse, please check
`mouse-drag-and-drop-region' too.



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

* Re: query: remapping a mouse press
  2018-08-25  5:15     ` Tak Kunihiro
@ 2018-08-25 15:38       ` allan gottlieb
  0 siblings, 0 replies; 10+ messages in thread
From: allan gottlieb @ 2018-08-25 15:38 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: help-gnu-emacs

On Sat, Aug 25 2018, Tak Kunihiro wrote:

>>>> I am having trouble enabling mouse-wheel-tilt-scroll
>>>>
>>>> Currently I have
>>>>
>>>>     mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
>>>>     Its value is t
>>>>     Original value was nil
>>>>
>>>> Possibly it is because my logitech mouse has many buttons and tilting
>>>> the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
>>>> and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
>>>> variations on
>>>>
>>>>    (define-key global-map <mouse-6> 'scroll-left)
>>>
>>> Disable mouse-wheel-mode by `M-x mouse-wheel-mode' then see if tilting
>>> gives `<wheel-right> is undefined' or `<wheel-left> is undefined'.  If
>>> not, configure Logitech mouse.
>>>
>>> Following is not necessary.
>>>
>>>     (define-key global-map [mouse-6] 'mwheel-scroll)
>> 
>> Thanks.  I hadn't realized I need to also set mouse-wheel mode.
>> Now is works.
>
> Is `mouse-wheel-mode' ON by default, isn't it?
> Anyway, it is good to hear that it works for you.
>
> If you like operation by mouse, please check
> `mouse-drag-and-drop-region' too.

Thanks.
allan



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

* Re: query: remapping a mouse press
  2018-08-23 20:58 query: remapping a mouse press allan gottlieb
  2018-08-23 23:08 ` Tak Kunihiro
@ 2018-08-26 18:10 ` hw
  2018-08-26 21:07   ` allan gottlieb
  1 sibling, 1 reply; 10+ messages in thread
From: hw @ 2018-08-26 18:10 UTC (permalink / raw)
  To: help-gnu-emacs

allan gottlieb <gottlieb@nyu.edu> writes:

> I am having trouble enabling mouse-wheel-tilt-scroll
>
> Currently I have
>
>     mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
>     Its value is t
>     Original value was nil
>
> Possibly it is because my logitech mouse has many buttons and tilting
> the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
> and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
> variations on
>
>    (define-key global-map <mouse-6> 'scroll-left)
>
> but with no success.
>
> Any help would be appreciated.

FWIW:

You can use xinput to configure which physical button on a mouse (or trackball,
in this example) is being mapped to which logical button like so:


xinput set-button-map "Kensington Kensington Slimblade Trackball" 2 1 3 4 5 6 7 8 9 10 11 12
xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation" 1
xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Button" 3
xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev Wheel Emulation Axes" 6, 7, 4, 5


This example is for when you use the trackball with your left hand.
(Don't buy that Kensington, it sucks.)


In case you have a Trackman Marble FX that still works:


#  set which button to use for wheel emulation (right button)
# xinput -set-prop "PS2++ Logitech TrackMan" "Evdev Wheel Emulation Button" 3
#  enable the wheel emulation
# xinput -set-prop "PS2++ Logitech TrackMan" "Evdev Wheel Emulation" 1



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

* Re: query: remapping a mouse press
  2018-08-26 18:10 ` hw
@ 2018-08-26 21:07   ` allan gottlieb
  2018-08-26 21:38     ` hw
  0 siblings, 1 reply; 10+ messages in thread
From: allan gottlieb @ 2018-08-26 21:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, Aug 26 2018, hw wrote:

> allan gottlieb <gottlieb@nyu.edu> writes:
>
>> I am having trouble enabling mouse-wheel-tilt-scroll
>>
>> Currently I have
>>
>>     mouse-wheel-tilt-scroll is a variable defined in `mwheel.el'.
>>     Its value is t
>>     Original value was nil
>>
>> Possibly it is because my logitech mouse has many buttons and tilting
>> the wheel generates mouse-6 and mouse-7, which are bound to scroll-down
>> and scroll-up.  I want to bind mouse-6 to scroll-left and tried several
>> variations on
>>
>>    (define-key global-map <mouse-6> 'scroll-left)
>>
>> but with no success.
>>
>> Any help would be appreciated.
>
> FWIW:
>
> You can use xinput to configure which physical button on a mouse (or trackball,
> in this example) is being mapped to which logical button like so:
>
>
> xinput set-button-map "Kensington Kensington Slimblade Trackball" 2 1
> 3 4 5 6 7 8 9 10 11 12
> xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev
> Wheel Emulation" 1
> xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev
> Wheel Emulation Button" 3
> xinput --set-prop "Kensington Kensington Slimblade Trackball" "Evdev
> Wheel Emulation Axes" 6, 7, 4, 5
>
>
> This example is for when you use the trackball with your left hand.

Thank you.

I believe that this use of xinput I accomplish with xmodmap.

My question is "downstream" of that.  Assuming I have configured the
mouse (in my case via xmodmap) and when I push a certain physical button
it generates a pair of x events

ButtonPress event, serial 36, synthetic NO, window 0x4200001,
    root 0x13b, subw 0x0, time 28609618, (45,96), root:(464,877),
    state 0x10, button 13, same_screen YES

ButtonRelease event, serial 36, synthetic NO, window 0x4200001,
    root 0x13b, subw 0x0, time 28609820, (54,94), root:(473,875),
    state 0x10, button 13, same_screen YES

How do I tell emacs to do something (say end-of-buffer) when button 13
is pressed?

thanks again,
allan



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

* Re: query: remapping a mouse press
  2018-08-26 21:07   ` allan gottlieb
@ 2018-08-26 21:38     ` hw
  2018-08-26 22:13       ` allan gottlieb
  0 siblings, 1 reply; 10+ messages in thread
From: hw @ 2018-08-26 21:38 UTC (permalink / raw)
  To: help-gnu-emacs

allan gottlieb <gottlieb@nyu.edu> writes:

> On Sun, Aug 26 2018, hw wrote:
>
>> allan gottlieb <gottlieb@nyu.edu> writes:
>>
>>> I am having trouble enabling mouse-wheel-tilt-scroll
> [...]
>> You can use xinput to configure which physical button on a mouse (or trackball,
>> in this example) is being mapped to which logical button like so:
> [...]
>
> Thank you.
>
> I believe that this use of xinput I accomplish with xmodmap.

How did you do that?  I prefer xmodmap because it's way less
complicated, but there seem to be things that can not be done with it,
and mapping mouse buttons seemed to be one of them.

> My question is "downstream" of that.  Assuming I have configured the
> mouse (in my case via xmodmap) and when I push a certain physical button
> it generates a pair of x events
>
> ButtonPress event, serial 36, synthetic NO, window 0x4200001,
>     root 0x13b, subw 0x0, time 28609618, (45,96), root:(464,877),
>     state 0x10, button 13, same_screen YES
>
> ButtonRelease event, serial 36, synthetic NO, window 0x4200001,
>     root 0x13b, subw 0x0, time 28609820, (54,94), root:(473,875),
>     state 0x10, button 13, same_screen YES
>
> How do I tell emacs to do something (say end-of-buffer) when button 13
> is pressed?

Does Emacs receive the event?  You can test with (describe-key).  I
could probably use something like this:


(global-set-key (kbd "<down-mouse-1>") 'end-of-buffer)


That might work if Emacs gets <down-mouse-13>.  If it doesn't know that
many buttons and you're not running out of button numbers, perhaps you
can re-map the buttons with xinput so they have lower button mumbers
Emacs can understand.



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

* Re: query: remapping a mouse press
  2018-08-26 21:38     ` hw
@ 2018-08-26 22:13       ` allan gottlieb
  2018-08-27 15:35         ` hw
  0 siblings, 1 reply; 10+ messages in thread
From: allan gottlieb @ 2018-08-26 22:13 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, Aug 26 2018, hw wrote:

> allan gottlieb <gottlieb@nyu.edu> writes:
>
>> On Sun, Aug 26 2018, hw wrote:
>>
>>> allan gottlieb <gottlieb@nyu.edu> writes:
>>>
>>>> I am having trouble enabling mouse-wheel-tilt-scroll
>> [...]
>>> You can use xinput to configure which physical button on a mouse
>>> (or trackball,
>>> in this example) is being mapped to which logical button like so:
>> [...]
>>
>> Thank you.
>>
>> I believe that this use of xinput I accomplish with xmodmap.
>
> How did you do that?  I prefer xmodmap because it's way less
> complicated, but there seem to be things that can not be done with it,
> and mapping mouse buttons seemed to be one of them.

I used xev to find our which "logic buttons" is generated by each of the
mouse's "physical buttons".  Then I used xmodmap to change the logical
buttons (this is easy with xmodmap), but probable that was not necessary.

>> My question is "downstream" of that.  Assuming I have configured the
>> mouse (in my case via xmodmap) and when I push a certain physical button
>> it generates a pair of x events
>>
>> ButtonPress event, serial 36, synthetic NO, window 0x4200001,
>>     root 0x13b, subw 0x0, time 28609618, (45,96), root:(464,877),
>>     state 0x10, button 13, same_screen YES
>>
>> ButtonRelease event, serial 36, synthetic NO, window 0x4200001,
>>     root 0x13b, subw 0x0, time 28609820, (54,94), root:(473,875),
>>     state 0x10, button 13, same_screen YES
>>
>> How do I tell emacs to do something (say end-of-buffer) when button 13
>> is pressed?
>
> Does Emacs receive the event?  You can test with (describe-key).  I
> could probably use something like this:
>
> (global-set-key (kbd "<down-mouse-1>") 'end-of-buffer)

Bingo!  (It worked better with just mouse-1 not down-mouse-1)

> That might work if Emacs gets <down-mouse-13>.  If it doesn't know that
> many buttons and you're not running out of button numbers, perhaps you
> can re-map the buttons with xinput so they have lower button mumbers
> Emacs can understand.

That remapping is what I use xmodmap for (see above).  But it is
necessary emacs is delighted with

   (global-set-key (kbd "<mouse-8>") 'beginning-of-buffer)

Now I have to decide what to do with all the logitech physical buttons!

Thanks again,
allan



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

* Re: query: remapping a mouse press
  2018-08-26 22:13       ` allan gottlieb
@ 2018-08-27 15:35         ` hw
  2018-08-27 21:13           ` allan gottlieb
  0 siblings, 1 reply; 10+ messages in thread
From: hw @ 2018-08-27 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

allan gottlieb <gottlieb@nyu.edu> writes:

> On Sun, Aug 26 2018, hw wrote:
>
>> allan gottlieb <gottlieb@nyu.edu> writes:
>>
>>> On Sun, Aug 26 2018, hw wrote:
>>>
>>>> allan gottlieb <gottlieb@nyu.edu> writes:
>>>>
> [...]
>>> I believe that this use of xinput I accomplish with xmodmap.
>>
>> How did you do that?
> [...]
>
> I used xev to find our which "logic buttons" is generated by each of the
> mouse's "physical buttons".  Then I used xmodmap to change the logical
> buttons (this is easy with xmodmap), but probable that was not necessary.

Oh, I mean what did you put into xmodmap to change mouse buttons?  I
thought it only deals with keys.

> [...]
>>> How do I tell emacs to do something (say end-of-buffer) when button 13
>>> is pressed?
>>
>> Does Emacs receive the event?  You can test with (describe-key).  I
>> could probably use something like this:
>>
>> (global-set-key (kbd "<down-mouse-1>") 'end-of-buffer)
>
> Bingo!  (It worked better with just mouse-1 not down-mouse-1)
>
>> That might work if Emacs gets <down-mouse-13>.  If it doesn't know that
>> many buttons and you're not running out of button numbers, perhaps you
>> can re-map the buttons with xinput so they have lower button mumbers
>> Emacs can understand.
>
> That remapping is what I use xmodmap for (see above).  But it is
> necessary emacs is delighted with
>
>    (global-set-key (kbd "<mouse-8>") 'beginning-of-buffer)
>
> Now I have to decide what to do with all the logitech physical buttons!

Cool, now you get to make the really difficult decisions ;)



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

* Re: query: remapping a mouse press
  2018-08-27 15:35         ` hw
@ 2018-08-27 21:13           ` allan gottlieb
  0 siblings, 0 replies; 10+ messages in thread
From: allan gottlieb @ 2018-08-27 21:13 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Aug 27 2018, hw wrote:

> allan gottlieb <gottlieb@nyu.edu> writes:
>
>> On Sun, Aug 26 2018, hw wrote:
>>
>>> allan gottlieb <gottlieb@nyu.edu> writes:
>>>
>>>> On Sun, Aug 26 2018, hw wrote:
>>>>
>>>>> allan gottlieb <gottlieb@nyu.edu> writes:
>>>>>
>> [...]
>>>> I believe that this use of xinput I accomplish with xmodmap.
>>>
>>> How did you do that?
>> [...]
>>
>> I used xev to find our which "logic buttons" is generated by each of the
>> mouse's "physical buttons".  Then I used xmodmap to change the logical
>> buttons (this is easy with xmodmap), but probable that was not necessary.
>
> Oh, I mean what did you put into xmodmap to change mouse buttons?  I
> thought it only deals with keys.

#                     1  2   3  4  5  6  7  8  9 10  11  12
xmodmap -e "pointer = 1  10  3  4  5  6  7  8  9  2  11  12"

This goes in a shell script run at login.  It swaps buttons 10 and 2.

>> [...]
>>>> How do I tell emacs to do something (say end-of-buffer) when button 13
>>>> is pressed?
>>>
>>> Does Emacs receive the event?  You can test with (describe-key).  I
>>> could probably use something like this:
>>>
>>> (global-set-key (kbd "<down-mouse-1>") 'end-of-buffer)
>>
>> Bingo!  (It worked better with just mouse-1 not down-mouse-1)
>>
>>> That might work if Emacs gets <down-mouse-13>.  If it doesn't know that
>>> many buttons and you're not running out of button numbers, perhaps you
>>> can re-map the buttons with xinput so they have lower button mumbers
>>> Emacs can understand.
>>
>> That remapping is what I use xmodmap for (see above).  But it is
>> necessary emacs is delighted with
>>
>>    (global-set-key (kbd "<mouse-8>") 'beginning-of-buffer)
>>
>> Now I have to decide what to do with all the logitech physical buttons!
>
> Cool, now you get to make the really difficult decisions ;)

Agreed.
allan



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

end of thread, other threads:[~2018-08-27 21:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 20:58 query: remapping a mouse press allan gottlieb
2018-08-23 23:08 ` Tak Kunihiro
     [not found]   ` <87h8jkzaw2.fsf@nyu.edu>
2018-08-25  5:15     ` Tak Kunihiro
2018-08-25 15:38       ` allan gottlieb
2018-08-26 18:10 ` hw
2018-08-26 21:07   ` allan gottlieb
2018-08-26 21:38     ` hw
2018-08-26 22:13       ` allan gottlieb
2018-08-27 15:35         ` hw
2018-08-27 21:13           ` allan gottlieb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).