Hi there! Welcome to my dotfiles
Quick Links
- Install
- Software
-
My configurations are heavily documented to make it as clear as possible. While you can clone the whole repository and use it, it is not recommended though. Good configurations are personal. Everyone should have his or her unique config file. You are encouraged to copy from this repo the part you want and add it to your own config.
-
I have to guide how to rice here
-
This way download is automatic. Only use when you have successfully installed and set up linux distro
β DO NOT RUN WITH ROOT
bash <(curl -s https://raw.githubusercontent.com/Dominic-github/dotfiles/main/bin/install.sh)bash (curl -s https://raw.githubusercontent.com/Dominic-github/dotfiles/main/bin/install.sh | psub)This guide will walk you through the process of building a desktop environment starting with a fresh Arch based installation. I will assume that you are comfortable with Linux based operating systems and command line interfaces. Because you are reading this, I will also assume that you've looked through some "tiling window manager" videos on Youtube, because that's where the rabbit hole starts. You can pick any window managers you want, but I'm going to use i3 as a first tiling window manager because that's what I started with. This is basically a description of how I made my desktop environment from scratch.
Installation guide and basic configurations for Arch Linux
Check if the directory exists:
ls /sys/firmware/efi/efivarsConnect to Wi-Fi network:
iwctl
device list
ex: wlan0
station 'name of device' get-networks
ex: station wlan0 get-networks
station wlan0 connect 'name of networks'Check if internet connectivity is available:
ping -c 3 archlinux.orgMake a list of mirrors sorted by their speed then remove those from the list that are out of sync according to their status.
Backup the existing mirrorlist:
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backupEdit the mirror list, bring the fastest mirrors to the top (you can use nano instead of vim or nvim).
For example this is my top 3 mirrors:
vim /etc/pacman.d/mirrorlist##
## Arch Linux repository mirrorlist
## Filtered by mirror score from mirror status page
## Generated on 2019-03-01
##
## Singapore
Server = http://mirror.0x.sg/archlinux/$repo/os/$arch
## Vietnam
Server = http://f.archlinuxvn.org/archlinux/$repo/os/$arch
## Netherlands
Server = http://archlinux.mirror.pcextreme.nl/$repo/os/$arch
Ensure the system clock is accurate:
timedatectl set-ntp trueCheck the service status:
timedatectl statusIdentify disks:
lsblkDisks are assigned to a block device such as /dev/sda.
Create boot partition and root partition:
# cfdisk /dev/sda- Select
gpt - Hit
[ New ]to create a new patition - Give the boot partition
1Gand let the rest for the root partition - Select the boot partition and hit
[ Type ]to chooseEFI System - Hit
[ Write ]then typeyesto save, then hit[ Quit ]
- sda1 || 600Mb: EFI System |
- sda2 || 4GB : Linux swap (= Ram / 2)
- sda3 || X GB : Linux filesystem ( 30GB < X < 60GB)
- sda4 || else : Linux filesystem
Format the boot partition to FAT32:
mkfs.fat -F32 /dev/sda1Format the root partition to ext4:
mkfs.ext4 /dev/sda3mkfs.ext4 /dev/sda4mkswap /dev/sda2swapon /dev/sda2Mount root partition first:
mount /dev/sda3 /mntHome folder
mkdir /mnt/homemount /dev/sda4 /mnt/homeThen create mount point for boot partition and mount it accordingly:
mkdir /mnt/bootmount /dev/sda1 /mnt/bootUse the pacstrap script:
pacstrap /mnt base base-devel linux linux-firmware base-devel neovimUse -U or -L to define by UUID or labels:
genfstab -U /mnt >> /mnt/etc/fstabChange root to the new system:
arch-chroot /mntSet your time zone by region:
ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtimeGenerate /etc/adjtime:
hwclock --systohcUncomment en_US.UTF-8 UTF-8 in /etc/locale.gen, then generate it:
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen && locale-genSet LANG variable in /etc/locale.conf:
echo 'LANG=en_US.UTF-8' > /etc/locale.confCreate hostname file at /etc/hostname contain the host name, for example:
- arch-pc is host name
echo 'arch-pc' > /etc/hostnamenvim /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch-pc.localdomain arch-pc
passwdEnter your password then confirm it.
Add a new user named your-name:
useradd -m your-nameProtect the newly created user your-name with a password:
passwd your-nameGrant permissions to users
usermod -aG wheel,audio,video,optical,storage,power your-nameEstablish nvim as the visudo editor:
EDITOR=nvim visudo
Then uncomment %wheel ALL=(ALL) ALL to allow members of group wheel sudo access, uncomment Defaults targetpw and change it to Defaults rootpw to ask for the root password instead of the user password (then change the comment beside it accordingly).
pacman -S efibootmgr intel-ucodepacman -S networkmanagerThere are many ways to boot but I prefer these method
Install systemd-boot to the /boot partition:
bootctl --path=/boot installEdit systemd-boot options:
nvim /boot/loader/loader.confdefault arch
timeout 0
editor 0Add Arch boot entry:
nvim /boot/loader/entries/arch.conftitle Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=/dev/sda3systemctl enable NetworkManagerExit the chroot environment by typing:
exit
Optionally manually unmount all the partitions with:
umount -R /mnt
Restart the machine:
reboot
After logging in, your internet should be working just fine, but that's only if your computer is plugged in. If you're on a laptop with no Ethernet ports, you might have used iwctl during installation, but that program is not available anymore unless you have installed it explicitly. However, we've installed NetworkManager, so no problem, this is how you connect to a wireless LAN with this software:
# List all available networks
nmcli device wifi list
# Connect to your network
nmcli device wifi connect YOUR_SSID password YOUR_PASSWORDCheck this page for other options provided by nmcli. The last thing we need to do before thinking about desktop environments is installing Xorg:
sudo pacman -S xorg- If you want get my config you can come back here.
First, we need to be able to login and open some programs like a browser and a terminal, so we'll start by installing lighdm and i3. Lightdm will not work unless we install a greeter. Then, a text editor is necessary for editing config files, you can use vscode or jump straight into neovim if you have previous experience, otherwise I wouldn't suggest it. Last but not least, we need a browser.
sudo pacman -S lightdm lightdm-gtk-greeter i3 code firefoxEnable lightdm service and restart your computer, you should be able to log into I3 through lightdm.
sudo systemctl enable lightdm
rebootNow that you're in I3, you should know some of the default keybindings.
| Key | Action |
|---|---|
| mod + return | launch xterm |
| mod + j | focus left window |
| mod + k | focus down window |
| mod + l | focus up window |
| mod + ; | focus right window |
| mod + d | dmenu |
| mod + Shift + q | kill window |
| mod + Shift + r | reset i3 |
| mod + Shift + e | Exit i3 come back lightdm |
See more on i3-tutorial
Before doing anything else, if you don't have a US keyboard, you should change it using setxkbmap. To open xterm use mod + return. For example to change your layout to vietnamese:
setxkbmap vnNote that this change is not permanent, if you reboot you have to type that command again. See this section for making it permanent, or follow the natural order of this guide if you have enough time.
There is no menu by default, you have to launch programs through xterm. At this point, you can pick your terminal emulator of choice and install a program launcher.
# Install another terminal emulator if you want
sudo pacman -S alacrittyNormally i3 will automatically get the terminal. If it doesn't work Now open the config file:
code ~/.config/i3/configAt the beginning, after imports, you should find an array called keys, and it contains the following line:
bindsym $mod+Return exec i3-sensible-terminal
Change that line to launch your terminal emulator:
# Change another terminal emulator if you want
bindsym $mod+Return exec alacrittysudo pacman -S rofiThen add keybindings for that program.
find line :
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_runChange that line to launch your terminal emulator:
# start dmenu (a program launcher)
bindsym $mod+d exec [program launcher]
# ex with rofi:
bindsym $mod+d exec rofi -run --show-icons
## Can change run = drun or somethingNow restart i3 with mod + Shift+ r. You should be able to open your menu and terminal emulator with keybindings. If you picked rofi, you can change its theme like so:
rofi-theme-selectorGo here for my config
sudo pacman -S whichThat's it for i3 , now you can start hacking on it and make it your own. Checkout my custom i3 config here. But before that I would recommend configuring basic utilities like audio, battery, mounting drives, etc.
In this section we will cover some software that almost everybody needs on their system. Keep in mind though that the changes we are going to make will not be permanent. This subsection describes how to accomplish that.
First things first, your screen looks empty and black, so you might want to have a wallpaper not to feel so depressed. You can open firefox through rofi using mod + d and download one. Then install feh or nitrogen and and set your wallpaper:
sudo pacman -S feh
feh --bg-scale path/to/wallpaperFonts in Arch Linux are basically a meme, before you run into any problems you can just use the simple approach of installing these packages:
sudo pacman -S ttf-dejavu ttf-liberation noto-fontsTo list all available fonts:
fc-listThere is no audio at this point, we need pulseaudio. I suggest also installing a graphical program to control audio like pavucontrol, because we don't have keybindings for that yet:
sudo pacman -S pulseaudio pavucontrolOn Arch, pulseaudio is enabled by default, but you might need to reboot in order for it to actually start. After rebooting, you can open pavucontrol through rofi, unmute the audio, and you should be just fine.
Now you can set up keybindings for pulseaudio, open file ~/.config/i3/config and add
these keys:
# volume
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ toggle
For a better CLI experience though, I recommend using pamixer:
sudo pacman -S pamixerNow you can turn your keybindings into:
# volume
bindsym XF86AudioMute exec pamixer -t
bindsym XF86AudioRaiseVolume exec pamixer -i 5
bindsym XF86AudioLowerVolume exec pamixer -d 5Now you can turn your keybindings into:
Restart i3 with mod + Shift+ r and your keybindings should work. If you're on a laptop, you might also want to control the brightness of your screen, and for that I recommend brightnessctl:
sudo pacman -S brightnessctlYou can add these keybindings and restart i3 after:
# Brightness
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-If you have a multi-monitor system, you surely want to use all your screens. Here's how xrandr CLI works:
# List all available outputs and resolutions
xrandr
# Common setup for a laptop and a monitor
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x1080 --output HDMI-1 --mode 1920x1080 --pos 0x0We need to specify the position for each output, otherwise it will default to 0x0, and all your outputs will be overlapped. Now if you don't want to calculate pixels and stuff you need a GUI like arandr:
sudo pacman -S arandrOpen it with rofi, arrange your screens however you want, and then you can save that layout, which will basically give you a shell script with the exact xrandr command that you need. Save that script, but don't click "apply" just yet.
For a multi-monitor system, it's recommended to create an instance of a Screen object for each monitor in your i3 config.
You'll find an array called screens which contains only one object initialized with a bar at the bottom. Inside that bar you can see the default widgets that come with it.
Add as many screens as you have and copy-paste all widgets, later you can customize them. Now you can go back to arandr, click apply, and then restart i3.
Now your multi-monitor system should work.
We have configured the network through nmcli, but a graphical frontend is more friendly. I use nm-applet:
sudo pacman -S network-manager-appletBy default, you have a system tray in i3
You can add them on .config/i3/config with
#===========================EXECUTABLES===================================
# Syntax: exec + conmand
# --no-startup-id is flag
#feh
exec_always --no-startup-id feh --bg-fill path/to/image
#picom
exec_always --no-startup-id picom
# network manage applet
exec_always --no-startup-id nm-applet
#==========================================================================Now you should see icons that you can click to configure drives and networking. Optionally, you can install tray icons for volume and battery. If you want using polybar you can go to Polybar
sudo pacman -S volumeicon cbatticon
volumeicon &
cbatticon &I like having desktop notifications as well, for that you need to install dunst
sudo pacman -S dunstTest it like so:
notify-send "Hello World"It will be difficult for a novice to configure the polybar. But think it's simple when you just put the module together. Go Here for more details
sudo pacman -S polybarAdd on i3/config
exec_always --no-startup-id polybarDon't exec on xrofile because polybar need reading module after started
As I have mentioned before, all these changes are not permanent. In order to make them permanent, we need a couple things. First, install xinit:
sudo pacman -S xorg-xinitNow you can use ~/.xprofile to run programs before your window manager starts:
touch ~/.xprofileFor example, if you place this in ~.xprofile:
nm-applet &
udiskie -t &
volumeicon &
cbatticon &
feh --bg-fill path/to/image &Every time you login you will have all systray utilities, your keyboard layout and monitors set.
Now that you have some software that allows you tu use your computer without losing your patience, it's time to do more interesting stuff. First, install an AUR helper, I use yay:
sudo pacman -S base-devel git
cd /opt/
sudo git clone https://aur.archlinux.org/yay-git.git
sudo chown -R username:username yay-git/
cd yay-git
makepkg -si
cd $HOMEWith an Arch User Repository helper, you can basically install any piece of software on this planet that was meant to run on Linux.
If you want to connect your phone to your computer using a USB port, you'll need MTP implementation and some CLI to use it, like this one:
sudo pacman -S libmtp
yay -S simple-mtpfs
# List connected devices
simple-mtpfs -l
# Mount first device in the previous list
simple-mtpfs --device 1 /mount/pointWe've done all files stuff through a terminal up to this point, but you can install graphical or terminal based file managers. For a graphical one, I suggest nemo and for a terminal based one, ranger, although this one is very vim-like, only use it if you know how to move in vim.
sudo pacman -S nemo rangerIf you don't want to rm all the time and potentially lose files, you need a trashing system. Luckily, that's pretty easy to do, using some of these tools such as glib2, and for GUIs like thunar you need gvfs:
sudo pacman -S glib2 gvfs
# CLI usage
gio trash path/to/file
# Empty trash
gio trash --emptyWith nemo you can open the trash clicking on the left panel, but on the command line you can use:
ls ~/.local/share/Trash/filesThe moment you have been wating for has arrived, you are finally going to install a dark theme. I use Material Black Colors, so go grab a flavor here and the matching icons here.
I suggest starting with Material-Black-Blueberry and Material-Black-Blueberry-Suru. You can find other GTK themes on this page. Once you have your theme folders downloaded, this is what you do:
yay -S material-black-colors-theme## Assuming you have downloaded Material-Black-Blueberry
cd Downloads/
sudo pacman -S unzip
unzip Material-Black-Blueberry.zip
unzip Material-Black-Blueberry-Suru.zip
rm Material-Black*.zip
## Make your themes available
sudo mv Material-Black-Blueberry /usr/share/themes
sudo mv Material-Black-Blueberry-Suru /usr/share/iconsNow edit ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini by adding these lines:
# ~/.gtkrc-2.0
gtk-theme-name = "Material-Black-Blueberry"
gtk-icon-theme-name = "Material-Black-Blueberry-Suru"
# ~/.config/gtk-3.0/settings.ini
gtk-theme-name = Material-Black-Blueberry
gtk-icon-theme-name = Material-Black-Blueberry-SuruNext time you log in, these changes will be visible. You can also install a different cursor theme, for that you need xcb-util-cursor. The theme I use is Sweet Cursor,:
yay -S xcb-util-cursor sweet-cursors-theme-gitsudo pacman -S xcb-util-cursor
cd Downloads/
tar -xf Sweet-cursors.tar.gz
sudo mv Sweet-cursors /usr/share/iconsEdit /usr/share/icons/default/index.theme by adding this:
[Icon Theme]
Inherits = Sweet-cursorsNow, again, edit ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini:
# ~/.gtkrc-2.0
gtk-cursor-theme-name = "Sweet-cursors"
# ~/.config/gtk-3.0/settings.ini
gtk-cursor-theme-name = Sweet-cursorsMake sure not to mistype the names of your themes and icons, they should match the names of the directories where they are located, the ones you can see in this output:
ls /usr/share/themes
ls /usr/share/iconsRemember that you will only see the new theme if you log in again. There are also graphical frontends for changing themes, I just prefer the traditional way of editing files though, but you can use lxappearance and qt5ct, which is a desktop environment independent GUI for this task, and it lets you preview themes.
sudo pacman -S lxappearance qt5ctFinally, if you want tranparency and fancy looking things, install a compositor:
sudo pacman -S picom
# Recomen run in i3 configs
exec_always --no-startup-id picom
# or in ~/.xrofile (Have some bugs)
picom &We can also change the theme of lightdm and make it look cooler, because why not? We need another greeter, and some theme, namely lightdm-webkit2-greeter and lightdm-webkit-theme-aether:
sudo pacman -S lightdm-webkit2-greeter
yay -S lightdm-webkit-theme-aetherThese are the configs you need to make:
# /etc/lightdm/lightdm.conf
[Seat:*]
# ...
# Uncomment this line and set this value
greeter-session = lightdm-webkit2-greeter
# ...
# /etc/lightdm/lightdm-webkit2-greeter.conf
[greeter]
# ...
webkit_theme = lightdm-webkit-theme-aetherReady to go.
There are dozens of programs for multimedia stuff, check this page.
For image previews, one of the best that I could find is sxiv and feh.
sudo pacman -S sxiv fehNo doubt vlc is exactly what you need:
sudo pacman -S vlcWith all you've done so far, you got all the tools to start playing with configs and make your desktop environment, well, yours. What I recommend is hacking on i3 to adding keybindings for common programs like firefox, a text editor, file manager, etc.
Once you feel comfortable with i3, you can install other tiling window managers, and you will have more sessions available when logging in through lightdm.
| Software | Utility |
|---|---|
| Networkmanager | Self explanatory |
| Network-manager-applet | NetworkManager systray |
| Pulseaudio | Self explanatory |
| Pavucontrol | pulseaudio GUI |
| Pamixer | pulseaudio CLI |
| Arandr | GUI for xrandr |
| Brightnessctl | Laptop screen brightness |
| StarShip | The cross-shell prompt |
| Dunst | Desktop notifications |
| Xidlehook | System suspend |
| Software | Utility |
|---|---|
| Picom | Compositor for Xorg |
| Roboto Mono Nerd Font | Nerd Font for icons |
| Fira Code Nerd Font | Nerd Font for icons |
| Material Desgin Icons | Font, Theme and icons |
| Material Black Theme | Theme |
| Candy Icons | Icons |
| Unifont | Icons |
| Sweet Cursor Theme | Cursor Theme |
| Lxappearance | GUI for changing themes |
| Nitrogen | GUI for setting wallpapers |
| Feh | CLI for setting wallpapers |
| Sxiv | CLI for setting wallpapers |
