Initial i3 configuration

This is derived from my Awesome configuration. Still a lot to do from
a WM perspective. The organization is a bit different and I am giving
it up on the per-display systemd units as it does not really work due
to the fact we only have one user DBus and one environment.
This commit is contained in:
Vincent Bernat 2021-07-03 14:13:56 +02:00
parent d3af9e4890
commit d85a504c53
95 changed files with 383 additions and 3116 deletions

3
dotfiles/Xresources Normal file
View file

@ -0,0 +1,3 @@
Emacs*toolBar: 0
Emacs*menuBar: 0
Emacs*verticalScrollBars: off

67
dotfiles/firefox.js Normal file
View file

@ -0,0 +1,67 @@
// Preferences for Firefox. To be symlinked in the profile as user.js.
// Settings synced through Firefox Accounts may not be present.
// Theme
user_pref("extensions.activeThemeID", "default-theme@mozilla.org");
user_pref("devtools.theme", "dark");
user_pref("ui.systemUsesDarkTheme", 0);
// Ensure context menus stay open after left-click (useful when scale
// == 1.5)
user_pref("ui.context_menus.after_mouseup", true);
// Don't display menubar when pressing Alt
user_pref("ui.key.menuAccessKeyFocuses", false);
// No popup at all!
user_pref("browser.link.open_newwindow.restriction", 0);
// Search settings
user_pref("browser.search.region", "FR");
user_pref("browser.search.suggest.enabled", false);
// Homepage is newtab. On launch, restore session.
user_pref("browser.startup.homepage", "about:newtab");
user_pref("browser.startup.page", 3);
// Languages
user_pref("intl.accept_languages", "en-us,en,fr");
// Disable pocket
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
user_pref("extensions.pocket.enabled", false);
// Don't recommend extensions
user_pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons", false);
user_pref("browser.discovery.enabled", false);
// Backspace is like back
user_pref("browser.backspace_action", 0);
// Don't allow detaching a tab by pulling it
user_pref("browser.tabs.allowTabDetach", false);
// Don't display a close button for tabs
user_pref("browser.tabs.tabClipWidth", 1000);
// Don't display fullscreen warning
user_pref("full-screen-api.warning.timeout", 0);
user_pref("full-screen-api.transition.timeout", 0);
// Don't autoplay videos (even without audio)
user_pref("media.autoplay.default", 5);
// Remove some annoying animations (notably when going full screen)
user_pref("toolkit.cosmeticAnimations.enabled", false);
// Force enable WebRender
user_pref("gfx.webrender.all", true);
// And VAAPI decoding with ffmpeg
user_pref("gfx.x11-egl.force-enabled", true);
user_pref("media.ffmpeg.vaapi.enabled", true);
// Enable AVIF
user_pref("image.avif.enabled", true);
// Disable DoH for now
user_pref("network.trr.mode", 5);

27
dotfiles/gtkrc-2.0 Normal file
View file

@ -0,0 +1,27 @@
gtk-theme-name="Adwaita-dark"
gtk-icon-theme-name="Adwaita"
gtk-cursor-theme-name="Adwaita"
gtk-cursor-theme-size=0
gtk-font-name="DejaVu Sans 10"
gtk-button-images=1
gtk-menu-images=1
gtk-fallback-icon-theme="gnome"
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-decoration-layout=":menu"
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-rgba="rgb"
gtk-key-theme-name="Emacs"
binding "vbe-text-entry-bindings" {
unbind "<ctrl>b"
unbind "<shift><ctrl>b"
unbind "<ctrl>f"
unbind "<shift><ctrl>f"
unbind "<ctrl>w"
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) }
}
class "GtkEntry" binding "vbe-text-entry-bindings"
class "GtkTextView" binding "vbe-text-entry-bindings"

44
dotfiles/gtkrc-3.0 Normal file
View file

@ -0,0 +1,44 @@
/* Useless: we cannot override properly by unbinding some keys */
/* @import url("/usr/share/themes/Emacs/gtk-3.0/gtk-keys.css"); */
@binding-set custom-text-entry
{
bind "<alt>b" { "move-cursor" (words, -1, 0) };
bind "<shift><alt>b" { "move-cursor" (words, -1, 1) };
bind "<alt>f" { "move-cursor" (words, 1, 0) };
bind "<shift><alt>f" { "move-cursor" (words, 1, 1) };
bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) };
bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) };
bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) };
bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) };
bind "<ctrl>y" { "paste-clipboard" () };
bind "<ctrl>d" { "delete-from-cursor" (chars, 1) };
bind "<alt>d" { "delete-from-cursor" (word-ends, 1) };
bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) };
bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) };
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) };
bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
}
entry, textview
{
-gtk-key-bindings: custom-text-entry;
}
.window-frame, .window-frame:backdrop {
box-shadow: 0 0 0 black;
border-style: none;
margin: 0;
border-radius: 0;
}
.titlebar {
border-radius: 0;
}

9
dotfiles/qt5ct.conf Normal file
View file

@ -0,0 +1,9 @@
[Appearance]
custom_palette=false
icon_theme=Adwaita
standard_dialogs=gtk3
style=Adwaita-dark
[Fonts]
fixed=@Variant(\0\0\0@\0\0\0 \0\x44\0\x65\0j\0\x61\0V\0u\0 \0S\0\x61\0n\0s\0 \0M\0o\0n\0o@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
general=@Variant(\0\0\0@\0\0\0\x16\0\x44\0\x65\0j\0\x61\0V\0u\0 \0S\0\x61\0n\0s@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)

View file

@ -0,0 +1,9 @@
[Unit]
Description=Configure monitors
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/autorandr --change --default default
LimitCORE=infinity
Type=oneshot
RemainAfterExit=false

View file

@ -0,0 +1,14 @@
[Unit]
Description=i3 window manager
PartOf=graphical-session.target
After=autorandr.service
After=picom.service
After=xsettingsd.service
After=tmux.service
After=ssh-agent.service
Before=wallpaper.service
[Service]
ExecStart=/usr/bin/i3
ExecStopPost=/bin/systemctl --user stop graphical-session.target
Restart=on-failure

View file

@ -0,0 +1,8 @@
[Unit]
Description=XInput event monitor
PartOf=graphical-session.target
[Service]
ExecStartPre=/usr/bin/setxkbmap us
ExecStart=%h/.local/bin/inputplug -d -0 -c %h/.config/i3/bin/input-event
Restart=on-failure

View file

@ -0,0 +1,11 @@
[Unit]
Description=Miscellaneous settings for X11
PartOf=graphical-session.target
After=ssh-agent.service
[Service]
ExecStart=/usr/bin/xset -b
ExecStart=/usr/bin/xsetroot -cursor_name left_ptr
ExecStart=%h/.config/i3/bin/ssh-add
Type=oneshot
RemainAfterExit=false

View file

@ -0,0 +1,12 @@
[Unit]
Description=Compositor for X11
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/picom --backend glx \
--xrender-sync-fence \
--vsync \
--opacity-rule 100:fullscreen \
--opacity-rule 85:!fullscreen \
--opacity-rule 100:focused
Restart=on-failure

View file

@ -0,0 +1,7 @@
[Unit]
Description=PolicyKit authentication agent
PartOf=graphical-session.target
[Service]
ExecStart=/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
Restart=on-failure

View file

@ -0,0 +1,7 @@
[Unit]
Description=Set color temperature
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/redshift -l manual:lon=2.35:lat=48.87 -t 6500:3900
Restart=on-failure

View file

@ -0,0 +1,12 @@
[Unit]
Description=SSH key agent
Wants=dbus.socket
After=dbus.socket
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStartPre=/usr/bin/dbus-update-activation-environment --systemd SSH_AUTH_SOCK
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
ExecStopPost=/usr/bin/dbus-update-activation-environment --systemd SSH_AUTH_SOCK=
Restart=always

View file

@ -0,0 +1,7 @@
[Unit]
Description=tmux session
[Service]
RemainAfterExit=yes
ExecStart=/usr/bin/tmux start-server
ExecStop=/usr/bin/tmux kill-server

View file

@ -0,0 +1,14 @@
[Unit]
Description=Build and display wallpaper
PartOf=graphical-session.target
[Service]
Environment=WALLPAPER_DIRECTORY=%h/.config/i3/wallpapers
Environment=WALLPAPER_OUTPUT=%h/.cache/i3/current-wallpaper.png
ExecStart=/usr/bin/mkdir -p %h/.cache/i3
ExecStart=%h/.config/i3/bin/build-wallpaper --crop \
--directory $WALLPAPER_DIRECTORY \
--target $WALLPAPER_OUTPUT
ExecStart=/usr/bin/fvwm-root -r $WALLPAPER_OUTPUT
Type=oneshot
RemainAfterExit=false

View file

@ -0,0 +1,7 @@
[Unit]
Description=Wallpaper rotation
PartOf=graphical-session.target
[Timer]
OnUnitActiveSec=2h
RandomizedDelaySec=10m

View file

@ -0,0 +1,7 @@
[Unit]
Description=X color management
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/xiccd --edid
Restart=on-failure

View file

@ -0,0 +1,17 @@
[Unit]
Description=X session
BindsTo=graphical-session.target
Wants=autorandr.service
Wants=i3.service
Wants=picom.service
Wants=inputplug.service
Wants=misc-x.service
Wants=policykit-agent.service
Wants=redshift.service
Wants=wallpaper.timer
Wants=xiccd.service
Wants=xsettingsd.service
Wants=xss-lock.service
Wants=tmux.service
Wants=ssh-agent.service
Wants=pulseaudio.service

View file

@ -0,0 +1,11 @@
[Unit]
Description=XSETTINGS daemon
PartOf=graphical-session.target
[Service]
Environment=SKIP_RELOAD=1
ExecStartPre=%h/.config/i3/bin/xsettingsd-setup
ExecStart=/usr/bin/xsettingsd -c %h/.xsettingsd
ExecReload=%h/.config/i3/bin/xsettingsd-setup
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=on-failure

View file

@ -0,0 +1,7 @@
[Unit]
Description=Manage X screen saver
PartOf=graphical-session.target
[Service]
ExecStart=%h/.config/i3/bin/xss-lock start
Restart=on-failure

16
dotfiles/xkb/default.xkb Normal file
View file

@ -0,0 +1,16 @@
# -*- conf -*-
# Default configuration with:
# - compose → rwin, ralt or menu
# - capslock as ctrl
# - pause key becomes xscreensaver
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)"
include "compose(rwin)+compose(menu)+compose(ralt)"
include "ctrl(nocaps)"
include "vbe(pause)" };
xkb_geometry { include "pc(pc105)" };
};

17
dotfiles/xkb/symbols/vbe Normal file
View file

@ -0,0 +1,17 @@
partial
xkb_symbols "pause" {
key <PAUS> {
[ XF86ScreenSaver, XF86ScreenSaver ]
};
};
partial modifier_keys alphanumeric_keys
xkb_symbols "x1gen2" {
key <LCTL> { [ Escape, Escape ] };
key <HOME> { [ Control_L, Control_L ] };
key <END> { [ Control_L, Control_L ] };
modifier_map Control { Control_L, <HOME>, <END> };
key <TLDE> { [ Insert, Insert ] };
key <ESC> { [ grave, asciitilde, dead_grave, dead_tilde ] };
};

View file

@ -0,0 +1,10 @@
# -*- conf -*-
# Configuration for thinkpad extra buttons
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};

21
dotfiles/xkb/x1gen2.xkb Normal file
View file

@ -0,0 +1,21 @@
# -*- conf -*-
# Configuration for a Lenovo X1 Carbon Gen 2 keyboard
#
# This keyboard is a mess. Really. Here is what we do about it:
#
# - transform Home and End as a Control_L key
# - transform Backquote (between left alt and left ctrl) into Insert
# - transform Escape to Backquote. Let's say we don't need escape.
#
# Escape can be replaced with C-[. See:
# http://vim.wikia.com/wiki/Avoid_the_escape_key
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)"
include "compose(ralt)+ctrl(nocaps)"
include "vbe(x1gen2)" };
xkb_geometry { include "pc(pc105)" };
};

38
dotfiles/xsession Normal file
View file

@ -0,0 +1,38 @@
#!/bin/sh
# Ensure we use the appropriate gtkrc-2.0 file
export GTK2_RC_FILES=$HOME/.gtkrc-2.0
# We do not want to rely on crappy mailcap
export MAILCAPS=$HOME/.mailcap
# Make QT automatically scale according to screen DPI
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_QPA_PLATFORMTHEME=qt5ct
# GTK3 apps try to contact org.a11y.Bus. Disable that.
export NO_AT_BRIDGE=1
# Environment variables
unset LC_ALL
[ -e ~/.zshenv ] && . ~/.zshenv
# Copy some configuration files
while read source target; do
for t in $target; do
mkdir -p $(dirname $HOME/$t)
ln -nsf ~/.config/i3/dotfiles/$source $HOME/$t
done
done <<EOF
Xresources .Xresources
gtkrc-2.0 .gtkrc-2.0
gtkrc-3.0 .config/gtk-3.0/settings.ini
qt5ct.conf .config/qt5ct/qt5ct.conf
systemd .config/systemd/user
firefox.js .mozilla/firefox/*/user.js
EOF
# Services are started with systemd
systemctl --user import-environment
systemctl --user daemon-reload
exec systemctl --user start --wait xsession.target

13
dotfiles/xsettingsd Normal file
View file

@ -0,0 +1,13 @@
# Before modifying, also check rc/appearance.lua
Xft/Antialias 1
Xft/Hinting 1
Xft/HintStyle "hintslight"
Net/ThemeName "Adwaita-dark"
Net/IconThemeName "Adwaita"
Gtk/CursorThemeName "Adwaita"
Gtk/CursorThemeSize 0
Gtk/FontName "DejaVu Sans 10"
Gtk/KeyThemeName "Emacs"
Gtk/ButtonImages 1
Gtk/MenuImages 1
Gtk/DecorationLayout ":menu"