예제 #1
0
def run_applet_window_appmenu():
    # Need to custom-build. Using this plasmoid because the Global Menu one breaks on multi-monitor setups.
    logger.info(
        "Building Window AppMenu plasmoid (Global Menu). This can take a while..."
    )
    u.run_shell(
        "cd ~/sources/applet-window-appmenu/ && bash ./install.sh",
        stderr_level=logging.DEBUG,
    )
예제 #2
0
def run(*args, **kwargs):
    # Need to custom-build to get latest latte for sidebar functionality.
    logger.info("Building latte-dock. This can take a while...")
    u.run_shell(
        "cd ~/sources/latte-dock/ && bash ./install.sh", stderr_level=logging.DEBUG,
    )
    # Start latte immediately after building it. This is to generate the initial configs.
    u.start_latte()

    # wait 2 seconds to allow latte to start up
    time.sleep(2)
    configure_latte()
예제 #3
0
def pre(*args, **kwargs):
    prerequisites = ["xbindkeys", "xdotool", "ibus"]

    u.apt_install(
        prerequisites,
        "kinto prerequisites",
    )
    """
    logger.info(
        "You may be asked to start the IBus Daemon. Please answer yes. Then, close the preferences window that pops up after."
    )
    """
    u.run_shell("ibus-daemon -drx")
    # u.run_shell("ibus-setup", stderr_level=logging.DEBUG)
    u.run_shell("im-config -n ibus", stderr_level=logging.DEBUG)

    u.git_clone("https://github.com/rbreaves/kinto.git", G["SOURCES_DIR"])
    return True
예제 #4
0
def install(*args, **kwargs):
    # install mcmojave_kde first as it is the base theme. everything else overwrites it.
    # mcmojave_kde.install(*args, **kwargs)
    # style = kwargs.get("style", "light")
    # if style == "light":
    #     theme = "McMojave-light"
    # elif style == "dark":
    #     # todo. not tested/working.
    #     theme = "McMojave"

    # https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands#Change_look_and_feel

    for component in components:
        component.install(*args, **kwargs)

    configure(*args, **kwargs)

    cmd = "lookandfeeltool -a 'com.github.jonchun.{}'".format(
        "macify-linux-light")
    u.run_shell(cmd, stderr_level=logging.DEBUG)
예제 #5
0
def install_icons():
    logger.info("Installing icon packs.")

    u.git_clone("https://github.com/vinceliuice/McMojave-circle.git",
                G["SOURCES_DIR"])
    u.git_clone("https://github.com/zayronxio/Os-Catalina-icons",
                G["SOURCES_DIR"])

    # This install script does a lot... don't want to figure out/translate it into python right now.
    try:
        u.run_shell(
            "cd ~/sources/McMojave-circle/ && bash ./install.sh",
            stderr_level=logging.DEBUG,
        )
    except subprocess.CalledProcessError:
        logger.error("Unable to install McMojave-circle icon pack!")

    catalina_icons = Path("~/sources/Os-Catalina-icons").expanduser()
    u.cp(catalina_icons, G["ICONS_DIR"], "rf")
    """
예제 #6
0
def run(*args, **kwargs):
    # Need to custom-build albert due to a bug with icons
    # https://github.com/albertlauncher/albert/issues/778

    albert_build = G["SOURCES_DIR"] / Path("albert-build")
    albert_build.mkdir(parents=True, exist_ok=True)
    logger.info("Building albert. This can take a while...")
    commands = [
        "cd ~/sources/albert-build/",
        "cmake ../albert -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug",
        "make",
        "sudo make install",
    ]
    u.run_shell(
        " && ".join(commands), stderr_level=logging.DEBUG,
    )

    # autostart albert
    albert_desktop_file = Path("/usr/local/share/applications/albert.desktop")
    autostart_dir = Path("~/.config/autostart").expanduser()
    autostart_dir.mkdir(parents=True, exist_ok=True)

    u.setup_symlink(albert_desktop_file, autostart_dir, target_is_directory=True)

    # albert configuration
    albert_conf = u.get_template("albert/albert.conf")
    albert_conf_dir = Path("~/.config/albert").expanduser()
    albert_conf_dir.mkdir(parents=True, exist_ok=True)
    u.copy_file(albert_conf, albert_conf_dir / albert_conf.name)

    last_used_version = albert_conf_dir / Path("last_used_version")
    with last_used_version.open("w") as f:
        f.write("0.16.1")

    # start albert
    # execute it directly via Popen so that there are no open pipes when program exits.
    subprocess.Popen(
        "nohup /bin/sh {} > /dev/null 2>&1 &".format(albert_desktop_file.resolve()),
        shell=True,
    )
    return True
예제 #7
0
def install_fonts():
    logger.info("Installing SF fonts.")
    u.git_clone("https://github.com/blaisck/sfwin.git", G["SOURCES_DIR"])

    installed = 0
    sf_compact = Path("~/sources/sfwin/SFCompact").expanduser()
    installed += int(
        u.setup_symlink(sf_compact, G["FONTS_DIR"], target_is_directory=True))
    sf_mono = Path("~/sources/sfwin/SFMono").expanduser()
    installed += int(
        u.setup_symlink(sf_mono, G["FONTS_DIR"], target_is_directory=True))
    sf_pro = Path("~/sources/sfwin/SFPro").expanduser()
    installed += int(
        u.setup_symlink(sf_pro, G["FONTS_DIR"], target_is_directory=True))

    if installed > 0:
        logger.info(
            "Installed %s fonts. Refreshing font cache. This may take a while.",
            installed,
        )
        u.run_shell("fc-cache -fv")
    else:
        logger.warning(
            "No fonts were installed. They probably already existed.")
예제 #8
0
def configure(*args, **kwargs):
    options = kwargs.get("options", {})
    style = options.get("style", "light")

    # https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands#Change_look_and_feel
    if style == "light":
        theme = "McMojave-light"
        color_scheme = "McMojaveLight"
    elif style == "dark":
        # todo. not tested/working.
        theme = "McMojave"
        color_scheme = "McMojave"

    # run the lookandfeeltool
    cmd = "lookandfeeltool -a 'com.github.vinceliuice.{}'".format(theme)
    u.run_shell(cmd, stderr_level=logging.DEBUG)

    u.stop_plasma()

    # ========== START KDEGLOBALS ==========
    configs = []

    # widget style
    configs.append({
        "key": "widgetStyle",
        "value": "Breeze",
        "group": "General",
    })
    configs.append({
        "key": "widgetStyle",
        "value": "Breeze",
        "group": "KDE",
    })

    # colors
    configs.append({
        "key": "Name",
        "value": color_scheme,
        "group": "General",
    })
    configs.append({
        "key": "ColorScheme",
        "value": color_scheme,
        "group": "General",
    })

    # Fonts
    configs.append({
        "key": "fixed",
        "value": "'SF Mono,10,-1,5,50,0,0,0,0,0'",
        "group": "General",
    })
    configs.append({
        "key": "font",
        "value": "'SF Pro Text,10,-1,5,50,0,0,0,0,0'",
        "group": "General",
    })
    configs.append({
        "key": "menuFont",
        "value": "'SF Pro Text,10,-1,5,50,0,0,0,0,0'",
        "group": "General",
    })

    configs.append({
        "key": "smallestReadableFont",
        "value": "'SF Pro Text,8,-1,5,50,0,0,0,0,0'",
        "group": "General",
    })

    configs.append({
        "key": "toolBarFont",
        "value": "'SF Pro Text,10,-1,5,50,0,0,0,0,0'",
        "group": "General",
    })

    configs.append({
        "key": "activeFont",
        "value": "'SF Pro Text,10,-1,5,50,0,0,0,0,0'",
        "group": "WM",
    })

    # icons
    configs.append({
        "key": "Theme",
        "value": "Os-Catalina-icons",
        "group": "Icons",
    })

    u.kwriteconfigs("~/.config/kdeglobals", configs)

    # ========== END KDEGLOBALS ==========

    # plasma theme
    u.kwriteconfig({
        "key": "name",
        "value": theme,
        "group": "Theme",
        "file": "~/.config/plasmarc",
    })

    # Dolphin
    u.kwriteconfig({
        "key": "ShowFullPath",
        "value": "true",
        "group": "General",
        "file": "~/.config/dolphinrc",
    })
    # This is to change browsing dolphing to doubleclick rather than single. For some reason it's in globals and not dolphin.
    u.kwriteconfig({
        "key": "SingleClick",
        "value": "false",
        "group": "KDE",
        "file": "~/.config/kdeglobals",
    })

    # ========== START SDDM ==========
    # On KDE Neon, the file is at /etc/sddm.conf.d/kde_settings.conf
    # this might be different in other distros.
    u.kwriteconfig(
        {
            "key": "Current",
            "value": "plasma-chili",
            "group": "Theme",
            "file": "/etc/sddm.conf.d/kde_settings.conf",
        },
        root=True,
    )
    # ========== END SDDM ==========

    # xsettingsd
    # not sure what this is, but seems important...
    xsettingsd_conf = Path("~/.config/xsettingsd/xsettingsd.conf").expanduser()
    xsettingsd_template = u.get_template("xsettingsd/xsettingsd.conf")
    xsettingsd_conf.rename(
        xsettingsd_conf.with_name("{}.bak".format(xsettingsd_conf.name)))
    with xsettingsd_template.open() as f:
        content = f.read()
    content = content.replace("$ICON_THEME", "Os-Catalina-icons").replace(
        "$CURSOR_THEME", "McMojave-cursors")

    with xsettingsd_conf.open("w") as f:
        f.write(content)
    xsettingsd_conf.chmod(0o664)

    # ========== START KWINRC ==========
    # Windows / Window Decorations
    configs = []

    configs.append({
        "key": "BorderSize",
        "value": "None",
        "group": "org.kde.kdecoration2",
    })

    configs.append({
        "key": "BorderSizeAuto",
        "value": "false",
        "group": "org.kde.kdecoration2",
    })
    configs.append({
        "key": "ButtonsOnLeft",
        "value": "XIA",
        "group": "org.kde.kdecoration2",
    })
    configs.append({
        "key": "ButtonsOnRight",
        "value": "''",
        "group": "org.kde.kdecoration2",
    })
    configs.append({
        "key": "library",
        "value": "org.kde.hello",
        "group": "org.kde.kdecoration2",
    })
    configs.append({
        "key": "theme",
        "value": "hello",
        "group": "org.kde.kdecoration2",
    })

    u.kwriteconfigs("~/.config/kwinrc", configs)

    # ========== END KWINRC ==========

    # ========== START PLASMANOTIFYRC ==========
    configs = []

    configs.append({
        "key": "LowPriorityHistory",
        "value": "true",
        "group": "Notifications",
    })

    configs.append({
        "key": "PopupPosition",
        "value": "TopRight",
        "group": "Notifications",
    })

    configs.append({
        "key": "PopupTimeout",
        "value": "5000",
        "group": "Notifications",
    })

    u.kwriteconfigs("~/.config/plasmanotifyrc", configs)

    # ========== END PLASMANOTIFYRC ==========

    # Change splash screen back to breeze
    u.kwriteconfig({
        "key": "Theme",
        "value": "org.kde.breeze.desktop",
        "group": "KSplash",
        "file": "~/.config/ksplashrc",
    })

    # Configure wallpaper of lockscreen
    wallpaper = G["WALLPAPER_DIR"] / Path("kym-ellis-RPT3AjdXlZc-unsplash.jpg")
    u.kwriteconfig({
        "key":
        "Image",
        "value":
        "file://{}".format(wallpaper),
        "group": ["Greeter", "Wallpaper", "org.kde.image", "General"],
        "file":
        "~/.config/kscreenlockerrc",
    })

    u.start_plasma()
    u.restart_kwin()