feat: optimize heart script and add it to git

This commit is contained in:
matt1432 2023-07-22 14:22:33 -04:00
parent fc18072aa5
commit 4bba7bb9b2
7 changed files with 26 additions and 15 deletions

View file

@ -6,7 +6,7 @@
/*font-family: Iosevka Nerd Font;*/ /*font-family: Iosevka Nerd Font;*/
font-size: 70px; font-size: 70px;
border-radius: 30px; border-radius: 30px;
border: 5px solid $contrastbg; border: 2px solid $contrastbg;
button { button {
border-radius: 12px; border-radius: 12px;
min-width: 80px; min-width: 80px;

View file

@ -2,7 +2,7 @@
WINDOW="$1" WINDOW="$1"
( (
eww update $WINDOW-visible=false eww update "$WINDOW"-visible=false
sleep .55 sleep .55
eww close $WINDOW-reveal eww close "$WINDOW"-reveal
) & ) &

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
cd ~
${@} 2>&1 >/dev/null &

14
config/eww/scripts/heart.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
FILE="$HOME/.config/.heart"
if [[ ! -f "$FILE" ]]; then
echo 󰣐 > "$FILE"
fi
if grep -q 󰣐 "$FILE"; then
eww update heart-ts=false
echo  > "$FILE"
else
eww update heart-ts=true
echo 󰣐 >> "$FILE"
fi

View file

@ -2,5 +2,5 @@
WINDOW="$1" WINDOW="$1"
eww open $WINDOW-reveal eww open "$WINDOW"-reveal
eww update $WINDOW-visible=true eww update "$WINDOW"-visible=true

View file

@ -21,15 +21,12 @@
) )
) )
(defvar heart-ts true)
(defvar heart-icon "󰣐")
(defwidget heart-toggle [] (defwidget heart-toggle []
(eventbox :class {heart-ts ? "toggle-on" : "toggle-off"} (eventbox :class {heart_icon == "󰣐" ? "toggle-on" : "toggle-off"}
:onclick {heart-ts ? "eww update heart-icon= ; eww update heart-ts=false" : :onclick "$EWW_PATH/heart.sh toggle"
"eww update heart-icon=󰣐 ; eww update heart-ts=true"}
(box :class "heart-toggle" (box :class "heart-toggle"
:orientation "h" :orientation "h"
(label :text " ${heart-icon} ") (label :text " ${heart_icon} ")
) )
) )
) )
@ -57,6 +54,9 @@
(left-bar) (left-bar)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 
(defvar notif-panel-state false) (defvar notif-panel-state false)

View file

@ -1,4 +1,5 @@
(deflisten notif_icon "$EWW_PATH/notif.sh icon") (deflisten notif_icon "$EWW_PATH/notif.sh icon")
(deflisten heart_icon "tail -f $HOME/.config/.heart")
(defpoll volume_icon :interval "1s" "$EWW_PATH/volume.sh icon") (defpoll volume_icon :interval "1s" "$EWW_PATH/volume.sh icon")
(defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage") (defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage")