#!/usr/bin/env bash # [[file:../Desktop.org::*Launch script][Launch script:1]] hostname=$(hostname) # Settings varying on the hostname export WLAN_INTERFACE=$(nmcli -f DEVICE con show | grep -Ev "(.*docker.*|DEVICE|br.*|tun.*|veth.*|--)" | xargs) if [ "$hostname" = "azure" ]; then TRAY_MONITOR="eDP-1" # export WLAN_INTERFACE="wlp3s0" elif [ "$hostname" = "eminence" ]; then TRAY_MONITOR="eDP" # export WLAN_INTERFACE="wlo1" else TRAY_MONITOR="HDMI-A-0" # export WLAN_INTERFACE="wlp35s0f3u2" fi # Setting varying on the monitor declare -A FONT_SIZES=( ["eDP"]="13" ["eDP-1"]="13" ["DVI-D-0"]="13" ["HDMI-A-0"]="13" ) declare -A EMOJI_SCALE=( ["eDP"]="9" ["eDP-1"]="9" ["DVI-D-0"]="10" ["HDMI-A-0"]="10" ) declare -A BAR_HEIGHT=( ["eDP"]="29" ["eDP-1"]="29" ["DVI-D-0"]="29" ["HDMI-A-0"]="29" ) declare -A BLOCKS=( ["eDP"]="glyph-background--white pulseaudio glyph-white--yellow mpd glyph-yellow--light-green cpu glyph-light-green--blue ram-memory glyph-blue--yellow swap-memory glyph-yellow--green network openvpn glyph-green--red xkeyboard glyph-red--light-blue battery glyph-light-blue--green weather glyph-green--yellow sun glyph-yellow--light-blue aw-afk glyph-light-blue--blue date glyph-blue--background " ["eDP-1"]="glyph-background--white pulseaudio glyph-white--yellow mpd glyph-yellow--light-green cpu glyph-light-green--blue ram-memory glyph-blue--yellow swap-memory glyph-yellow--green network openvpn glyph-green--red xkeyboard glyph-red--light-blue battery glyph-light-blue--green weather glyph-green--yellow sun glyph-yellow--light-blue aw-afk glyph-light-blue--blue date glyph-blue--background " ["DVI-D-0"]="glyph-background--white pulseaudio glyph-white--yellow mpd glyph-yellow--light-green cpu glyph-light-green--blue ram-memory glyph-blue--yellow swap-memory glyph-yellow--green network openvpn glyph-green--red xkeyboard glyph-red--green weather glyph-green--yellow sun glyph-yellow--light-blue aw-afk glyph-light-blue--blue date glyph-blue--background " ["HDMI-A-0"]="glyph-background--white pulseaudio glyph-white--yellow mpd glyph-yellow--light-green cpu glyph-light-green--blue ram-memory glyph-blue--yellow swap-memory glyph-yellow--green network openvpn glyph-green--red xkeyboard glyph-red--green weather glyph-green--yellow sun glyph-yellow--light-blue aw-afk glyph-light-blue--blue date glyph-blue--background " ) # Geolocation for some modules export LOC="SPB" # export IPSTACK_API_KEY=$(pass show My_Online/APIs/ipstack | head -n 1) pkill polybar for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do export MONITOR=$m if [ "$MONITOR" = "$TRAY_MONITOR" ]; then export TRAY="right" else export TRAY="none" fi SIZE=${FONT_SIZES[$MONITOR]} SCALE=${EMOJI_SCALE[$MONITOR]} if [[ -z "$SCALE" ]]; then continue fi # export FONT0="pango:monospace:size=$SIZE;1" # export FONT1="NotoEmoji:scale=$SCALE:antialias=false;1" # export FONT2="fontawesome:pixelsize=$SIZE;1" # export FONT3="JetBrains Mono Nerd Font:monospace:size=15;1" export HEIGHT=${BAR_HEIGHT[$MONITOR]} export RIGHT_BLOCKS=${BLOCKS[$MONITOR]} polybar mybar & done # Launch script:1 ends here