{"id":175,"date":"2023-12-12T08:50:08","date_gmt":"2023-12-12T08:50:08","guid":{"rendered":"http:\/\/localhost:9090\/?p=175"},"modified":"2024-06-23T03:48:03","modified_gmt":"2024-06-23T03:48:03","slug":"disable-keyboard-touch-pad-in-pop","status":"publish","type":"post","link":"http:\/\/localhost:9090\/disable-keyboard-touch-pad-in-pop\/","title":{"rendered":"Disable keyboard touch pad in Pop!"},"content":{"rendered":"\n
In the case of convertible laptops the keyboard and touchpad needs to be disabled if the laptop screen is being used as a tablet and you dont want accidental keypresses. This happens automatically on windows but linux and Pop! does not detect the switch which allows it to know that the laptop os being flipped. Some laptops show up this key , some dont.<\/p>\n\n\n\n
ray@pop-os:~\/TabletButton$ xinput list \n\u23a1 Virtual core pointer \tid=2\t<\/strong>[master pointer (3)]\n\u239c \u21b3 Virtual core XTEST pointer \tid=4\t[slave pointer (2)]\n\u239c \u21b3 Asus Keyboard \tid=9\t[slave pointer (2)]\n\u239c \u21b3 Asus Keyboard \tid=11\t[slave pointer (2)]\n\u239c \u21b3 ELAN9008:00 04F3:2FC2 \tid=12\t[slave pointer (2)]\n\u239c \u21b3 ASUE120D:00 04F3:31FB Mouse \tid=14\t[slave pointer (2)]\n\u239c \u21b3 ASUE120D:00 04F3:31FB Touchpad \tid=15\t[slave pointer (2)]<\/strong>\n\u239c \u21b3 input-remapper Asus Keyboard forwarded \tid=20\t[slave pointer (2)]\n\u239c \u21b3 ERGO M575 Mouse \tid=22\t[slave pointer (2)]\n\u239c \u21b3 input-remapper ERGO M575 Mouse forwarded\tid=23\t[slave pointer (2)]\n\u23a3 Virtual core keyboard \tid=3<\/strong>\t[master keyboard (2)]\n \u21b3 Virtual core XTEST keyboard \tid=5\t[slave keyboard (3)]\n \u21b3 Video Bus \tid=6\t[slave keyboard (3)]\n \u21b3 Power Button \tid=7\t[slave keyboard (3)]\n \u21b3 Sleep Button \tid=8\t[slave keyboard (3)]\n \u21b3 Asus Keyboard \tid=10\t[slave keyboard (3)]\n \u21b3 ELAN9008:00 04F3:2FC2 Stylus \tid=13\t[slave keyboard (3)]\n \u21b3 Asus WMI hotkeys \tid=16\t[slave keyboard (3)]\n \u21b3 Asus Keyboard \tid=17\t[slave keyboard (3)]\n \u21b3 input-remapper keyboard \tid=18\t[slave keyboard (3)]\n \u21b3 input-remapper Asus Keyboard forwarded \tid=19\t[slave keyboard (3)]\n \u21b3 input-remapper Asus Keyboard forwarded<\/strong> \tid=21\t[slave keyboard (3)]<\/strong><\/code><\/pre>\n\n\n\nWe can find the correct input type by disconnecting and connecting. If you are successful and the keyboard is disabled you need an external usb keyboard to start typing to reattach. So its best to use the below script to experiment which finishes in a certain time and you regain keyboard.<\/p>\n\n\n\n
#!\/bin\/bash\n\n#to disconnect by id\n#disconnect special key\nxinput float 18\n#disconnect main keyboard\nxinput float 19\n#disconnect special key\nxinput float 21\n#disconnect touch pad\nxinput float 15\n\nsleep 10s # Waits 10 seconds. \n#Check if your keyboard and touchpad is disabled\n\n#to reconnecct by id to parent\nxinput reattach 18 3\nxinput reattach 19 3\nxinput reattach 21 3\nxinput reattach 15 2<\/code><\/pre>\n\n\n\nCreate a Gnome Panel applet to do the same. We need a dependency for this<\/p>\n\n\n\n
sudo apt-get install gir1.2-appindicator3-0.1 <\/code><\/pre>\n\n\n\nNow the script<\/p>\n\n\n\n
#!\/usr\/bin\/python3\n\n# This code is an example for a tutorial on Ubuntu Unity\/Gnome AppIndicators:\n# http:\/\/candidtim.github.io\/appindicator\/2014\/09\/13\/ubuntu-appindicator-step-by-step.html\n# https:\/\/gist.github.com\/candidtim\/7290a1ad6e465d680b68\n\nimport os\nimport signal\nimport json\nimport subprocess\n\nimport gi\ngi.require_version('Gtk', '3.0') \nfrom gi.repository import Gtk as gtk\nfrom gi.repository import AppIndicator3 as appindicator\nfrom gi.repository import Notify as notify\n\n\n\nAPPINDICATOR_ID = 'tabletmodeindicator'\n\ndef main():\n indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath('\/home\/surajitray\/TabletButton\/tablet.svg<\/strong>'), appindicator.IndicatorCategory.SYSTEM_SERVICES)\n indicator.set_status(appindicator.IndicatorStatus.ACTIVE)\n indicator.set_menu(build_menu())\n notify.init(APPINDICATOR_ID)\n gtk.main()\n\ndef build_menu():\n menu = gtk.Menu()\n\n item_tbmode = gtk.MenuItem('TabletMode')\n item_tbmode.connect('activate', tbmode)\n menu.append(item_tbmode)\n\n\n item_lpmode = gtk.MenuItem('LaptopMode')\n item_lpmode.connect('activate', lpmode)\n menu.append(item_lpmode)\n\n item_quit = gtk.MenuItem('Quit')\n item_quit.connect('activate', quit)\n menu.append(item_quit)\n\n menu.show_all()\n return menu\n\ndef tbmode(_):\n subprocess.call(\"\/home\/surajitray\/TabletButton<\/strong><\/strong>\/keyboardtouchpaddisable.sh<\/strong>\", shell=True)\n return tbmode\n\ndef lpmode(_):\n subprocess.call(\"\/home\/surajitray\/TabletButton<\/strong><\/strong>\/keyboardtouchpadenable.sh<\/strong>\", shell=True)\n return lpmode\n\ndef quit1(_):\n notify.uninit()\n gtk.main_quit()\n\nif __name__ == \"__main__\":\n signal.signal(signal.SIGINT, signal.SIG_DFL)\n main()<\/code><\/pre>\n\n\n\nThe scripts are below<\/p>\n\n\n\n
keyboardtouchpaddisable.sh<\/strong><\/p>\n\n\n\n#!\/bin\/bash\n\nxinput float 18\nxinput float 19\nxinput float 21\nxinput float 15<\/code><\/pre>\n\n\n\nkeyboardtouchpaddisable.sh<\/strong><\/p>\n\n\n\n#!\/bin\/bash\n\nxinput reattach 18 3\nxinput reattach 19 3\nxinput reattach 21 3\nxinput reattach 15 2<\/code><\/pre>\n\n\n\nYou can use any svg for the image : \/home\/surajitray\/TabletButton\/tablet.svg<\/strong>, just make sure the image and path are correct. Now you can put this item in the startup applications<\/p>\n\n\n\n<\/p>\n\n\n\n