diff --git a/eww/.config/eww/bar/assets/images/mic.png b/eww/.config/eww/bar/assets/images/mic.png new file mode 100644 index 0000000..d77f315 Binary files /dev/null and b/eww/.config/eww/bar/assets/images/mic.png differ diff --git a/eww/.config/eww/bar/assets/images/music.png b/eww/.config/eww/bar/assets/images/music.png new file mode 100644 index 0000000..11804f5 Binary files /dev/null and b/eww/.config/eww/bar/assets/images/music.png differ diff --git a/eww/.config/eww/bar/assets/images/profile.png b/eww/.config/eww/bar/assets/images/profile.png new file mode 100644 index 0000000..0190a36 Binary files /dev/null and b/eww/.config/eww/bar/assets/images/profile.png differ diff --git a/eww/.config/eww/bar/assets/images/speaker.png b/eww/.config/eww/bar/assets/images/speaker.png new file mode 100644 index 0000000..79e005b Binary files /dev/null and b/eww/.config/eww/bar/assets/images/speaker.png differ diff --git a/eww/.config/eww/bar/assets/scss/index.scss b/eww/.config/eww/bar/assets/scss/index.scss new file mode 100644 index 0000000..f4b7da4 --- /dev/null +++ b/eww/.config/eww/bar/assets/scss/index.scss @@ -0,0 +1,5 @@ +* { + all: unset; + font-family: feather; + font-family: mononoki Nerd Font; +} \ No newline at end of file diff --git a/eww/.config/eww/bar/eww.scss b/eww/.config/eww/bar/eww.scss new file mode 100644 index 0000000..459a7f2 --- /dev/null +++ b/eww/.config/eww/bar/eww.scss @@ -0,0 +1,54 @@ +@import "./assets/scss/main.scss"; + +.bar { + background-color: #0f0f17; + padding: 0.5rem; + border-radius: 0.8rem; +} + +.sidestuff slider { + all: unset; + color: #ffd5cd; +} + +.metric scale trough highlight { + all: unset; + background-color: #D35D6E; + color: #000000; + border-radius: 10px; +} + +.metric scale trough { + all: unset; + background-color: #4e4e4e; + border-radius: 50px; + min-height: 3px; + min-width: 50px; + margin-left: 10px; + margin-right: 20px; +} + +.metric scale trough highlight { + all: unset; + background-color: #D35D6E; + color: #000000; + border-radius: 10px; +} + +.metric scale trough { + all: unset; + background-color: #4e4e4e; + border-radius: 50px; + min-height: 3px; + min-width: 50px; + margin-left: 10px; + margin-right: 20px; +} + +.label-ram { + font-size: large; +} + +.workspaces button:hover { + color: #D35D6E; +} \ No newline at end of file diff --git a/eww/.config/eww/bar/eww.yuck b/eww/.config/eww/bar/eww.yuck new file mode 100644 index 0000000..0b4e534 --- /dev/null +++ b/eww/.config/eww/bar/eww.yuck @@ -0,0 +1,96 @@ +; variables : +(deflisten workspace "scripts/workspace") +(deflisten music :initial "" +"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true") +(defpoll volume :interval "1s" +"scripts/getvol") +(defpoll time :interval "10s" +"date '+%H:%M %b %d, %Y'") + +(defwidget workspaces [] + (literal + :content workspace + :valign "center")) + +(defwidget bar [] + (centerbox :orientation "w" + (workspaces) + (music) + (sidestuff))) + +(defwidget sidestuff [] + (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" + (metric :label "πŸ”Š" + :value volume + :onchange "amixer -D pulse sset Master {}%") + (metric :label "" + :value {EWW_RAM.used_mem_perc} + :onchange "") + (metric :label "πŸ’Ύ" + :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} + :onchange "") + time)) + +(defwidget music [] + (box :class "music" + :orientation "h" + :space-evenly false + :halign "center" + {music != "" ? "🎡${music}" : ""})) + + +(defwidget metric [label value onchange] + (box :orientation "h" + :class "metric" + :space-evenly false + (box :class "label" label) + (scale :min 0 + :max 101 + :active {onchange != ""} + :value value + :onchange onchange))) + +(defwidget left [] + (box :orientation "h" + :space-evenly false + :halign "end" + :class "left_modules" + (bright) + (volume) + (wifi) + (sep) + (bat) + (mem) + (sep) + (clock_module))) + + +(defwidget right [] + (box :orientation "h" + :space-evenly false + :halign "start" + :class "right_modules" + (workspaces))) + + +(defwidget center [] + (box :orientation "h" + :space-evenly false + :halign "center" + :class "center_modules" + (music))) + +(defwindow bar + :monitor 0 + :geometry + (geometry + :anchor "top center" + :y "5px" + :width "99%" + :height "36px" + ) + :stacking "fg" + :exclusive "true" + :focusable "false" + (bar) +) \ No newline at end of file diff --git a/eww/.config/eww/bar/launch_bar b/eww/.config/eww/bar/launch_bar new file mode 100755 index 0000000..cb7b28b --- /dev/null +++ b/eww/.config/eww/bar/launch_bar @@ -0,0 +1,14 @@ +#!/bin/bash + +EWW="eww -c $HOME/.config/eww/bar" + +if [[ ! $(pidof eww) ]]; then + eww daemon + sleep 1 +fi + +run_eww() { + ${EWW} open bar +} + +run_eww diff --git a/eww/.config/eww/bar/scripts/battery b/eww/.config/eww/bar/scripts/battery new file mode 100755 index 0000000..0540a1b --- /dev/null +++ b/eww/.config/eww/bar/scripts/battery @@ -0,0 +1,17 @@ +#!/bin/bash + +battery() { + BAT=`ls /sys/class/power_supply | grep BAT | head -n 1` + cat /sys/class/power_supply/${BAT}/capacity +} +battery_stat() { + BAT=`ls /sys/class/power_supply | grep BAT | head -n 1` + cat /sys/class/power_supply/${BAT}/status +} + +if [[ "$1" == "--bat" ]]; then + battery +elif [[ "$1" == "--bat-st" ]]; then + battery_stat +fi + diff --git a/eww/.config/eww/bar/scripts/mem-ad b/eww/.config/eww/bar/scripts/mem-ad new file mode 100755 index 0000000..1e4cf89 --- /dev/null +++ b/eww/.config/eww/bar/scripts/mem-ad @@ -0,0 +1,15 @@ +#!/bin/sh + + +total="$(free -m | grep Mem: | awk '{ print $2 }')" +used="$(free -m | grep Mem: | awk '{ print $3 }')" + +free=$(expr $total - $used) + +if [ "$1" = "total" ]; then + echo $total +elif [ "$1" = "used" ]; then + echo $used +elif [ "$1" = "free" ]; then + echo $free +fi diff --git a/eww/.config/eww/bar/scripts/memory b/eww/.config/eww/bar/scripts/memory new file mode 100755 index 0000000..217c834 --- /dev/null +++ b/eww/.config/eww/bar/scripts/memory @@ -0,0 +1,3 @@ +#!/bin/sh + +printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') diff --git a/eww/.config/eww/bar/scripts/music_info b/eww/.config/eww/bar/scripts/music_info new file mode 100755 index 0000000..ffafe87 --- /dev/null +++ b/eww/.config/eww/bar/scripts/music_info @@ -0,0 +1,98 @@ +#!/bin/bash +# scripts by adi1090x + +## Get data +STATUS="$(mpc status)" +COVER="/tmp/.music_cover.png" +MUSIC_DIR="$HOME/Music" + +## Get status +get_status() { + if [[ $STATUS == *"[playing]"* ]]; then + echo "ο£₯" + else + echo "" + fi +} + +## Get song +get_song() { + song=`mpc -f %title% current` + if [[ -z "$song" ]]; then + echo "Offline" + else + echo "$song" + fi +} + +## Get artist +get_artist() { + artist=`mpc -f %artist% current` + if [[ -z "$artist" ]]; then + echo "" + else + echo "$artist" + fi +} + +## Get time +get_time() { + time=`mpc status | grep "%)" | awk '{print $4}' | tr -d '(%)'` + if [[ -z "$time" ]]; then + echo "0" + else + echo "$time" + fi +} +get_ctime() { + ctime=`mpc status | grep "#" | awk '{print $3}' | sed 's|/.*||g'` + if [[ -z "$ctime" ]]; then + echo "0:00" + else + echo "$ctime" + fi +} +get_ttime() { + ttime=`mpc -f %time% current` + if [[ -z "$ttime" ]]; then + echo "0:00" + else + echo "$ttime" + fi +} + +## Get cover +get_cover() { + ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null + STATUS=$? + + # Check if the file has a embbeded album art + if [ "$STATUS" -eq 0 ];then + echo "$COVER" + else + echo "images/music.png" + fi +} + +## Execute accordingly +if [[ "$1" == "--song" ]]; then + get_song +elif [[ "$1" == "--artist" ]]; then + get_artist +elif [[ "$1" == "--status" ]]; then + get_status +elif [[ "$1" == "--time" ]]; then + get_time +elif [[ "$1" == "--ctime" ]]; then + get_ctime +elif [[ "$1" == "--ttime" ]]; then + get_ttime +elif [[ "$1" == "--cover" ]]; then + get_cover +elif [[ "$1" == "--toggle" ]]; then + mpc -q toggle +elif [[ "$1" == "--next" ]]; then + { mpc -q next; get_cover; } +elif [[ "$1" == "--prev" ]]; then + { mpc -q prev; get_cover; } +fi diff --git a/eww/.config/eww/bar/scripts/pop b/eww/.config/eww/bar/scripts/pop new file mode 100755 index 0000000..aef82e8 --- /dev/null +++ b/eww/.config/eww/bar/scripts/pop @@ -0,0 +1,92 @@ +#!/bin/bash + +calendar() { +LOCK_FILE="$HOME/.cache/eww-calendar.lock" +EWW_BIN="$HOME/.local/bin/eww/eww" + +run() { + ${EWW_BIN} -c $HOME/.config/eww/bar open calendar +} + +# Open widgets +if [[ ! -f "$LOCK_FILE" ]]; then + ${EWW_BIN} -c $HOME/.config/eww/bar close system music_win audio_ctl + touch "$LOCK_FILE" + run && echo "ok good!" +else + ${EWW_BIN} -c $HOME/.config/eww/bar close calendar + rm "$LOCK_FILE" && echo "closed" +fi +} + + +system() { +LOCK_FILE_MEM="$HOME/.cache/eww-system.lock" +EWW_BIN="$HOME/.local/bin/eww/eww" + +run() { + ${EWW_BIN} -c $HOME/.config/eww/bar open system +} + +# Open widgets +if [[ ! -f "$LOCK_FILE_MEM" ]]; then + ${EWW_BIN} -c $HOME/.config/eww/bar close calendar music_win audio_ctl + touch "$LOCK_FILE_MEM" + run && echo "ok good!" +else + ${EWW_BIN} -c $HOME/.config/eww/bar close system + rm "$LOCK_FILE_MEM" && echo "closed" +fi +} + + +music() { +LOCK_FILE_SONG="$HOME/.cache/eww-song.lock" +EWW_BIN="$HOME/.local/bin/eww/eww" + +run() { + ${EWW_BIN} -c $HOME/.config/eww/bar open music_win +} + +# Open widgets +if [[ ! -f "$LOCK_FILE_SONG" ]]; then + ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar + touch "$LOCK_FILE_SONG" + run && echo "ok good!" +else + ${EWW_BIN} -c $HOME/.config/eww/bar close music_win + rm "$LOCK_FILE_SONG" && echo "closed" +fi +} + + + +audio() { +LOCK_FILE_AUDIO="$HOME/.cache/eww-audio.lock" +EWW_BIN="$HOME/.local/bin/eww/eww" + +run() { + ${EWW_BIN} -c $HOME/.config/eww/bar open audio_ctl +} + +# Open widgets +if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then + ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar music + touch "$LOCK_FILE_AUDIO" + run && echo "ok good!" +else + ${EWW_BIN} -c $HOME/.config/eww/bar close audio_ctl + rm "$LOCK_FILE_AUDIO" && echo "closed" +fi +} + + +if [ "$1" = "calendar" ]; then +calendar +elif [ "$1" = "system" ]; then +system +elif [ "$1" = "music" ]; then +music +elif [ "$1" = "audio" ]; then +audio +fi diff --git a/eww/.config/eww/bar/scripts/wifi b/eww/.config/eww/bar/scripts/wifi new file mode 100755 index 0000000..5d7cc59 --- /dev/null +++ b/eww/.config/eww/bar/scripts/wifi @@ -0,0 +1,26 @@ +#!/bin/bash + +status=$(nmcli g | grep -oE "disconnected") +essid=$(nmcli c | grep wlp2s0 | awk '{print ($1)}') + +if [ $status ] ; then + icon="ξ‡š" + text="" + col="#575268" + +else + icon="ξ†Ί" + text="${essid}" + col="#a1bdce" +fi + + + +if [[ "$1" == "--COL" ]]; then + echo $col +elif [[ "$1" == "--ESSID" ]]; then + echo $text +elif [[ "$1" == "--ICON" ]]; then + echo $icon +fi + diff --git a/eww/.config/eww/bar/scripts/workspace b/eww/.config/eww/bar/scripts/workspace new file mode 100755 index 0000000..2148493 --- /dev/null +++ b/eww/.config/eww/bar/scripts/workspace @@ -0,0 +1,75 @@ +#! /bin/bash + +#define icons for workspaces 1-9 +ic=(0 ο’‰ ο’ˆ   ο«‚ ο†· "ο€Ύ " "ο›­ " ξœ“) +# ic=(0 1 2 3 4 5 6 7 8 9) +# ic=(0 δΈ€ 二 δΈ‰ ε›› δΊ” ε…­ δΈƒ ε…« 九 〇) + +#initial check for occupied workspaces +for num in $(hyprctl workspaces | grep ID | awk '{print $3}'); do + export o"$num"="$num" +done + +#initial check for focused workspace +for num in $(hyprctl monitors | grep -B 4 "focused: yes" | awk 'NR==1{print $3}'); do + export f"$num"="$num" + export fnum=f"$num" + export mon=$(hyprctl monitors | grep -B 2 "\($num\)" | awk 'NR==1{print $2}') +done + +workspaces() { + if [[ ${1:0:9} == "workspace" ]] && [[ ${1:11} != "special" ]]; then #set focused workspace + unset -v "$fnum" + num=${1:11} + export f"$num"="$num" + export fnum=f"$num" + + elif [[ ${1:0:10} == "focusedmon" ]]; then #set focused workspace following monitor focus change + unset -v "$fnum" + string=${1:12} + num=${string##*,} + export mon=${string/,*/} + export f"$num"="$num" + export fnum=f"$num" + + elif [[ ${1:0:13} == "moveworkspace" ]] && [[ ${1##*,} == "$mon" ]]; then #Set focused workspace following swapactiveworkspace + unset -v "$fnum" + string=${1:15} + num=${string/,*/} + export f"$num"="$num" + export fnum=f"$num" + + elif [[ ${1:0:15} == "createworkspace" ]]; then #set Occupied workspace + num=${1:17} + export o"$num"="$num" + export onum=o"$num" + + elif [[ ${1:0:16} == "destroyworkspace" ]]; then #unset unoccupied workspace + num=${1:18} + unset -v o"$num" + fi +} +module() { + #output eww widget + echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" \ + (box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" :valign \"center\" \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 1\'\" :onrightclick \"hyprctl dispatch workspace 1 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o1$f1\" \"${ic[1]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 2\'\" :onrightclick \"hyprctl dispatch workspace 2 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o2$f2\" \"${ic[2]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 3\'\" :onrightclick \"hyprctl dispatch workspace 3 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o3$f3\" \"${ic[3]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 4\'\" :onrightclick \"hyprctl dispatch workspace 4 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o4$f4\" \"${ic[4]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 5\'\" :onrightclick \"hyprctl dispatch workspace 5 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o5$f5\" \"${ic[5]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 6\'\" :onrightclick \"hyprctl dispatch workspace 6 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o6$f6\" \"${ic[6]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 7\'\" :onrightclick \"hyprctl dispatch workspace 7 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o7$f7\" \"${ic[7]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 8\'\" :onrightclick \"hyprctl dispatch workspace 8 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o8$f8\" \"${ic[8]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 9\'\" :onrightclick \"hyprctl dispatch workspace 9 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o9$f9\" \"${ic[9]}\") \ + (button :onclick \"hyprctl dispatch exec \'~/.config/hypr/themes/winter/scripts/workspace 10\'\" :onrightclick \"hyprctl dispatch workspace 10 && $HOME/.config/hypr/themes/winter/scripts/default_app\" :class \"ws-btn 0$o10$f10\" \"${ic[10]}\") \ + )\ + )" +} + +module + +socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do + workspaces "$event" + module +done