from cfgtools.files import DesktopEntry, UserBin, XinitRC, normalize from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service, UserService NAME = normalize(__name__) packages = {Pacman("feh"), Pacman("curl"), Pacman("which")} files = [ UserBin(f"{NAME}/wallpaper.sh", "wallpaper"), UserService(f"{NAME}/wallpaper.service"), UserService(f"{NAME}/wallpaper.timer"), XinitRC(NAME, priority=90), DesktopEntry(f"{NAME}/wallpaper.desktop"), ] @after def enable_wallpaper_timer() -> None: ensure_service("wallpaper.timer", user=True)
import subprocess from pathlib import Path from cfgtools.files import XDGConfigFile from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service packages = {Pacman("xdg-user-dirs")} files = [XDGConfigFile("user_dirs/dirs", "user-dirs.dirs")] @after def ensure_user_dirs_exist() -> None: with open("user_dirs/dirs", "r") as dirs_file: for line in dirs_file: if line.startswith("#"): continue dirname = line.split("=")[1]\ .strip('"\n')\ .replace("$HOME", str(Path.home())) location = Path(dirname) if not location.exists(): location.mkdir(parents=True) # this *can't* run first otherwise it will remove the symlink and replace # with a bad default file ensure_service("xdg-user-dirs-update", user=True)
from cfgtools.files import DesktopEntry, UserBin, XDGConfigFile, XDG_CONFIG_HOME, normalize from cfgtools.system.arch import Pacman import dropbox import mpv import web_xdg_open NAME = normalize(__name__) packages = {Pacman("streamlink"), Pacman("xclip")} files = [ XDGConfigFile(f"{NAME}/config", "streamlink/config"), DesktopEntry(f"{NAME}/streamlink.desktop"), UserBin(f"{NAME}/streamlink-clipboard.sh", "_streamlink-clipboard"), dropbox.EncryptedFile( "credentials/streamlink.crunchyroll.gpg", XDG_CONFIG_HOME / "streamlink/config.crunchyroll", ), web_xdg_open.SettingsFile(f"{NAME}/web-xdg-open", "streamlink"), ]
from cfgtools.files import File, UserBin, XinitRC, DesktopEntry, normalize from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service, UserService from cfgtools.utils import hide_xdg_entry import mpv NAME = normalize(__name__) packages = {Pacman("xsecurelock"), Pacman("xss-lock")} files = [ UserBin(f"{NAME}/screenlock.sh", "_screenlock"), UserBin(f"{NAME}/screenlock_wrapper.sh", "screenlock"), UserService(f"{NAME}/screenlock.service"), XinitRC(NAME, priority=10), File( f"{NAME}/saver_mpv-cinemagraph", "/usr/lib/xsecurelock/saver_mpv-cinemagraph", ), DesktopEntry(f"{NAME}/screenlock.desktop"), ] @after def enable_screenlock_service() -> None: ensure_service("screenlock", user=True)
from cfgtools.files import XDGConfigFile from cfgtools.system.arch import AUR, Pacman packages = {Pacman("alacritty"), AUR("./aur/pkgs/ttf-hack-ext")} files = [ XDGConfigFile("alacritty/alacritty.yml"), ]
from cfgtools.files import XDGConfigFile, normalize from cfgtools.system.arch import Pacman import dropbox NAME = normalize(__name__) packages = {Pacman("qutebrowser"), Pacman("pdfjs"), Pacman("python-adblock")} files = [ XDGConfigFile(f"{NAME}/config.py", "qutebrowser/config.py"), XDGConfigFile(dropbox.DROPBOX_DIR / "greasemonkey", "qutebrowser/greasemonkey"), XDGConfigFile( dropbox.DROPBOX_DIR / "configs/qutebrowser/quickmarks", "qutebrowser/quickmarks", ), ] + [ XDGConfigFile(f"{NAME}/{n}.py", f"qutebrowser/modules.d/{n}.py") for n in ["conditionals", "hints", "privacy", "theme"] ]
from cfgtools.files import EnvironmentFile, XDGConfigFile, HOME, normalize from cfgtools.system.arch import Pacman from cfgtools.system import GitRepository import dropbox import rofi NAME = normalize(__name__) packages = { Pacman("pass"), Pacman("yubikey-manager"), Pacman("xclip"), Pacman("xdotool"), GitRepository( HOME / ".local/dropbox/pass.git", HOME / ".local/password_store", ), } files = [ XDGConfigFile(f"{NAME}/totp_rofi", "rofi/scripts/totp"), XDGConfigFile(f"{NAME}/pass_rofi", "rofi/scripts/pass"), XDGConfigFile(f"{NAME}/config.rasi", "rofi/themes/auth.rasi"), EnvironmentFile(NAME), ]
from cfgtools.files import UserBin from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.ubuntu import Apt from cfgtools.system.systemd import ensure_service from cfgtools.utils import add_group import homebin system_packages = {Pacman("docker"), Apt("docker.io")} files = [UserBin("docker/wrapper.sh", "docker")] @after def start_docker_service() -> None: ensure_service("docker.service") @after def give_user_docker_access() -> None: add_group("docker")
from cfgtools.hooks import after from cfgtools.files import normalize from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service, UserService packages = {Pacman("unclutter")} files = [ UserService(f"{normalize(__name__)}/unclutter.service"), ] @after def unclutter_enabled() -> None: ensure_service("unclutter", user=True)
import vim from cfgtools.system.arch import Pacman from cfgtools.system.ubuntu import Apt from cfgtools.files import XDGConfigFile packages = { Pacman("neovim"), Pacman("python-pynvim"), Apt("neovim"), Apt("python3-neovim"), } nvim_files = { XDGConfigFile("vim/neovim.vim", "nvim/init.vim"), }
from cfgtools.system.arch import Pacman, AUR from cfgtools.files import DesktopEntry, UserBin, normalize NAME = normalize(__name__) pkgs = {AUR("scrcpy"), Pacman("android-tools")} files = [ UserBin(f"{NAME}/wrapper.sh", "scrcpy"), DesktopEntry(f"{NAME}/scrcpy.desktop"), ]
from cfgtools.files import XDGConfigFile from cfgtools.system.arch import AUR, Pacman packages = {Pacman("rofi"), AUR("./aur/pkgs/ttf-hack-ext")} files = [ XDGConfigFile("rofi/config.rasi"), XDGConfigFile("rofi/themes/icons_launcher.rasi"), ]
from cfgtools.files import XDGConfigFile, normalize from cfgtools.system.arch import Pacman NAME = normalize(__name__) packages = {Pacman("papirus-icon-theme")} files = [ XDGConfigFile(f"{NAME}/settings.ini", "gtk-3.0/settings.ini"), ]
from cfgtools.system.arch import AUR, Pacman from cfgtools.files import XDGConfigFile, normalize NAME = normalize(__name__) pkgs = {Pacman("wezterm"), AUR("./aur/pkgs/ttf-iosevka-ext")} files = [ XDGConfigFile(f"{NAME}/wezterm.lua", "wezterm/wezterm.lua"), ]
from cfgtools.files import UserBin from cfgtools.system.arch import Pacman import docker import homebin packages = {Pacman("binutils")} files = [UserBin("aur/aur.py", "aur")]
NAME = normalize(__name__) python_tools = [ "black", "flake8", "isort", "mypy", "mypy-ls", "neovim", "pynvim", "python-lsp-black", "python-lsp-server", ] packages = { Pacman("python"), Pacman("python-wheel"), Apt("python3"), Apt("python3-pip"), Apt("python3-venv"), VirtualEnv("python-code-tools", *python_tools), } files = [ XDGConfigFile(f"{NAME}/pip.conf", "pip/pip.conf"), EnvironmentFile(NAME), XDGConfigFile(f"{NAME}/python_startup.py", "python/startup.py"), XDGConfigFile(f"{NAME}/black.toml", "black"), XDGConfigFile(f"{NAME}/isort.cfg", "isort.cfg"), ]
from cfgtools.files import DesktopEntry, UserBin, XDGConfigFile, normalize from cfgtools.system.arch import Pacman import rofi NAME = normalize(__name__) packages = {Pacman("maim"), Pacman("which"), Pacman("xclip")} files = [ UserBin(f"{NAME}/screencap-menu.sh", "rofi-screencap"), XDGConfigFile(f"{NAME}/config.rasi", "rofi/themes/screencap.rasi"), DesktopEntry(f"{NAME}/screencap.desktop"), ]
from cfgtools.hooks import after from cfgtools.files import DesktopEntry, File, UserBin, XDG_CONFIG_HOME, normalize from cfgtools.system.arch import Pacman from cfgtools.utils import xdg_settings_get, xdg_settings_set class SettingsFile(File): def __init__(self, src: str, tgt: str): super().__init__(src=src, dst=XDG_CONFIG_HOME / f"web-xdg-open/{tgt}") NAME = normalize(__name__) DEFAULT_BROWSER = XDG_CONFIG_HOME / NAME / "default" packages={ Pacman("xdg-utils"), } files=[ DesktopEntry(f"{NAME}/web-xdg-open.desktop"), UserBin(f"{NAME}/web-xdg-open.py", "web-xdg-open"), ] @after def register_as_default_browser() -> None: # xdg-settings set default-web-browser web-xdg-open.desktop tgt = "web-xdg-open.desktop" if xdg_settings_get("default-web-browser") != tgt: xdg_settings_set("default-web-browser", tgt)
from cfgtools.files import UserBin, XDGConfigFile, normalize from cfgtools.system.arch import Pacman from cfgtools.system.ubuntu import Apt import homebin NAME = normalize(__name__) packages = { Pacman("openssh"), Pacman("git"), Pacman("man-db"), Apt("git"), Apt("openssh-client") } files = [ XDGConfigFile(f"{NAME}/config"), XDGConfigFile(f"{NAME}/ignore"), UserBin(f"{NAME}/wrapper.sh", "git"), ]
from cfgtools.files import HOME, UserBin, XDGConfigFile, normalize from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service, UserService from cfgtools.utils import run NAME = normalize(__name__) packages = {Pacman("luakit")} files = [ UserBin(f"{NAME}/adblock-update.sh", "_adblock-update"), UserService(f"{NAME}/adblock-update.service"), UserService(f"{NAME}/adblock-update.timer"), XDGConfigFile(f"{NAME}/userconf.lua"), XDGConfigFile(f"{NAME}/theme.lua"), ] @after def periodic_adblock_updates() -> None: ensure_service("adblock-update.timer", user=True) if not (HOME / ".local/share/luakit/adblock/easylist.txt").exists(): run("_update-adblock")
from cfgtools.files import XDGConfigFile from cfgtools.system.arch import Pacman packages = {Pacman("sxhkd")} files = [XDGConfigFile("sxhkd/sxhkdrc")]
from cfgtools.files import XinitRC, XDGConfigFile, normalize from cfgtools.system.arch import Pacman import alacritty import deadd import picom import polybar import rofi import sxhkd import xorg NAME = normalize(__name__) packages = {Pacman("bspwm"), Pacman("xorg-xsetroot")} files = [ XDGConfigFile(f"{NAME}/bspwmrc"), XDGConfigFile(f"{NAME}/polybar", "polybar/bspwm"), XinitRC(NAME, priority=99), ]
import getpass import os import subprocess import bat from cfgtools.files import EnvironmentFile, File, HOME, XDGConfigFile, normalize from cfgtools.hooks import after from cfgtools.system.arch import AUR, Pacman from cfgtools.system.nix import NixPkgBin from cfgtools.system.ubuntu import Apt _SUDO_CHSH = False NAME = normalize(__name__) packages = { Pacman("zsh"), Pacman("zsh-syntax-highlighting"), Pacman("zsh-completions"), AUR("./aur/pkgs/cli-utils"), Apt("zsh"), Apt("zsh-common"), Apt("zsh-syntax-highlighting"), NixPkgBin("exa"), NixPkgBin("ripgrep", "rg"), NixPkgBin("colordiff"), NixPkgBin("fzf"), } files = [ File(f"{NAME}/zshrc", HOME / ".zshrc"), XDGConfigFile(f"{NAME}/settings"), EnvironmentFile(NAME),
from cfgtools.files import XDGConfigFile from cfgtools.system.arch import Pacman, AUR system_packages = { Pacman("zathura"), Pacman("zathura-pdf-mupdf"), AUR("./aur/pkgs/ttf-hack-ext"), } files = [ XDGConfigFile("zathura/zathurarc"), ]
from cfgtools.files import (HOME, EnvironmentFile, UserBin, XDGConfigFile, normalize) from cfgtools.system.arch import Pacman from cfgtools.system.ubuntu import Apt NAME = normalize(__name__) packages = {Pacman("tmux"), Apt("tmux")} files = [ XDGConfigFile(f"{NAME}/tmux.conf", "tmux/tmux.conf"), EnvironmentFile(NAME), UserBin(f"{NAME}/wrapper.sh", "tmux") ]
import urllib.request from pathlib import Path from cfgtools.files import HOME, File, normalize from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.ubuntu import Apt NAME = normalize(__name__) packages = {Pacman("openssh"), Apt("ssh-client")} files = [ File(f"{NAME}/default.ssh", HOME / ".ssh/config.d/default") ] @after def setup_base_ssh_config() -> None: base_config = HOME / ".ssh/config" base_config_template = Path(__file__).parent / "base.ssh" if not base_config.exists(): base_config.write_text(base_config_template.read_text()) else: include_line, _ = base_config_template.read_text().split("\n", 1) if not base_config.read_text().startswith(include_line): print( f"!!! Please add `{include_line}` to the top" f" of your `{base_config}` file." )
from cfgtools.files import normalize from cfgtools.hooks import after from cfgtools.system.systemd import ensure_service, UserService from cfgtools.system.arch import Pacman NAME = normalize(__name__) system_packages = {Pacman("network-manager-applet")} files = [ UserService(f"{NAME}/networkmanager-tray.service"), ] @after def start_nm_tray() -> None: ensure_service("networkmanager-tray", user=True)
from cfgtools.hooks import after from cfgtools.system.arch import Pacman from cfgtools.system.systemd import ensure_service packages = {Pacman("autorandr")} @after def enable_autorandr_service() -> None: ensure_service("autorandr")
from cfgtools.system.arch import Pacman from cfgtools.files import File, HOME, XDG_CONFIG_HOME, XDGConfigFile, normalize NAME = normalize(__name__) packages={ Pacman("xorg-xinit"), Pacman("xorg-server"), Pacman("xorg-xmodmap"), Pacman("xorg-xrdb"), } files=[ File(f"{NAME}/xorg.target", XDG_CONFIG_HOME / "systemd/user/xorg.target"), File(f"{NAME}/xinitrc", HOME / ".xinitrc"), XDGConfigFile(f"{NAME}/xinitrc.d/90-systemd"), XDGConfigFile(f"{NAME}/xinitrc.d/10-xmodmap"), XDGConfigFile(f"{NAME}/xinitrc.d/10-xresources"), XDGConfigFile(f"{NAME}/caps-ctrl-swap.xmodmap"), XDGConfigFile(f"{NAME}/Xresources"), ]
from cfgtools.files import XDGConfigFile, UserBin, normalize from cfgtools.system.arch import Pacman NAME = normalize(__name__) packages={Pacman("npm")} files=[ XDGConfigFile(f"{NAME}/npmrc", "npm/npmrc"), UserBin(f"{NAME}/wrapper.sh", "npm"), ]