Tagged: neovim

Exploring with Gentoo Linux (Part 3)

Part 3 - Setting up i3 Window Manager

It's been a couple of years since I started using Tiling Window Manager. I first started with Awesome because it's said that this window manager was somewhat between floating and tiling window manager. It uses Lua to configure the system. It's not the easiest language to learn, but not the most difficult one, either. I liked it but I found a bit cumbersome to arrange windows the way I wanted. So, I migrated over to i3.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

I love i3 for its simplicity and text based configuration file. It's fast, powerful and supports multi-monitors well. I don't think I can go back to any other Window Managers anymore.

X11:

Updated: Updated article about X11

To use i3 Window Manager, X Window System needs to be installed. # emerge --ask x11-base/xorg-drivers # emerge --ask x11-base/xorg-server

When the installation is finished, some environment variables will need to re-initialized before continuing. Source the profile with this command:# env-update # source /etc/profile

NVIDIA Driver:

Updated: Updated article about NVIDIA Driver

I have a rather old NVIDIA GeForce GTS 450. For some reasons, the latest drivers from the nvidia website always doesn't work even though it says its compatible with my graphic card. So, I use the one I know it works from before.# sh NVIDIA-Linux-x86_64-390.116.run

i3 Window Manager:

The installation of i3wm is straight forward.# emerge --ask x11-wm/i3

After i3wm is successfully installed, we need a way to execute it and get into i3 window environment. To do this, ~/.xinitrc needs to be created. This is the file when startx and xinit are run and execute it. If this file is not present, startx run the default from /etc/X11/xinit/xinitrc.$ nvim ~/.xinitrc ========== exec i3

Then, we need to update ~/.xinitrc to load ~/.Xresources automatically each time startx is executed so the config is loaded into urxvt.$ nvim ~/.xinitrc ========== [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources exec i3

Rofi:

Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that I've been using since the day I switched to i3 Window Manager.# emerge x11-misc/rofi

i3pystatus:

Installation of i3pystatus is straightforward. To display icons, I'd need Font Awesome installed.# emerge --ask media-fonts/fontawesome

Then, install pip, Python's package management system.# emerge --ask dev-python/pip

Using pip, i3pystatus can be installed. The --user option is needed because I'm installing it as a regular user. This will install it user's $HOME directory ($HOME/.local/): $ pip install --user i3pystatus

As mentioned before, i3pystatus was installed under $HOME/.local/bin/, this needs to be added to $PATH.

Finally, install some modules to display volume, memory usage, disk usage, network status, etc.

Updated: Updated article about Python Modules
$ pip install --user colour \ netifaces \ psutil

New: Pop-up Calendar Applet

gsimplecal:

I wanted a simple calendar applet to pop up when the date/time field in i3pystatus is clicked. What I was looking for is something simple, small, and lightweight calendar app, and narrowed down to Orage and gsimplecal. Orage is from XFCE, known its lightweight desktop environment, and gsimplecal is written in C++ using GTK for OpenBox. Both are simple and lightweight, but I decided to use gsimplecal because I can control its behavior from a config file.$ cd /tmp $ git clone git://github.com/dmedvinsky/gsimplecal.git $ cd gsimplecal $ ./autogen.sh $ ./configure $ make ... Unique.cpp:7:10: fatal error: sys/sysctl.h: No such file or directory 7 | #include <sys/sysctl.h> |

At this point, it failed on my system because sysctl.h is under /usr/include/linux/ directory. To fix this issue, simply edit the affected Unique.cpp under gsimplecal/src/ directory.

After correcting the path for the header file, re-run the make command and continue installing the app$ make $ make install

Then create a config file under ~/.config/gsimplecal/ and enter the following config values:$ mkdir ~/.config/gsimplecal $ cd ~/.config/gsimplecal/ $ nvim config ================== show_calendar = 1 show_timezones = 1 mark_today = 1 show_week_numbers = 1 close_on_unfocus = 0 external_viewer = sunbird \-showdate "%Y\-%m\-%d" clock_format = %a %d %b %H:%M force_lang = en_US.utf8 mainwindow_decorated = 0 mainwindow_keep_above = 1 mainwindow_sticky = 0 mainwindow_skip_taskbar = 1 mainwindow_resizable = 0 mainwindow_position = none mainwindow_xoffset = 1690 mainwindow_yoffset = 845 clock_label = Local clock_tz = clock_label = Tokyo clock_tz = :Asia/Tokyo clock_label = Taiwan clock_tz = :Asia/Taipei

The last step is to integrate gsimplecal to i3pystatus.$ nvim ~/.config/i3/pystatusconfig.py ================== ... status.register("clock", format="%b %e (%a) %H:%M %p ", color="#fffff3", interval=1, on_rightclick="gsimplecal", on_leftclick="gsimplecal", ) ...

That's all!
-gibb

Exploring with Gentoo Linux (Part 2)

Part 2 - Configuring Other Applications

Git:

Git is distributed revision control and source code management software. I need to install git first because I have dotfiles and config files for the applications I need. # emerge --ask dev-vcs/git

After the installation, following config settings need to be done at least.$ git config --global user.name "my_username" $ git config --global user.email "my_email"

Then, download the dotfiles from Github.$ cd ~/ $ git clone https://github.com/ubyt3m3/dotfiles.git ... $ ls dotfiles

st:

st is a simpke terminal for X. I use this terminal until I finish setting up urxvt. savedconfig USE flag lets you save a customized configuration file to /etc/portage/savedconfig/x11-terms/st.# echo "x11-terms/st savedconfig" > /etc/portage/package.use/st # emerge --ask x11-terms/st

Rxvt-unicode:

Rxvt-unicode (urxvt) is THE terminal emulator that I must have in my work environment since OpenBox days. It's fast, lean, highly customizable and can display different fonts. I have another post regarding how I customize it.

Gentoo Linux allows you to choose what options to enable or disable using the USE flags. The options I wanted to enable were the followings:

  • 256-color: Enable 256 color support
  • unicode3: Use 21 instead of 16 bits to represent unicode characters
  • xft: Build with support for XFT font renderer (x11-libs/libXft)
  • gdk-pixbuf: Build with support for image loading and manipulation. Need this for image previewing in ranger

There are a few ways to do this in Gentoo. Since I wanted to do per package base, I set it in the /etc/portage/package.use/ directory:# echo "x11-terms/rxvt-unicode 256-color unicode3 xft gdk-pixbuf" > /etc/portage/package.use/rxvt-unicode # emerge --ask x11-terms/rxvt-unicode or set it during the installation:# USE="256-color unicode3 xft gdk-pixbuf" emerge --ask x11-terms/rxvt-unicode

Its config file is ~/.Xresources.

Updated: Updated article about Xresources

Neovim:

Neovim is a fork of Vim that promised to fix issues with Vim and provide a better out-of-the-box experience for Vim users. It also includs a built in terminal emulator.

Installation is simple.# emerge --ask app-editors/neovim

Its configuration file is in ~/.config/nvim/init.vim and I use vim-plug plug-in to handle installation of other plug-ins. Once my init.vim is copied to its config directory, run nvim. It should install defined plug-ins automatically. If it doesn't, go into the Normal/Command mode by hitting Esc. Then type :PlugInstall. This should trigger installation of plug-ins.

PCManFM:

PCManFM is a GUI file manager. It's light weight and has features like displaying mounted drives and dual panes. I don't usually use it but it's good to have as a backup.# emerge --ask x11-misc/pcmanfm

Faenza Icons and gtk2 theme:

Faenza is an icon theme for Gnome. I've looked around and liked it the most. It can be installed from Portage. # emerge --ask x11-themes/faenza-icon-theme

Icons and GTK2 theme can be applied from lxappearance, but it needs to be installed first. # emerge --ask lxde-base/lxappearance

My customized Morning Glory needs to be extracted to ~/.themes/.$ tar -xzvf MorningGlory.tar.gz -C ~/.themes/

Once the icons and theme have been prep'ed, run lxappearance to apply them.

For the theme, click on the Widget tab. Morning Glory should be listed in the left pane.

Icons

For the icon theme, click on the Icon Theme tab, and choose Faenza from the list in the left pane.

Ranger:

Ranger is a text-based file manager. The best feature for me is the vi-style keybinding. # emerge --ask app-misc/ranger

The default directory is ~/.config/ranger/ and you can copy the default configuration files to this directory.$ ranger --copy-config=all

Copied files are the followings:

  • rc.conf - startup commands and key bindings
  • commands.py - commands which are launched with :
  • rifle.conf - applications used when a given type of file is launched.

For image preview, w3m needs to be installed.# emerge --ask www-client/w3m

Then, enable image preview in ranger's config file, ~/.config/ranger/rc.conf.$ nvim ~/.config/ranger/rc.conf ================================== ... set preview_image true ... set preview_images_method urxvt

Cmus:

Cmus is a small, fast and powerful console music player. # emerge --ask media-sound/cmus

TO DOs: set ups

Scrot:

Scrot is a command line screen capture utility.# emerge --ask media-gfx/scrot

Neofetch:

Neofetch is a bash script that displays the system information such as installed OS, kernel version, CPU, memory, etc... next to an ASCII operating system logo.# emerge --ask app-misc/neofetch

Chromium

Chromium is a free and open-source web browser from Google. It features a minimal user interface, powerful web development tools, and a built in task manager. There is a proprietary version of browser called Google Chrome

with more features than Chromium.# emerge --ask www-client/chromium

Be warned: Compiling Chromium can take a significant amount of CPU time and system memory, and it took nearly 7 hours to complete compiling.

Fonts:

I use following fonts for urxvt and i3.

  • Inconsolata
  • Kochi (for Japanese)
  • Font Awesome (for font icons)
  • Deja Vu
# emerge --ask media-fonts/inconsolata # emerge --ask media-fonts/kochi-substitute # emerge --ask media-fonts/fontawesome # emerge --ask media-fonts/dejavu

That's all!
-gibb