예제 #1
0
def configure():
    # ========== 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,
    )

    # Configure wallpaper of SDDM
    with u.get_template("sddm/theme.conf.user").open() as f:
        sddm_theme_conf = f.read()
    sddm_theme_conf = sddm_theme_conf.replace(
        "$BACKGROUND_IMAGE", G["DEFAULT_WALLPAPER"]
    )

    default_wallpaper = G["WALLPAPERS_DIR"] / G["DEFAULT_WALLPAPER"]

    # Create theme.user.conf (points to wallpaper) and move it to theme directory. Doing it weird like this because sudo is required.
    tmp_file = tempfile.NamedTemporaryFile("w", delete=False)
    tmp_file.write(sddm_theme_conf)
    tmp_file.close()
    logger.debug("Wallpaper: %s", default_wallpaper)
    u.cp(default_wallpaper, "/usr/share/sddm/themes/plasma-chili", root=True)
    tmp_file_path = Path(tmp_file.name)
    tmp_file_path.chmod(0o664)
    u.cp(
        tmp_file_path, "/usr/share/sddm/themes/plasma-chili/theme.conf.user", root=True
    )
    tmp_file_path.unlink()
예제 #2
0
def configure_latte():
    u.stop_latte()
    logger.info("Removing default panels and configuring latte.")
    script = u.get_template("removeDefaultPanels.js")
    u.eval_plasma_script(script)

    latte_template = u.get_template("lattedock/macifyLinux.layout.latte")
    latte_layout_conf = G["LATTE_DIR"] / latte_template.name
    u.copy_file(latte_template, latte_layout_conf)
    latte_layout_conf.chmod(0o664)

    u.kwriteconfig(
        {
            "key": "currentLayout",
            "value": "macifyLinux",
            "group": "UniversalSettings",
            "file": "~/.config/lattedockrc",
        }
    )
    u.kwriteconfig(
        {
            "key": "lastNonAssignedLayout",
            "value": "macifyLinux",
            "group": "UniversalSettings",
            "file": "~/.config/lattedockrc",
        }
    )
    u.start_latte()
예제 #3
0
def install(*args, **kwargs):
    u.git_clone(repo_url, G["SOURCES_DIR"])
    # run install.sh
    u.bash_action(action="install",
                  file=__file__,
                  name=component_name,
                  stderr_level=logging.DEBUG)

    # Start and stop latte once after installing in order to generate the default configs.
    start_latte()
    time.sleep(2)
    stop_latte()

    # run configure.sh
    u.bash_action(action="configure", file=__file__, name=component_name)

    # remove any default panels we find automatically
    script = u.get_template("removeDefaultPanels.js")
    u.eval_plasma_script(script)

    # Edit latte config files
    u.kwriteconfig({
        "file": "~/.config/lattedockrc",
        "group": "UniversalSettings",
        "key": "currentLayout",
        "value": "macifyLinux",
    })
    u.kwriteconfig({
        "file": "~/.config/lattedockrc",
        "group": "UniversalSettings",
        "key": "lastNonAssignedLayout",
        "value": "macifyLinux",
    })
    start_latte()
예제 #4
0
def configure(*args, **kwargs):
    style = kwargs.get("style", "light")
    if style == "light":
        color_scheme = "HelloLight"
        plasma_theme = "hellolight"
    elif style == "dark":
        # todo. not tested/working.
        color_scheme = "HelloDark"
        plasma_theme = "hellodark"

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

    # set color scheme
    configs = []
    configs.append({
        "group": "General",
        "key": "Name",
        "value": color_scheme,
    })
    configs.append({
        "group": "General",
        "key": "ColorScheme",
        "value": color_scheme,
    })
    u.kwriteconfigs("~/.config/kdeglobals", configs)

    # Style the titlebar buttons to add a little bit of margin on left & make it thinner.
    configs = []
    configs.append({
        "group": "Windeco",
        "key": "TitleBarHeightSpin",
        "value": 1,
    })
    configs.append({
        "group": "Windeco",
        "key": "ButtonMarginSpin",
        "value": 4,
    })
    u.kwriteconfigs("~/.config/hellorc", configs)

    # Set the kwinrc to hello
    configs = []
    configs.append({
        "group": "org.kde.kdecoration2",
        "key": "library",
        "value": "org.kde.hello",
    })
    configs.append({
        "group": "org.kde.kdecoration2",
        "key": "theme",
        "value": "hello",
    })
    u.kwriteconfigs("~/.config/kwinrc", configs)
예제 #5
0
def install(*args, **kwargs):
    u.git_clone(repo_url, G["SOURCES_DIR"])
    # run install.sh
    u.bash_action(action="install", file=__file__, name=component_name)

    # icons
    u.kwriteconfig({
        "file": "~/.config/kdeglobals",
        "group": "Icons",
        "key": "Theme",
        "value": "Os-Catalina-icons",
    })
예제 #6
0
def install(*args, **kwargs):
    # run install.sh
    u.bash_action(action="install", file=__file__, name=component_name)

    # change desktop wallapaper
    wallpaper = G["WALLPAPERS_DIR"] / Path(G["DEFAULT_WALLPAPER"])
    u.change_desktop_wallpaper(wallpaper)

    # change lockscreen wallpaper
    u.kwriteconfig({
        "key":
        "Image",
        "value":
        "file://{}".format(wallpaper),
        "group": ["Greeter", "Wallpaper", "org.kde.image", "General"],
        "file":
        "~/.config/kscreenlockerrc",
    })
예제 #7
0
def configure(*args, **kwargs):
    # ========== START KDEGLOBALS ==========
    configs = []

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

    # Dolphin
    u.kwriteconfig({
        "file": "~/.config/dolphinrc",
        "group": "General",
        "key": "ShowFullPath",
        "value": "true",
    })

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

    # xsettingsd
    # not sure what this is, but seems important... someone please PR with a better explanation.
    xsettingsd_dir = Path("~/.config/xsettingsd").expanduser()
    xsettingsd_dir.mkdir(parents=True, exist_ok=True)
    xsettingsd_conf = xsettingsd_dir / Path("xsettingsd.conf")
    xsettingsd_template = u.get_template("xsettingsd/xsettingsd.conf")

    if xsettingsd_conf.is_file():
        xsettingsd_conf.rename(
            xsettingsd_conf.with_name("{}.bak".format(xsettingsd_conf.name)))
    with xsettingsd_template.open() as f:
        content = f.read()
    # this should later be moved into a search/replace within the icons and cursors components respectively
    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({
        "group": "org.kde.kdecoration2",
        "key": "BorderSize",
        "value": "None",
    })

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

    # This section moves the window buttons to the left. Some users might prefer it on the right so will have to add options later.
    configs.append({
        "group": "org.kde.kdecoration2",
        "key": "ButtonsOnLeft",
        "value": "XIA",
    })
    configs.append({
        "group": "org.kde.kdecoration2",
        "key": "ButtonsOnRight",
        "value": "''",
    })

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

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

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

    u.restart_kwin()
    u.restart_plasma()
예제 #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()