From 4bba7bb9b2b1da9d69c2b7f7ecdebae657679a8a Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 22 Jul 2023 14:22:33 -0400 Subject: [PATCH] feat: optimize heart script and add it to git --- config/eww/powermenu/powermenu.scss | 2 +- config/eww/scripts/close.sh | 4 ++-- config/eww/scripts/exec | 4 ---- config/eww/scripts/heart.sh | 14 ++++++++++++++ config/eww/scripts/open.sh | 4 ++-- config/eww/traybuttons/traybuttons.yuck | 12 ++++++------ config/eww/variables.yuck | 1 + 7 files changed, 26 insertions(+), 15 deletions(-) delete mode 100755 config/eww/scripts/exec create mode 100755 config/eww/scripts/heart.sh diff --git a/config/eww/powermenu/powermenu.scss b/config/eww/powermenu/powermenu.scss index c77e43d..9646789 100644 --- a/config/eww/powermenu/powermenu.scss +++ b/config/eww/powermenu/powermenu.scss @@ -6,7 +6,7 @@ /*font-family: Iosevka Nerd Font;*/ font-size: 70px; border-radius: 30px; - border: 5px solid $contrastbg; + border: 2px solid $contrastbg; button { border-radius: 12px; min-width: 80px; diff --git a/config/eww/scripts/close.sh b/config/eww/scripts/close.sh index d03dc30..24f5049 100755 --- a/config/eww/scripts/close.sh +++ b/config/eww/scripts/close.sh @@ -2,7 +2,7 @@ WINDOW="$1" ( -eww update $WINDOW-visible=false +eww update "$WINDOW"-visible=false sleep .55 -eww close $WINDOW-reveal +eww close "$WINDOW"-reveal ) & diff --git a/config/eww/scripts/exec b/config/eww/scripts/exec deleted file mode 100755 index b821a3c..0000000 --- a/config/eww/scripts/exec +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -cd ~ -${@} 2>&1 >/dev/null & diff --git a/config/eww/scripts/heart.sh b/config/eww/scripts/heart.sh new file mode 100755 index 0000000..eba4c71 --- /dev/null +++ b/config/eww/scripts/heart.sh @@ -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 diff --git a/config/eww/scripts/open.sh b/config/eww/scripts/open.sh index 5831cdd..4b2605a 100755 --- a/config/eww/scripts/open.sh +++ b/config/eww/scripts/open.sh @@ -2,5 +2,5 @@ WINDOW="$1" -eww open $WINDOW-reveal -eww update $WINDOW-visible=true +eww open "$WINDOW"-reveal +eww update "$WINDOW"-visible=true diff --git a/config/eww/traybuttons/traybuttons.yuck b/config/eww/traybuttons/traybuttons.yuck index ab7ca67..f0bbf92 100644 --- a/config/eww/traybuttons/traybuttons.yuck +++ b/config/eww/traybuttons/traybuttons.yuck @@ -21,15 +21,12 @@ ) ) -(defvar heart-ts true) -(defvar heart-icon "󰣐") (defwidget heart-toggle [] - (eventbox :class {heart-ts ? "toggle-on" : "toggle-off"} - :onclick {heart-ts ? "eww update heart-icon= ; eww update heart-ts=false" : - "eww update heart-icon=󰣐 ; eww update heart-ts=true"} + (eventbox :class {heart_icon == "󰣐" ? "toggle-on" : "toggle-off"} + :onclick "$EWW_PATH/heart.sh toggle" (box :class "heart-toggle" :orientation "h" - (label :text " ${heart-icon} ") + (label :text " ${heart_icon} ") ) ) ) @@ -57,6 +54,9 @@ (left-bar) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;  (defvar notif-panel-state false) diff --git a/config/eww/variables.yuck b/config/eww/variables.yuck index f1aa724..4a78b97 100644 --- a/config/eww/variables.yuck +++ b/config/eww/variables.yuck @@ -1,4 +1,5 @@ (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 :interval "1s" "$EWW_PATH/volume.sh percentage")