Since around a year or two I've been using i3 tiling window manager together with the xfce4 services as my desktop environment and I'm quite content with the result. The i3-wm can be installed on top of the xfce4 DE without any package conflicts. Such a combination allows to have both DE at the same time and share common settings and applications between them.
I can't remember exactly why I have chosen the i3-wm as my window manager but maybe it's because I have read that i3-wm has vim style movement keyboard shortcuts. As far as I'm a vim user I decided to 'take it for a spin'.
Foreword
- Beside the original i3-wm site, lots of useful information about i3-wm usage and configuration is availabe at archlinux wiki page. I have used that wiki as a starting point.
- All configs and scripts described in this article are available at my git repository . Use it at your own risk. I'll describe at the end of this article how do I handle my dotfiles too.
Installation
Add the repository how it is described on this page but instead of installing i3 package install i3-wm and sucklesstools only.
Configuration
The i3-wm package comes with a user guide html page that is installed at /usr/share/doc/i3-wm/userguide.html which is a good source of information about the i3-wm configuration.
The first thing to change though is the default movement key binding. The author wanted to reserve 'h' as the horizontal split key binding, breaking the vim like movement bindings. As a long time vim user I couldn't even understand at first why all the movements are messed up. Then I have remapped the semicolon to be the horizontal split key binding and 'h' as the 'move to the right' to be vim compatible:
# split in horizontal orientation bindsym $mod+semicolon split h # change focus bindsym $mod+h focus left bindsym $mod+j focus down bindsym $mod+k focus up bindsym $mod+l focus right # move focused window bindsym $mod+Shift+h move left bindsym $mod+Shift+j move down bindsym $mod+Shift+k move up bindsym $mod+Shift+l move right # These bindings trigger as soon as you enter the resize mode mode "resize" { # I also changed the step to 5px from default 10px bindsym $mod+h resize shrink width 5 px or 5 ppt bindsym $mod+j resize grow height 5 px or 5 ppt bindsym $mod+k resize shrink height 5 px or 5 ppt bindsym $mod+l resize grow width 5 px or 5 ppt ... }Additionally add a key binding to focus a child container:
# focus the child container bindsym $mod+c focus childMy complete .i3/config file is available here for the reference.
Starting xfsettingsd and some other xfce services
First I need to say - do not follow an advice you may find on the Internet to use a normal xfce session with the i3wm added to the autostart - that's just utter BS. Always start a separate i3 session and start only xfce services you need. In this case you'll get a really lightweight desktop environment which is blazing fast and uses less RAM.
Initially I tried to follow advices I found on the net on how to configure my desktop environment because I didn't know that I can just use xfce services. For example I tried to use the lxappearance first to adjust font settings and appearance but I couldn't even set the font antialiazing the same way I do with the xfce. Then I tried to start the xfsettingsd thinking that it would refuse to work in absence of the xfce session manager but it worked and did the trick! The daemon works even without xfce settings manager and all my xfce settings were back including keyboard shortcuts! To start it add:
exec --no-startup-id xfsettingsd --sm-client-disable &to your .i3/config file
As far as my keyboard settings are managed by the xfsettingsd now the older settings in my .i3/config are removed:
# keyboard #exec --no-startup-id xset r rate 300 35 #exec --no-startup-id setxkbmap -layout us,ru -option 'grp:alt_shift_toggle' -model chromebook
Patching the xfsettingsd
There's only one major problem with the xfsettingsd that needs to be fixed - for some reason I cannot fathom daemon listens for lid close events and does something that leads to loosing the i3 session. When the lid is opened - all opened programs are closed at once. To find out if you are affected by this bug start xrandr and check if the active screen has 'LVDS' or 'PANEL' in its name:
alex@chrome:~$ xrandr Screen 0: minimum 320 x 200, current 1366 x 768, maximum 32767 x 32767 eDP1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 256mm x 144mm 1366x768 60.0*+ 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 HDMI1 disconnected (normal left inverted right x axis y axis) VIRTUAL1 disconnected (normal left inverted right x axis y axis)
In this example my active screen is called 'eDP1' so I'm not affected. On other notebooks I'm using, I have 'LVDS1' and I had to patch the daemon. The patch is pretty much easy - find 'LVDS' string in the xfsettingsd binary and change it to somethings else with any hex editor. After I changed it to 'LVDD' everything started to work smooth.
(EDIT: I had this problem with the Xubuntu 14.04 but is seems to be fixed in the Xubuntu 16.04)
(EDIT: I had this problem with the Xubuntu 14.04 but is seems to be fixed in the Xubuntu 16.04)
Other xfce services
The next xfce daemon I'm starting is the xfce4-volumed. This daemon handles the audio volume keys and also sends dbus notifications when the volume is changed. At first I've written a small bash script (or here in the repository) with a bit of a python code inside to do the same thing and it worked pretty much the same as the xfce4-volumed. I mapped key bindings in the .i3/config to call the script:
# volume control #bindsym XF86AudioLowerVolume exec /home/alex/bin/volume_notify.sh down #bindsym XF86AudioRaiseVolume exec /home/alex/bin/volume_notify.sh up #bindsym XF86AudioMute exec /home/alex/bin/volume_notify.sh toggle
But then I realized that the xfce4-volumed does absolutely the same thing and now I simply start it and the bindings above are removed.
Do not install dunst because it's ugly and also because default xfce notification daemon works out of the box without additional tweaks:
And the next daemon I start is the xfce4-power-manager. It manages power states of the computer and it also handles screen brightness key bindings.
Status bar
To display my status I'm using conky and a small shell script that also handles mouse clicks in the status area. I installed the conky-cli package and continued with the description given on this page .
The first thing I stumbled upon was constantly blinking status line. After lots of time spent on that issue I realized that the description on the page is wrong. The json output that conky sends should always be in one line otherwise the status line blinks. If you check my .i3/conkyrc config file you'll notice that all strings after the 'TEXT' keyword are ended with the backslash to make it appear as a one line.
Second thing was to extend the suggested wrapper script .i3/conky-i3bar so that it would also handle mouse clicks. Well it wasn't that difficult in the end. I just added a loop that reads and handles script's standard input stream.
The trick here is to use the 'name' variable that is not described on the aforementioned page. For example for the cpu status I'm adding "name" = "cpu" to the .i3/conkyrc at the appropriate place. Then this tuple is handled by the .i3/conky-i3bar script that starts the htop in a terminal window. I also want that this window would float so I specify an additional parameter '-T "TerminalHtop"'. Now i3-wm knows that a window with such a title should float because in my .i3/config I specified:
for_window [title="^TerminalHtop$"] floating enableSo the .i3/conkyrc, .i3/conky-i3bar and .i3/config files are coupled together.
What I'm displaying in my status bar
Instead of rainbow alike status line implemented by others my status line is white unless something important needs to be shown (the exception is the current time shown always in yellow). For example if the CPU temperature increases then the cpu status is shown in yellow, then in orange and then in red. Information which is not actual is not shown at all. For example the LAN status is only shown when a LAN interface is up. Or only if there are new mail messages the new mail status icon is shown.
I'm using the icons ttf file I downloaded following a link provided on the archlinux wiki page. The font and its pdf description is also available at my repository .i3/icons.tgz. Font file needs to be 'installed' first to make the icons symbols available. To install it just put the ttf file somewhere under /usr/share/fonts/truetype/
Keyboard layout
Shows active layout and it also turns red if caps lock is pressed. I must say that this is not a very optimal solution. First it would probably not work if there are more than two layout present at the same time. Second it requires gawk to be installed (ubuntu has mawk by default which is fast but lacks functionality). Third xset causes lots of wakeups for some reason that drains the battery a bit faster.
WLAN status
Unfortunately conky-cli package I'm using is compiled without WLAN support. I had to write a small script .bin/apstatus.sh that outputs the status. If my notebook is connected to an AP then it would show the AP name, signal strength in percent and the channel frequency. The same drawback here as above - new processes are started constantly that drains the battery.
LAN status
If LAN is up then LAN interface name and its speed is shown. An interface name could be 'eth0', 'eth1', 'eth2' or 'p3p1'. If this is not the case then the .i3/conkyrc config file should be adjusted accordingly.
VPN status
If a VPN is activated ('tap0' is up) then a blue lock icon is shown.
New mail status
I have a cron job that checks my mail account each 10 minutes by starting the .bin/checkmail.sh script. If there are new mails then it creates a file /tmp/newMail and the content of the file is the number of unread messages. If it's not '0' then a new mail icon appears drawn with the red color. If the icon is clicked then the 'gmail.com' site is opened in a new browser window
Display icon
To adjust display settings (multimonitor) I'm using default xfce4-display-settings program which is called when the icon is clicked.
Logout symbol
Logout symbol
All logout solutions for the i3 I saw were ugly. So I've written a python script to show the logout dialog in the same manner like xfce does. I couldn't use the xfce facility for that because it doesn't work without the xfce session manager. The files are .bin/logout.py and .bin/logout.ui. No other dependencies are needed and it should work out of the box
The logout dialog is also bind to the power off button and the default 'mod-shift-E' combination
The rest of the .i3/conkyrc is self explanatory.
Helper scripts and applications
Connect to a Wi-Fi station
I'm starting the network-manager too that shows a small icon in the system tray but it is very small and also there's no keyboard binding to open its connection dialog. I've written a simple bash script .bin/wifi_connect.sh that shows a dialog to connect/disconnect to/from an AP. The script is bind to the 'mod-shift-w' combination and it is also possible to navigate opened dialog using keyboard only.
Network throughput
I couldn't find a simple program that would show me an interface throughput statistics like xfce4-netload-plugin does so I've written a simple python script that does that too .bin/nticon.py. The interface name to watch and its upper limit (100k) is hardcoded for now. The drawback is that the script would not update its tooltip too - it just doesn't work with the interface provided by the Gtk.StatusIcon class. Lame, I know
feh
I have also installed feh to display a desktop background. Principally it's not needed but some display drivers are displaying garbage because they aren't cleaning the frame buffer after the start.
Compton
I'm using compton as my tear-free compositing manager with the i3-wm. Additionally I have disabled the default xfce compositor because of its lame implementation and am using compton ever since even within an xfce session. My compton settings file is located here
Slock to lock the screen
The 'sucklesstools' package comes with a program called slock to lock the screen. If you do not have any other screen locking tool installed then the slock will be called when the lid is closed and then opened (check the logic in the /usr/bin/xflock4 script). It has really confused me the first time because it shows just a black screen after the lid is opened. Just start typing your password and the screen should turn blue to provide a notification that the password is been entered.
Dotfiles
To synchronize my setting over all my computers I'm using a git repository and a dotfiles management tool .
First I clone my own dotfiles from my repository into '~/dotfiles'. Then I copy the ~/dotfiles/.dotfilesrc file to the ~/ and start 'dotfiles -s'. And finally I create a 'bin' symlink in my home directory 'ln -s .bin bin'. Where .bin/ is a symlink created by the dotfiles manager and it points to the '~/dotfiles/.bin'
4 comments:
Thank you, this is very useful !
nice awesome !!!!!!
Good one.
I had hard time to figure out why my volume buttons work in XFCE and don't in qtile.
I will try this trick :)
Thank you!
On my new Manjaro Xfce installation polkit-gnome is in another folder. If it isn't working, try to
replace
exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
with
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1&
Post a Comment