dotfiles/README.md

138 lines
6.6 KiB
Markdown
Raw Normal View History

2018-05-03 20:25:03 +02:00
# dotfiles
2019-02-24 21:20:30 +01:00
<!-- MarkdownTOC autolink="true" -->
- [What is this, Chosto ?](#what-is-this-chosto-)
- [Contents](#contents)
- [Requirements](#requirements)
- [Usage](#usage)
2019-04-06 19:20:32 +02:00
- [Bare repository trick](#bare-repository-trick)
- [Divergence betwteen laptop and desktop](#divergence-betwteen-laptop-and-desktop)
- [Configuration outside XDG_CONFIG_HOME, e.g. /etc](#configuration-outside-xdgconfighome-eg-etc)
- [Git Hook](#git-hook)
- [Screenshots](#screenshots)
2019-02-24 21:20:30 +01:00
<!-- /MarkdownTOC -->
## What is this, Chosto ?
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 (for me, no brag).
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 keybord shortcuts for productivity.
I added to the classic Arch/i3 :
* A notification daemon (urgency-aware), Dunst, controlled by shortcuts (but possibly with mouse).
* A fancy lock screen, with optionnal suspend-to-RAM, either triggered by hotkey or when there is no activity for X minutes.
* A Display Manager (LightDM), for login and X starting.
* A great File Explorer (SpaceFM), with hotkey / command-line / screen-split / protocol handlers / events support.
* ZSH with Oh My ZSH and excellent community plugins (Git aliases, Docker autocomplete, FASD bindings, cat and man coloration...)
* Some mappings to control ALSA volume from dedicated keyboards buttons, to play/plause players compatible with MPRIS D-Bus Interface spec ; some changes to key speed (X settings) ; Smooth and dark theme for GTK and for Sublime-Text...
## Contents
2018-06-09 13:21:44 +02:00
Setup for :
2019-02-24 21:20:30 +01:00
2018-06-09 13:21:44 +02:00
* [i3](http://i3wm.org/), a great tiling windows manager
2019-02-24 21:20:30 +01:00
* In fact i3-gaps, to add margins between windows
2018-06-09 13:21:44 +02:00
* And i3-lock-color, an improved lock screen
* [LightDM](https://wiki.ubuntu.com/LightDM) with custom GTKTheme and background
* Sublime Text 3
* [Polybar](https://github.com/jaagr/polybar/), a great replacement for i3-bar with easy custom plugins
* Terminator
* ZSH with Oh My ZSH!
* [Dunst](https://github.com/dunst-project/dunst), a great and lightweight notification daemon
2018-07-27 20:35:00 +02:00
* [Rofi](https://github.com/DaveDavenport/rofi), a full-customizable app launcher/windows
switcher
2018-06-21 00:27:25 +02:00
* Sound setup (total beginner there btw) :
2018-06-18 23:36:16 +02:00
* JACK, a sound server, without PA support ;
* PianoTeq, a virtual synth ;
* Cadence and Claudia, JACK and LADISH front-ends ;
* Non-Mixer, a mixer.
2018-06-21 00:27:25 +02:00
* Ardour, a DAW.
2018-06-15 21:26:41 +02:00
* Random things (GTK3+ theme, Redshift, taskwarrior...)
2019-04-06 19:20:32 +02:00
* A custom script to take screenshots and save them or upload them
* Screenshots (area or windows), with saving or uploading to a Lychee server ([custom script here](.config/i3/scripts/screenshot.py))
2018-05-03 20:25:03 +02:00
2019-02-24 21:20:30 +01:00
Here is a screenshot of the rendition i3/polybar with this setup (and yeah, I use nano, sorry to disappoint)
![Screenshot of i3/polybar](https://pic.chosty.fr/uploads/big/22c75dc7901223204e0e9c798506b435.png)
2018-05-03 20:25:03 +02:00
2019-02-24 21:20:30 +01:00
## Requirements
Configuration makes use of these things, just to record but not exhaustive :
2018-06-09 13:21:44 +02:00
2018-05-03 20:25:03 +02:00
* [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
* [fasd](https://github.com/clvv/fasd)
* [Pygments](http://pygments.org/) (with `pygmentize` command)
* [Powerline Fonts](https://github.com/powerline/fonts)
2018-06-09 13:21:44 +02:00
* `sudo pip install --upgrade google-api-python-client`
* [SpaceFM](https://ignorantguru.github.io/spacefm/)
* [PlayerCTL](https://github.com/acrisci/playerctl)
* [GTK Arc Theme](https://github.com/horst3180/arc-theme)
2018-07-27 20:35:00 +02:00
* Fonts : Noto Sans, Noto Emoji, DejaVu Sans, MaterialIcons, Symbola
* xdotool, xsel
* gnupg
2019-04-18 21:13:10 +02:00
* maim, for screenshot + `pip install pyperclip`
* Python 3.7
2019-03-25 23:21:15 +01:00
* opensmtpd
2018-06-09 13:21:44 +02:00
2019-02-24 21:20:30 +01:00
\#todo automatic installation of dependencies
2018-06-09 13:21:44 +02:00
2019-02-24 21:20:30 +01:00
## Usage
2018-06-09 13:21:44 +02:00
2019-02-24 21:20:30 +01:00
Please note : on my system `XDG_CONFIG_HOME` is empty and default to `$HOME/.config`.
2018-05-03 20:25:03 +02:00
2019-02-24 21:20:30 +01:00
### Bare repository trick
2018-06-09 13:21:44 +02:00
2018-05-03 20:25:03 +02:00
* 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`.
2018-05-03 20:25:03 +02:00
* Adjust `DEFAUT_USER` in `~/.zshrc`.
* Adjust other environment variables, such as `SCREENSHOT_PATH`.
2018-05-03 20:25:03 +02:00
* Source `~/.zshrc` and use provided `config` alias to pull.
* `config config --local status.showUntrackedFiles no` to ignore untracked files in status (better as it is home dir).
Credits to [this great article](https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/) for the trick.
2019-02-24 21:20:30 +01:00
### Divergence betwteen laptop and desktop
As desktop machine and laptop don't have configuration conflicts (e.g. laptop uses PulseAudio and desktop uses ALSA/Jack), some files have `.desk` extension and others `.laptop`. Configuration files that works on both systems have no extension.
Launch `~/.init_config.sh` to create symlinks (e.g. `~/.config/i3/config` will be symlinked to `~/.config/i3/config.laptop` if I launch `~/.init_config.sh laptop`).
### Configuration outside XDG_CONFIG_HOME, e.g. /etc
Some configuration files reside in `/etc` directory, but I want to keep track of them.
Just create a folder in `XDG_CONFIG_HOME` and a 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 also use `.desk` and `.laptop` extensions for specific configuration.
2019-02-24 21:22:59 +01:00
The `~/.init_config.sh` script will copy relevant files (laptop or desktop) in the directory specified by `dest` file. Now you just modify the files tracked by Git and run `~/.init_config.sh`.
Example : see `~/.config/lightdm` directory.
2019-02-24 21:20:30 +01:00
2019-03-13 15:37:08 +01:00
### Git Hook
You may want to add a file named `post-merge` **and** `pre-push` in `~/.cfg/hooks` with contains something like :
2019-03-13 15:37:08 +01:00
```bash
#!/bin/sh
exec ~/.init_config.sh <whatever you environment is>
```
And then `chmod +x ~/.cfg/hooks/{post-merge,pre-push}`.
2019-03-13 15:37:08 +01:00
When you pull, changes are applied automagically.
Note this is a quick and quite dirty solution.
2019-04-06 19:20:32 +02:00
### 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).
The `~/.config/i3/scripts/config.py` contains the default configuration.
In either case, the link or path is copied to clipboard and a notification is triggered.