Skip to main content

i3wm essentials - I (Brightness)

So you have started using i3 and somehow managed to open your browser and almost resumed your normal work. 

But wait, the brightness is too much isn't it? Or is it too low? The mousepad used to work fine, but now all of a sudden tapping does not equal click?! 

Don't worry. This blog series will tell you all about the essential setup commands and common shortcuts that I use to navigate my work in i3, and how you can too.

Changing the brightness

So you just started i3 and you just can't take this brightness setting. You go for your function keys, and damn! They aren't working.

Quick fix:

Run the following command if you need to change the brightness ASAP.

xrandr -q | grep ' connected' | head -n 1 | cut -d ' ' -f1

This will give an ouput that's the name of your monitor. Use that monitor name here and change the values of brightness to suit your needs.

xrandr --output <monitor-name> --brightness 0.7

Now that your eyes are comfortable, let me show you the permanent way.

Permanent fix:

Find your i3 config file

First, find your i3 config file. Here are 4 file paths:
  1. ~/.i3/config
  2. ~/.config/i3/config
  3. /etc/i3/config
  4. /etc/xdg/i3/config
Starting from the first path, run:
ls <path>
If you do not get an output like: 
ls: cannot access '...

And instead get the actual path as output, that is the true path of your i3 config file. This is the file that i3 executes first everytime it is loaded.

Alright, now back to the brightness problems.

Test xbacklight

First, test what this command does:
xbacklight -inc 20
Or
xbacklight -dec 20
If this command works fine for you and the brightness changes, skip this part and scroll down to xbacklight works.

xbacklight gives "No outputs have backlight property"

Alright. Now run: 
ls /sys/class/backlight
If the output is not intel_backlight, scroll down to output is not intel_backlight

The output is intel_backlight

Run this command:
vim /etc/X11/xorg.conf
And paste the following:
Section "Device"
    Identifier  "Intel Graphics" 
    Driver      "intel"
    Option      "Backlight"  "intel_backlight"
EndSection
Restart your PC, and it should work fine.
If you use anything other than Xorg, you might still need to go to output is not intel_backlight.

Doesn't Work?

Read on.

The output is not intel_backlight

Well, that's new. Go follow this forum.
Don't worry if it still doesn't work, I've got a backup plan for you too. Scroll on to Nothing Works.

xbacklight works

Congratulations, the command for brightness works perfectly in your system. Now all you have to do is bind them to the right function keys.

1. Identify which function keys exist for brightness change by looking at the keyboard. Let's say it is F11 & F12.
2. Go to your i3 config file. Find a line that reads:
bindsym XF86MonBrightnessUp exec xbacklight -inc 20
Note: Only do this when you are sure the current keys do not work and the above instructions don't work for you.

There are 2 things you can do. Let's start with the simpler option:
1. Replace XF86... with $mod+F11
2. Or, follow these threads: reddit, unix.

Nothing Works (or TL;DR)

Well, if absolutely nothing from the above list worked for you for brightness change, I have a jugaad (work-around).

Test this output:
xrandr --output <monitor-name> --brightness 0.5
The monitor-name can be obtained from the very first command I wrote on this page.
Now, assuming this command works, run:
vim ~/.bashrc
And add the following line in the file:
alias bright="xrandr --output <monitor-name> --brightness $1"
Close the terminal, open the terminal again, and run bright 0.7.
Does the brightness change?
Say yes, baby!

Now your jugaad is that every time you have to change brightness, you will have to remember to execute the command alias:
bright <any decimal number from 0-1>
You can keep the name anything else too. Just change the alias name in .bashrc.

The End, but is it?

Okay, that's it for my first part. Hope this tutorial helped you. The next part of this series will contain guides on enabling mouse tap, volume control, wifi setup and connection, bluetooth and wallpapers.

Comments

Popular posts from this blog

i3wm essentials - II

Welcome back! Let's continue this guide with other setup essentials for i3. Enabling Mousetap Chances are that if you're using a laptop, then tapping on the mousepad does not equal a click for you. You need to enable tapping in your config. Fortunately, there is one documentation available that works for majority of the setups. I don't need to explain this one in detail. Here you go: Enable tap to click in i3 . Volume Control This one is simple again. Do you remember the i3 config file I talked about in the previous blog ? All you need to do is go to that file and find the line: bindsym XF86AudioRaiseVolume Just below that line you will find lines with XF86AudioLowerVolume and XF86AudioMute too. Anyway, the truth is, there are 2 sets of lines with these keywords. Chances are that the line: bindsym XF86AudioRaiseVolume exec --no-startup-id pactl -- set-sink-volume 0 +5% Will be uncommented and the line: bindsym XF86AudioRaiseVolume exec --no-startup-id pactl -- set-sink vo

Namaste JavaScript Quick Notes

Note:  Akshay Saini's Namaste JavaScript is probably the best course for JavaScript developers out there. These are my personal notes that I made while watching the course; they serve more of as an online quick reference for my understanding and revision, and I hope it benefits anyone reading it too! Everything in JS happens inside an Execution Context. Before a JS code is run, memory is allocated and variables are set as undefined   , and functions are set as their exact code in the scope within the Execution Context. The global execution context hosts all the global variables and function definitions. An Execution Context has 2 components: Memory, that stores variables and functions; and Code, that reads and executes the code. Call Stack maintains the order of execution contexts. Since JS is single threaded and asynchronous, at one point of time, only one function is executed which is at the top of the call stack. For each function, an execution context is created before executi