Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit 7d20331

Browse files
committed
feat: speed up system
1 parent 03d3ba4 commit 7d20331

File tree

8 files changed

+115
-26
lines changed

8 files changed

+115
-26
lines changed
1.32 MB
Loading
1.01 MB
Loading
2.14 MB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--ozone-platform=wayland
2+
--enable-features=TouchpadOverscrollHistoryNavigation,WaylandWindowDecorations
3+
--enable-wayland-ime
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--ozone-platform=wayland
2+
--enable-features=TouchpadOverscrollHistoryNavigation,WaylandWindowDecorations
3+
--enable-wayland-ime

unix/fedora/config.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@
6161
"redis.service",
6262
"tailscaled.service"
6363
],
64-
"disable": [
65-
"cups.service",
66-
"NetworkManager-wait-online.service"
67-
]
64+
"disable": ["cups.service", "NetworkManager-wait-online.service"]
6865
},
6966
"hardware": {
7067
"asus": {
@@ -87,8 +84,9 @@
8784
"enable_fstrim": true,
8885
"enable_oomd": true,
8986
"grub_timeout": 1,
90-
"auto_luks": true
91-
87+
"auto_luks": true,
88+
"shut_off_time": 5,
89+
"swappiness": 10
9290
},
9391
"git": {
9492
"user_name": "PiX",

unix/fedora/install/config/performance.sh

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ echo "Applying performance optimizations"
66
# Configure zram
77
enable_zram=$(get_config '.performance.enable_zram')
88
zram_size=$(get_config '.performance.zram_size_mb')
9+
enable_oomd=$(get_config '.performance.enable_oomd')
10+
enable_fstrim=$(get_config '.performance.enable_fstrim')
11+
disable_mitigations=$(get_config '.performance.disable_cpu_mitigations')
12+
grub_timeout=$(get_config '.performance.grub_timeout')
13+
auto_luks=$(get_config '.performance.auto_luks')
14+
swappiness=$(get_config '.performance.swappiness')
15+
shut_off_time=$(get_config '.performance.shut_off_time')
916

1017
if [[ "$enable_zram" == "true" ]]; then
1118
log_info "Configuring zram swap"
@@ -26,9 +33,6 @@ EOF
2633
fi
2734
fi
2835

29-
# Enable systemd-oomd
30-
enable_oomd=$(get_config '.performance.enable_oomd')
31-
3236
if [[ "$enable_oomd" == "true" ]]; then
3337
log_info "Enabling systemd-oomd (Out-of-Memory Daemon)"
3438

@@ -39,9 +43,6 @@ if [[ "$enable_oomd" == "true" ]]; then
3943
fi
4044
fi
4145

42-
# Enable fstrim for SSDs
43-
enable_fstrim=$(get_config '.performance.enable_fstrim')
44-
4546
if [[ "$enable_fstrim" == "true" ]]; then
4647
log_info "Enabling fstrim timer for SSD optimization"
4748

@@ -52,9 +53,6 @@ if [[ "$enable_fstrim" == "true" ]]; then
5253
fi
5354
fi
5455

55-
# CPU mitigations
56-
disable_mitigations=$(get_config '.performance.disable_cpu_mitigations')
57-
5856
if [[ "$disable_mitigations" == "true" ]]; then
5957
log_warning "Disabling CPU mitigations (less secure but faster)"
6058

@@ -70,9 +68,6 @@ if [[ "$disable_mitigations" == "true" ]]; then
7068
fi
7169
fi
7270

73-
# Reduce grub timeout
74-
grub_timeout=$(get_config '.performance.grub_timeout')
75-
7671
# If grub_timeout is a valid integer
7772
if [[ -v grub_timeout && "$grub_timeout" =~ ^[0-9]+$ ]]; then
7873
log_warning "Reducing GRUB timeout to 1 second"
@@ -96,25 +91,40 @@ else
9691
log_warning "grub_timeout is not set or not a valid integer"
9792
fi
9893

99-
# Do not ask user to enter the LUKS password
100-
auto_luks=$(get_config '.performance.auto_luks')
101-
10294
if [[ "$auto_luks" == "true" ]]; then
10395
log_warning "Setting up TPM2 auto-unlock for LUKS"
104-
96+
10597
if confirm "This will reduce security. Continue?"; then
10698
LUKS_DEVICE=$(lsblk -nlo NAME,FSTYPE | grep crypto_LUKS | awk '{print "/dev/"$1}')
107-
99+
108100
if [ -n "$LUKS_DEVICE" ]; then
109101
log_info "TPM2 device found, enrolling..."
110-
102+
111103
sudo systemd-cryptenroll "$LUKS_DEVICE" --tpm2-device=auto --tpm2-pcrs=0+1+7
112104
sudo dracut -f
113-
105+
114106
log_info "To rollback tpm2 auto-unlock, execute:\nsudo system-cryptenroll $LUKS_DEVICE --wipe-slot=tpm2\nsudo dracut -f"
115107
fi
116-
117108
fi
118109
fi
119110

111+
if [[ -v swappiness && "$swappiness" =~ ^[0-9]+$ ]]; then
112+
sudo tee /etc/sysctl.d/99-performance.conf > /dev/null <<EOF
113+
net.ipv4.tcp_mtu_probing=1
114+
vm.swappiness=${swappiness}
115+
EOF
116+
fi
117+
118+
if [[ -v shut_off_time && "$shut_off_time" =~ ^[0-9]+$ ]]; then
119+
sudo mkdir -p /etc/systemd/system.conf.d
120+
121+
sudo tee /etc/systemd/system.conf.d/10-faster-shutdown.conf > /dev/null <<EOF
122+
[Manager]
123+
DefaultTimeoutStopSec=${shut_off_time}s
124+
EOF
125+
fi
126+
127+
sudo sysctl --system
128+
sudo systemctl daemon-reload
129+
120130
log_success "Performance optimizations applied"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
# Add configurable shutdown timeout and swappiness settings
3+
# Restow browser flags and osaka jade wallpapers
4+
# Configure Firefox smooth scrolling
5+
6+
echo "Running migration: Add shutdown timeout, swappiness, and restow configs"
7+
8+
CONFIG_FILE="$HOME/Dev/.configs/unix/fedora/config.json"
9+
10+
SHUT_OFF_TIME=$(jq -r '.performance.shut_off_time // empty' "$CONFIG_FILE" 2>/dev/null)
11+
12+
if [ -n "$SHUT_OFF_TIME" ] && [ "$SHUT_OFF_TIME" != "null" ]; then
13+
echo "Applying systemd shutdown timeout: ${SHUT_OFF_TIME}s"
14+
15+
sudo mkdir -p /etc/systemd/system.conf.d
16+
17+
sudo tee /etc/systemd/system.conf.d/10-faster-shutdown.conf > /dev/null <<EOF
18+
[Manager]
19+
DefaultTimeoutStopSec=${SHUT_OFF_TIME}s
20+
EOF
21+
22+
sudo systemctl daemon-reload
23+
echo "Shutdown timeout configured"
24+
fi
25+
26+
SWAPPINESS=$(jq -r '.performance.swappiness // empty' "$CONFIG_FILE" 2>/dev/null)
27+
28+
if [ -n "$SWAPPINESS" ] && [ "$SWAPPINESS" != "null" ]; then
29+
echo "Applying performance settings: swappiness=${SWAPPINESS}"
30+
31+
# Create file if it doesn't exist
32+
sudo touch /etc/sysctl.d/99-performance.conf
33+
34+
# Add tcp_mtu_probing if not present (network performance)
35+
if ! grep -q "net.ipv4.tcp_mtu_probing" /etc/sysctl.d/99-performance.conf; then
36+
echo "net.ipv4.tcp_mtu_probing=1" | sudo tee -a /etc/sysctl.d/99-performance.conf > /dev/null
37+
fi
38+
39+
# Add swappiness if not present
40+
if ! grep -q "vm.swappiness" /etc/sysctl.d/99-performance.conf; then
41+
echo "vm.swappiness=${SWAPPINESS}" | sudo tee -a /etc/sysctl.d/99-performance.conf > /dev/null
42+
fi
43+
44+
sudo sysctl --system > /dev/null
45+
echo "Performance settings configured"
46+
fi
47+
48+
# Restow browser flags (Brave & Chromium)
49+
echo "Restowing browser Wayland flags"
50+
51+
STOW_SOURCE=$(jq -r '.dotfiles.stow_source // empty' "$CONFIG_FILE" 2>/dev/null)
52+
STOW_SOURCE=${STOW_SOURCE/#\~/$HOME}
53+
54+
if [ -d "$STOW_SOURCE/config/.config" ]; then
55+
# Restow config package to update browser flags
56+
cd "$STOW_SOURCE" && stow -R config 2>/dev/null
57+
echo "Browser flags restowed (brave-flags.conf, chromium-flags.conf)"
58+
else
59+
echo "Stow source not found: $STOW_SOURCE"
60+
fi
61+
62+
# Restow osaka jade wallpapers
63+
echo "Restowing osaka jade wallpapers"
64+
65+
if [ -d "$STOW_SOURCE/Pictures" ]; then
66+
# Restow Pictures package to update wallpapers
67+
cd "$STOW_SOURCE" && stow -R Pictures 2>/dev/null
68+
echo "Osaka jade wallpapers restowed (1-osaka-jade-bg.jpg, 2-osaka-jade-bg.jpg, 3-osaka-jade-bg.jpg)"
69+
else
70+
echo "Pictures source not found: $STOW_SOURCE/Pictures"
71+
fi
72+
73+
74+
75+
echo "Migration completed successfully"

0 commit comments

Comments
 (0)