I should have used NixOS...
 
 
 
Go to file
Quentin Duchemin 84d003bb7a
Added new Obsidian vault
2023-02-22 12:38:41 +01:00
.config Added new Obsidian vault 2023-02-22 12:38:41 +01:00
.gnupg Still gpg-agent not remembering key for signing commits 2023-02-18 22:40:28 +01:00
.Xmodmap.laptop Replace Left-CTLR by Compose key 2019-03-20 11:52:45 +01:00
.Xresources Cleaner, more flexible install process after re-installating 2023-02-18 22:35:26 +01:00
.Xresources.desk Let XFT settings for desktop computer 2019-01-26 19:22:15 +01:00
.Xresources.laptop Let XFT settings for desktop computer 2019-01-26 19:22:15 +01:00
.asoundrc.desk Fix Signal and scratchpad 2022-11-10 12:03:38 +01:00
.init_config.sh Added new Obsidian vault 2023-02-22 12:38:41 +01:00
.zprofile Cleaner, more flexible install process after re-installating 2023-02-18 22:35:26 +01:00
.zshrc Fish-like feature and fuzzy finding for ZSH 2023-02-20 14:03:38 +01:00
README.md Add Polybar support for music print and control 2023-02-19 19:42:07 +01:00

README.md

dotfiles

Generic todo

Would be great to have a real people-agnostic base, separated from my own customization. Right now, base configuration still have personal path and stuff, making it unusable as-is for other people.

What is this, Chosto ?

Basically, a way to bootstrap and keep track of my machines' configuration, that can realistically be used as a base for other people.

Context and content

I used a lot Debian/Ubuntu with Gnome. So a full Desktop Manager with a stacking Windows Manager. A friend of mine showed me i3, a great and customizable tiling Windows Manager (i.e. no windows stack, just divide the scren and take all empty space).

With some customization and additionnal component (in this repo), I managed to get a functional and pleasant yet lightweight environment. While initially I used low footprint software like netctl for networks, I gave up and choose heavier but simpler option like NetworkManager.

So basically, what I like about this setup is that there is no "useless" menu bar anywhere and no border. Just windows with gaps between them when multiple windows are on the same screen and keyboard shortcuts.

In brief this is the classic Arch/i3 combo with :

  • Polybar, a great replacement for i3-bar with easy custom plugins and system tray
  • A notification daemon (urgency-aware), Dunst, controlled by shortcuts (but possibly with mouse)
  • Rofi, a full-customizable app launcher
  • Automatic login (drives are encrypted)
  • Automatic backups
  • Blue light reducer at night
  • A fancy lock screen, with optional hibernation, either triggered by hotkey or when there is no activity for X minutes
  • ZSH with Oh My ZSH
  • Mappings to control ALSA volume from dedicated keyboards buttons, to play/plause players compatible with MPRIS D-Bus Interface spec
  • Do-not-disturb mode
  • Screenshots (area or windows), with saving or uploading to a Lychee server (custom script here)
  • A curated list of software for daily usage (browser, mail client, messaging, network manager, password manager etc)
  • Fonts I like, used in i3, polybar, etc

Screenshots

#TODO

Requirements

Installation

Please note : on my system XDG_CONFIG_HOME is empty and default to $HOME/.config.

Clone the repository

  • Clone in bare repository : git clone --bare https://github.com/Chostakovitch/dotfiles.git $HOME/.cfg. A bare repository does not have a working tree (basically it is just .git content). So we avoid conflicts with another git repository.
  • Create a working tree outside .cfg : git --git-dir=$HOME/.cfg/ --work-tree=$HOME checkout.

Credits to this article for the trick.

Configure for your system

Polybar

The bottom bar will work for every machine.

However, depending on your machine you may want slightly different modules loaded on the top bar, e.g. battery for laptop. Available modules are listed in .config/polybar/config_common. You also may want to adjust bars' height and DPI.

This can be done in ~/.config/polybar/conf.d/<env> (see explanation for env).

This is optional for now as by default, polybar will use this fallback values :

[variables]
dpi = 90
height = 27
top_left = powermenu system-uptime-pretty player-mpris
top_center = xwindow
top_right = system-usb-udev alsa date

The bottom bar also reports disk usage, which cannot be configured generically. You can set the partitions you want to track in config/polybar/scripts/filesystem.data with the following format :

# Each mount point (parts) will be associated with the icon 
# (icons) having the same array index.
# You can add as many mount point as you want.
icons=( )
parts=(/ /home)

Wallpaper

You can put an optional wallpaper in ~/.local/share/backgrounds/wallpaper.jpg.

Autologin

Adjust your login in .config/systemd/getty@tty1.service.d/autologin.conf.

Default user directories

Configure in .config/user-dirs.dirs.

Backups

Adjust backup script and timer in .config/systemd

Keybinding and started programs

Well... keybindings and programs started automatically are documented in ./.config/i3/config_common, but you probably want to change almost everything in that file because it is very specific to my setup.

Just note the existence of :

Get the system ready

INIT=1 ~/.init_config.sh [<env>]

This will install all needed software and configuration. If you want to re-use my setup, I highly recommand not to pass env, which are specific overrides for my hardware. You should provide you own adaptations, see explanations section.

In actual setup env can be :

  • desk is currently adjusted for my home setup, i.e. two screens, a keyboard with media keys and JACK Audio Connection Kit.
  • laptop is adjusted for a basic, single and high-DPI screen laptop, with a simple keyboard.

You can now reboot.

Install Git Hook

You want to add files named post-merge and pre-push in ~/.cfg/hooks with contains :

#!/bin/sh

exec env WM_RESTART=1 ~/.init_config.sh <env>

And then chmod +x ~/.cfg/hooks/{post-merge,pre-push}. WM_RESTART controls whether i3, polybar and picom are restarted.

That way, each time you commit or pull, changes are applied automagically, including configuration deletion detection.

Git alias

.zshrc provides a config alias that you can use for manipulating the repository, e.g.

config add -u
config commit
config push

Explanations

Managing divergences between environments

This repository is used on several machines, called environements and defined at the beginning of the init script. In my example I have a desktop and a laptop, and envs are called desk or laptop.

Sometimes, you want a configuration file to be present only in a specific environment. Just add .<env> extension to this file and the init script will create symlinks without .<env> if running on a matching environment.

Other times, you have a base configuration for all environment with specific additions par-environment. This is called merging. The following scheme is used :

<config_subdir>
  |__config_common
  |__config.d
     |__[desk]
     |__[laptop]

In that case, the script will create a <config_subdir>/config file, which contains the concatenation of config_common and config.d/<env>, the later being optional. Filenames and path are hardcoded for now.

Configuration outside XDG_CONFIG_HOME, e.g. /etc

Some configuration files reside in /etc directory, but I want to keep track of them.

To do so, you need to add a special text file named dest. In this file, write the destination path. Then, copy the configuration files that you want to track and add them to the repository.

You can combine with .<env> extensions or config merging for specific configuration : only the "final files" will be copied, e.g.

<config_subdir>
  |__dest = /etc/foo
  |__subfolder
     |__bar.desk

At the end, you will have a /etc/foo/subfolder/bar file, iff the environment is desk.

If INIT variable is set, files are copied anyway. Otherwise they are copied only if they have changed since the latest commit. The script also ensures that deleted files upstream are also deleted in destination paths.

Bootstrap

The folder $XDG_CONFIG_HOME/boostrap is a special folder used to help launching a fresh system. It uses the merging system to list the Arch packages to install (including AUR ones) in yay folder.

These packages are intented to provide reasonable defaults so the configuration just works out-of-the-box.

These packages are not to specific too my usage but still include messaging app for example, you can remove them if you want.

Screenshots

#TODO : move it on another repo

A small script inside .config/i3/scripts uses maim to take screenshots.

Then, a flag can either save locally the image or upload it (now, only on a Lychee server using the API).

~/.config/i3/scripts/config.py should contains credentials, adapted from .config/i3/scripts/config.py.example.

In either case, the link or path is copied to clipboard and a notification is triggered.