Ever since I've started using Ubuntu, I've always relied on the keyboard to get things done. I switched to Mac OS on a macbook air in 2018 and the first thing I did was learn all the keyboard shortcuts. Keyboards are an amazing tool to get things done without lifting the palms. Modal editors like VI and VIM force the user to get acquainted with the keyboard to interact with the editor.
After I decided to give Ubuntu another shot on my old machine, I was stuck with the horrible mouse pointer support that Ubuntu has. Or maybe its my hardware that sucks, its a logitech wired mouse from Adam's age. So clicking to close one tab on chrome accidently closes multiple ones. Drag and drop is an issue. Heck, I can't even select the text properly. It is incredibly frustrating to be stuck with such a mouse. And with the lockdown in place amists the Covid-19 pandemic, there is no way I can get another mouse ordered from amazon.
My setup uses two displays. The primary display is the one that's built into my Dell Inspiron 5521R and the secondary display is an external monitor. Since the 5521R's screen is a touchscreen, the panel has a glossy coating on it that makes it a bit unreadable in daylight. Hence I set it up to max brightness during the day and easy on the eye brightness during the night time. The only issue is the built in keyboard went bust and so I have to rely on the software to tweak the brightness. And with the unreliable accuracy of the pointer, I had to look for some workarounds.
The xrandr (X RandR) command invokes the official configuration utility for the X window system. I use this command to adjust the brightness of my primary display.
If you are using multiple monitors, you need to query which display is your primary display and which one is the secondary display. ➜ `xrandr -q` will give you the list of display ports attached to your machine as well as the ones that are currently being used.
➜ `xrandr -q`
➜ Screen 0: minimum 320 x 200, current 2688 x 1366, maximum 16384 x 16384
LVDS-1 connected 768x1366+0+0 left (normal left inverted right x axis y axis) 344mm x ...
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1920x1080+768+286 (normal left inverted right x axis y axis) ...
DP-1 disconnected (normal left inverted right x axis y axis)
You can see in the above output the displays connected, what port is in use, and the rotation as well. My primary display LVDS-1 is used as a vertical display and hence is rotated counterclockwise. The secondary display is HDMI-1 . Now that I know what display is the primary one, I need to use the following command to set the brightness to the desired value. The --output flag requires additional arguments. So we will specify the display and the value of the brightness to be set. The value is typically set between 0 and 1 with 0 being the least and 1 being the max brightness.
➜ xrandr —output LVDS-1 —brightness 0.5 // sets the brightness to 0.5.
➜ xrandr —output LVDS-1 —brightness 0.75 // sets the brightness to 0.75.
Linux commands can get lengthy to type and so I've made an alias in my ~/.zshrc to make controlling the brightness a breeze.
alias maxb="xrandr —output LVDS-1 —brightness 1"
alias medb="xrandr —output LVDS-1 —brightness 0.7"
alias minb="xrandr —output LVDS-1 —brightness 0.5"
alias zerob="xrandr —output LVDS-1 —brightness 0"
After having 4 aliases set, I kinda messed up wondering which alias was setting the brightness to 0.7 and 0.5. And there were times when I needed more fine-tuned control over the brightness. So I set up the following alias which allowed me to specify the value between 0 and 1 while still keeping it short. alias lumos="xrandr --output LVDS-1 --brightness" I run it like so ➜ lumos 0.7.
X RandR is a good utility for me especially given how I use the laptop as a vertical monitor and don't have its built-in keyboard to control various functions. This also helps me not move my palms away from the keyboard too frequently.