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 103 replies, 8 voices, and was last updated Mar 30-10:59 pm by Brian Masinick.
Viewing 15 posts - 16 through 30 (of 104 total)
  • Author
    Posts
  • #135156
    Moderator
    caprea

      Yep, it works for her.Thanks.

      #135169
      Member
      PPC

        I just want to share the logic that I think the touchpad toggle function in ds-mouse should follow, accounting for more than 1 touchpad device being present:

        #cat ~/roky | grep -E '(touchpad|glidepoint|Synaptics)\s'|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g'  > /tmp/check-ds-mouse
        xinput list| grep -E '(touchpad|glidepoint|Synaptics)\s'|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g'  > /tmp/check-ds-mouse
        if [ $(wc -l < /tmp/check-ds-mouse) -gt 1 ]; then
            echo "There are more than one matches. Allow user to select which one to configure in a yad window"
        else
            
            if [ ! -s /tmp/check-ds-mouse ]; then
        		echo "There is no match. Doing nothing"
        	else
        		echo "There is one match. Configuring that match"
        		touchpad_id=$(cat /tmp/check-ds-mouse)
        		echo "Configuring the only touchpad that was detected, it's device number is ${touchpad_id}."
        	fi
        fi

        Anyone can paste this mini-script in the terminal and check if it works correctly: it should state if a match for touchpad devices was found, if none was found or if more than one was found… The part we need to implement now is what to do if more than one match is found…

        P.

        #135171
        Moderator
        caprea

          From terminal as expected

          There is one match. Configuring that match
          Configuring the only touchpad that was detected, it's device number is 12.
          #135174
          Member
          PPC

            @Caprea – many thanks for the test.

            an updated “logic” test, that should deal with multiple touchpads and allow the user to select one. To see what it looks like when there are multiple choices, change the searched strings in the grep command on the first line to something like (utton) – that will display the multiple buttons found. To see what what happens when there is only one choice, use (mouse|Mouse)

            #!/bin/bash
            xinput list| grep -E '(touchpad|glidepoint|Synaptics)\s'|cut -d "[" -f 1 > /tmp/check-ds-mouse
            #xinput list| grep -E '(mouse|Mouse)\s'|cut -d "[" -f 1 > /tmp/check-ds-mouse
            #xinput list| grep -E '(utton)\s'|cut -d "[" -f 1 > /tmp/check-ds-mouse
            selected_option=""
            if [ $(wc -l < /tmp/check-ds-mouse) -gt 1 ]; then
                echo "There are more than one matches. Allow user to select which one to configure in a yad window"
            else
                
                if [ ! -s /tmp/check-ds-mouse ]; then
            		yad --center --text="No touchpad detected." --button="OK"
            		exit
            	else
            	    id=$(cat /tmp/check-ds-mouse|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g')
            		yad --center --text="There is one match, with the ID ${id}. Configuring that match..." --button="OK"
            		#do what needs to be done...
            		exit
            	fi
            fi
            # Read the file line by line and construct a list of options
            options=""
            while IFS= read -r line
            do
             options+="$line"$'! '
            done < /tmp/check-ds-mouse
            # Use yad to create a dropdown box with the options
            selected_option=$(yad --center --button="gtk-ok:0" --title "Choose device to configure" --form --field="Touchpad:CB" "$options")
            # Check if the user selected an option
            if [ "$selected_option" != "" ]; then
             id=$(echo $selected_option|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g')
             echo "You selected the device with the ID ${id}."
            else
             echo "No option was selected."
            fi
            • This reply was modified 1 month, 3 weeks ago by PPC.
            #135177
            Member
            PPC

              When I can, I’ll test this version of ds-mouse, that *should* allow to toggle multiple touchpads. I’m certain that Dave never designed the script for that possibility, so I’m not really sure what happens if multiple touchpads are present… I’ve not yet tested this with a single touchpad 🙁

              Note: I’ve not edited any other ds-mouse feature, since the last proposed test version of ds-mouse…

              P.

              #135180
              Forum Admin
              Dave

                First off, thank you for the designated thread. It was becoming difficult to consolidate the information from multiple threads when I do not appear to share as much free time as others. Secondly, I am seeing multiple suggestions on corrections for what works for everyone in particularity to their case. Attempting some of the suggestions I have encountered failure with the name search (for example my usb mouse does not show “mouse” in the name) or the identifier part of the name being the same for two devices (Example: touchpad and the mouse joystick in the middle of my keyboard on my dell).

                So I was attempting to add a drop down in ds-mouse.py to diplay the pointer devices. When looking into / learning xinput the listed output was 7 pointer devices and my computer only has 1 touchpad and 1 usb mouse added (not the dell). Thus my question in the other thread asking how we can cross reference the output of xinput to find the real device without the user seeing / having to guess from a spew of random ids and names.

                The second question results from trying to identify the device. Idealistically we would configure the settings for the device and this would persist over a reboot. Obviously we can loop through all the devices and blindly set them. This is essentially what ds-mouse has been doing and not much change would be needed for this. However if we are going to set the configuration per device we cannot have a yad popup for each device. This is ok for the initial setup but would be rather annoying when ds-mouse is run on startup. So in order to save the settings as ds-mouse has been doing but on a per device level we will need an identifier string that does not change when rebooting and does not rearrange when adding / removing a device. (Example: added a usb mouse and the touchpad id changes). Thus the question about the id value if it changes on reboot/unplug/replug. I suspect it does change, but then we need another identifier.

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

                #135183
                Member
                PPC

                  @Dave – I’m tired and almost giving up on this… The fact that you noticed that your mouse does not include “mouse” on it’s “name” makes me think that the way to go would really, really be always showing, in ds-mouse, a menu, on the top (or an initial window) so the users can select what device they want to configure and then process that choice.
                  There may also be more “touchpad” names than the ones my test script searches for… so that’s probably the best or ONLY solution.

                  As far as I read, on the links Mr. Masinick made available, the device IDs can, in fact change. If/when that happens, any selected “choice” will fail to work if the script that runs on startup depends on the ID. My suggestion would be using the device name, stored on a configuration file, and when reading the saved configuration (ex: at startup) do a on-the-fly search for the ID of that name and apply the saved configuration (i.e. disabling it if it’s a touchpad; reversed scrolling; whatever).

                  On my previous posts I showed the logic of getting the names of touchpads, that can be expanded to get the names of all pointing devices, to allow a selecting, when running ds-mouse:

                  Ex:

                  xinput list|grep pointer| grep -v "Virtual"| grep -v "virtual" > /tmp/check-ds-mouse
                  cat  /tmp/check-ds-mouse
                  selected_option=""
                  if [ $(wc -l < /tmp/check-ds-mouse) -gt 1 ]; then
                      echo "There are more than one matches. Allowing user to select which one to configure in a yad window"
                      # Read the file line by line and construct a list of options
                  	options=""
                  	while IFS= read -r line
                  	do
                  		options+="$line"$'! '
                  	done < /tmp/check-ds-mouse
                  	# Use yad to create a dropdown box with the options
                  	selected_option=$(yad --center --button="gtk-ok:0" --title "Choose device to configure" --form --field="Touchpad:CB" "$options")
                  	# Check if the user selected an option
                  	if [ "$selected_option" != "" ]; then
                  		id=$(echo $selected_option|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g')
                  		echo "You selected the device with the ID ${id}."
                  	 else
                  		echo "No option was selected."
                  	fi
                   else
                      
                      if [ ! -s /tmp/check-ds-mouse ]; then
                  		yad --center --text="No devices detected." --button="OK"
                  		exit
                  	else
                  	    id=$(cat /tmp/check-ds-mouse|cut -d "=" -f 2 | sed 's/s.*$//' | sed 's/[^0-9]//g')
                  		yad --center --text="There is one match, with the ID ${id}. Configuring that match..." --button="OK"
                  		#do what needs to be done...
                  		exit
                  	fi
                  fi

                  P.

                  • This reply was modified 1 month, 3 weeks ago by PPC.
                  • This reply was modified 1 month, 3 weeks ago by PPC.
                  • This reply was modified 1 month, 3 weeks ago by PPC.
                  #135194
                  Moderator
                  Brian Masinick

                    Based on what I see, xinput list displays a couple of sections;
                    the FIRST section says “Virtual core pointer”
                    the SECOND section says “Virtual core keyboard”

                    While I don’t know how many different peripheral devices are possible, based
                    on the information provided by xinput list, you can obtain the virtual devices
                    from there, select various ones as desired, and I would also “assume” that what
                    we are interested in is some type of pointer or pointing device.

                    That may be a helpful starting point; it would certainly be preferable to automatically
                    selecting MOUSE, Mouse or mouse as the only possibilities.

                    --
                    Brian Masinick

                    #135205
                    Member
                    Robin

                      If somebody happens to have two or more USB mice, he could connect them to a single PC or notebook and see what the xinput comes up with in the listings then, and whether singling out one of them can be done reliably in some way. Unfortunately I have only one USB mouse, all my serial mice (still working fine) can’t be attached to the desktop PC without lots of trouble, and the notebook even doesn’t have a serial connector. So somebody else might step in here and do this pretty simple multi-mice testing.

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

                      #135293
                      Member
                      marcelocripe

                        If somebody happens to have two or more USB mice, he could connect them to a single PC or notebook and see what the xinput comes up with in the listings then, and whether singling out one of them can be done reliably in some way.

                        I can help with this test. What is the command I have to apply when both mice are connected?

                        – – – – –

                        If somebody happens to have two or more USB mice, he could connect them to a single PC or notebook and see what the xinput comes up with in the listings then, and whether singling out one of them can be done reliably in some way.

                        Eu posso ajudar com este teste. Qual é o comando que eu tenho que aplicar quando os dois ratos/mouses estiverem conectados?

                        #135645
                        Member
                        dspencerj3

                          Hi, long-time listener — first time caller here.

                          JK — I am in the “advanced newbie” category. But I have been searching and reading my brains out about this before posting, thanks to the frequent occastions of “This has already been covered extensively in another thread, if you’d search the forum, you twit!” I’ve run across in other forums. I added the “you twit” — haven’t actually seen that — only sensed it.

                          So I am finally posting myself, after running down countless rabbit holes, even ending up causing my computer to boot to a bash or shell or whatever (CLI), where I had to use a bunch of cd and ls to rm the /etc/X11/xorg.conf.d/50-mouse-map.conf file I created one time and the /etc/Xll/Xsession.d/10-libinput.conf another to get it to boot back to the GUI.

                          Though I am learning to implement, and even appreciate (a little), some of the terminal commands I have needed to use during this early part of my journey, I have to confess that I am a GUI guy. Besides my ADHD and poor memory, I believe remembering and understanding all that code stuff is what I pay the computer to do. I want icons and buttons with labels and descriptions.

                          Anywho …. I have been trying to make natural scrolling the default when I log into my machine. I finally learned how to turn it on once I’m logged in using…

                          xinput set-prop “PixArt Dell MS116 USB Optical Mouse” “libinput Natural Scrolling Enabled” “1”

                          I wish the mouse control panel in antix did not even have that switch for “reverse scrolling”, unless it happens to be functional for other machines or hardware, of course.

                          BTW, here is the system I am on:

                          _,met$$$$$gg.
                          OS: Debian 12 bookworm
                          Kernel: x86_64 Linux 6.1.42-antix.1-amd64-smp
                          Uptime: 1d 13h 7m
                          Packages: 1734
                          Shell: bash 5.2.15
                          Resolution: 1920×1080
                          WM: IceWM
                          WM Theme: FX-dark
                          GTK Theme: Arc-EvoPro2 [GTK2/3]
                          Icon Theme: papirus-antix
                          Font: Ubuntu 10.5
                          Disk: 79G / 105G (80%)
                          CPU: Intel Core i7-7700T @ 8x 3.8GHz [70.0°C]
                          GPU: Mesa Intel(R) HD Graphics 630 (KBL GT2)
                          RAM: 1815MiB / 11851MiB

                          It’s an HP Pavilion 27-A210 AIO – 27″ from 2017 that I saved from the trash a few weeks ago.

                          What I would like to know….

                          1. What is the order of startup commands or scripts for when I boot antix (and also for logging in, if it is different). What various files run and in what order (I assume the later ones supercede the earlier ones).

                          2. What is the easiest, best way to persuse the output that quickly scrolls by when I am booting up? Is it captured in a file somewhere? Or is there a key I can safely press to get it to pause while I read it?

                          3. Where would I insert the xinput set-prop command mentioned above so that it runs automatically every time I log in (or boot up).

                          It seems that you guys are addressing this sort of setting in this thread, but your scripts seem above my skill level just yet.

                          Ok … so in writing that last sentence, I was nudged to open your script again, while also tracking down my current /usr/local/bin/ds-mouse file to compare. Starting to make a little more sense — and that is scaring me!

                          So, would I put my set-prop command in this vicinity, marked with “*********” in the snippet below, of PPC’s script?

                          code:

                          function reversescrolling() {
                          VertScrollDelta=$(xinput list-props $mouse |grep “263”|cut -d “:” -f2| tr -dc ‘0-9’) #EDITED BY PPC to work with xinput
                          if ! [ “$VertScrollDelta” -eq “$VertScrollDelta” ] > /dev/null 2>&1; then
                          echo $”Could not retrieve vertical scroll value. $VertScrollDelta”;
                          break;
                          fi

                          if grep -iq “REVERSE_SCROLLING=.*true” $user_config; then
                          xinput set-prop $mouse 263 1 #EDITED BY PPC to work with xinput
                          else
                          xinput set-prop $mouse 263 0 #EDITED BY PPC to work with xinput
                          fi
                          else
                          *********xinput set-prop “PixArt Dell MS116 USB Optical Mouse” “libinput Natural Scrolling Enabled” “1”
                          fi
                          }

                          end code

                          I used the label identifiers instead of the ID numbers, since I had read (or saw in a nightmare during my sleep) that the ID numbers can change from boot-to-boot, depending on what happens to be plugged in at the time. Please let me know if that is not true, cuz numbers are way easier.

                          I solemnly swear that I was not trying to write the longest post of the month! I am a beginning novelist and get a bit (<-?) wordy.

                          Thank you magnanimously for your help and patience reading this!

                          —Spence

                          #135647
                          Forum Admin
                          rokytnji

                            Might wanna check libinput install in Debian

                            harry@23.1runit:~
                            $ apt search libinput
                            Sorting... Done
                            Full Text Search... Done
                            consolation/stable 0.0.9-1+b1 amd64
                              linux console pointer support for copy-paste
                            libelput1/stable 1.26.3-1+b1 amd64
                              EFL abstraction for libinput
                            libinput-bin/stable,now 1.22.1-1 amd64 [installed,automatic]
                              input device management and event handling library - udev quirks
                            libinput-dev/stable 1.22.1-1 amd64
                              input device management and event handling library - development files
                            libinput-pad-1.0-1/stable 1.0.99.20210817-2+b1 amd64
                              On-screen Input Pad to Send Characters with Mouse - libs
                            libinput-pad-dev/stable 1.0.99.20210817-2+b1 amd64
                              On-screen Input Pad to Send Characters with Mouse - dev
                            libinput-pad-xtest/stable 1.0.99.20210817-2+b1 amd64
                              On-screen Input Pad to Send Characters with Mouse - xtest
                            libinput-tools/stable 1.22.1-1 amd64
                              input device management and event handling library - command line tools
                            libinput10/stable,now 1.22.1-1 amd64 [installed,automatic]
                              input device management and event handling library - shared library
                            libinputsynth-0.15-0/stable 0.15.0-2 amd64
                              synthesize keyboard and mouse input
                            libinputsynth-dev/stable 0.15.0-2 amd64
                              synthesize keyboard and mouse input -- development files
                            lisgd/stable 0.3.7-1 amd64
                              libinput synthetic gesture daemon
                            xserver-xorg-input-libinput/stable,now 1.2.1-1+b1 amd64 [installed]
                              X.Org X server -- libinput input driver
                            xserver-xorg-input-libinput-dev/stable,stable 1.2.1-1 all
                              X.Org X server -- libinput input driver (development headers)
                            harry@23.1runit:~
                            $ 
                            

                            Just to make sure it is there.

                            Sometimes I drive a crooked road to get my mind straight.
                            I don't suffer from insanity. I enjoy every minute off it.
                            Motorcycle racing is rocket science.

                            Linux Registered User # 475019
                            How to Search for AntiX solutions to your problems

                            #135648
                            Member
                            PPC

                              1. What is the order of startup commands or scripts for when I boot antix

                              As far as I know: first antiX startup file (~/.desktop-session/startup) , then the window manager startup file (ex: for IceWM, the default Window Manager, it’s ~/.icewm/startup).

                              3. Where would I insert the xinput set-prop command mentioned above so that it runs automatically every time I log in (or boot up).

                              You can add the command on either startup file, it will work. In the case of the antiX startup file, it will work for all window managers and always run when you start antiX, if you place the command in the window manager startup file, it will run only every time you start that window manager.

                              Like stated in my original post: the reason why ds-mouse has unresponsive (i.e. non working) options is because in the most recent versions of antiX, the software that is used to manage mouse and touchpad inputs was changed. In the middle of so many changes, no one reported that most ds-mouse options would no longer work, because they depended on the old software. The Dev team is almost a one man show… we are trying to fix the situation as fast as possible, but don’t forget: we are not professional programers, and we do need to work to earn money, so we do this on our spare time!
                              All of you, please learn the virtue of waiting until something is finished/fixed!!!

                              P.

                              • This reply was modified 1 month, 2 weeks ago by PPC.
                              • This reply was modified 1 month, 2 weeks ago by PPC.
                              #135661
                              Member
                              PPC

                                OK, during the weekend, I tried to implement a provisional simple GUI that allows users to select a device and then toggle it on/off OR toggle reverse scrolling on/off, FOR THE CURRENT SESSION (i.e., information is not saved across restart/reboot)

                                When I can, I’ll try to add more features to it. The way the script looks is not important, I’m just trying to get the logic of all functions and implement, from strach, what I can. I don’t even know if Dave is working on the same thing or not…

                                Like Robin wished, this allows users to disable a particular touchpad and enable another…

                                P.

                                #135678
                                Member
                                dspencerj3

                                  PPC,
                                  I apologize sincerely if my post came across as critical or complaining. I can tell by your reaction that you have put a lot of time, energy, and passion into antix. I, and I’m sure countless others, appreciate you greatly. If I am off base on your feelings in this, Please ignore this part as I might have given too much stock to your number of “!’s”. 🙂

                                  —————–
                                  “… The Dev team is almost a one man show… we are trying to fix the situation as fast as possible, but don’t forget: we are not professional programers, and we do need to work to earn money, so we do this on our spare time!
                                  All of you, please learn the virtue of waiting until something is finished/fixed!!!”
                                  —————–

                                  A. I had NO IDEA when I began my “natural scrolling” saga that anything was broken and I fully assumed it was a PICNIC scenario — Problem in Chair (mine) – Not in Computer.
                                  B. I also had NO IDEA that antix was almost a one man show … it is so smooth compared to several other light (and heavy) -weight distros I tried. And it has such a huge presence on the web and Youtube, I assumed it was practically foundation status, you know, like Mozilla or something. Hardly any list of great distros for low powered computers lacks antix in the running.

                                  I would imagine that the more people like me adopt antix, especially for keeping old computers out of landfill, the higher the chance of people volunteering to join the 1-man show. I may not be a strong coder, but I have half a brain, and, having recently retired from 25 years as a public school special education teacher, have some free time (when I *should* be writing!) that I could use to occasionally test a script here and there. I think I was pretty darn good at teaching math to struggling students because I was weak in math. I would probably be an excellent candidate for testing out GUI aspects of antix while enhabiting the mindset of our next generation of antix newbies. Who will one day carry the torch.

                                  Again, please accept my apology 🙂
                                  My input on the Mouse config issue will be in a different post/reply.
                                  🙂 —Spence

                                Viewing 15 posts - 16 through 30 (of 104 total)
                                • You must be logged in to reply to this topic.