#!/usr/bin/env bash eww_root="$HOME/.config/eww" eww="$eww_root/scripts" eww_daemons="$eww/daemons" # Normally, we would add something like `output eDP-1 scale 1.5` to our sway # config which would make all clients (including eww) scale automatically. # However, this can cause blurry xwayland apps. # See: https://github.com/swaywm/sway/issues/2966 # Fix: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733 # -------------------------------------------------------------------------- # Workaround: Use scale 1 in sway BUT scale eww manually :( # To do that we need to apply scaling to both *.yuck values and *.scss values. # - In yuck we can use a (defvar) to set the scale or use get_env() to get an env # var and multiply all values with it. # - In scss we can declare a $scale var and multiply all values with it. # See DPI function in #~/.config/eww/eww.scss # To configure both in one place (this script), we use the EWW_SCALE variable to # auto-generate a scss file declaring the $scale variable. This file will be # imported by eww.scss. In *.yuck we will use get_env(EWW_SCALE). # To see the result of changing this value, we have to kill eww and re-run this # script that it can see the new value of EWW_SCALE: # pkill eww; ~/.config/eww/scripts/init export EWW_SCALE=1.5 # shellcheck disable=2016 echo -e '// Auto-generated by ~/.config/eww/scripts/init\n$scale: '"$EWW_SCALE"';' > "$eww_root/_scale.scss" open_all() { # It is important to open the background widget last to avoid it being above other widgets eww open-many \ bottom-bar \ workspaces \ ; # sidebar-activator \ # background \ } # Start eww and widgets if pgrep eww >/dev/null; then open_all else eww daemon sleep 1 open_all fi # Start eww script daemons if not already running # shellcheck disable=2009 running_daemons="$(ps x | grep "$eww")" start() { daemon="$1" shift if [[ $# == 0 ]]; then [[ "$running_daemons" == *"$eww_daemons/${daemon}"* ]] && found=true || found=false else [[ "$running_daemons" == *"$eww_daemons/${daemon} $*"* ]] && found=true || found=false fi if ! $found; then echo "> starting daemon ${daemon} $*" "$eww_daemons/${daemon}" "$@" >/dev/null & fi } sleep 1 # Initial updates "$eww/networks.sh" update_networks # Daemons start sway-workspaces.py start sway-modes.py start sway-split-indicator.py start sway-dock.py start microphone.sh start brightness.sh start volume.sh start charger.sh start weather.sh start vpn.sh start days-of-the-week.sh start gpu.sh start kdeconnect.sh start uptime.sh start media.sh start alarms.sh start agenda.sh start network-scan.sh start network-events.sh start input-buffer.sh alarms start input-buffer.sh lockscreen