Skip to content

Brutuski/linux-wm-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Guide to Windows Managers in Linux

Maintenance GitHub license

Introduction

This is intended to be a simple guide to help anyone get started with a WM in linux. I personally use Arch along with i3-gaps. While setting up everything from scratch, it seemed like a monumental challenge to install and get started with. For any suggestions, edits or questions start a new issue.

The example config files shown here are from my own dotfiles. A complete set of all dotfiles can be found here. They are formatted and commented to make things easier to understand.

Packages and programs mentioned here are available for all linux distros. The configs provided here are verified to work on drawing Arch but should work on most distros. Some features might require tweaking to work on other distros.

What is a Windows Manager(WM)?

As the name implies, a WM is a software that manages the placement and movements of windows. Nothing more.

Some of the different kinds of WM are:

  • Stacking WM: allow for overlapping floating windows. Some examples of stacking WM are:
  • Tiling WM: windows are opened in full screen more. Every subsequent window splits the screen space. Some of the popular tiling WM are:
  • Dynamic WM: dynamically change between tiling and floating modes. Some of the popular dynamic WM are:
  • Composite WM: all windows are drawn and buffered individually with additonal effects such as 3D animations, blurr, fading etc. Some of the popular composite WM are:
    • Windows WM
    • OS X WM

We will be focusing on tiling WM here, in particular i3-wm and it's forks. It is very minimal and does not come with any added modules. All further configuration is left to the user's discretion.

Difference between Desktop Environment(DE) and WM

A full DE comes with a WM and other modules like a network manager, filemanager and so on.

A WM however lacks such modules and typically is only capable of handling window placements for the most part.

Some distros come with full Desktop Experiences by default. For example:

Distros like Arch however come with no GUI. It is left upto the user to choose and install what they please.

An extensive list of WM is available on the archwiki

My setup

After having extensively used Ubuntu 18.04, I changed over to my current setup:

  • Arch OS
  • i3-gaps WM
  • lightDM - Display Manager
  • Polybar - Bar to show different information
  • Rofi - Program launcher
  • Nautilus - GUI filemanager
  • Ranger - Terminal filemanager
  • Dunst - Notification daemon
  • i3-lock - for lockscreen

Installation

After having installed the desired OS, (Links top get started with installing Arch and Ubuntu) open up the terminal. On arch you are already on the terminal after a fresh install. On Ubuntu you can either press Ctrl + Alt + Enter or simply open it from the Gnome App launcher.

To install i3-gaps simply enter:

  • on Arch: sudo pacman -S i3-gaps
  • on Ubuntu i3-gaps first need some dependencies and then it is installed from source
sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf xutils-dev libtool libxcb-shape0-dev 
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
git checkout gaps && git pull
autoreconf --force --install
rm -rf build
mkdir build
cd build
../configure --prefix=/usr --sysconfdir=/etc
make
sudo make install

For further information refer to the i3-gaps wiki

After Installation, restart your PC and once logged in you will be prompted by the i3 setup.

Additional Requirements and Recommendations

To get i3 config highlighting in vim, install i3config vim plugin. Makes it much easier to visually navigate the config file in vim. For example

Install a Display Manager like LightDM. This displays the X server where necessary and runs a greeter allowing the user to login. More information and options for DM is available on arch wiki

To display information on a bar, there are several different programs available. Two of the most popular ones are i3status and Polybar. I personally use polybar, there are numerous modules available for both.

A progam launcher is needed as well. d-menu is a very popular program launcher, also highly customizable. rofi is the other popular alternative and extremely customizable.

Having no full DE and only a WM means your background will be black/empty. Feh is a program that can very easily set background images.

Another essential program would be filemanagers. Some popular graphical filemanagers are nautilus, thunar.

Terminal based filemanagers are also available, ranger and nnn

Common Keybidings

i3 uses either the Alt key (referred to as Mod1) or the Win key(referred to as Mod4 in the i3 config) as a MOD key. This is configured by the user during initial setup. Can be changed later any time by editing the following line in the config

set $mod Mod<num>

Some common and default shortcuts to get started with are:

  • Open terminal: Mod + enter
  • Open dmenu: Mod + d
  • Reload i3 config: Mod + shift + r
  • Closing windows: Mod + shift + q
  • Switching to Workspace: Mod + <num>
  • Shifting window to Workspace: Mod + shift + <num>
  • Toogle window to floating: MOD + shift + space

All these shortcuts can be customized by editing .config/i3/config

A full list of all i3 options can be found in the comprehensive i3 user documentation

Editing Configurations

i3 config is located at .config/i3

Open it with any editor to edit it. With vim for example vim .config/i3/config or using any preferred editor.

Default i3 config looks like this.

My i3 config file is linked here as well.

Some useful tips to get started:

  • To comment out a line, type # before it.

  • To set a custom keybinding

    bindsym $mod+z exec <program name>
    
  • To always execute a custom script on startup, starting polybar for example

    exec_always --no-startup-id $HOME/.config/polybar/launch.sh
    
  • To switch between multiple keyboard layouts, US and German for example (necessary drivers required)

    exec_always setxkbmap -layout us,de
    
  • To start a particular program in floating mode always

    for_window [class="<program_name"] floating enable
    

How to procede further

  • Install polybar to show information from various modules. A lot more modules for it can be found here and here. Polybar can be customized with various themes and color schemes as per the user's setup.

    • Example bars: bar1

      bar2

  • Install Rofi to launch programs. Rofi's look and functions can be customized by editing the config (located at .config/rofi/config).

    My rofi setup:

    rofi

    Rofi can also be used for various other functionalities, such as:

    • Powermenu:

      Powermenu

    • Window Switcher :

      windowswitcher

    Scripts for Powermenu and Window Switcher are linked as well to get started with.

  • Install feh, a lightweight image viewer. Feh also sets wallpapers: feh --bg-scale /path/to/image.file

  • Install i3-lock to use as lockscreen. A keybind to lock your screen can be added to i3 as such:

    bindsym $mod+F1 exec --no-startup-id i3lock -i ~/path/to/image.png -p default -n
    
    

    My lockscreen:

    lock-screen

    To unlock, simply start typing the password and press Enter

  • Install Dunst to be use as a notification daemon. Dunst is highly configurable and lightweight. My config is included here. Example image for Dunst

    dunst

Forums

List of some forums to help with questions and customizations:

Disclaimer

I am not a pro user, so there might be some errors in this guide. If you find any, please point them out and open an issue here.

My setup is also geared towards being a programmer and IT person. You might want to make your own customizations as per your requirements.

I started using Ubuntu to learn more about computers and as a hobby as well. After distro hopping I eventually settled on Arch linux. While arch wiki is hands down the most comprehensive set of documentation and guides for anything linux related, it can however be jarring to someone just getting started. With this guide I hope to share what I have learnt after all the trial and errors and give a beginner a boost.

License

This Project is licensed under the MIT License - see the LICENSE file for more details.