Ejemplo n.º 1
0
from cfgtools.files import UserBin
from cfgtools.system.arch import Pacman

import docker
import homebin

packages = {Pacman("binutils")}
files = [UserBin("aur/aur.py", "aur")]
Ejemplo n.º 2
0
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"),
]
Ejemplo n.º 3
0
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")
Ejemplo n.º 4
0
from cfgtools.files import DesktopEntry, XDGConfigFile, UserBin, normalize
from cfgtools.hooks import after
from cfgtools.system.arch import AUR
from cfgtools.system.systemd import ensure_service, UserService
from cfgtools.utils import hide_xdg_entry

NAME = normalize(__name__)

packages = {AUR("deadd-notification-center-bin")}
files = [
    XDGConfigFile(f"{NAME}/deadd.conf"),
    UserService(f"{NAME}/notifications.service"),
    UserBin(f"{NAME}/toggle-notifications.sh", "notifications-toggle"),
    DesktopEntry(f"{NAME}/notifications-toggle.desktop"),
]


@after
def start_notification_service() -> None:
    ensure_service("notifications", user=True)


@after
def cleanup_unwanted_avahi_entries() -> None:
    [hide_xdg_entry(e) for e in ["avahi-discover", "bvnc", "bssh"]]
Ejemplo n.º 5
0
 def __init__(self, folder: str, name: Optional[str] = None):
     name = name if name else folder
     self.bin = UserBin(f"{NAME}/{folder}/run.sh", name)
     self.entry = DesktopEntry(f"{NAME}/{folder}/entry.desktop", name)
Ejemplo n.º 6
0

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)


def set_default(browser: str) -> None:
    from shutil import which

    if not DEFAULT_BROWSER.exists():
Ejemplo n.º 7
0
from cfgtools.files import HOME, Folder, UserBin, EnvironmentFile, normalize

NAME = normalize(__name__)

files = [
    Folder(HOME / ".local/bin", permissions=0o755),
    EnvironmentFile(NAME),
    UserBin(f"{NAME}/settitle.sh", "settitle"),
    UserBin(f"{NAME}/term_info.sh", "term-info"),
    UserBin(f"{NAME}/retry.sh", "retry"),
]
Ejemplo n.º 8
0
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")
]
Ejemplo n.º 9
0
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"),
]
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
import subprocess

from cfgtools.files import HOME, RegisteredFileAction, UserBin, convert_loc, normalize
from cfgtools.hooks import after
from cfgtools.system.arch import Pacman
from cfgtools.system.python import VirtualEnv
from cfgtools.system.systemd import ensure_service, UserService
from cfgtools.utils import run

NAME = normalize(__name__)

packages = {Pacman("qt5-base")}
virtualenv = VirtualEnv("maestral", "maestral", "maestral-qt")
files = [
    UserBin(virtualenv.location / "bin/maestral", "maestral"),
    UserService(f"{NAME}/dropbox.service"),
]

DROPBOX_DIR = HOME / ".local/dropbox"


class EncryptedFile(RegisteredFileAction):
    DROPBOX_BASE = DROPBOX_DIR
    U_RO=0o400

    def __init__(self, src: str, dst: str):
        self.src = self.DROPBOX_BASE / src
        self.dst = convert_loc(dst)

        super().__init__()
Ejemplo n.º 12
0
from cfgtools.files import DesktopEntry, XDGConfigFile, XDG_CONFIG_HOME, UserBin, normalize
from cfgtools.hooks import after
from cfgtools.system.arch import Pacman
from cfgtools.system.python import VirtualEnv
from cfgtools.system.systemd import ensure_service, UserService

import dropbox

ENABLED = True
NAME = normalize(__name__)

packages = {Pacman("calcurse")}
virtualenv = VirtualEnv("gcal-sync", "gcsa")
files = [
    UserBin(f"{NAME}/gcal-sync.sh", "gcal-sync"),
    UserService(f"{NAME}/gcal-sync.service"),
    UserService(f"{NAME}/gcal-sync.timer"),
    XDGConfigFile(f"{NAME}/config", "calcurse/conf"),
    DesktopEntry(f"{NAME}/calcurse.desktop"),
    dropbox.EncryptedFile(
        "credentials/gcal-sync.json.gpg",
        XDG_CONFIG_HOME / "calcurse/credentials.json",
    ),
]


@after
def enable_sync_timer() -> None:
    global ENABLED
    if not ENABLED:
        return
Ejemplo n.º 13
0
from cfgtools.files import DesktopEntry, XDG_CONFIG_HOME, XDGConfigFile, UserBin, normalize
from cfgtools.system.arch import AUR, Pacman

import alacritty
import tmux
import dropbox

NAME = normalize(__name__)

packages = {Pacman("cmus"), AUR("ncspot")}
files = [
    XDGConfigFile(f"{NAME}/ncspot.toml", "ncspot/config.toml"),
    XDGConfigFile(f"{NAME}/cmus", "cmus/rc"),
    XDGConfigFile(f"{NAME}/cmus.theme", "cmus/local.theme"),
    UserBin(f"{NAME}/music-tmux.sh", "music-tmux"),
    UserBin(f"{NAME}/playerctl-wrapper.sh", "playerctl"),
    DesktopEntry(f"{NAME}/music-sidebar.desktop"),
    dropbox.EncryptedFile(
        "credentials/ncspot.toml.gpg",
        XDG_CONFIG_HOME / "ncspot/credentials.toml",
    ),
]
Ejemplo n.º 14
0
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"),
]
Ejemplo n.º 15
0
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"),
]
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
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")
Ejemplo n.º 18
0
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"),
]
Ejemplo n.º 19
0
from cfgtools.files import EnvironmentFile, UserBin, XDGConfigFile, normalize
from cfgtools.system.arch import Pacman
from cfgtools.system.ubuntu import Apt

NAME = normalize(__name__)
CONFIG_FILES = ["vimrc", "ftplugin", "plugin", "plugins.vim"]

packages = {Pacman("vim"), Apt("vim")}
files = [
    EnvironmentFile(NAME),
    UserBin(f"{NAME}/wrapper.sh", "vim"),
] + [XDGConfigFile(f"{NAME}/{f}") for f in CONFIG_FILES]