From 1c4e533ab7b83b45d1e00d55e5a5e58794776845 Mon Sep 17 00:00:00 2001 From: vinceliuice Date: Sun, 10 Aug 2025 13:19:59 +0800 Subject: [PATCH] update --- libs/lib-install.sh | 79 ++++++++++++++++++- other/firefox/common/icons/side-view-dark.svg | 3 + other/firefox/common/parts/icons.css | 12 ++- src/sass/gtk/_common-3.0.scss | 4 +- tweaks.sh | 14 +++- 5 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 other/firefox/common/icons/side-view-dark.svg diff --git a/libs/lib-install.sh b/libs/lib-install.sh index f1b99e12..cfefd773 100755 --- a/libs/lib-install.sh +++ b/libs/lib-install.sh @@ -758,9 +758,6 @@ install_firefox_theme() { remove_firefox_theme - udo mkdir -p "${TARGET_DIR}" - udo cp -rf "${FIREFOX_SRC_DIR}"/customChrome.css "${TARGET_DIR}" - mkdir -p "${TARGET_DIR}" cp -rf "${FIREFOX_SRC_DIR}/${theme_name}" "${TARGET_DIR}" [[ -f "${TARGET_DIR}"/customChrome.css ]] && mv "${TARGET_DIR}"/customChrome.css "${TARGET_DIR}"/customChrome.css.bak @@ -798,6 +795,82 @@ install_firefox_theme() { config_firefox } +link_firefox_theme() { + if has_snap_app firefox; then + local TARGET_DIR="${FIREFOX_SNAP_THEME_DIR}" + elif has_flatpak_app org.mozilla.firefox; then + local TARGET_DIR="${FIREFOX_FLATPAK_THEME_DIR}" + else + local TARGET_DIR="${FIREFOX_THEME_DIR}" + fi + + if [[ "${colorscheme}" == '-nord' && "${adaptive}" == '-adaptive' ]]; then + local theme_type="${adaptive}" + else + local theme_type="${darker}${adaptive}${colorscheme}" + fi + + remove_firefox_theme + + mkdir -p "${TARGET_DIR}/${theme_name}" + + ln -sf "${FIREFOX_SRC_DIR}/${theme_name}"/colors "${TARGET_DIR}/${theme_name}"/colors + + ( + cd "${FIREFOX_SRC_DIR}/${theme_name}" + for file_name in `ls *.css`; do + ln -sf "${FIREFOX_SRC_DIR}/${theme_name}/${file_name}" "${TARGET_DIR}/${theme_name}/${file_name}" + done + ) + + ln -sf "${FIREFOX_SRC_DIR}"/common/icons "${TARGET_DIR}/${theme_name}"/icons + ln -sf "${FIREFOX_SRC_DIR}"/common/pages "${TARGET_DIR}/${theme_name}"/pages + + if [[ "${colorscheme}" == '-nord' ]]; then + ln -sf "${FIREFOX_SRC_DIR}"/common/titlebuttons-nord "${TARGET_DIR}/${theme_name}"/titlebuttons + else + ln -sf "${FIREFOX_SRC_DIR}"/common/titlebuttons "${TARGET_DIR}/${theme_name}"/titlebuttons + fi + + ( + cd "${FIREFOX_SRC_DIR}"/common + for file_name in `ls *.css`; do + ln -sf "${FIREFOX_SRC_DIR}"/common/"${file_name}" "${TARGET_DIR}/${theme_name}/${file_name}" + done + ) + + mkdir -p "${TARGET_DIR}/${theme_name}"/parts + + ( + cd "${FIREFOX_SRC_DIR}/${theme_name}"/parts + for file_name in `ls *.css`; do + ln -sf "${FIREFOX_SRC_DIR}/${theme_name}/parts/${file_name}" "${TARGET_DIR}/${theme_name}/parts/${file_name}" + done + ) + + ( + cd "${FIREFOX_SRC_DIR}"/common/parts + for file_name in `ls *.css`; do + ln -sf "${FIREFOX_SRC_DIR}"/common/parts/"${file_name}" "${TARGET_DIR}/${theme_name}/parts/${file_name}" + done + ) + + [[ -f "${TARGET_DIR}"/userChrome.css ]] && mv "${TARGET_DIR}"/userChrome.css "${TARGET_DIR}"/userChrome.css.bak + cp -rf "${FIREFOX_SRC_DIR}"/userChrome-"${theme_name}${theme_type}".css "${TARGET_DIR}"/userChrome.css + [[ -f "${TARGET_DIR}"/userContent.css ]] && mv "${TARGET_DIR}"/userContent.css "${TARGET_DIR}"/userContent.css.bak + cp -rf "${FIREFOX_SRC_DIR}"/userContent-"${theme_name}${theme_type}".css "${TARGET_DIR}"/userContent.css + + if [[ "${theme_name}" == 'Monterey' ]]; then + sed -i "s/left_header_button_3/left_header_button_${left_button}/g" "${TARGET_DIR}"/userChrome.css + sed -i "s/right_header_button_3/right_header_button_${right_button}/g" "${TARGET_DIR}"/userChrome.css + fi + + if [[ "${firefoxtheme}" == 'Flat' && "${theme_name}" == 'Monterey' ]]; then + cp -rf "${FIREFOX_SRC_DIR}"/userChrome-Monterey-alt"${theme_type}".css "${TARGET_DIR}"/userChrome.css + ln -sf "${FIREFOX_SRC_DIR}"/WhiteSur/parts/headerbar-urlbar.css "${TARGET_DIR}"/Monterey/parts/headerbar-urlbar-alt.css + fi +} + config_firefox() { if has_snap_app firefox; then local TARGET_DIR="${FIREFOX_SNAP_THEME_DIR}" diff --git a/other/firefox/common/icons/side-view-dark.svg b/other/firefox/common/icons/side-view-dark.svg new file mode 100644 index 00000000..88e43ee7 --- /dev/null +++ b/other/firefox/common/icons/side-view-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/other/firefox/common/parts/icons.css b/other/firefox/common/parts/icons.css index ee35e2e6..c216e28a 100644 --- a/other/firefox/common/parts/icons.css +++ b/other/firefox/common/parts/icons.css @@ -721,7 +721,7 @@ toolbar:not([brighttext]) .webextension-browser-action:-moz-lwtheme { /* side view extension */ #pageAction-urlbar-side-view_mozilla_org, -#sidebarswitcher_menu_side-view_mozilla_org-sidebar-action, +#sidebarswitcher_menu_side-view_mozilla_org-sidebar-action.webextension-menuitem, #side-view_mozilla_org-BAP .toolbarbutton-icon, #sidebar-box[sidebarcommand="side-view_mozilla_org-sidebar-action"] > #sidebar-header > #sidebar-switcher-target > #sidebar-icon { list-style-image: url("../icons/side-view.svg") !important; @@ -731,6 +731,16 @@ toolbar:not([brighttext]) .webextension-browser-action:-moz-lwtheme { background-image: url("../icons/side-view.svg") !important; } +@media (prefers-color-scheme: dark) { +#side-view_mozilla_org-menuitem-_open-in-sidebar .menu-iconic-icon { + background-image: url("../icons/side-view-dark.svg") !important; +} + +#sidebarswitcher_menu_side-view_mozilla_org-sidebar-action.webextension-menuitem { + list-style-image: url("../icons/side-view-dark.svg") !important; +} +} + /* Firefox note extension */ #notes_mozilla_com-BAP .toolbarbutton-icon, #sidebarswitcher_menu_notes_mozilla_com-sidebar-action, diff --git a/src/sass/gtk/_common-3.0.scss b/src/sass/gtk/_common-3.0.scss index 2948e975..3b75b992 100644 --- a/src/sass/gtk/_common-3.0.scss +++ b/src/sass/gtk/_common-3.0.scss @@ -16,8 +16,8 @@ $cakeisalie: "This stylesheet is generated, DO NOT EDIT"; -GtkWidget-text-handle-height: 20; -GtkDialog-button-spacing: 6; - -GtkDialog-action-area-border: 4; // This is necessary to align buttons and elements inside windows. - -GtkDialog-content-area-border: 4; + -GtkDialog-action-area-border: 6; // This is necessary to align buttons and elements inside windows. + -GtkDialog-content-area-border: 6; // We use the outline properties to signal the focus properties outline-color: gtkalpha(currentColor, 0.15); diff --git a/tweaks.sh b/tweaks.sh index 706517f2..5265c30e 100755 --- a/tweaks.sh +++ b/tweaks.sh @@ -46,6 +46,7 @@ usage() { sec_helpify "4. darker" " Darker Firefox theme version" "" " Darker Firefox theme version" sec_helpify "5. nord" " Nord Firefox colorscheme version" "" " Nord Firefox colorscheme version" sec_helpify "6. adaptive" " Adaptive color version" " You need install adaptive-tab-bar-colour plugin first" " https://addons.mozilla.org/firefox/addon/adaptive-tab-bar-colour/" + sec_helpify "7. link" " Install links for theme" "" "" helpify "-e, --edit-firefox" "[(monterey|flat)|alt|(darker|adaptive)]" " Edit '${THEME_NAME}' theme for Firefox settings and also connect the theme to the current Firefox profiles" "" @@ -175,6 +176,10 @@ while [[ $# -gt 0 ]]; do prompt -i "Firefox adaptive color version...\n" prompt -w "You need install adaptive-tab-bar-colour plugin first: https://addons.mozilla.org/firefox/addon/adaptive-tab-bar-colour/\n" shift ;; + link) + link="true" + prompt -i "Install links...\n" + shift ;; esac done @@ -284,7 +289,8 @@ if [[ "${uninstall}" == 'true' ]]; then prompt -s "Done! '${firefoxtheme}' Firefox theme has been removed. \n" fi else - show_needed_dialogs; customize_theme +# show_needed_dialogs + customize_theme if [[ "${gdm}" == 'true' ]]; then if [[ "${firefox}" == 'true' || "${edit_firefox}" == 'true' || "${flatpak}" == 'true' || "${snap}" == 'true' || "${dash_to_dock}" == 'true' ]]; then @@ -323,7 +329,11 @@ else if [[ "${firefox}" == 'true' && "${gdm}" != 'true' ]]; then prompt -i "Installing '${firefoxtheme}' Firefox theme... \n" - install_firefox_theme + if [[ "${link}" == 'true' ]]; then + link_firefox_theme + else + install_firefox_theme + fi prompt -s "Done! '${firefoxtheme}' Firefox theme has been installed. \n" fi