Skip to content

Commit

Permalink
More tweaks and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlendea committed Apr 12, 2024
1 parent 3ecd84d commit d9c1df6
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 13 deletions.
1 change: 1 addition & 0 deletions rc/keyboard-layouts/ro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ xkb_symbols "basic" {
key <AE10> { [ 0, parenright, dead_doubleacute ] };
key <AE11> { [ minus, underscore, dead_diaeresis, endash ] };
key <AE12> { [ equal, plus, dead_cedilla, plusminus ] };
key <AC05> { [ g, G, U011F, U011E ] }; # G-breve
key <AD01> { [ q, Q, acircumflex, Acircumflex ] };
key <AD02> { [ w, W, ssharp, U1E9E ] };
key <AD03> { [ e, E, EuroSign ] };
Expand Down
1 change: 1 addition & 0 deletions resources/udev/pci_pm.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEM=="pci", ATTR{power/control}="auto"
1 change: 1 addition & 0 deletions resources/udev/usb_powersave.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
File renamed without changes.
3 changes: 3 additions & 0 deletions scripts/common/filesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ ROOT_USR_SHARE="${ROOT_USR}/share"
ROOT_VAR="${ROOT}/var"
ROOT_VAR_LIB="${ROOT_VAR}/lib"

# Dirs
UDEV_RULES_DIR="${ROOT_ETC}/udev/rules.d"

# Username and home directory
USER_REAL=${SUDO_USER}
[ -z "${USER_REAL}" ] && USER_REAL=${USER}
Expand Down
28 changes: 22 additions & 6 deletions scripts/configure-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ if [ -f "${ROOT_ETC}/default/grub" ] \

[ -f "/swapfile" ] && BOOT_FLAGS_DEFAULT="${BOOT_FLAGS_DEFAULT} resume=/swapfile"

set_config_value "${GRUB_CONFIG_FILE}" "GRUB_CMDLINE_LINUX_DEFAULT" "\"${BOOT_FLAGS_DEFAULT}\""

set_config_value "${GRUB_CONFIG_FILE}" "GRUB_DISABLE_RECOVERY" true
set_config_value "${GRUB_CONFIG_FILE}" "GRUB_TIMEOUT" "${GRUB_TIMEOUT}"
Expand All @@ -302,13 +301,19 @@ if [ -f "${ROOT_ETC}/default/grub" ] \
set_config_value "${GRUB_CONFIG_FILE}" "GRUB_THEME" "${ROOT_USR}/share/grub/themes/Nuci/theme.txt"
fi

if [ "$(get_cpu_family)" == "Intel" ]; then
BOOT_FLAGS_DEFAULT="${BOOT_FLAGS_DEFAULT} intel_idle.max_cstate=1"
fi

# Set GRUB resolution to the highest supported one
if [ "$(get_gpu_model)" == "GeForce GTX 1650" ]; then
if [ "${SCREEN_RESOLUTION_H}" -ge 1280 ] \
&& [ "${SCREEN_RESOLUTION_V}" -ge 1024 ]; then
set_config_value "${GRUB_CONFIG_FILE}" "GRUB_GFXMODE" "1280x1024x32"
fi
fi

set_config_value "${GRUB_CONFIG_FILE}" "GRUB_CMDLINE_LINUX_DEFAULT" "\"${BOOT_FLAGS_DEFAULT}\""
fi

if does_bin_exist "gdm"; then
Expand Down Expand Up @@ -877,9 +882,19 @@ if does_bin_exist "firefox" "librewolf" "org.mozilla.firefox" "io.gitlab.librewo
set_firefox_config "${FIREFOX_PROFILE_DIR}" "browser.urlbar.suggest.quicksuggest.sponsored" false

# Performance
set_firefox_config "${FIREFOX_PROFILE_DIR}" "dom.ipc.processCount" $(nproc) # Limit to the number of physical cores, to save resources and save battery power
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dnsCacheEntries" $((DNS_CACHE_SIZE/10))
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dnsCacheExpiration" $((DNS_CACHE_TTL*60))
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dnsCacheExpirationGracePeriod" $((DNS_CACHE_TTL*60))
# Performance - Hardware Acceleration
set_firefox_config "${FIREFOX_PROFILE_DIR}" "gfx.webrender.all" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "layers.acceleration.force-enabled" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "media.hardware-video-decoding.enabled" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "webgl.disabled" false # Setting it to true might improve privacy, but reduces performance and increases power consumption

# JavaScript timers - Reduce to save resources and power
set_firefox_config "${FIREFOX_PROFILE_DIR}" "dom.min_timeout_value" 1000
set_firefox_config "${FIREFOX_PROFILE_DIR}" "dom.min_timeout_value_ns" 1000

# Security
set_firefox_config "${FIREFOX_PROFILE_DIR}" "dom.security.https_first" true
Expand All @@ -890,6 +905,7 @@ if does_bin_exist "firefox" "librewolf" "org.mozilla.firefox" "io.gitlab.librewo
# Network
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dns.disableIPv6" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dns.disablePrefetch" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.http.connection-timeout" 30 # Timeout faster, to prevent wasting resources, and to save battery power
#set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.dns.disablePrefetchFromHTTPS" true
set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.predictor.enabled" false
#set_firefox_config "${FIREFOX_PROFILE_DIR}" "network.predictor.enable-prefetch" false
Expand Down Expand Up @@ -1368,10 +1384,10 @@ if does_bin_exist "tlp"; then
set_config_value "${TLP_CONFIG_FILE}" "CPU_ENERGY_PERF_POLICY_ON_AC" "performance"
set_config_value "${TLP_CONFIG_FILE}" "CPU_ENERGY_PERF_POLICY_ON_BAT" "power"

set_config_value "${TLP_CONFIG_FILE}" "CPU_MIN_PERF_ON_AC" "0"
set_config_value "${TLP_CONFIG_FILE}" "CPU_MAX_PERF_ON_AC" "100"
set_config_value "${TLP_CONFIG_FILE}" "CPU_MIN_PERF_ON_BAT" "0"
set_config_value "${TLP_CONFIG_FILE}" "CPU_MAX_PERF_ON_BAT" "75"
#set_config_value "${TLP_CONFIG_FILE}" "CPU_MIN_PERF_ON_AC" "0"
#set_config_value "${TLP_CONFIG_FILE}" "CPU_MAX_PERF_ON_AC" "100"
#set_config_value "${TLP_CONFIG_FILE}" "CPU_MIN_PERF_ON_BAT" "0"
#set_config_value "${TLP_CONFIG_FILE}" "CPU_MAX_PERF_ON_BAT" "75"

set_config_value "${TLP_CONFIG_FILE}" "PLATFORM_PROFILE_ON_AC" "performance"
set_config_value "${TLP_CONFIG_FILE}" "PLATFORM_PROFILE_ON_BAT" "low-power"
Expand All @@ -1393,7 +1409,7 @@ if does_bin_exist "tlp"; then
set_config_value "${TLP_CONFIG_FILE}" "PCIE_ASPM_ON_BAT" 'powersupersave'

set_config_value "${TLP_CONFIG_FILE}" "SATA_LINKPWR_ON_AC" 'max_performance' # Default: med_power_with_dipm
set_config_value "${TLP_CONFIG_FILE}" "SATA_LINKPWR_ON_BAT" 'min_power' # Default: med_power_with_dipm
set_config_value "${TLP_CONFIG_FILE}" "SATA_LINKPWR_ON_BAT" 'med_power_with_dipm' # Default: med_power_with_dipm | min_power can cause data loss

set_config_value "${TLP_CONFIG_FILE}" "RUNTIME_PM_ON_AC" 'on'
set_config_value "${TLP_CONFIG_FILE}" "RUNTIME_PM_ON_BAT" 'auto'
Expand Down
4 changes: 2 additions & 2 deletions scripts/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ if [ "${DISTRO_FAMILY}" == "Arch" ]; then

# Themes
if [ "${DESKTOP_ENVIRONMENT}" = "GNOME" ]; then
install_native_package adwaita-dark # GTK3's AdwaitaDark ported to GTK2
install_native_package adw-gtk3
is_package_installed "gtk2" && install_native_package adwaita-dark # GTK3's AdwaitaDark ported to GTK2
is_package_installed "gtk3" && install_native_package adw-gtk3
install_flatpak org.gtk.Gtk3theme.adw-gtk3-dark
fi

Expand Down
13 changes: 8 additions & 5 deletions scripts/update-resources.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
source "scripts/common/filesystem.sh"
source "${REPO_DIR}/scripts/common/common.sh"
source "${REPO_DIR}/scripts/common/apps.sh"
source "${REPO_SCRIPTS_COMMON_DIR}/common.sh"
source "${REPO_SCRIPTS_COMMON_DIR}/apps.sh"
source "${REPO_SCRIPTS_COMMON_DIR}/system-info.sh"

if does_bin_exist "firefox" "org.mozilla.firefox" "io.gitlab.librewolf-community"; then
FIREFOX_PROFILE_DIR=$(get_firefox_profile_dir)
Expand Down Expand Up @@ -68,11 +69,13 @@ if ${HAS_GUI}; then
fi

###########

WIFI_POWERSAVE_UDEV_RULES_FILE="${ROOT_ETC}/udev/rules.d/wifi-powersave.rules"
WIFI_POWERSAVE_UDEV_RULES_FILE="${UDEV_RULES_DIR}/873-wifi_powersave.rules"

if [[ "${CHASSIS_TYPE}" == "Laptop" ]]; then
update_file_if_distinct "${REPO_RES__DIR}/udev/wifi-powersave.rules" "${WIFI_POWERSAVE_UDEV_RULES_FILE}"
update_file_if_distinct "${REPO_RES_DIR}/udev/wifi_powersave.rules" "${WIFI_POWERSAVE_UDEV_RULES_FILE}"
elif [ -f "${WIFI_POWERSAVE_UDEV_RULES_FIE}" ]; then
sudo rm "${WIFI_POWERSAVE_UDEV_RULES_FILE}"
fi

update_file_if_distinct "${REPO_RES_DIR}/udev/pci_pm.rules" "${UDEV_RULES_DIR}/873-pci_pm.rules"
update_file_if_distinct "${REPO_RES_DIR}/udev/usb_powersave.rules" "${UDEV_RULES_DIR}/873-usb_powersave.rules"

0 comments on commit d9c1df6

Please sign in to comment.