#!/bin/bash

[[ -f ~/.bashrc ]] && . ~/.bashrc

systemctl --user enable electron-app
systemctl --user start electron-app
# systemctl --user enable go-ws
# systemctl --user enable go-ws-restart
# systemctl --user enable --now go-ws.path
# systemctl --user start go-ws

HDMI_SINK_ID=$(wpctl status | grep HDMI | awk '{print $2}' | cut -f 1 -d'.')
if [ "$HDMI_SINK_ID" != "" ] && [ "$HDMI_SINK_ID" != "*" ]; then
    wpctl set-default $HDMI_SINK_ID
fi

if [ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ]; then
    # VM detection
    virt=$(systemd-detect-virt 2>/dev/null)
    if [[ "$virt" == "kvm" || "$virt" == "qemu" ]]; then
        export WLR_RENDERER=pixman
        export WLR_NO_HARDWARE_CURSORS=1
    fi

    swaymsg -t get_outputs > /home/ds/supported_resolutions.txt
    exec sway
fi