OSDN Git Service

remove redundant width setting from instantdiper
[instantos/instantOS.git] / programs / instantdpi
index aaa7d6f..bca9fab 100755 (executable)
@@ -7,11 +7,16 @@ DPI="$(iconf dpi)"
 resetdpi() {
     echo "resetting dpi"
     sed -i '/^Xft\.dpi/d' ~/.Xresources
+    sed -i '/^st.font/d' ~/.Xresources
 }
 
-appendresources() {
+appendpi() {
     echo "setting dpi to $DPI"
     echo "Xft.dpi: $DPI" >>~/.Xresources
+    NEWDPI="$(echo "( $DPI / 96 ) * 15" | bc -l | grep -o '^[^\.]*')"
+    sed -i '/^st.font/d' ~/.Xresources
+    echo "st.font: Fira Code Nerd Font Mono:pixelsize=$NEWDPI:antialias=true:autohint=true" >>~/.Xresources
+    echo "st.font2: JoyPixels:pixelsize=$NEWDPI:antialias=true:autohint=true" >>~/.Xresources
 }
 
 if [ -z "$DPI" ]; then
@@ -30,10 +35,10 @@ fi
 if ! [ -e .Xresources ]; then
     echo "initializing xresources"
     touch ~/.Xresources
-    appendresources "$DPI"
+    appendpi "$DPI"
 else
     if grep -q '^Xft.dpi' ~/.Xresources; then
         resetdpi
     fi
-    appendresources "$DPI"
+    appendpi "$DPI"
 fi