#!/bin/bash

################################################################################
#
# discord-launcher
# Launches discord and forces it to use the correct (dark) GTK theme variant
#
################################################################################

export GTK_THEME=:dark
export GTK_THEME_VARIANT="dark"

/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=discord com.discordapp.Discord &

# This is dumb, but it works...
for i in {1..11}
do
	xprop -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT dark -id $(wmctrl -lp | grep Discord | cut -d ' ' -f1)
	sleep 1
done