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()
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()
def install_login_screen(): # Login Screen kde_plasma_chili = u.git_clone( "https://github.com/MarianArlt/kde-plasma-chili.git", G["SOURCES_DIR"]) u.cp(kde_plasma_chili, "/usr/share/sddm/themes/plasma-chili", flags='r', root=True) 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["WALLPAPER_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() 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()
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()
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
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()
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()
"""MacifyLinux LookAndFeel Package""" import logging from pathlib import Path from macifylinux.globals import GLOBALS as G import macifylinux.utils as u component_name = Path(__file__).parent.name logger = logging.getLogger("macifylinux.components.{}".format(component_name)) apt_requirements = [] light_laf = u.get_template("lookandfeel/com.github.jonchun.macify-linux-light") dark_laf = u.get_template("lookandfeel/com.github.jonchun.macify-linux-dark") def install(*args, **kwargs): u.plasmoid_tool( light_laf, action="install", package_type="Plasma/LookAndFeel", pretty_name="macify-linux-light lookandfeel", ) u.plasmoid_tool( dark_laf, action="install", package_type="Plasma/LookAndFeel", pretty_name="macify-linux-dark lookandfeel", )