disable swipe to go back chrome
To disable swipe to go back in Chrome using Go language, you can use the robotgo
package, which provides Go bindings for the cross-platform library that allows you to control the mouse and keyboard. Here are the steps to achieve that:
- Install the
robotgo
package by running the following command in your terminal:
go get github.com/go-vgo/robotgo
- Import the
robotgo
package in your Go code:
import "github.com/go-vgo/robotgo"
- Use the
robotgo.EventHook()
function to hook into the mouse events:
robotgo.EventHook(robotgo.MouseWheel, []string{})
- Inside the event loop, use the
robotgo.EventStart()
function to start capturing mouse events:
go robotgo.EventStart()
- In the event loop, you can check for mouse wheel events and disable the swipe to go back action:
for {
event := <-robotgo.EventStart()
if event.Kind == robotgo.MouseWheel {
robotgo.EventEnd()
}
}
- Run your Go program to disable the swipe to go back action in Chrome.
This code will hook into the mouse events and disable the swipe to go back action by ending the event when a mouse wheel event is detected.