<!-- **
** Widgets config for EWW
** Created by : @adi1090x
** -->

<eww>
    <variables>

        <!-- Profile vars -->
        <var name="IMAGE">images/profile.jpg</var>
        <var name="NAME">YOUR NAME</var>
		<script-var name="UNAME" interval="5m">whoami</script-var>

        <!-- System vars -->
		<script-var name="HOST" interval="5s">hostname</script-var>
		<script-var name="CPU_USAGE" interval="1s">~/.config/eww/scripts/sys_info --cpu</script-var>
		<script-var name="MEM_USAGE" interval="1s">~/.config/eww/scripts/sys_info --mem</script-var>
		<script-var name="BLIGHT" interval="1s">~/.config/eww/scripts/sys_info --blight</script-var>
		<script-var name="BATTERY" interval="5s">~/.config/eww/scripts/sys_info --bat</script-var>

        <!-- Time vars -->
		<script-var name="HOUR" interval="5s">date +"%I"</script-var>
		<script-var name="MIN" interval="5s">date +"%M"</script-var>
		<script-var name="MER" interval="5s">date +"%p"</script-var>
		<script-var name="DAY" interval="5s">date +"%A"</script-var>

        <!-- Uptime vars -->
		<script-var name="UPHOUR" interval="5s">uptime -p | awk '{print $2 " " $3}' | sed 's/,//g'</script-var>
		<script-var name="UPMIN" interval="5s">uptime -p | awk '{print $4 " " $5}'</script-var>

        <!-- Music vars -->
		<script-var name="SONG" interval="1s">~/.config/eww/scripts/music_info --song</script-var>
		<script-var name="ARTIST" interval="1s">~/.config/eww/scripts/music_info --artist</script-var>
		<script-var name="STATUS" interval="1s">~/.config/eww/scripts/music_info --status</script-var>
		<script-var name="CURRENT" interval="1s">~/.config/eww/scripts/music_info --time</script-var>
		<script-var name="COVER" interval="1s">~/.config/eww/scripts/music_info --cover</script-var>
		<script-var name="CTIME" interval="1s">~/.config/eww/scripts/music_info --ctime</script-var>
		<script-var name="TTIME" interval="1s">~/.config/eww/scripts/music_info --ttime</script-var>

		<!--Weather vars-->
		<script-var name="ICON" interval="15m">~/.config/eww/scripts/weather_info --icon</script-var>
		<script-var name="STAT" interval="15m">~/.config/eww/scripts/weather_info --stat</script-var>
		<script-var name="TEMP" interval="15m">~/.config/eww/scripts/weather_info --temp</script-var>
		<script-var name="HEX" interval="15m">~/.config/eww/scripts/weather_info --hex</script-var>
		<script-var name="QUOTE" interval="15m">~/.config/eww/scripts/weather_info --quote</script-var>
		<script-var name="QUOTE2" interval="15m">~/.config/eww/scripts/weather_info --quote2</script-var>

        <!-- Apps vars -->
		<script-var name="MAILS" interval="5m">~/.config/eww/scripts/mails</script-var>

        <!-- Files vars -->
		<script-var name="FREE" interval="5s">df -h / | awk '{print $4}' | tail -n 1 | sed 's/G/GB/'</script-var>

    </variables>

<!-- ******************************************************************************** -->

    <definitions>

        <!-- background -->
		<def name="bg">
			<box class="bg"></box>
		</def>

		<!-- profile -->
		<def name="user">
			<box class="genwin" orientation="v" spacing="35" space-evenly="false" vexpand="false" hexpand="false">
				<box style="background-image: url('{{IMAGE}}');" class="face" halign="center"/>
				<label class="fullname" halign="center" wrap="true" limit-width="25" text="{{NAME}}"/>
				<label class="username" halign="center" wrap="true" limit-width="25" text="{{UNAME}}"/>
			</box>
		</def>

		<!-- system -->
		<def name="system">
			<box class="genwin" vexpand="false" hexpand="false">
				<box orientation="v" spacing="35" halign="center" valign="center" space-evenly="false" vexpand="false" hexpand="false">
					<box class="cpu_bar" orientation="h" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
						<label class="iconcpu" text=""/>
						<scale min="0" max="100" value="{{CPU_USAGE}}" active="false"/>
					</box>
					<box class="mem_bar" orientation="h" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
						<label class="iconmem" text=""/>
						<scale min="0" max="100" value="{{MEM_USAGE}}" active="false"/>
					</box>
					<box class="bright_bar" orientation="h" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
						<label class="iconbright" text=""/>
						<scale min="0" max="100" value="{{BLIGHT}}" active="false"/>
					</box>
					<box class="bat_bar" orientation="h" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
						<label class="iconbat" text=""/>
						<scale min="0" max="100" value="{{BATTERY}}" active="false"/>
					</box>
				</box>
			</box>
		</def>

		<!-- clock -->
		<def name="clock">
			<box class="genwin" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
				<label class="time_hour" valign="start" wrap="true" limit-width="25" text="{{HOUR}}"/>
				<label class="time_min" valign="end" wrap="true" limit-width="25" text="{{MIN}}"/>
				<box orientation="v" spacing="25" space-evenly="false" vexpand="false" hexpand="false">
					<label class="time_mer" halign="end" wrap="true" limit-width="25" text="{{MER}}"/>
					<label class="time_day" halign="end" wrap="true" limit-width="25" text="{{DAY}}"/>
				</box>
			</box>
		</def>

		<!-- uptime -->
		<def name="uptime">
			<box class="genwin">
				<box orientation="h" halign="center" spacing="40" space-evenly="false" vexpand="false" hexpand="false">
					<label class="icontimer" valign="center" text="祥"/>
					<box orientation="v" valign="center" spacing="0" space-evenly="false" vexpand="false" hexpand="false">
						<label class="uphour" halign="start" wrap="true" limit-width="25" text="{{UPHOUR}}"/>
						<label class="upmin" halign="start" wrap="true" limit-width="25" text="{{UPMIN}}"/>
					</box>
				</box>
			</box>
		</def>

		<!-- Music -->
		<def name="music">
			<box class="genwin" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
				<box class="album_art" vexpand="false" hexpand="false" style="background-image: url('.coverart/cover.png);">
				</box>
				<box orientation="v" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
					<label halign="center" class="song" wrap="true" limit-width="20" text="{{SONG}}"/>
					<label halign="center" class="artist" wrap="true" limit-width="15" text="{{ARTIST}}"/>
					<box orientation="h" spacing="20" halign="center" space-evenly="true" vexpand="false" hexpand="false">
						<button class="btn_prev" onclick="~/.config/eww/scripts/music_info --prev">玲</button>
						<button class="btn_play" onclick="~/.config/eww/scripts/music_info --toggle">{{STATUS}}</button>
						<button class="btn_next" onclick="~/.config/eww/scripts/music_info --next">怜</button>
					</box>
					<box class="music_bar" halign="center" vexpand="false" hexpand="false">
						<scale onscroll="mpc -q seek +1" min="0" active="true" max="100" value="{{CURRENT}}"/>
					</box>
				</box>
			</box>
		</def>

		<!-- github -->
		<def name="github">
			<box class="github" vexpand="false" hexpand="false">
				<button class="iconweb" onclick="~/.config/eww/scripts/open_links --gh"></button>
			</box>
		</def>

		<!-- reddit -->
		<def name="reddit">
			<box class="reddit" vexpand="false" hexpand="false">
				<button class="iconweb" onclick="~/.config/eww/scripts/open_links --rd">樓</button>
			</box>
		</def>

		<!-- twitter -->
		<def name="twitter">
			<box class="twitter" vexpand="false" hexpand="false">
				<button class="iconweb" onclick="~/.config/eww/scripts/open_links --tw"></button>
			</box>
		</def>

		<!-- youtube -->
		<def name="youtube">
			<box class="youtube" vexpand="false" hexpand="false">
				<button class="iconweb" onclick="~/.config/eww/scripts/open_links --yt"></button>
			</box>
		</def>

		<!-- mail -->
		<def name="mail">
			<box class="mail">
				<box orientation="h" halign="center" spacing="20" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconmail" onclick="~/.config/eww/scripts/open_links --mail"></button>
					<box class="mailbox" space-evenly="false" vexpand="false" hexpand="false">
						<button class="label_mails" onclick="~/.config/eww/scripts/open_links --mail">{{MAILS}}</button>
					</box>
				</box>
			</box>
		</def>

		<!-- weather -->
		<def name="weather">
			<box class="genwin">
				<box orientation="v" spacing="10" space-evenly="false" vexpand="false" hexpand="false">
					<box orientation="h" vexpand="false" hexpand="false">
						<label class="iconweather" halign="start" style="color: {{HEX}};" text="{{ICON}}"/>
						<label class="label_temp" halign="end" text="{{TEMP}}"/>
					</box>
					<box orientation="v" spacing="10" halign="center" space-evenly="false" vexpand="false" hexpand="false">
						<label class="label_stat" text="{{STAT}}"/>
						<label class="label_quote" text="{{QUOTE}}"/>
						<label class="label_quote" text="{{QUOTE2}}"/>
					</box>
				</box>
			</box>
		</def>

		<!-- apps -->
		<def name="apps">
			<box class="genwin" orientation="v" space-evenly="false" vexpand="false" hexpand="false">
				<box class="appbox" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button style="background-image: url('images/icons/firefox.svg');" class="app_fox" onclick="~/.config/eww/scripts/open_apps --ff"/>
					<button style="background-image: url('images/icons/telegram.svg');" class="app_telegram" onclick="~/.config/eww/scripts/open_apps --tg"/>
					<button style="background-image: url('images/icons/discord.svg');" class="app_discord" onclick="~/.config/eww/scripts/open_apps --dc"/>
				</box>				
				<box class="appbox" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button style="background-image: url('images/icons/terminal.svg');" class="app_terminal" onclick="~/.config/eww/scripts/open_apps --tr"/>
					<button style="background-image: url('images/icons/files.svg');" class="app_files" onclick="~/.config/eww/scripts/open_apps --fm"/>
					<button style="background-image: url('images/icons/geany.svg');" class="app_geany" onclick="~/.config/eww/scripts/open_apps --ge"/>
				</box>				
				<box class="appbox" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button style="background-image: url('images/icons/code.svg');" class="app_code" onclick="~/.config/eww/scripts/open_apps --cd"/>
					<button style="background-image: url('images/icons/gimp.svg');" class="app_gimp" onclick="~/.config/eww/scripts/open_apps --gp"/>
					<button style="background-image: url('images/icons/virtualbox.svg');" class="app_vbox" onclick="~/.config/eww/scripts/open_apps --vb"/>
				</box>				
			</box>
		</def>

		<!-- power buttons -->
		<def name="logout">
			<box class="genwin" vexpand="false" hexpand="false">
				<button class="btn_logout" onclick="openbox --exit"></button>
			</box>
		</def>
		<def name="sleep">
			<box class="genwin" vexpand="false" hexpand="false">
				<button class="btn_sleep" onclick="systemctl suspend"></button>
			</box>
		</def>
		<def name="reboot">
			<box class="genwin" vexpand="false" hexpand="false">
				<button class="btn_reboot" onclick="systemctl reboot"></button>
			</box>
		</def>
		<def name="poweroff">
			<box class="genwin" vexpand="false" hexpand="false">
				<button class="btn_poweroff" onclick="systemctl poweroff"></button>
			</box>
		</def>

		<!-- folders -->
		<def name="folders">
			<box class="genwin" orientation="v" space-evenly="false" vexpand="false" hexpand="false">
				<box class="hddbox" orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<box space-evenly="false" vexpand="false" hexpand="false">
						<button class="hddicon" onclick="~/.config/eww/scripts/open_apps --fm"></button>
					</box>
					<label class="fs_sep" text="|"/>
					<box space-evenly="false" vexpand="false" hexpand="false">
						<label class="hdd_label" wrap="true" limit-width="25" text="{{FREE}}"/>
					</box>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder1" onclick="~/.config/eww/scripts/open_folders --docs"></button>
					<button class="label_folder1" onclick="~/.config/eww/scripts/open_folders --docs">Documents</button>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder2" onclick="~/.config/eww/scripts/open_folders --dl"></button>
					<button class="label_folder2" onclick="~/.config/eww/scripts/open_folders --dl">Downloads</button>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder3" onclick="~/.config/eww/scripts/open_folders --music"></button>
					<button class="label_folder3" onclick="~/.config/eww/scripts/open_folders --music">Music</button>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder4" onclick="~/.config/eww/scripts/open_folders --pics"></button>
					<button class="label_folder4" onclick="~/.config/eww/scripts/open_folders --pics">Pictures</button>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder5" onclick="~/.config/eww/scripts/open_folders --cfg">ﮛ</button>
					<button class="label_folder5" onclick="~/.config/eww/scripts/open_folders --cfg">~/.config</button>
				</box>
				<box orientation="h" space-evenly="false" vexpand="false" hexpand="false">
					<button class="iconfolder6" onclick="~/.config/eww/scripts/open_folders --local">ﮛ</button>
					<button class="label_folder6" onclick="~/.config/eww/scripts/open_folders --local">~/.local</button>
				</box>
			</box>
		</def>

    </definitions>

<!-- ******************************************************************************** -->

    <windows>

		<!-- background -->
		<window name="background" stacking="fg" focusable="false" screen="1">
			<geometry x="0" y="0" width="1920px" height="1080px"/>
			<widget>
				<bg/>
			</widget>
		</window>

		<!-- profile -->
		<window name="profile" stacking="fg" focusable="false" screen="1">
			<geometry x="150" y="150" width="350" height="440"/>
			<widget>
				<user/>
			</widget>
		</window>

		<!-- system -->
		<window name="system" stacking="fg" focusable="false" screen="1">
			<geometry x="150" y="605" width="350" height="325"/>
			<widget>
				<system/>
			</widget>
		</window>

		<!-- clock -->
		<window name="clock" stacking="fg" focusable="false" screen="1">
			<geometry x="515" y="150" width="350" height="155"/>
			<widget>
				<clock/>
			</widget>
		</window>

		<!-- uptime -->
		<window name="uptime" stacking="fg" focusable="false" screen="1">
			<geometry x="515" y="320" width="350" height="155"/>
			<widget>
				<uptime/>
			</widget>
		</window>

		<!-- music -->
		<window name="music" stacking="fg" focusable="false" screen="1">
			<geometry x="515" y="490" width="610" height="280"/>
			<widget>
				<music/>
			</widget>
		</window>

		<!-- github -->
		<window name="github" stacking="fg" focusable="false" screen="1">
			<geometry x="515" y="785" width="141" height="145"/>
			<widget>
				<github/>
			</widget>
		</window>

		<!-- reddit -->
		<window name="reddit" stacking="fg" focusable="false" screen="1">
			<geometry x="671" y="785" width="141" height="145"/>
			<widget>
				<reddit/>
			</widget>
		</window>

		<!-- twitter -->
		<window name="twitter" stacking="fg" focusable="false" screen="1">
			<geometry x="827" y="785" width="141" height="145"/>
			<widget>
				<twitter/>
			</widget>
		</window>

		<!-- youtube -->
		<window name="youtube" stacking="fg" focusable="false" screen="1">
			<geometry x="983" y="785" width="142" height="145"/>
			<widget>
				<youtube/>
			</widget>
		</window>

		<!-- weather -->
		<window name="weather" stacking="fg" focusable="false" screen="1">
			<geometry x="880" y="150" width="550" height="325"/>
			<widget>
				<weather/>
			</widget>
		</window>

		<!-- apps -->
		<window name="apps" stacking="fg" focusable="false" screen="1">
			<geometry x="1140" y="490" width="290" height="280"/>
			<widget>
				<apps/>
			</widget>
		</window>

		<!-- mail -->
		<window name="mail" stacking="fg" focusable="false" screen="1">
			<geometry x="1140" y="785" width="290" height="145"/>
			<widget>
				<mail/>
			</widget>
		</window>

		<!-- logout -->
		<window name="logout" stacking="fg" focusable="false" screen="1">
			<geometry x="1445" y="150" width="155" height="155"/>
			<widget>
				<logout/>
			</widget>
		</window>

		<!-- sleep -->
		<window name="sleep" stacking="fg" focusable="false" screen="1">
			<geometry x="1615" y="150" width="155" height="155"/>
			<widget>
				<sleep/>
			</widget>
		</window>

		<!-- reboot -->
		<window name="reboot" stacking="fg" focusable="false" screen="1">
			<geometry x="1445" y="320" width="155" height="155"/>
			<widget>
				<reboot/>
			</widget>
		</window>

		<!-- poweroff -->
		<window name="poweroff" stacking="fg" focusable="false" screen="1">
			<geometry x="1615" y="320" width="155" height="155"/>
			<widget>
				<poweroff/>
			</widget>
		</window>

		<!-- folders -->
		<window name="folders" stacking="fg" focusable="false" screen="1">
			<geometry x="1445" y="490" width="325" height="440"/>
			<widget>
				<folders/>
			</widget>
		</window>

    </windows>
</eww>
