From f9e3dc72eb782645cd3998274d514bcbffbc6c1c Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Mon, 18 Nov 2024 08:45:20 +0100 Subject: [PATCH] feat: more sp[ace between icon and text, disable network monitor untillfigure out how to handle its bar changes --- i3blocks/config | 31 +++++++++++++++++++++---------- i3blocks/cpu_monitor.sh | 2 +- i3blocks/gpu_monitor.sh | 2 +- i3blocks/network_monitor.sh | 2 +- i3blocks/wifi_monitor.sh | 6 +++--- install.sh | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/i3blocks/config b/i3blocks/config index 852a68c..0102ab9 100644 --- a/i3blocks/config +++ b/i3blocks/config @@ -1,58 +1,69 @@ -[global] -separator=false -markup=pango - [cpu_monitor] command=~/.config/i3blocks/cpu_monitor.sh interval=5 markup=pango + [gpu_monitor] command=~/.config/i3blocks/gpu_monitor.sh interval=5 markup=pango + [motherboard_temperature] command=~/.config/i3blocks/motherboard_temp.sh interval=5 + [memory] command=free -h | awk '/^Mem:/ {print " " $3 "/" $2}' #  for RAM interval=5 color=#50FA7B + [disk] command=df -h / | awk '/\// {print " " $3 "/" $2}' #  for disk interval=60 color=#50FA7B + + [volume] command=~/.config/i3blocks/volume.sh interval=1 + [bluetooth] command=~/.config/i3blocks/bluetooth.sh interval=5 +color=#FFFFFF + [battery] command=~/.config/i3blocks/battery_status.sh interval=1 -color=#50FA7B + [ethernet] -command=ip -o -4 addr show enp6s0 | awk '{print " "$4}' || echo " down" #  for Ethernet +command=ip -o -4 addr show enp6s0 | awk '{print " "$4}' || echo " down" #  for Ethernet interval=10 +color=#FFFFFF + [wifi] command=~/.config/i3blocks/wifi_monitor.sh interval=10 +color=#FFFFFF + + +#[network_monitor] +#command=~/.config/i3blocks/network_monitor.sh +#interval=1 +#color=#FFFFFF -[network_monitor] -command=~/.config/i3blocks/network_monitor.sh -interval=1 [time] -command=echo " $(date '+%Y-%m-%d %H:%M')" #  for time (Font Awesome icon) +command=echo " $(date '+%Y-%m-%d %H:%M')" #  for time (Font Awesome icon) interval=1 color=#50FA7B diff --git a/i3blocks/cpu_monitor.sh b/i3blocks/cpu_monitor.sh index d529f24..c720dfa 100755 --- a/i3blocks/cpu_monitor.sh +++ b/i3blocks/cpu_monitor.sh @@ -45,4 +45,4 @@ if [[ "$cpu_temp" != "N/A" ]]; then fi fi -echo -e " ${cpu_temp}°C, ${cpu_load}" \ No newline at end of file +echo -e " ${cpu_temp}°C, ${cpu_load}" \ No newline at end of file diff --git a/i3blocks/gpu_monitor.sh b/i3blocks/gpu_monitor.sh index 515686c..412e079 100755 --- a/i3blocks/gpu_monitor.sh +++ b/i3blocks/gpu_monitor.sh @@ -59,7 +59,7 @@ else fi # Output< -echo -e " ${gpu_temp}, ${gpu_load}%" +echo -e " ${gpu_temp}, ${gpu_load}%" echo echo "#FFFFFF" # Default color for fallback (ignored if markup is enabled) diff --git a/i3blocks/network_monitor.sh b/i3blocks/network_monitor.sh index cc947ba..c03a5a2 100755 --- a/i3blocks/network_monitor.sh +++ b/i3blocks/network_monitor.sh @@ -75,5 +75,5 @@ rx_rate_human=$(numfmt --to=iec --suffix=B/s $total_rx_rate) tx_rate_human=$(numfmt --to=iec --suffix=B/s $total_tx_rate) # Output the result with fixed width -printf " %-8s  %-8s\n" "$rx_rate_human" "$tx_rate_human" +printf " %-8s  %-8s\n" "$rx_rate_human" "$tx_rate_human" echo "#50FA7B" \ No newline at end of file diff --git a/i3blocks/wifi_monitor.sh b/i3blocks/wifi_monitor.sh index c58d2b8..045960d 100755 --- a/i3blocks/wifi_monitor.sh +++ b/i3blocks/wifi_monitor.sh @@ -5,7 +5,7 @@ wifi_interface=$(iw dev | awk '$1=="Interface"{print $2}') # If no WiFi interface is found, exit if [ -z "$wifi_interface" ]; then - echo " down" + echo " down" exit 1 fi @@ -18,7 +18,7 @@ signal=$(echo "$wifi_info" | awk '/Signal level/ {print $4}' | tr -d 'level=') # Output the result if [ -z "$ssid" ]; then - echo " down" + echo " down" else - echo " $ssid ($signal dBm)" + echo " $ssid ($signal dBm)" fi \ No newline at end of file diff --git a/install.sh b/install.sh index d20715b..b8a7c00 100755 --- a/install.sh +++ b/install.sh @@ -5,6 +5,17 @@ is_ubuntu() { [ -f /etc/os-release ] && grep -qi 'ubuntu' /etc/os-release } +# Function to detect screen resolution and set font size +set_font_size() { + resolution=$(xdpyinfo | grep dimensions | awk '{print $2}') + width=$(echo $resolution | cut -d 'x' -f 1) + if [ "$width" -gt 1920 ]; then + echo "14" + else + echo "8" + fi +} + # Check if Intel GPU is detected if lspci | grep -i 'vga' | grep -i 'intel'; then if is_ubuntu; then @@ -24,6 +35,10 @@ else yes | sudo pacman -S --needed ttf-dejavu noto-fonts ttf-font-awesome bc jq iw fi +# Set font size based on screen resolution +font_size=$(set_font_size) + cp -r i3blocks ~/.config/ cp -r i3 ~/.config/ +sed -i "s/font pango:System San Francisco Display, FontAwesome [0-9]*/font pango:System San Francisco Display, FontAwesome $font_size/" ~/.config/i3/config i3-msg reload \ No newline at end of file