i3 laptop configuration: how to reduce performance to 100%?

I recently realized that my laptop is not performing well enough. It lacks the power to bring everything together: Vim (+ 20 plugins), VSCode (+ the same number of extensions), Google Chrome (+ 20 tabs) and so on. It seemed to be a common problem on laptops with 4 GB of RAM, but I did not give up. I love laptops for their small size and the fact that they can run on battery anywhere. I just needed to think about how to free up extra RAM, as well as increase energy efficiency.

i3 laptop configuration: how to reduce performance to 100%?

If you need configs right away, then scroll down to the section "Picking up the installation"

Operating system

Since I need an OS that will eat the least amount of RAM and battery, I chose Arch Linux. Classic, nothing new. Its repositories will allow me to automate a bunch of unnecessary work, and AUR will save even more time.

window manager

I decided to take the window manager, and not a full-fledged environment. Although I like sneakers (KDE), they still eat quite a lot, due to the fact that they pull a lot of libraries and dependencies with them. Well, by itself DE'shka eats quite a lot because of all sorts of unnecessary widgets.

i3 laptop configuration: how to reduce performance to 100%?

Parsing the installer

First we need to install all the main packages (we need to configure something)

sudo pacman -Sy --noconfirm i3 i3-gaps base-devel rofi okular feh vim code picom kitty ranger git xdotool xautolock i3lock-color scrot imagemagick rxvt-unicode urxvt-perls

Here is an example diagram of how it will work

i3 laptop configuration: how to reduce performance to 100%?

What packages are needed for what?

Plastic bag
What is it needed for

xwinwrap
Required to install .gif files as animated wallpapers

polybar
Needed in order for the window manager to display the topbar

i3
The window manager itself

i3 gaps
Window manager extension

base-devel
Components needed to install polybar

rofi
Application Launcher

okulate
Document viewer

zathura
Document viewer (fewer extensions supported, but more minimalistic)

feh
Program for viewing pictures, as well as for setting background images

vim
Main editor

queues
Additional editor

picom
Composer (a program that creates shadows, transparency, blurs the background)

kitty
Main terminal

urxvt
Additional terminal

creak
File Manager

git
Version control system

xdotool
A utility that will help in developing scripts and interacting with windows

xautolock
A utility that locks the computer when idle and launches i3-lock

i3lock color
Improved version of i3lock. The program is needed to lock the computer and enter a password

scrotum
Minimalist screenshot app

imagemagick
A program that will help when interacting with pictures (blurs them in advance, converts, changes resolution)

Configuring i3

i3 - A window manager that does not consume a lot of resources, thus, it will be useful to us in order to "emulate" other ordinary window managers. (The gift, of course, is tiling - the ability of the window manager to expand applications to the entire free part of the screen)

I will provide the config i3 in parts, so that even beginners understand everything. Let's start with the most important - the button $mod. It serves to interact with i3. All major hotkeys will pass through it.

### Tweaks ###
# Set main key (Win)
set $mod Mod4

Next, we will teach our window manager to move windows with the mouse when clicked. $mod

# Press MOD key and click on mouse to move your window
floating_modifier $mod

# Focus doesn't follow the mouse
focus_follows_mouse no

Let's install fonts for our applications, as well as for applications that depend on i3

# Fonts
font pango: JetBrains Mono 10

My idea was to make all the windows initially flying (Which turned out to be very convenient). For clarification: in i3 there are many kinds docking windows (Tilling, Fullscreen, Tabbed, Float, Stacking), they are all handy in different situations, but I see no reason to do all windows fill the entire screen. Better let them fill it when pressed $mod + f, but hang in the air by default, which I did in the following piece of code:

# Maximum width for floating windows
floating_minimum_size 400 x 350
floating_maximum_size 1800 x 900

# (1920 - 10)/2 and (1080 - 10)/2
for_window [class=".*"] floating enable
for_window [class=".*"] resize set 955 535
for_window [class=".*"] focus

In order not to confuse the expression (1920 - 10)/2 and (1080 - 10)/2 means that each window will take up a quarter of the screen, and will also be indented (from each other) by exactly 5 pixels (5 on all sides).

Next, let's bind all the main applications. All hotkeys try to follow this scheme.

i3 laptop configuration: how to reduce performance to 100%?

## Keyboard Settings ##
# Apps
bindsym $mod+Return exec kitty
bindsym $mod+Mod1+r exec "kitty sh -c 'ranger'"
bindsym $mod+Mod1+g exec google-chrome-stable
bindsym $mod+Mod1+c exec code
bindsym $mod+Mod1+v exec dolphin
bindsym Print exec spectacle

Also, we will bind all the main functions that we perform without thinking, and which must be

# System / Volume
bindsym XF86AudioMute "exec amixer -D pulse sset Master toggle && notify-send "Volume" "Sound is (un)muted" --urgency low"
bindsym XF86AudioRaiseVolume "exec amixer -D pulse sset Master 5%+ && notify-send "Volume" "Volume added +5%n    Volume level is now $(amixer -D pulse get Master | awk -F 'Left:|[][]' 'BEGIN {RS=""}{ print $3 }')" --urgency low"
bindsym XF86AudioLowerVolume "exec amixer -D pulse sset Master 5%- && notify-send "Volume" "Volume added -5%n    Volume level is now $(amixer -D pulse get Master | awk -F 'Left:|[][]' 'BEGIN {RS=""}{ print $3 }')" --urgency low"

# System / Brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 5
bindsym XF86MonBrightnessUp exec xbacklight -inc 5

# Moving from one window to another
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# Choose one of your workspaces
bindsym $mod+1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4

# Move window to the workspace
bindsym $mod+Shift+1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4

## Floating manipulation ##
# Make window floating
bindsym $mod+f floating toggle
# Change focus
bindsym $mod+Shift+f focus mode_toggle

# Move windows
bindsym $mod+Shift+h move left 20px
bindsym $mod+Shift+j move down 20px
bindsym $mod+Shift+k move up 20px
bindsym $mod+Shift+l move right 20px

# Resizing Windows
bindsym $mod+Ctrl+l resize shrink width 10 px or 10 ppt
bindsym $mod+Ctrl+k resize grow height 10 px or 10 ppt
bindsym $mod+Ctrl+j resize shrink height 10 px or 10 ppt
bindsym $mod+Ctrl+h resize grow width 10 px or 10 ppt

# Make window fullscreen
bindcode 95 fullscreen toggle

# Reload Configuration
bindsym $mod+p reload

# Kill a window
bindsym $mod+x exec xdotool getwindowfocus windowkill

Let's make an autostart section

### Autostart ###
# Lockscreen after 10min delay
exec --no-startup-id "$HOME/.config/i3/lockscreen"
# Convert background gif to jpg
exec --no-startup-id convert -verbose $HOME/.config/i3/{gif.gif,gif.jpg}
# Generate Colorscheme
exec_always --no-startup-id wal -i $HOME/.config/i3/gif-0.jpg
# Compositor
exec_always --no-startup-id "killall -q picom; picom --config $HOME/.config/picom.conf"
# Language
exec --no-startup-id setxkbmap -model pc105 -layout us,ru -option grp:win_space_toggle
# Dunst
exec --no-startup-id dunst
# Kitty
exec kitty
# Dropbox
exec --no-startup-id dropbox &
# Polybar
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# Cursor
exec_always --no-startup-id xsetroot -cursor_name left_ptr

i3 gaps - build i3, which adds many new features. One of them is the addition of gaps, which visually look very good.

### i3-gaps ###
# Borders for windows
for_window [class=".*"] border pixel 5

# Gaps for i3bar
for_window [class="i3bar"] gaps outer current set 10

# Gaps
gaps inner 10
gaps outer 4

### Topbar and color theme ###
# Color theme of borders
client.focused              #bf616a #2f343f #d8dee8 #bf616a #d8dee8
client.focused_inactive     #2f343f #kf343f #d8dee8 #2f343f #2f343f
client.unfocused            #2f343f #2f343f #d8dee8 #2f343f #2f343f
client.urgent               #2f343f #2f343f #d8dee8 #2f343f #2f343f
client.placeholder          #2f343f #2f343f #d8dee8 #2f343f #2f343f
client.background           #2f343f

What happened?

And it turned out to be a rather minimalistic assembly on i3, which works very fast on laptops and gives good performance.

i3 laptop configuration: how to reduce performance to 100%?

Since I wrote a lot of configurations (which is clearly visible in the screenshot), they can be found in the repository Great i3.

A couple more screenshots

i3 laptop configuration: how to reduce performance to 100%?

i3 laptop configuration: how to reduce performance to 100%?

i3 laptop configuration: how to reduce performance to 100%?

Source: habr.com

Add a comment