First Steps with Kali – Changing Keyboard Layout and Natural Scrolling Settings

Emilia VemarajuEmilia Vemaraju
5 min read

Right after I set up my first Kali Linux Virtual Machine (VM) on a MacBook, I ran into a couple of issues - one with the keyboard layout and another with scrolling behavior. Most characters were mapped correctly, but symbols like “~” and “@” were misplaced. Additionally, the scrolling was set to natural, which felt nonintuitive to me. To use Kali comfortably, I needed to address both problems.

During my research, I came across several forum posts from users experiencing the exact same issues. Unfortunately, most of those threads had no replies - and when they did, the responses often came from frustrated users saying things like: "If you can’t handle this kind of thing, you shouldn’t be using Kali in the first place". I disagree with that mindset. You can’t assess someone’s general knowledge of a topic based solely on the questions they ask. While I agree that beginners should approach Kali with caution - being mindful of their steps and ideally starting in a virtual machine for safety - I don’t believe we should be discouraged or “banned” from using it altogether just because there are more beginner-friendly systems available.That’s why I’m sharing what worked for me - here on my blog and in response to those earlier unanswered threads.

Kali isn’t some sacred tool reserved only for experts who’ve passed a rite of passage. It’s a powerful system that can be used by anyone with the willingness to learn. So...

Can’t access the ~ and @ characters in Kali on your MacBook? Keep reading - here’s how to fix it!

When trying to solve the incorrect key mapping, I quickly realized the issue was due to the keyboard layout. I experimented with the Kali GUI and tried switching layouts via the command line - using various Apple layouts and even the generic pc105 - but none of them worked properly.

Eventually, I discovered a command called setxkbmap, which lets you manually set the keyboard layout using command-line options. I’d seen some people mention a variant or model simply called 'mac', so I decided to try it directly in the setxkbmap command, like this:

setxkbmap -layout us -variant mac

Then I rebooted the system, et voilà! Everything worked, and I could use ‘~’ and ‘@’ as expected again!

How to Disable Natural Scrolling Inside a QEMU Virtual Machine on a MacBook

The solution I found will most likely work for you if:

  • Your QEMU VM is installed on a MacBook,

  • You run Kali Linux,

  • Your native MacBook trackpad scrolling works fine on macOS (the host OS),

  • And inside the Kali VM, two-finger scrolling feels reversed or “unnatural.”

Firstly, let me explain what didn’t work. I tried changing basic mouse and touchpad settings, but it didn’t help - most likely because the VM uses virtual input devices (QEMU USB tablet/mouse) instead of the real MacBook hardware. That’s why Kali’s input system (libinput) couldn’t properly control or invert the scroll direction for these virtual devices.

I located the QEMU virtual mouse device and confirmed that natural scrolling was disabled, yet the scroll direction still felt “off” and behaved like enabled. Therefore I experimented with settings via xinput, but it didn’t change anything because the virtual device doesn’t fully support those options.

After some research, I found the imwheel utility, which allows you to customize mouse wheel behavior. First, I had to install it:

Command 'imwheel' not found, but can be installed with:
sudo apt install imwheel
Do you want to install it? (N/y)y

Then, after a few attempts, I created a ~/.imwheelrc file using ‘nano’ command (in two weeks I won’t be using nano, pinky promise):

nano ~/.imwheelrc

Now, why did I name the file ~/.imwheelrc and not, for example, imwheelscrolling?
It’s because that’s the specific filename the imwheel program expects. The ~ refers to your home directory. .imwheelrc is a dotfile, meaning it’s hidden by default and typically used for user-level configuration. The suffix ‘rc’ stands for “run commands” or “runtime configuration,” which is a common Linux convention.

Next, I added these two settings to the file created with nano:

".*"
None, Up,   Button5
None, Down, Button4

What’s “.*”? It’s an important regular expression that tells imwheel: “Apply the following mouse button remappings to all windows, no matter their name.” Hence, as imwheelrc config is structured like this:

"window_name_pattern"
modifier, direction, button

"window_name_pattern" is a regex that matches the title of the application window. If we wanted our scroll inversion to be applied only to the Firefox window, we’d place "Firefox" here. However, since we want to match all windows, with no exceptions, I chose the regular expression ".*" to match any string of any length - meaning all windows.

The second line, None, Up, Button5, means: when no modifier key is held and the user scrolls up, send Button5 instead (inverting the scroll direction).

After saving the newly created file, I ran imwheel with the following parameters:

imwheel -b "4 5"

-b means buttons; 4 is scroll up and 5 is scroll down in X11 (the windowing system Linux uses). And ta-da! After running this command, your scrolling should be inverted!

I loved the process of researching all these commands and digging deeper to understand exactly how they work, instead of just pasting random solutions into the terminal. I believe that being stuck is the best way to learn!

0
Subscribe to my newsletter

Read articles from Emilia Vemaraju directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Emilia Vemaraju
Emilia Vemaraju

I was supposed to become a pianist but I chose not to. Instead, I’m a self-driven cybersecurity learner, preparing for a career in Detection & Response or Red Teaming. I'm currently building hands-on experience through platforms like TryHackMe and Hack The Box, focusing on practical skills in threat detection, incident response, and ethical hacking. My goal is to enter the cybersecurity field in 2026 with a strong portfolio, real-world lab experience, and relevant certifications.