i3wm: Configuration (2/3)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is Alex welcome to part two of my series on the i3 window manager in the previous video I taught you how to install I free and of course how to use it in this video I'm going to teach you how to customize your I free installation before we can delve in and start to customize i3 I must first introduce you to the I free configuration file you'll recall it when you first installed I free you were asked if you wanted to create a configuration file I recommended that you did great one if you did you should see inside of your home directory a subdirectory called I free and inside of that subdirectory a file called config this config file is the I free configuration file and it's where the majority of the configuration for I free takes place if you did not ask I free to create a configuration file for you when you install I free you can run the I free - config - wizard application this will prompt you to create the configuration file again however if you already have a configuration file the program will exit this configuration file is simply a text document which means you can edit it using any text editor if you're on Ubuntu you can use gelid which is a text editor that comes pre-installed you can simply type the JEDEC command followed by the path to the config file which relative from the home directory is dot I free forward slash config as I run this command you can see the configuration file opens in its own panel so for out this video we'll be making a bunch of changes to this file as we make them I recommend you press the Save button up here or click on file and save I'm going to use a different editor for the purposes of this tutorial I'm going to use them them doesn't come pre-installed with you burn too so I'm going to have to install it manually and then similar to how you would open the config file and jet it I will type the name of the TextEdit sub m and then the relative path to the config file which is dot SCI free forward slash config now the reason why I'm using them in these tutorials is because comments which have aligns prefix with pound symbols are highlighted in blue and actual instructions are highlighted in white this will make it easier for me to explain what's happening also I can enable line numbers very quickly as I'm from this editor and that will help me refer to the lines I'm working with the first thing I'll teach you is how to create a custom keybinding you'll recall in the previous video that I taught you how to lock your computer the process entailed opening your terminal and writing the ivory lock command whilst that's not too tedious it's a little bit monotonous to have to open the terminal and write the command every time you want to lock your computer it would be much nicer if we could create a custom key binding so in other words I want to make it so that when I press mod + Shift + X the ivory log command will be executed I can do that by the configuration file so I'm going to go back to the config file and go all the way to the bottom I'm going to create a new line and write bind same dollar mod + Shift + eggs Exe C I free lock I'll explain this in a second but first let me save the document and then I'll try and press mode shift and eggs to see what happens so I'll press mod Shift + X and nothing happens in fact because I free is not interpreting about shortcuts but then editor is and as you can see as I press mod Shift + X is deleting the currently focused character I'll undo those changes and we save the document I'll explain why this is not working basically we've saved the configuration but we have not yet applied for its changes to do that press mod shift and our mode shift in R is the key binding to restart I free once you restart I free your new configuration will take effect now when I press mod shift and eggs the screen actually logs ok now you've seen that works let me explain what's going on here in a little bit more detail basically bind sim is the configuration for binding system keys we then specify which keys were binding and then to which action so you can think of this command is reading when the system keys mod + Shift + X or pressed execute I free log next I'll teach you how to change existing key bindings something sort of interesting about I free is what all of the defaults are defined inside of this configuration file when you open this file it wasn't empty was it that's because all the key bindings but I taught you in the previous video and all the key bindings you're still yet to discover are defined in this file if I go to the top of the file you can see that for example there is a key binding for mod + Shift + Q which executes the kale command you'll recall that the mod + Shift + Q command quits the current window similarly we have a command here to launch the menu when dollar mod + D is pressed now in the last video X for me asked if it was possible to change the default key binding for the run menu yes it's absolutely possible all I have to do in this case is replace the key binding here say for instance I want to bind the mod + X keys to D menu I can make that change save the file press mod Shift + R to restart I free in place and now when I press mod + agz the menu is launched at the top there if I press mod + D nothing happens I think specifically though what X for me wanted to do was bind mod + R to D menu which makes perfect sense because the menu is a program runner the trouble is mod + R is already in use by the resize key binding if I search the document for resize I think it's actually just beneath this block yeah you can see that the mod + R key is already bound to this command which means if I save this file and restart I free by pressing mode shift + R we'll get an error can you see this red banner at the top here if I click the button called show errors you can see the error duplicate key binding in config file so we can't do that by default but what we could do is we could then replace the R for this command with X for example that will then make it unreserved lista now when I save the file and we start I free the error is no longer there me personally I don't really like to mess with the default key bindings too much because it will get very confusing as you start shuffling key bindings around so whilst I don't recommend it it's totally possible I think now would be a good time to take a brief into mezzo to introduce you to the I free documentation so access for documentation go to your browser and go to I 3 WM the old avatar pair you'll see a navigation item for the docs click it and what you really want to read is this user's guide now the reason why I bring this up now is because it's a good time to mention that was I'm going to cover a fair amount of ground in this tutorial I can't possibly cover the entire breadth of i3 for example at the moment I'm teaching you about keyboard bindings but for example it's also possible to configure Mouse bindings which is something I'm not going to talk about so if you are looking to learn more about ivory outside of this video I highly recommend you check out the dogs it's very well-written very concise and full of actual examples which is great for kinesthetic learners like me with that brief Intermezzo out of the way I want to take another moment to address what I anticipate will be a common problem relating to media keys volume keys screen brightness keys and touchpad keys basically out of the box none of those sorts of keys will work on I free simply puts I free does not understand how to process them you must first configure I free before those key bindings will work fortunately this is a common problem for which a solution already exists I found an answer on this website that entails a snippet you can simply copy and paste into the bottom of your configuration file of course there'll be a link to this website in the show notes unfortunately I use I free on a desktop computer which means I've never used the touch pad or screen brightness controls so I'm going to remove those the pulseaudio controls work really well on Ubuntu basically we're using that same bind Sim command to say that when the audio race volume button is pressed we should execute the following command as you can see this particular handler uses an application called pag tool to control the volume PAP tool comes pre-installed on Ubuntu which means these commands should work brilliantly on Ubuntu out of the box however if you're on a different Linux distribution you may find the pen tool is not installed and you'll need to install it manually the player controls work much in the same way we say that when the audio play button is pressed which it executes he play a CTL application with the argument play the same is true for the pause next and previous buttons just with their own respective arguments unfortunately player CTL is not pre-installed on Ubuntu which means we'll have to install it manually what's more there is no package for its in any of the predefined repositories so we'll have to go and download the Debian package manually the first step to do that is to go to your browser and search for player CTL on github click on the first and most obvious link under the releases page you should see a download for the debian package click on it and you should be prompted to save the file I'm going to go back to workspace born and open a new terminal navigate into that downloads directory if I list all of the files you should see the player CTL Debian package I can install it by typing sudo dpkg - I have a name of the package enter my password and just like that player CTL should be installed we can verify as installed by looking at the help page now when I use the media of volume keys on my keyboard my system should respond unfortunately I can't demonstrate that as I'm in a virtual machine but if you have any doubt just try it yourself and I'm sure it will work if you follow my steps exactly next we're going to move away from the keyboard so look at how we can make applications automatically load with I free in other words how to make it when we login to i3 some applications will be automatically loaded say for the purposes of this demonstration I want to make ribbon box automatically load with I free ribbon box is a media player and it's something that you might realistically want to load with I free me personally I always load my media player with i3 so you make Riven box load with i3 go to the bottom of your configuration file and simply write exe c4 execute and then the name of the application which in this case is Riven box of course it doesn't have to be Riven box you could write for example Firefox hair or Skype or any other application but I will just do Riven box you save the file and restart by free you'll notice that nothing happens this is because by default outside of the context of a key binding Exe C will only work when you first log into y3 and when you think about it this kind of makes perfect sense because you wouldn't want to for example close Riven bugs go and change your configuration file outside free and have Riven box pop up every time you restart your desktop it'd be kind of irritating nonetheless the only way you can demonstrate this is by logging out and then logging back in as you can see Riven box is loaded say for example though you do want to make Riven box load every time you restart your desktop you can do that by right to exe C underscore always save the file now and then restart I free and as you can see Riven box loads if I close it and then restart I free Riven parks loads it makes me sort of laugh because it's almost ridiculous when it comes to applications there is a very valid use case for the exe and the score always a configuration but I'll show you in just a second when we look at how to create a custom wallpaper next I'll show you how to set a custom wallpaper in I free you might expect that if you went to your browser and sort of picked out a nice wallpaper you could save this file sort of right-click it and then press set as wallpaper in i3 that won't work what you must do firstly is right click on the photo and save it to your filesystem I've saved mine to be pictures directory and renamed it to wallpaper JPEG to set the wallpaper you're going to need to install an additional application there are a few options here but I like to use an application called fat that's Fe H which I can install by writing sudo apt - gets install fair I'll enter my password and just like that fat will be installed but for now I can access the fat command specify an argument namely - - BG scale and then the path to the wallpaper relative from the current directory as I'm already in the pictures directory I can just write wallpaper dot JPEG now before I run this command let me show you an empty workspace see how the wallpaper is for default Ubuntu 1510 wallpaper but as I press ENTER to run this command you can see that the wallpaper now changes so we're done right no not quite you'll notice that if you log out of I free and then log back in with the wallpaper has been restored to the default Ubuntu wallpaper this is because the application we used fair is ephemeral the change it makes only lasts for the duration of the users as soon as you log out I free basically forgets that you ever set a custom wallpaper therefore when you log in again it just shows you the default wallpaper to rectify this problem we need to execute the same fare program with those same arguments every time we log into y3 we can do that using the same technique I showed you previously so go to your configuration file a live very bottom right Exe underscore always Fe H specify any arguments that you might want to specify such as PG - scale and then specify an absolute path to the wallpaper in my case it's going to be my home folder which is called Booker because that's my user name obviously you'll want to replace this with your own user name and the wallpaper is called wallpaper jpg I'll save the file but before restarting i3 let me just go to an empty workspace and show you that the wallpaper is for default I restart i3 and now the wallpaper has been updated hopefully now you can see why this Exe C and the score always command is actually useful for certain commands in the case of driven box it makes no sense to execute living bugs every time you restart I free however in the case of fair it makes a lot of sense because say you want to change your wallpaper you can just replace that file and then we start I free and the wallpaper will propagate it makes it really easy to change your wallpaper in the future one more thing I think I ought to explain before I move on is this - - BG - scale argument I supply to the fat application you'll recall it in most conventional operating systems when you set the wallpaper you have an option to either sort stretch or scale or Center or tile the wallpaper well in fact there is no graphical user interface so I specify that option via an argument BG scale isn't the only option if you look at the man page for fare and search for BG scale you can see with our other options like BG Center and BG fill next I want to talk about how to configure monitors in a three by default there is no graphical user interface for editing settings there is only a command-line utility called X render which if you look at the help page there are a bunch of arguments that relate to the position resolution and orientation of monitors but as you can probably imagine trying to express the position of your monitors using command-line arguments can be a bit difficult it's for that reason but I highly recommend you use a graphical based tool called a Rando a randhir centrally a graphical user interface that sits on top of X render when you make setting changes and hits apply it basically calls the X random program under the hood a render however is not installed on ubuntu by default to install it go to the command line and write sudo apt - get to install a random enter your password and a random should install once a Randall is installed you should be able to open it by ad menu like so as you can see it closely resembles other operating systems setting windows for monitors if I had multiple monitors I'd be able to drag them around like this to configure that position I can right click on any monitor to change the resolution or orientation it just so happens because I'm running my computer inside of a virtual machine I don't really need to make any changes but say you make your changes you can just hit apply and those changes will take effect however much like the back command that we looked at previously to set the wallpaper the changes are ephemeral as soon as you log out I free will forget them if you want to apply these changes on a more permanent basis press the Save button and you'll be prompted to save the x-rounder command that a randomized internally to disk you can then execute that x-rounder command when you login to Y free using the same techniques I've showed you previously I'll call this file foo which is a gibberish word because I'm only saving it for the purposes of extracting its contents I'll delete it afterwards I'll open the terminal and using the cats application I can list the contents of the food SH file it looks like a Randa added the SH extension for me as you can see internally we have a she bank that indicates to Linux but this is a shell file beneath that we have the x-rounder command and all of its arguments that we don't have to write it just so happens in this case that most of these arguments are redundant especially because I don't really make any changes to my file but if you did for example change your resolution or screen position these arguments would be very valuable to you I'm going to copy those and then I'm going to open my config file at the very bottom I'm going to paste the command and prefix it with Exe C underscore always this way whenever I restart the i3 desktop that command is going to be executed first if I want to make a change for example to the resolution I can just restart the desktop and it will take effect of course you could optionally write just exe C in that way it will only be executed when you log in okay everyone I've closed down everything so we can focus on our next topic which is workspaces so you configure workspaces you do so from the same configuration file you've been using throughout this video specifically those search for workspace and you'll find the configurations relating to workspaces as you can see the each of the key bindings I described in the previous video there are corresponding bind sim configurations in this particular case we're saying when we press mod +1 we should execute the workspace command preceding that workspace command is the name of the workspace by default the workspaces are simply named 1 through 10 but if you want you can rename the workspace to anything for example I'll rename my first workspace to terminals I'll save this file and press mode shift in R and nothing happens what I recommend you do is log out and log back in for these changes to take effect as you can see the workspace is no longer called one it's called terminals ignore the fact that ribbon bugs a music player is loading on a workspace called terminals for now we'll address that problem in a little bit the now though let's go back to the configuration file and configure some more things relating to the workspaces if I scroll down a little bit here you can see that there is a further command into workspace one that says when I press mod + Shift + one I free should move the current container to the workspace with the identifier 1 there is no such workspace as we renamed it 2 terminals which means if we for example create a second workspace and open a terminal and press mode shift + 1 it does create a workspace called 1 even though we removed it above to rectify that problem I'm going to have to use my mouse to click on the workspace number 1 because if I press mod + 1 it's going to take me to the terminals workspace we've kind of made ourselves in an inconsistent state where we can't actually access workspace 1 via the keyboard anymore because we remove that key binding so let me go to workspace number 1 my mouse close this window go back to the terminals works-based I'm simply going to rename this two terminals now I'll save this restart the desktop environment and now when I create a new terminal workspace number to impress mode shift 1 it gets moved to the correct workspace but previously I said that you should log out for those changes to take effect you don't really have to log out it's just that if you don't you might find yourself in a similarly inconsistent state so it's up to you whether or not you want to log out it slotted for you at the moment if you want to rename a workspace for example to rename workspace 2 - maybe Firefox you have to remember to rename the workspace in two places which you might forget to do what's more if you for example make a typo in one of the workspace names it won't be referring to the same workspace and you'll get into a similarly inconsistent state generally having to rename a value in two places is considered to be an anti-pattern and very error-prone to rectify this solution I free configuration files support variables you can come anywhere in the configuration file above the use of the variable and write set the name of the variable which in this case will be dollar room space one having the value of the variable which will be terminals in this case now anywhere where you see the value terminals you can replace it workspace one you can do the same down here and of course we'll also create a second variable for the second workspace which will be workspace to the value will be Firefox anywhere we see Firefox will replace it with workspace - I wish by the way that the configuration file would do this out with box because it's really only useful when you now change your workspace name in the future say for example I want to rename terminals - I don't know editor well I make that change in one place we starve a desktop environment I'm going to actually log out and log back in because I don't want to be in an inconsistent state and as you can see the workspace is now called editor if I create a window on a second workspace and press mode shift and one it goes to the correct workspace I only had to make the change in one place and I've done it in such a way that it's very difficult to get wrong I recommend you do the same thing I'm going to create an additional workspace I'll make it workspace 10 and I'll make its value music because it's going to host any music players I'll need to remember to come down here and rename 10 - dollar workspace 10 and also to come down here and replace time with dollar workspace 10 basically by the way when I free and services configuration file anywhere it sees for text dollar workspace 10 it's going to simply replace it with the value music can the same is true for the other variables as well I'm going to save this file and reapply the changes by pressing mode shift in R and now when I press modern 0 it will take me to the music workspace as you can see if I create a container on another workspace and press mode shift + 0 it will take it to the music workspace actually what I want to do is open the breathing box move that to workspace 10 by the way I recommend you prefix all of your workspaces with their numbers this way they will always be in a consistent order this is a prime example of why I want to log out and log back in because I'm actually I've got two of these free workspaces open and if I was to start trying to use my system it would just be all kinds of messed up so let me log out and log back in real quick okay we log back in and as you can see the workspace is called one colon editor if I press mode - you can see it's called - Firefox and if I press mod 0 you can see it's called 10 music we're encountering a problem for the second time which is the ribbon box a music player is automatically loading on workspace one which has the label editor when really it belongs on workspace 10 which has four label music it is possible to make a three for certain windows to open on a particular workspace and I'm going to show you how to do that next firstly open the configuration file and then navigate the general proximity of the other workspace configurations and creates a new line we'll fill in this line in just a second but first we need to find out the ribbon boxes windows class every window in ìfree has Lee class to find out the class open the application whose class you want to find in my cases ribbon bugs then open the terminal and type in X probe watch the cursor as I press answer see how it changes to a kind of crosshair I can now click on rhythm bugs and they will it will give me information about the window including the class copy the second value in this case capital R ribbon box then go back to your editor and write a sign inside the square brackets class equals have an inside of double quotes the name of the class and then specify the workspace you want to force that window to open on in this case will be workspace 10 so another good reason to have variables because now we're referring to workspace 10 in three places which if we had to do about variables would be a nightmare to maintain I'll save this file now and restart I free I'll quickly head over to workspace number 10 and delete everything rather close everything and now watch as I open ribbon bugs it automatically creates workspace 10 if I navigate there ribbon box is open better yet if I log out and log back in you can see with the editor works bases empty and the music workspace is being created on it is ribbon box I think this is really good because it will help you always know where to find windows something I think a lot of people will be interested in doing is associating icons with their workspaces for example for the second workspace which is preserved for Firefox you might want to associate the Firefox icon so do that you must first install a font that has icons I recommend font awesome to install it head over to Firefox and then head over to github comm forward slash forts awesome /font - awesome they'll be a link in the description click on releases and then click on the zip link beneath the latest version which at this time is 4.40 you'll be prompted to save the zip file hit OK once the download is complete head over to your terminal navigates your downloads directory you should see a file called font awesome zip to unzip it simply write unzip and then the path to the zip file if you release the files in that directory you should see now a folder called font - awesome - the version number navigate inside of that directory you should see a nervous subdirectory called fonts which you can then change directory into and inside of there you'll see the fonts in a bunch of different versions what we want is the TTFN version firstly to install this bond make a directory in your home directory called dot fonts using the birth command then simply move the TTF fonts into that directory using this command if I navigate now to my home directory and then into the dot fonts directory you should see by TTFN bonds next it's simply a case of looking up the font awesome cheat sheets and then searching for the icon you want which in my case will be Firefox copying the icon heading back to your config file searching for the workspace event simply pasting the icon inside of the string literal now in this particular case inside of the editor it looks a bit malformed after you log out and log back in it should look better as I press mod to notice how the Firefox icon is associated with the workspace hey let me look out and log back in to show you the final product okay notice how I press multiply to the Firefox window has the Firefox icon nice if I go to my editor workspace and open up the config file search for Firefox you can see where the icon is actually rendered properly inside of the editor now good stuff right it's really not that hard and you can use that cheat sheet to find any other kind of icon you might want to associate with any workspace okay everyone that's all we've really got time for today honestly when I was recording the first video I thought I would be able to cut that everything else in the second video but I've just run out of time this video has been going on for a long time already in the next video we're going to look at how to make a free look wonderful by customizing the color scheme and also the color of the bar and the windows and that kind of stuff we're also going to look at how to improve the bar which is this black strip at the bottom here we're going to make it look a lot nicer and make it serve a more practical purpose thank you very much for watching if you enjoyed the video please leave a like or a comment and if you loved it please consider subscribing
Info
Channel: Code Cast
Views: 510,205
Rating: 4.980505 out of 5
Keywords: GNU/Linux (Operating System), Linux Kernel (Software), Linux Distribution (Software Genre), Ubuntu (Operating System), Window Manager (Software Genre), i3, i3wm, i3 Window Manager, Operating System (Software Genre), Computer Keyboard (Computer Peripheral Class), Productivity (Literature Subject), Software (Industry), Tutorial (Media Genre), Help.
Id: 8-S0cWnLBKg
Channel Id: undefined
Length: 29min 54sec (1794 seconds)
Published: Sun Nov 08 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.