summarylogtreecommitdiffstats
path: root/blurry-text-fix.install
blob: f8943b5e46339b754808428b5d83d7fab075d1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pre_install() {
    if [[ ! -f "/usr/share/gtk-4.0/settings.ini" ]]
    then
        echo "ERROR: /usr/share/gtk-4.0/settings.ini doesn't exist."
        exit 1
    fi
}

post_install() {
    already_contains=$(grep -q "gtk-hint-font-metrics=true" /usr/share/gtk-4.0/settings.ini && echo true || echo false)

    # GTK 4
    if [[ "$already_contains" == false ]]
    then
        echo "gtk-hint-font-metrics=true" >> /usr/share/gtk-4.0/settings.ini
    fi

    if [[ -f "/usr/bin/flatpak" ]]
    then
        echo "Flatpak found! Overriding flatpak"
        flatpak override --filesystem=xdg-config/gtk-4.0 || exit 1
        flatpak override --filesystem=xdg-config/gtk-3.0 || exit 1
    fi
    
    echo "SUCCESS: Settings have been written to '/usr/share/gtk-4.0/settings.ini'"
    echo "Please relog to apply changes."

}

post_upgrade() {
    post_install
}

post_remove() {
    sed -e "s/gtk-hint-font-metrics=true//g" -i /usr/share/gtk-4.0/settings.ini

    echo "SUCCESS: Settings have been removed from '/usr/share/gtk-4.0/settings.ini'"
    echo "Please relog to apply changes."
}