Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-31 Thread Klaus Ethgen
Am Mo den 26. Jul 2021 um 10:15 schrieb Mark Hills:
> Is there some kind of X event that fvwm can respond to when a new USB 
> input device is plugged in?
> 
> Because I recently switched from using CorePointer/CoreKeyboard in the 
> xorg.conf, to the 'modern' hot plugging of X devices.

Well, there are some answers already. But...

For security reason I made the way around, Instead of using the standard
core pointer, I do configure explicitly the input devices I use.

I made this to prevent a malicious USB device plugged in that exploits
some flaws or could act as a key logger.

I would like to have a whitelist or to enable the devices manually.

The bad side of this setup are:
- I could not plug additional devices like a barcode reader or a wacom
  tablet
- All devices must be present at X server start.

I found a way to redetect a device that was plugged out and in again
with xinput disabling and reenabling it (like a bluetooth mouse) but I
found no way to manually add new devices by intention. If it is not
working automated, it doesn't work at all.

But this is not specially related to fvwm than to X itself.

Regards
   Klaus
-- 
Klaus Ethgen   http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16Klaus Ethgen 
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C


signature.asc
Description: PGP signature


Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-30 Thread Tom Horsley
On Fri, 30 Jul 2021 18:29:05 +0100 (BST)
Mark Hills wrote:

> Thanks, I will take a look at this when I have time to try it, but does it 
> need to run as root?

Nope, runs as me at login in my X session. You could probably make
it a systemd user unit with six years of research :-). I just run
it as a startup program in my session.



Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-30 Thread Mark Hills
On Mon, 26 Jul 2021, Tom Horsley wrote:

> On Mon, 26 Jul 2021 10:15:08 +0100 (BST)
> Mark Hills wrote:
> 
> > Is there some kind of X event that fvwm can respond to when a new USB 
> > input device is plugged in?
> 
> You could check out the silly program I wrote to handle this
> exact situation. It listens for udev events.
> 
> https://tomhorsley.com/software/udev-act/udev-act.html

Thanks, I will take a look at this when I have time to try it, but does it 
need to run as root?

-- 
Mark



Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-30 Thread Mark Hills
On Mon, 26 Jul 2021, Dominique Michel wrote:

> Le Mon, 26 Jul 2021 10:15:08 +0100 (BST),
> Mark Hills  a écrit :
> 
> > My keyboard and mouse are on a USB hub, powered on/off separately.
> > I'm tired of having to manually re-run a script every time I return
> > to work.
> > 
> > Searching gives suggestions to add scripts to Linux udev; that seems 
> > totally the wrong layer to me -- it can only be configured by root,
> > runs whether X is running or not, and I'd somehow need to delegate
> > access to the running X session. I don't run dbus here either. This
> > is on simple Slackware/Alpine Linux system.
> 
> I would say than the best way is to let X to manage the mouse and the
> pointer. As example, I have nothing special for the USB mouse, it just
> work, and for the keyboard I have a file
> /etc/X11/xorg.conf.d/30-keyboard.conf
> 
> Section "InputClass"
>   Identifier "evdev keyboard  catchall"
>   MatchIsKeyboard "on"
>   MatchDevicePath "/dev/input/event*"
>   Driver "evdev"
>   Option "XkbLayout" "ch"
>   Option "XkbVariant" "fr"
>   Option "XkbRules" "xorg"
> EndSection

Thanks for the suggestion.

I'm reluctant to push these to system settings, as they're personal onces 
I should be able to move around in my $HOME folder (and in my previous 
employer I could not even have adjusted this configuration) -- but I can 
see what you are saying.

I suppose I'd need to work out the equivalent of xmodmap in these Xkb* 
settings, as well as the other settings:

  xmodmap ~/.xmodmap # custom layout
  xset r rate 300 100# keyboard repeat
  xset m 0.4 # mouse acceleration
  xsetwacom --set "Wacom One by Wacom M Pen stylus" MapToOutput DisplayPort-0

The X server could really be more helpful here: "xset r" is presented as a 
global setting, yet it sets the current keyboards, not newly added ones. 
Same for "xset m" with mice.

What do fvwm users do if they have a custom keyboard layout?

-- 
Mark

Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-26 Thread Dominique Michel
Le Mon, 26 Jul 2021 10:15:08 +0100 (BST),
Mark Hills  a écrit :

> My keyboard and mouse are on a USB hub, powered on/off separately.
> I'm tired of having to manually re-run a script every time I return
> to work.
> 
> Searching gives suggestions to add scripts to Linux udev; that seems 
> totally the wrong layer to me -- it can only be configured by root,
> runs whether X is running or not, and I'd somehow need to delegate
> access to the running X session. I don't run dbus here either. This
> is on simple Slackware/Alpine Linux system.

I would say than the best way is to let X to manage the mouse and the
pointer. As example, I have nothing special for the USB mouse, it just
work, and for the keyboard I have a file
/etc/X11/xorg.conf.d/30-keyboard.conf

Section "InputClass"
Identifier "evdev keyboard  catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "XkbLayout" "ch"
Option "XkbVariant" "fr"
Option "XkbRules" "xorg"
EndSection

Dominique




Re: FVWM: Restoring keyboard/mouse settings on USB plug

2021-07-26 Thread Tom Horsley
On Mon, 26 Jul 2021 10:15:08 +0100 (BST)
Mark Hills wrote:

> Is there some kind of X event that fvwm can respond to when a new USB 
> input device is plugged in?

You could check out the silly program I wrote to handle this
exact situation. It listens for udev events.

https://tomhorsley.com/software/udev-act/udev-act.html