Reimplementing a GUI Mouse configuration tool in antiX 23

Forum Forums Official Releases antiX-23 “Arditi del Popolo Reimplementing a GUI Mouse configuration tool in antiX 23

  • This topic has 104 replies, 9 voices, and was last updated May 27-4:05 pm by BobC.
Viewing 15 posts - 61 through 75 (of 105 total)
  • Author
    Posts
  • #135925
    Member
    PPC

      Reading more on the subject, during my commute, I found out that there is another setting that xinput can probably manage:
      “libinput Scrolling Pixel Distance” that ranges from 10 to 50 (at least on my mouse).
      This should control how fast the scroll wheel works, but I failed to notice any real difference, so, for now, I won’t add that feature to the script, particulary considering that Dave seems to be doing his homework, so he can adapt ds-mouse to work with xinput.

      It seems that xinput can’t really control double click speed.

      EDIT-
      …But that can be easily achieved by editing the file ~/.gtkrc-2.0.mine
      and making sure that a line such as this exists and is not commented.

      gtk-double-click-time = 800

      This default value is 250. Setting it to something like 800 allows very slow double clicks.
      As far as I have tested, this requires users to restart the session, so the new value is used.
      I am just waiting to hear from Dave. If he is not creating a script, I will adapt my script and allow it to manage this feature too…

      P.

      • This reply was modified 2 months, 2 weeks ago by PPC.
      • This reply was modified 2 months, 2 weeks ago by PPC.
      #135933
      Member
      Robin

        it is probably trivial to change the “Mouse settings” to use the current ds-mouse script if synaptics is detected or the new script that uses xinput, keeping everyone as happy as possible.

        This was already possible easily before I added some convenience functions to control centre, actually these functions don’t deal with that at all.
        What these functions actually do is: They provide a simple standardised method to add or deactivate a new value needed by an control centre entry to the antiX desktop session startup file, and also make sure the prerequisites for an entry are met, otherwise allowing to offer an install option.

        We just need to add a new entry to the list, and give the xinput preference above the outdated synaptics, in case user has both installed for some reason. That’s actually easy.

        It seems that just 2 users, other than me, tested the script so far…

        No, still testing. Have not that much time right now… Sorry.
        First findings: Great tool, PPC, really nice work.

        What did not work for me?
        Acceleration. Changing the value seems not to change anything in mouse behaviour.
        So I looked up what this is supposed to work. Here the basics, it was obviously ported from wayland to x: https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html#the-custom-acceleration-profile
        It describes there are three acceleration profiles to be managed to make it work: “flat”, “adaptive” and “custom”, and the custom profile takes a curve to be entered by the user, something like that: https://www.desmos.com/calculator/xjylr70yt4

        [EDIT: Not sure whether this would rather apply here, since we are talking about xorg rather than wayland: https://www.x.org/wiki/Development/Documentation/PointerAcceleration/ ]

        Another thought: If you find a single device, you go straight to the config. But what, if user hasn’t connected any pointing device, and hence the logic you have set up grabs falsely the keyboard? (Here I always have to pick the mouse from in between two keyboard entries, so I guess if I’d disconnect it, what I can’t do right now on this productive machine, it would actually grab for the keyboard? Possibly you can add a blacklist (exclude devices with “keyboard” in its name?)

        So, some work is waiting to be done to the new mouse config GUI still in future updates, but as a first hotfix to replace the no longer functional synaptics based ds-mouse this is perfectly fine already. Many thanks @PPC!

        • This reply was modified 2 months, 2 weeks ago by Robin. Reason: wayland ←→ xorg

        Windows is like a submarine. Open a window and serious problems will start.

        #135936
        Forum Admin
        Dave

          @ppc. I think you are doing well. I have been watching the progress of your script such as accessing devices and properties by name. For assurance on this… It is also how the other programs operate. Your script is doing well, I am hoping to use the research and functions going into it for the actual management. In this way I can focus on the GUI.

          Robin is correct about acceleration profiles. If I recall correctly the default is adaptive.

          If there is anything interesting in my research that I find relates to the script I will post here. Honestly like Robin seems to think; the progress on your script is moving much faster than my reading/ testing/ research.

          Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

          #135937
          Member
          Robin

            Since on my mouse it is difficult to use the scroll wheel for the middle button functionality without moving the wheel, I’d suggest to add another entry to the GUI:

            xinput set-prop ›device‹ "libinput Middle Emulation Enabled" 1
            xinput set-prop ›device‹ "libinput Middle Emulation Enabled" 0

            This allowing the use of the right and left button together as a simulation of a middle click (and moreover cares for users with two button mice)

            And another one, sometimes causing trouble when activated, so it is desirable there is a way to deactivate it easily:

            xinput set-prop ›device‹ "libinput Horizontal Scroll Enabled" 1
            xinput set-prop ›device‹ "libinput Horizontal Scroll Enabled" 0

            Could you add them to the GUI? Have right now no time to do it.

            Windows is like a submarine. Open a window and serious problems will start.

            #135946
            Member
            Robin

              If I recall correctly the default is adaptive.

              Can confirm. Adaptive seems to be the default.

              Switch to flat profile:
              xinput set-prop ›device‹ "libinput Accel Profile Enabled" 0 1

              Switch back to adaptive profile:
              xinput set-prop ›device‹ "libinput Accel Profile Enabled" 1 0

              You can check this when moving the mouse by a defined distance (let’s say a hand’s breadth) and measure the cursor path on screen, when moving either really speedy or really slowly. The flat profile should move the cursor the same distance on fast and slow movement, while the adaptive profile transports the cursor a wider distance the faster you move. In my testings this made a difference of doubled distance on high speed movement.

              Windows is like a submarine. Open a window and serious problems will start.

              #135947
              Member
              Robin

                You can allow a range of 0.01…10.0 for the sensivity, instead of 0.1 to 1.0 merely:

                xinput set-prop ›device‹ "Coordinate Transformation Matrix" 10 0 0 0 10 0 0 0 1
                xinput set-prop ›device‹ "Coordinate Transformation Matrix" 0.01 0 0 0 0.01 0 0 0 1

                This allows for adjustment of more or less sensitive devices, not narrowing down the available adjustment range unnecessarily. (Then you’ll need to set the steps to 0.01 in the pulldown). You even could use 0.001 to 100, step 0.001 but that would render it unusable for most default devices I guess. So best middle way is actually 0.01 to 10.0, step 0.01 in my opinion and from my testing results.

                Windows is like a submarine. Open a window and serious problems will start.

                #135948
                Forum Admin
                Dave

                  You can allow a range of 0.01…10.0 for the sensivity, instead of 0.1 to 1.0 merely:
                  ……..
                  You even could use 0.001 to 100, step 0.001 but that would render it unusable for most default devices I guess. So best middle way is actually 0.1 to 10.0, step 0.1 in my opinion and from my testing results.

                  I think this is the same as the old threshold value that I made a slider for in ds-mouse.py

                  Another note from my reading is that disable touchpad while typing is on by default with libinput. This is indeed the case on a couple of computers I tried but it is barely noticeable (where you just think your finger is dry or the touchpad dirty)

                  Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                  #135950
                  Member
                  Robin

                    I made a slider for in ds-mouse.py

                    Your slider for this is really great.
                    Maybe the two scripts could be merged in some way to have best of both worlds combined? In the end it doesn’t count whether it is done in python or in bashscript. Your python approach promises that more powerful methods can be applied than bash scripting provides, so it’s preferable, I guess.

                    Windows is like a submarine. Open a window and serious problems will start.

                    #135962
                    Member
                    PPC

                      Since Dave will use in his final script, part of the bash code of my script, I’ll keep trying to improve it.
                      My priority is adding an option to manage “double click” speed. For now, I’ll just try to add a button to set slow double click on/off, without giving users the choice of the speed double click uses.
                      Then I’ll try adding the other features, requested by @Robin. That can happen very fast, or very slow… let’s see how it goes…

                      P.

                      #136002
                      Member
                      PPC

                        Today is really, really not my day…
                        But I was able to add a basic feature, to toggle on/off “slow double click”… If I knew it would be so hard, I would just try implementing a field to select the value! 🙁

                        Please be careful, I did not spend much time, testing this…

                        #136010
                        Moderator
                        Brian Masinick

                          @PPC, on February 15, 2023 at 11:56 am (at least according to my “view” of the post
                          #99639 you wrote a pretty quick and effective script that does the job.

                          I just tried it when I plug in or remove my USB mouse; in my case I had to re-execute
                          the script, but otherwise it works.

                          I think you used what I call back ticks (`); the forum showed them as tags with code and end code (bracketed);
                          I just changed them to $( and ) to evaluate the expressions within, and this worked
                          for me.

                          In case others have problems reading and interpreting the script, I’m reposting your script, adding
                          a “name” to my tiny changes with the $( and ); otherwise the logic is all yours!

                          #!/usr/bin/env bash
                          # mouse-or-touchpad.bash originally written by @PPC, altered slightly by Brian Masinick
                          declare -i ID
                          ID=$(xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}')
                          if [ -n "$(ls /dev/input/by-id/*mouse 2>/dev/null | grep -i 'usb\|PS\|COM')" ]; then
                           echo "antiX found a mouse, disabling touchpad"
                           xinput disable $ID
                          else 
                           echo "No mice around, trying to enable touchpad"
                           xinput enable $ID
                          fi
                          declare -i ID
                          ID=$(xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}')
                          if [ -n "$(ls /dev/input/by-id/*mouse 2>/dev/null | grep -i 'usb\|PS\|COM')" ]; then
                           echo "antiX found a mouse, disabling touchpad"
                           xinput disable $ID
                          else 
                           echo "No mice around, trying to enable touchpad"
                           xinput enable $ID
                          fi
                          • This reply was modified 2 months, 2 weeks ago by Brian Masinick.

                          --
                          Brian Masinick

                          #136011
                          Moderator
                          Brian Masinick

                            Here is a use case scenario where THIS default makes good sense:

                            IF you have more than one mouse pointing device – (for example, I currently have a three button HP USB mouse with a scrollable middle button), THEN I recommend that the Touchpad be automatically turned OFF.

                            Of course, it can and should be allowed to be enabled or disabled, but this is an ideal scenario where chances are significant that the user may not, and probably does not, intend to use the touchpad. For me, that is the case. The only computer I currently own that I can think of where I really do not have to connect an external mouse is my Lenovo X201 laptop.

                            It has TWO ways to scroll – a red button that you can use to physically move the graphical pointer, and the touchpad. It ALSO has two sets of selection buttons, above AND below the touchpad. Moreover, this touchpad is not so sensitive and touchy, which makes SOME of them annoying to use at all.

                            Most other touchpads I use feel pressure or SOMETHING on the keypad and INCORRECTLY select and cut text often, which IS the REASON that I sought a touchpad disabling feature in the first place, and MADE sure that I had an attachable USB mouse instead; otherwise if EVERY touchpad was as good as they are on some of the CLASSIC Thinkpad models, which were actually engineered by IBM, who LATER sold their entire laptop lineup to Lenovo, THEN I probably wouldn’t have even EXPLORED touchpad features, but because of this issue, back when synaptics was the common touchpad and the synclient was the method supporting them, I found the method to enable or disable the touchpad, wrote a small function, took it OUT of my login shell and attached the toggle feature to a single alias – in my case t; so I can enable or disable it with a single letter plus the Enter key.

                            During antiX 23.1 Alpha testing, all of a sudden, I didn’t see ANY synaptics features available so I did some research, found out that the synclient capability, while still available in sources, is NOT being carried forward in most systems, and it wasn’t in our first Alpha build. It was this event that caused me to investigate xinput in the first place and I ended up rewriting my short script to toggle the touchpad to use xinput instead of synclient and synaptics. As long as it doesn’t result in a ridiculous amount of code or complexity, it’d be nice for a well designed tool to handle either approach.

                            That way those still hanging on to older versions of our distribution and those who are adamant to KEEP synclient, it will still work; those who are using our newest software, which lacks synclient as far as I can tell, will be able to add in xinput and libinput and retain the ability to manage current and future systems with the software that, from what I have read, has replaced synclient.

                            I believe that @PPC actually wrote a script that pretty much accomplishes this; I’m not sure if there is a newer version of it or not; the only thing the script DIDN’T do was remain live and therefore I had to run it again, but it DID recognize whether a mouse or a touchpad was active; if mouse active, disable touchpad, otherwise enable touchpad; the idea works well.

                            --
                            Brian Masinick

                            #136014
                            Member
                            PPC

                              @Robin – please test – I created a version of the script that processes Middle Emulation, but I can’t test it. Please check if it works for you… If it does, I’ll try implementing the other feature you requested…

                              @Mr Masinick – I think I did not get around do rewrite that script… But I’m thinking of adapting as a kind of “deamon” that keeps running on the background, checking for a mouse, if a touchpad is detected… I’m not really sure if it’s worth the work, for the marginal gain users have (and running deamons is usually a wast of resources… but it’s the only way I can see, since I never wrote udev rules, like Dave mentioned)

                              EDIT: I’m tired and I have “fat fingers”. the new feature works, I just tested. I’ll have to change the text to something clearer like: “Right + Left click emulate Middle click”

                              P.

                              • This reply was modified 2 months, 2 weeks ago by PPC.
                              #136022
                              Moderator
                              Brian Masinick

                                @Robin – please test – I created a version of the script that processes Middle Emulation, but I can’t test it. Please check if it works for you… If it does, I’ll try implementing the other feature you requested…

                                @Mr Masinick – I think I did not get around do rewrite that script… But I’m thinking of adapting as a kind of “daemon” that keeps running on the background, checking for a mouse, if a touchpad is detected… I’m not really sure if it’s worth the work, for the marginal gain users have (and running deamons is usually a wast of resources… but it’s the only way I can see, since I never wrote udev rules, like Dave mentioned)

                                P.

                                @PPC, whether you rewrite it yourself or not, that particular script does have to run in a daemon mode. Otherwise it has to be explicitly re-executed; the base functionality as I wrote it (only very slightly altering what came in as displayed in the forum); those minor changes plus making it a daemon process is reasonable.

                                Regarding daemon processes, it depends how they are written whether they are intrusive or not.
                                A process that wildly loops, waiting for something to take place is going to consume considerable resources whether it’s small or large in size; a program that instead is triggered by an event, and otherwise remains dormant is, to me, a properly functioning daemon process.

                                I’m not an expert in developing daemon processes, but I can state that creating event driven processes is what makes such processes efficient or a system bottleneck. Research into the correct operation of daemon processes is wise before implementing them; from a conceptual basis I understand them; for the specific coding steps necessary, I’d need to learn the specifics again before either coding or doing a code review on them myself.

                                --
                                Brian Masinick

                                #136023
                                Member
                                PPC

                                  @Robin – I cant really test it here, but I think “Horizontal Scroll” will work on the script, once again, when possible, please test… I’ll have to go pick up by daughter… So no coding during the week end! 🙂

                                  P.

                                Viewing 15 posts - 61 through 75 (of 105 total)
                                • You must be logged in to reply to this topic.