This commit is contained in:
elkowar 2020-10-21 22:01:39 +02:00
parent ee60b8dd59
commit 27aeedb0c8
5 changed files with 218 additions and 1 deletions

View file

@ -0,0 +1,64 @@
entry {
padding: 10px;
background: red;
}
.main_window {
all: unset;
background: #1d2021;
}
.volume_popup {
&,
& * {
all: unset;
}
background: #1d2021;
border-radius: 50px;
scale trough {
border-radius: 50px;
background-color: #ebdbb2;
highlight {
min-width: 30px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #8ec07c;
}
}
}
.music {
&,
& * {
all: unset;
}
.data {
margin: 15px;
margin-left: 45px;
.songname {
color: #8ec07c;
}
.key {
color: #928374;
}
}
.buttons {
min-height: 50px;
}
button, button * {
border: none;
margin: 0;
padding: 0;
}
.buttons {
background: #1d2021;
//box-shadow: 0 0 10px -5px rgba(0,0,0, 0.5);
}
}

109
files/.config/eww/eww.xml Normal file
View file

@ -0,0 +1,109 @@
<eww>
<definitions>
<def name="test">
<box space-evenly="false" spacing="10">
testing {{shit}}
<scale value="50" />
<button onclick="notify-send 'ree' 'this is {{shit}}'">click me</button>
<calendar show-heading="false" show-day-names="false" day="2" onclick="notify-send 'asdf' '{}'" />
notify-send 'ree' 'this is {{shit}}'
<multiple text="{{shit}}" />
</box>
</def>
<def name="multiple">
<box orientation="v" space-evenly="false">
<box>{{text}}</box>
<box>{{text}}</box>
<box>{{text}}</box>
<box>{{text}}</box>
<box>{{text}}</box>
</box>
</def>
<def name="volume_popup">
<box orientation="v" space-evenly="true">
<scale flipped="true" orientation="v" value="{{volume}}" min="0" max="100" onchange="amixer sset 'Master' {}%" />
</box>
</def>
<def name="music">
<box orientation="h" valign="start" space-evenly="false" hexpand="true">
<image path="{{song-image}}" width="150" height="150" />
<box orientation="v" halign="fill" space-evenly="false" vexpand="true" hexpand="true">
<box class="data" vexpand="true">
<box orientation="v" halign="start">
<label class="songname" halign="start" limit-width="30" text="{{song-name}}" />
<box space-evenly="false" halign="start">
<label class="key" text="Album: "/>
<label halign="start" limit-width="30" text="{{song-album}}" />
</box>
<box space-evenly="false" halign="start">
<label class="key" text="By: "/>
<label halign="start" limit-width="30" text="{{song-artist}}" />
</box>
</box>
</box>
<scale visible="{{song-show-progress}}" min="0" max="1" value="{{song-position}}" />
<box class="buttons" hexpand="true">
<button onclick="playerctl previous"></button>
<button onclick="playerctl play-pause">{{song-playpause}}</button>
<button onclick="playerctl next"></button>
</box>
</box>
</box>
</def>
</definitions>
<variables>
<script-var name="volume">
amixer sget 'Master' | grep 'Front Left:' | sed 's/.*\[\(.*\)%\].*/\1/g';
LANG=C pactl subscribe | grep --line-buffered sink | while read -r _; do
amixer sget 'Master' | grep 'Front Left:' | sed 's/.*\[\(.*\)%\].*/\1/g'
done
</script-var>
<var name="shit">
shit
</var>
<var name="song-image"></var>
<var name="song-name"></var>
<var name="song-album"></var>
<var name="song-artist"></var>
<var name="song-show-progress">false</var>
<var name="song-playpause"></var>
<!--<script-var name="song-position" interval="5s">-->
<!--playerctl position-->
<!--</script-var>-->
</variables>
<windows>
<window screen="0" name="main_window" stacking="fg">
<pos x="50px" y="0px" />
<size x="30%" y="20%" />
<widget>
<test ree="test" />
</widget>
</window>
<window screen="0" name="volume_popup">
<size x="20" y="300" />
<pos x="2500" y="720" />
<widget>
<volume_popup />
</widget>
</window>
<window screen="0" name="music">
<pos x="80%" y="6%" />
<size x="18%" y="10%" />
<widget>
<music />
</widget>
</window>
</windows>
</eww>

32
files/.config/eww/music.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/bash
fixArtUrl() {
sed -e 's/open.spotify.com/i.scdn.co/g'
}
getData() {
eww update song-name "$(playerctl metadata --format "{{ xesam:title }}")"
wget -O /tmp/music-file "$(playerctl metadata --format "{{ mpris:artUrl }}"| fixArtUrl)"
eww update song-image /tmp/music-file
eww update song-album "$(playerctl metadata --format "{{ xesam:album }}")"
eww update song-artist "$(playerctl metadata --format "{{ xesam:artist }}")"
if [ "spotify" = "$(playerctl metadata | head -n1 | awk '{ print $1 }')" ]; then
eww update song-show-progress "false"
else
eww update song-show-progress "true"
fi;
song_status="$(playerctl status --format "{{ lc(status) }}")"
if [ "$song_status" = "playing" ]; then
eww update song-playpause 
else
eww update song-playpause 
fi
}
#getData
cat <(playerctl metadata --format '{{ title }}' -F & playerctl status -F) | while read -r _; do getData; done;

12
files/.config/eww/popup.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
secs="$1"
window_name="$2"
kill -9 "$(cat /tmp/eww-popup.pid)" || \
eww -d open "$window_name"
{ sleep "$secs"; eww close "$window_name"; } &
echo $! > /tmp/eww-popup.pid

View file

@ -34,7 +34,7 @@ function _my_prompt() {
echo -n "%F{$__bright_green} $(dir)"
echo -n "%F{$__bright_white} $(git_status)"
if [ ! "$exit_code" = 0 ]; then
echo -n "%F{red}REEEEEEEEEEE $exit_code"
echo -n "%F{red} REEEEEEEEEEE $exit_code"
fi
echo
# %3{stuff%} tell's zsh that the characters are printed as 3 chars wide