diff --git a/configs/hyprland/eww/assets/perfil.png b/configs/hyprland/eww/assets/perfil.png new file mode 100644 index 0000000..6a62be5 Binary files /dev/null and b/configs/hyprland/eww/assets/perfil.png differ diff --git a/configs/hyprland/eww/bar/assets/images/mic.png b/configs/hyprland/eww/bar/assets/images/mic.png deleted file mode 100644 index d77f315..0000000 Binary files a/configs/hyprland/eww/bar/assets/images/mic.png and /dev/null differ diff --git a/configs/hyprland/eww/bar/assets/images/music.png b/configs/hyprland/eww/bar/assets/images/music.png deleted file mode 100644 index 11804f5..0000000 Binary files a/configs/hyprland/eww/bar/assets/images/music.png and /dev/null differ diff --git a/configs/hyprland/eww/bar/assets/images/profile.png b/configs/hyprland/eww/bar/assets/images/profile.png deleted file mode 100644 index 0190a36..0000000 Binary files a/configs/hyprland/eww/bar/assets/images/profile.png and /dev/null differ diff --git a/configs/hyprland/eww/bar/assets/images/speaker.png b/configs/hyprland/eww/bar/assets/images/speaker.png deleted file mode 100644 index 79e005b..0000000 Binary files a/configs/hyprland/eww/bar/assets/images/speaker.png and /dev/null differ diff --git a/configs/hyprland/eww/bar/assets/scss/colors.scss b/configs/hyprland/eww/bar/assets/scss/colors.scss deleted file mode 100644 index 31a6ae2..0000000 --- a/configs/hyprland/eww/bar/assets/scss/colors.scss +++ /dev/null @@ -1,21 +0,0 @@ -$background-bar: rgb(68, 47, 173); -$background: rgba(11, 10, 16, 1); -$widget-background: rgba(17, 16, 25, 1); -$shadow: rgba(0, 0, 0, 0.3); -$grey: rgba(105, 101, 124, 0.7); - -$black: #282A36; -$red: #f1a7b3; -$green: #AAC5A0; -$yellow: #f6d6b3; -$orange: #f2c798; -$blue: #A8C5E6; -$blue2: #e1eefd; -$purple: #f1a7e2; -$purple2: #ecdbee; -$teal: #72B69C; -$white: #eae9f0; - -$primary: #d3e8ff; -$secondary: #f1a7e2; -$tertiary: #93f0e2; \ No newline at end of file diff --git a/configs/hyprland/eww/bar/assets/scss/index.scss b/configs/hyprland/eww/bar/assets/scss/index.scss deleted file mode 100644 index 655ea6f..0000000 --- a/configs/hyprland/eww/bar/assets/scss/index.scss +++ /dev/null @@ -1,57 +0,0 @@ -.bar { - padding: 0.1rem; -} - -.works { - font-size: 12px; - font-weight: normal; - margin: 5px 0px 0px 20px; - background-color: #0f0f17; -} - -.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/configs/hyprland/eww/bar/assets/scss/widgets/workspaces.scss b/configs/hyprland/eww/bar/assets/scss/widgets/workspaces.scss deleted file mode 100644 index 40fb001..0000000 --- a/configs/hyprland/eww/bar/assets/scss/widgets/workspaces.scss +++ /dev/null @@ -1,9 +0,0 @@ -.works { - font-size: 18px; - // margin: 10px 0px 0px 10px; - background-color: rgba(00, 00, 00, 0.0); -} - -.ws-btn { - margin: 0px 7px 0px 0px; -} \ No newline at end of file diff --git a/configs/hyprland/eww/bar/bar.scss b/configs/hyprland/eww/bar/bar.scss new file mode 100644 index 0000000..db4e15b --- /dev/null +++ b/configs/hyprland/eww/bar/bar.scss @@ -0,0 +1,140 @@ +* { + all: unset; //Unsets everything so you can style everything from scratch +} + +//Global Styles +.bar-widget { + @include window; + background-color: $bg; + color: $fg; + padding: 1rem; +} + + +.apps { + background-color: $bg-alt; + padding: .5rem; + margin: 0 -.5rem; + border-radius: .4rem; +} + +.uptime { + font-size: .9rem; + color: $fg-alt; + padding: .2rem; +} + +.launcher { + color: $green; + font-size: 1.4rem; + padding: 0 .30rem 0 0; +} + +.spotify { + color: $green; + font-size: 1.5rem; +} + +.central-icon { + font-size: 1.5rem; +} + +.bell { + font-size: 1.5rem; + color: $yellow; +} + +.firefox { + color: $cyan; + font-size: 1.5rem; + padding: 0 .2rem 0 0; +} + +.workspaces { + font-size: 1.2rem; + border-radius: 1rem; + margin: 0 0 0 -.3rem; + + + .icon { + &.current {color: $green;} + } + + button { + &.empty { + color: $black; + } + + &.occupied { + color: lighten($color: $fg-alt2, $amount: 10%); + } + + &.current { + color: $green; + } + + &:hover { + &.empty { + color: lighten($color: $black, $amount: 5%); + } + &.occupied { + color: lighten($color: $black, $amount: 20%); + } + &.current { + color: darken($color: $green, $amount: 10%); + } + } + } + } + + .volume { + font-size: 1.3rem; + .volume-bar scale trough { + all: unset; + background-color: $black; + border-radius: 1rem; + min-width: 0.4rem; + min-height: 3rem; + margin-bottom: 0.5rem; + box-shadow: 0 0 2px 1px rgba(black, 0.3); + } + + .volume-bar scale trough highlight { + all: unset; + background: $green; + border-radius: 1rem; + } + } + + .clock { + font-family: "SF Pro"; + font-size: 1.4rem; + + &.hour { + font-weight: bold; + color: $fg; + } + + &.minute { + color: $fg-alt; + } + + &.separator { + color: $fg-alt; + } + .timebox { + font-size: 0.5rem; + + &.magenta { + color: $magenta; + } + + &.green { + color: $green; + } + + &.yellow { + color: $yellow; + } + } + } diff --git a/configs/hyprland/eww/bar/bar.yuck b/configs/hyprland/eww/bar/bar.yuck new file mode 100644 index 0000000..61e99fc --- /dev/null +++ b/configs/hyprland/eww/bar/bar.yuck @@ -0,0 +1,257 @@ +(defwidget bar [] + (box :class "bar-widget" :orientation "v" :space-evenly true :halign "center" + (start) + (center) + (apps) + (and) + )) + + +(defwidget start [] + (box :class "start" :orientation "v" :halign "center" :valign "start" + (launcher) + ) +) + + +(defwidget center [] + (box :class "center" :halign "center" :orientation "v" + (workspaces) + ) +) + +(defwidget apps [] + (box :class "apps" :spacing 10 :space-evenly false :valign "end" :halign "center" :orientation "v" + (volume) + (spotify) + (firefox) + ) +) + +(defwidget and [] + (box :class "" :valign "end":orientation "v" :space-evenly false :spacing 15 + (bell) + (central-icon) + (clock) + ) +) + +(defwidget launcher [] + (eventbox + :cursor "pointer" + :halign "center" + (button + :class "launcher" + :valign "start" + :onclick "actions --launcher" + :width 25 + "" ))) + +(defwidget spotify [] + (eventbox + :cursor "pointer" + :halign "center" + (button + :class "launcher" + :valign "start" + :onclick "env LD_PRELOAD=/usr/lib/spotify-adblock.so spotify --uri=%U &" + :width 25 + "" ))) + +(defwidget firefox [] + (eventbox + :cursor "pointer" + :halign "center" + (button + :class "firefox" + :valign "start" + :onclick "firefox &" + :width 25 + "󰾔" ))) + +(defwidget central-icon [] + (eventbox + :cursor "pointer" + :halign "center" + (button + :class "central-icon" + :valign "start" + :onclick "eww open --toggle central" + :width 20 + "󰙪" ))) + + +(defwidget bell [] + (eventbox + :cursor "pointer" + :halign "center" + (button + :class "bell" + :valign "start" + :onclick "eww open --toggle notifications" + :width 20 + "󰂚" ))) + +(defwidget workspaces [] + (box + :class "workspaces" + :halign "start" + :spacing 10 + :orientation "v" + :space-evenly false + (for workspace in hyprland + (eventbox + :cursor "pointer" + :onscroll "echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace" + :halign "center" + (button + :class "${workspace.current ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" + :onclick "hyprctl dispatch workspace ${workspace.id}" + (button + :width 25 + :class "icon ${workspace.current ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" + {workspace.current ? "" : ""} + ) + ) + ) + ) + ) +) + +(defwidget music [] + (eventbox + :onhover "eww update music-rev=true" + :onhoverlost "eww update music-rev=false" + (box + :space-evenly false + :spacing 10 + :orientation "v" + (eventbox + :cursor "pointer" + (button + :class "musicbar-art" + :orientation "v" + :onclick "eww open-many --toggle player-closer player" + :style "background-image: url('${music-art}');" + ) + ) + (label + :class "musicbar-title" + :orientation "v" + :limit-height 10 + :limit-width 35 + :text music-title + ) + (revealer + :transition "slideright" + :reveal music-rev + :duration "500ms" + (box + :spacing 10 + :orientation "h" + (eventbox + :cursor "pointer" + (button + :class "musicbar-previous-icon" + :onclick "./scripts/mediacontrol --previous" + "" + ) + ) + (eventbox + :cursor "pointer" + (button + :class "musicbar-toggle-icon" + :onclick "./scripts/mediacontrol --toggle" + music-toggle + ) + ) + (eventbox + :cursor "pointer" + (button + :class "musicbar-next-icon" + :onclick "./scripts/mediacontrol --next" + "" + ) + ) + ) + ) + ) + ) +) + +(defwidget volume [] + (eventbox + :onhover "eww update volume_rev=true" + :onhoverlost "eww update volume_rev=false" + (box + :class "volume" + :space-evenly false + :orientation "v" + (revealer + :class "volume-bar" + :transition "slideup" + :reveal volume_rev + (eventbox + :cursor "pointer" + :halign "center" + (scale + :orientation "v" + :tooltip {volume == "muted" ? "Muted" : "${volume}%"} + :value {volume == "muted" ? "0" : volume} + :min 0 + :max 101 + :onchange "pamixer -u && pamixer --set-volume {}" + :flipped true + ) + ) + ) + (eventbox + :cursor "pointer" + :onscroll "echo {} | sed -e 's/up/--up/g' -e 's/down/--down/g' | xargs volume" + (button + :class "volume icon" + :style {volume == 0 || volume == "muted" ? "color: #dd6777;" : "color: #cacaca;"} + :tooltip {volume == "muted" ? "Muted" : "${volume}%" } + :onclick "volume --toggle" + {volume == 0 || volume == "muted" ? "󰝟" : + volume < 30 ? "" : + volume < 75 ? "" : ""} + ) + ) + ) + ) +) + + + +(defwidget clock [] + (box + :class "clock" + :orientation "v" + :space-evenly false + :spacing 4 + :halign "center" + :valign "end" + (label + :class "clock hour" + :text hour + ) + (box :class "timebox" :spacing 4 + ) + (label + :class "clock minute" + :text minute) + ) +) + + +(defwindow bar + :monitor 0 + :exclusive true + :geometry (geometry :x "0%" + :y "0%" + :height "99%" + :width "4%" + :anchor "center left") + :reserve (struts :side "top" :distance "4%") + (bar)) diff --git a/configs/hyprland/eww/bar/eww.scss b/configs/hyprland/eww/bar/eww.scss deleted file mode 100644 index 7a5f1f8..0000000 --- a/configs/hyprland/eww/bar/eww.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "assets/scss/colors.scss"; -@import "assets/scss/index.scss"; -@import "assets/scss/widgets/workspaces.scss"; - -* { - all: unset; -} \ No newline at end of file diff --git a/configs/hyprland/eww/bar/eww.yuck b/configs/hyprland/eww/bar/eww.yuck deleted file mode 100644 index 0b4e534..0000000 --- a/configs/hyprland/eww/bar/eww.yuck +++ /dev/null @@ -1,96 +0,0 @@ -; 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/configs/hyprland/eww/bar/launch_bar b/configs/hyprland/eww/bar/launch_bar deleted file mode 100755 index b9b2d50..0000000 --- a/configs/hyprland/eww/bar/launch_bar +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -EWW="eww -c $HOME/.config/eww/bar" - -run_eww() { - ${EWW} open bar -} - -run_eww diff --git a/configs/hyprland/eww/bar/scripts/battery b/configs/hyprland/eww/bar/scripts/battery deleted file mode 100755 index 0540a1b..0000000 --- a/configs/hyprland/eww/bar/scripts/battery +++ /dev/null @@ -1,17 +0,0 @@ -#!/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/configs/hyprland/eww/bar/scripts/mem-ad b/configs/hyprland/eww/bar/scripts/mem-ad deleted file mode 100755 index 1e4cf89..0000000 --- a/configs/hyprland/eww/bar/scripts/mem-ad +++ /dev/null @@ -1,15 +0,0 @@ -#!/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/configs/hyprland/eww/bar/scripts/memory b/configs/hyprland/eww/bar/scripts/memory deleted file mode 100755 index 217c834..0000000 --- a/configs/hyprland/eww/bar/scripts/memory +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') diff --git a/configs/hyprland/eww/bar/scripts/music_info b/configs/hyprland/eww/bar/scripts/music_info deleted file mode 100755 index ffafe87..0000000 --- a/configs/hyprland/eww/bar/scripts/music_info +++ /dev/null @@ -1,98 +0,0 @@ -#!/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/configs/hyprland/eww/bar/scripts/pop b/configs/hyprland/eww/bar/scripts/pop deleted file mode 100755 index aef82e8..0000000 --- a/configs/hyprland/eww/bar/scripts/pop +++ /dev/null @@ -1,92 +0,0 @@ -#!/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/configs/hyprland/eww/bar/scripts/wifi b/configs/hyprland/eww/bar/scripts/wifi deleted file mode 100755 index 5d7cc59..0000000 --- a/configs/hyprland/eww/bar/scripts/wifi +++ /dev/null @@ -1,26 +0,0 @@ -#!/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/configs/hyprland/eww/bar/scripts/workspace b/configs/hyprland/eww/bar/scripts/workspace deleted file mode 100755 index 94ea341..0000000 --- a/configs/hyprland/eww/bar/scripts/workspace +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/bash - -#define icons for workspaces 1-9 -ic=(    輸) -# 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() { - 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 diff --git a/configs/hyprland/eww/central/central.scss b/configs/hyprland/eww/central/central.scss new file mode 100644 index 0000000..077a184 --- /dev/null +++ b/configs/hyprland/eww/central/central.scss @@ -0,0 +1,242 @@ +.central-widget { + @include window; + background-color: $bg; + color: $fg; + padding: 1rem; +} + +.profile { + background-color: $bg-alt; + background-repeat: no-repeat; + background-size: cover; + background-position: center; + min-height: 4rem; + min-width: 4rem; + border-radius: .4rem; +} + +.name { + color: $fg; + font-weight: bolder; +} + +.wm { + color: $fg-alt; + font-weight: bold; +} + +.lock, .exit { + font-size: 1.2rem; + background-color: $bg-alt; + padding: .7rem 1.2rem .7rem 1rem; + border-radius: .4rem; +} + +.system-info { + background-color: $bg-alt; +} + + +.music { + background-color: $bg-alt; + + border-radius: .4rem; + padding: .8rem; +} + +.player { + font-family: "JetBrainsMono Nerd Font"; + min-height: 1rem; + border-radius: .1rem; + margin: .1rem .8rem; +} + +.player-art { + background-color: $bg-alt; + background-repeat: no-repeat; + background-size: cover; + background-position: center; + min-height: 4rem; + min-width: 4rem; + border-radius: .4rem; +} + +.player-info { + border-radius: .4rem; + +} + +.player-title { + font-size: 1rem; + padding: .1rem 0; + font-weight: bolder; +} + +.player-artist { + color: $white; + padding: .2rem 0; +} + +.player-bar scale trough highlight { + background-image: linear-gradient(to right, $bg-alt, $green); + border-radius: .4rem; +} + +.player-bar scale trough { + all: unset; + background-color: rgba($fg-alt, 0.3); + box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.5); + border-radius: .4rem; + min-height: .25rem; + min-width: 18rem; + margin: .2rem 0; +} + +.player-position { + font-size: .9rem; + font-weight: 500; + color: $fg-alt; +} + +.player-controls { + font-size: 5rem; + background-color: $bg-alt; +} + +.player-toggle { + font-size: 1.4rem; + color: $fg; +} + +.player-previous, +.player-next { + font-size: 1.2rem; + color: $fg-alt; +} + +.player-toggle:hover, +.player-previous:hover, +.player-next:hover { + color: $green; +} + +.player-shuffle, +.player-loop { + font-size: 1rem; +} + +.spotify-icon { + font-family: "Font Awesome 6 Brands"; + font-size: 1.25rem; + color: $green; + border-radius: .4rem; +} +.box-control { + background-color: $bg-alt; + padding: 1.5rem; + margin: 1rem 1.5rem; + border-radius: .4rem; + +} + +.time { + font-size: 4rem; +} + +.date { + font-size: 1.3rem; +} + +.timeboxes { + font-size: .6rem; + margin: -.1rem 0; + + .magenta { + color: $magenta; + } + + .green { + color: $green; + } + + .yellow { + color: $yellow; + } +} + + +.calendar { + font-size: 1.1rem; + font-weight: 500; + background-color: $bg-alt; + border-radius: .4rem; + padding: .4rem; + + calendar { + + &.button { + color: $fg-alt; + + &:hover { + background-color: $black; + border-radius: 1rem; + } + } + + &:selected { + color: $green; + text-shadow: 0 0 3px lighten($color: $bg-alt, $amount: 10%); + border-radius: 1rem; + } + + &.header { + background-color: transparent; + border: none; + } + + &.highlight { + color: $green; + } + + &:indeterminate { + color: $gray; + } + } + } + + .system { + .progress { + background-color: $bg-alt; + padding: .4rem; + border-radius: .4rem; + + circular-progress { + background-color: $black; + + &.ram { + color: $magenta; + } + + &.cpu { + color: $yellow; + label { margin-left: 1px;} + } + + &.temp { + color: $red; + label { margin: .2rem .5rem .2rem .2rem;} + + } + + &.disk { + color: $green; + } + } + } + + .icon { + font-size: 1.2rem; + padding: 1.2rem; + } + + } diff --git a/configs/hyprland/eww/central/central.yuck b/configs/hyprland/eww/central/central.yuck new file mode 100644 index 0000000..57220c2 --- /dev/null +++ b/configs/hyprland/eww/central/central.yuck @@ -0,0 +1,272 @@ +(defwidget central [] + (box :class "central-widget" :space-evenly false :orientation "v" :spacing 10 + (box-profile) + (box-calendar) + (box-system) + (music) + ) +) + +(defwidget box-profile [] + (box + :class "box-profile" + :space-evenly false + :hexpand false + :spacing 10 + (box :class "profile" + :style "background-image: url('${perfil}')" + :valign "start" + ) + (box + :class "box-about" + :halign "start" + :spacing 5 + (box + :orientation "v" :space-evenly false :halign "start" + (label :class "name" :halign "start" :text {name}) + (label :class "wm" :halign "start" :text {wm}) + (box + (label :class "uptime" :text `Uptime: ${uptime}`) + ))) + (box + :halign "end" + :valign "center" + :hexpand true + :spacing 10 + (eventbox + :cursor "pointer" + (button + :class "lock" + :onclick "poweroff&" + "" + )) + (eventbox + :cursor "pointer" + (button + :class "exit" + :onclick "eww open --toggle powercontrol && eww close central" + "⏻" + ))))) + +(defwidget box-system [] + (box + :class "system" + :spacing 10 + (ram) + (cpu) + (temp) + (disk) + ) +) + +(defwidget system_progress [data icon css tip] + (box + :class "progress" + (circular-progress + :class css + :value data + :thickness 7 + :tooltip tip + (overlay + :valign "center" + (label + :class "icon" + :text icon + ) + ) + ) + ) +) + + +(defwidget cpu [] + (system_progress + :css "cpu" + :tip "CPU ${round(EWW_CPU.avg,0)}%" + :data {round(EWW_CPU.avg, 0)} + :icon "󰻠" + ) +) + +(defwidget ram [] + (system_progress + :css "ram" + :tip "RAM ${round(EWW_RAM.used_mem / 1048576, 2)}MB" + :data {round(EWW_RAM.used_mem_perc, 0)} + :icon "󰍛" + ) +) + +(defwidget temp [] + (system_progress + :css "temp" + :tip "Temperature ${EWW_TEMPS["AMDGPU_EDGE"]}°C" + :data {round(EWW_TEMPS.AMDGPU_EDGE, 0)} + :icon "󰔄" + ) +) + +(defwidget disk [] + (system_progress + :css "disk" + :tip "SSD ${round(EWW_DISK["/"].used_perc, 2)}%" + :data {round(EWW_DISK["/"].used_perc, 0)} + :icon "󰗮" + ) +) + + +(defwidget music [] + (box + :class "music" + :space-evenly false + :spacing 15 + :halign "start" + (box + :class "player-art" + :style "background-image: url('${music-art}')" + ) + (box + :class "player-info" + :space-evenly false + :orientation "v" + (label :class "player-title" :halign "start" :valign "center" :text music-title :limit-width 30 ) + (label :class "player-artist" :halign "start" :valign "center" :text music-artist :limit-width 30 ) + (box + :space-evenly false + :orientation "v" + :valign "end" + (box + :class "player-bar" + :halign "center" + :valign "end" + :hexpand true + (eventbox + :cursor "pointer" + (scale + :onchange "playerctl -p spotify position {}" + :min 0 + :max music-lengths + :value music-positions + ) + ) + ) + (box + :class "player-position" + :space-evenly true + :valign "start" + + (label + :class "player-time" + :halign "start" + :text "${music-position} / ${music-length}" + ) + (box + :class "player-controls" + :valign "center" + :space-evenly false + :halign "end" + :spacing 10 + (eventbox + :cursor "pointer" + (button + :class "player-previous" + :onclick "scripts/mediacontrol --previous" + "" + ) + ) + (eventbox + :cursor "pointer" + (button + :class "player-toggle" + :onclick "scripts/mediacontrol --toggle" + music-toggle + ) + ) + (eventbox + :cursor "pointer" + (button + :class "player-next" + :onclick "scripts/mediacontrol --next" + "" + ) + ) + ) ) + ) + ) + ) +) + +(defwidget box-calendar [] + (box + :class "calendar-main-box" + :space-evenly false + :orientation "v" + :spacing 20 + (box + :class "date" + :space-evenly false + :orientation "v" + (box + :space-evenly false + :halign "center" + :spacing 10 + (label + :class "time" + :text hour) + (box + :class "timeboxes" + :space-evenly false + :valign "center" + :orientation "v" + :spacing 5 + (box + :class "timebox-1" + "󰝤" + ) + (box + :class "timebox green" + "󰝤" + ) + ) + (label + :class "time" + :text minute + ) + ) + (box + :halign "center" + :valign "start" + (label + :class "today" + :text date + ) + ) + ) + (box + :class "cal" + :orientation "v" + (box + :class "cal-inner-box" + (calendar + :class "calendar" + :day calendar-day + :month calendar-month + :year calendar-year + :show-day-names true + :show-heading true + :show-details true + ) + ) + ) + ) +) + +(defwindow central + :monitor 0 + :geometry (geometry :x "-1%" + :y "0%" + :height "85%" + :anchor "center left") + :reserve (struts :side "top" :distance "4%") + (central)) diff --git a/configs/hyprland/eww/eww.scss b/configs/hyprland/eww/eww.scss new file mode 100644 index 0000000..11dc102 --- /dev/null +++ b/configs/hyprland/eww/eww.scss @@ -0,0 +1,34 @@ +/* Variables */ +* { + all: unset; + transition: 200ms; + } + +@mixin window { + background-color: $bg; + box-shadow: 0 0 0.3rem 0.3rem $shadow; + margin: 1rem; +} + + +$shadow: #151515; +$bg: #121013; +$bg-alt: #171518; +$bg-alt2: #312f32; +$fg: #f0f0f0; +$fg-alt: #cacaca; +$fg-alt2: #a0a0a0; +$black: #262626; +$gray: #bababa; +$red: #FA8E89; +$green: #9EC49F; +$yellow: #FAF889; +$blue: #89B4FA; +$magenta: #E889FA; +$cyan: #89EAFA; +$white: #ffffff; + +@import "bar/bar.scss"; +@import "central/central.scss"; +@import "notifications/notifications.scss"; +@import "volume/volume.scss"; diff --git a/configs/hyprland/eww/eww.yuck b/configs/hyprland/eww/eww.yuck new file mode 100644 index 0000000..f46a6d0 --- /dev/null +++ b/configs/hyprland/eww/eww.yuck @@ -0,0 +1,43 @@ +(include "bar/bar.yuck") +(include "central/central.yuck") +(include "notifications/notifications.yuck") +(include "volume/volume.yuck") + +(deflisten hyprland `scripts/workspace`) +(deflisten name `scripts/sysinfo.sh --name`) +(deflisten kernel `scripts/sysinfo.sh --kernel`) +(deflisten os `scripts/sysinfo.sh --os`) +(deflisten wm `scripts/sysinfo.sh --wm`) +(deflisten uptime `scripts/sysinfo.sh --uptime`) + +(defvar perfil "assets/perfil.png") + + +;; Music +(defpoll music-art :interval "1s" "scripts/mediacontrol coverloc") +(defpoll music-title :interval "1s" "scripts/mediacontrol title") +(defpoll music-artist :interval "1s" "scripts/mediacontrol artist") +(defpoll music-toggle :interval "1s" "scripts/mediacontrol statusicon") +(defpoll music-status :interval "1s" "scripts/mediacontrol status") +(defpoll music-position :interval "1s" "scripts/mediacontrol position") +(defpoll music-length :interval "1s" "scripts/mediacontrol length") +(defpoll music-positions :interval "1s" "scripts/mediacontrol positions") +(defpoll music-lengths :interval "1s" "scripts/mediacontrol lengths") +(defpoll music-shuffle-color :interval "1s" "scripts/mediacontrol shufflecolor") +(defpoll music-shuffle-status :interval "1s" "playerctl -p spotify shuffle") +(defpoll music-loop-icon :interval "1s" "scripts/mediacontrol loopicon") +(defpoll music-loop-color :interval "1s" "scripts/mediacontrol loopcolor") +(defpoll music-loop-status :interval "1s" "playerctl -p spotify loop") +(defvar music-rev false) + +;; Volume +(deflisten volume `scripts/volume`) +(defvar volume_rev false) + +;; Date +(defpoll hour :interval "1s" "date '+%H'") +(defpoll minute :interval "1s" "date '+%M'") +(defpoll date :interval "1h" "date '+%a, %d %B'") +(defpoll calendar-day :interval "1h" "date '+%d'") +(defpoll calendar-month :interval "1h" "date '+%m'") +(defpoll calendar-year :interval "1h" "date '+%Y'") diff --git a/configs/hyprland/eww/notifications/notifications.scss b/configs/hyprland/eww/notifications/notifications.scss new file mode 100644 index 0000000..584bac2 --- /dev/null +++ b/configs/hyprland/eww/notifications/notifications.scss @@ -0,0 +1,12 @@ + +.notifications { + background-color: $bg; + color: $fg-alt; + margin: 1rem; + border-radius: .4rem; +} + +.title { + font-size: 1.5rem; + color: $fg; +} diff --git a/configs/hyprland/eww/notifications/notifications.yuck b/configs/hyprland/eww/notifications/notifications.yuck new file mode 100644 index 0000000..97d7e53 --- /dev/null +++ b/configs/hyprland/eww/notifications/notifications.yuck @@ -0,0 +1,31 @@ +(defwidget notifications [] + (box + :class "notifications" + (box + :class "title" + :space-evenly false + :valign "start" + :halign "center" + (label :text "Notifications") + ) + ) + +) + + + + + + + + + +(defwindow notifications + :monitor 0 + :geometry (geometry :x "1%" + :y "0%" + :height "75%" + :width "25%" + :anchor "center left") + :reserve (struts :side "top" :distance "4%") + (notifications)) diff --git a/configs/hyprland/eww/scripts/apps.py b/configs/hyprland/eww/scripts/apps.py new file mode 100644 index 0000000..2f6e501 --- /dev/null +++ b/configs/hyprland/eww/scripts/apps.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +import glob +import sys +import os +import json +import subprocess +import gi + +gi.require_version("Gtk", "3.0") + +from gi.repository import Gtk +from configparser import ConfigParser + +cache_file = os.path.expandvars("$XDG_CACHE_HOME/apps.json") + +def get_gtk_icon(icon_name): + theme = Gtk.IconTheme.get_default() + icon_info = theme.lookup_icon(icon_name, 128, 0) + + if icon_info is not None: + return icon_info.get_filename() + +def get_desktop_entries(query=None): + desktop_files = glob.glob(os.path.join("/usr/share/applications", "*.desktop")) + entries = [] + + for file_path in desktop_files: + parser = ConfigParser() + parser.read(file_path) + + if parser.getboolean("Desktop Entry", "NoDisplay", fallback=False): + continue # Skip entries with NoDisplay=true + + app_name = parser.get("Desktop Entry", "Name") + icon_path = get_gtk_icon(parser.get("Desktop Entry", "Icon", fallback="")) + comment = parser.get("Desktop Entry", "Comment", fallback="") + + entry = { + "name": app_name, + "icon": icon_path, + "comment": comment, + "desktop": os.path.basename(file_path), + } + entries.append(entry) + return entries + +def update_cache(entries): + with open(cache_file, "w") as file: + file.write(json.dumps(entries, indent=2)) + +def get_cached_entries(): + if os.path.exists(cache_file): + with open(cache_file, "r") as file: + content = file.read().strip() + if content: + try: + return json.loads(content) + except json.JSONDecodeError: + pass + + entries = get_desktop_entries() + update_cache(entries) + return entries + +def filter_entries(entries, query): + filtered_data = [ + entry for entry in entries + if query.lower() in entry["name"].lower() + or (entry["comment"] and query.lower() in entry["comment"].lower()) + ] + return filtered_data + +def update_eww(entries): + update = ["eww", "update", "apps={}".format(json.dumps(entries))] + subprocess.run(update) + +if __name__ == "__main__": + if len(sys.argv) > 2 and sys.argv[1] == "--query": + query = sys.argv[2] + else: + query = None + + entries = get_cached_entries() + + if query is not None: + filtered = filter_entries(entries, query) + update_eww(filtered) + else: + update_eww(entries) \ No newline at end of file diff --git a/configs/hyprland/eww/scripts/brightness b/configs/hyprland/eww/scripts/brightness new file mode 100644 index 0000000..7b49220 --- /dev/null +++ b/configs/hyprland/eww/scripts/brightness @@ -0,0 +1,30 @@ +#!/bin/bash + +current_brightness=1.0 + +function set_brightness() { + gdbus call -e -d de.mherzberg -o /de/mherzberg/wlrbrightness -m de.mherzberg.wlrbrightness.set $1 &> /dev/null +} + +echo "Ajuste o brilho com o scroll do mouse." +echo "Gire o scroll para cima para aumentar o brilho e para baixo para diminuir." +echo "Pressione Ctrl+C para sair." + +while true; do + read -r -n 1 scroll + if [[ "$scroll" == $'\x1b[A' ]]; then + # Scroll para cima + current_brightness=$(echo "$current_brightness + 0.1" | bc) + if (( $(echo "$current_brightness > 1.0" | bc -l) )); then + current_brightness=1.0 + fi + sudo bash -c "set_brightness $current_brightness" + elif [[ "$scroll" == $'\x1b[B' ]]; then + # Scroll para baixo + current_brightness=$(echo "$current_brightness - 0.1" | bc) + if (( $(echo "$current_brightness < 0.0" | bc -l) )); then + current_brightness=0.0 + fi + sudo bash -c "set_brightness $current_brightness" + fi +done diff --git a/configs/hyprland/eww/scripts/details b/configs/hyprland/eww/scripts/details new file mode 100644 index 0000000..e80d436 --- /dev/null +++ b/configs/hyprland/eww/scripts/details @@ -0,0 +1,26 @@ +#!/usr/bin/bash + +if [[ $1 == "--name" ]]; then + fullname=$(getent passwd "$(whoami)" | cut -d ':' -f 5 | cut -d ',' -f 1 | tr -d "\n") + if [ -z "$fullname" ]; then + echo "$(whoami)@$(hostnamectl | awk 'FNR==1 {print $3}')" + else + echo "$fullname" + fi +fi + +if [[ $1 == "--kernel" ]]; then + echo "$(uname -r)" +fi + +if [[ $1 == "--os" ]]; then + echo "$(cat /etc/os-release | awk 'NR==1' | awk -F '"' '{print $2}')" +fi + +if [[ $1 == "--pkgs" ]]; then + echo "$(yay -Q | wc -l)" +fi + +if [[ $1 == "--wm" ]]; then + echo "$XDG_CURRENT_DESKTOP" +fi \ No newline at end of file diff --git a/configs/hyprland/eww/scripts/mediacontrol b/configs/hyprland/eww/scripts/mediacontrol new file mode 100644 index 0000000..37a710b --- /dev/null +++ b/configs/hyprland/eww/scripts/mediacontrol @@ -0,0 +1,242 @@ +#!/usr/bin/bash + +# ╔╦╗ ╦ ╦ ╔═╗ ╦ ╔═╗ +# ║║║ ║ ║ ╚═╗ ║ ║ +# ╩ ╩ ╚═╝ ╚═╝ ╩ ╚═╝ + +# author Niraj +# github niraj998 + +# ┌─┐┌─┐┌┐┌┌─┐┬┌─┐┬ ┬┬─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐ +# │ │ ││││├┤ ││ ┬│ │├┬┘├─┤ │ ││ ││││└─┐ +# └─┘└─┘┘└┘└ ┴└─┘└─┘┴└─┴ ┴ ┴ ┴└─┘┘└┘└─┘ + +# uncomment your music players below. +# + +[ -n "$(pgrep spotify)" ] && Control="spotify" +#[ -n "$(pgrep firefox)" ] && Control="firefox" +# [ -n "$(pgrep rhythmbox)" ] && Control="rhythmbox" +# [ -n "$(pgrep audacious)" ] && Control="audacious" +# [ -n "$(pgrep clementine)" ] && Control="clementine" +# [ -n "$(pgrep strawberry)" ] && Control="strawberry" + +# saves covers here +Cover=/tmp/cover.png +# if cover not found in metadata use this instead +bkpCover=~/.config/bspwm/assets/fallback.webp + +# ┌─┐┬ ┌─┐┬ ┬┌─┐┬─┐┌─┐┌┬┐┬ ┌─┐┌─┐┬─┐┬┌─┐┌┬┐┌─┐ +# ├─┘│ ├─┤└┬┘├┤ ├┬┘│ │ │ └─┐│ ├┬┘│├─┘ │ └─┐ +# ┴ ┴─┘┴ ┴ ┴ └─┘┴└─└─┘ ┴ ┴─┘ └─┘└─┘┴└─┴┴ ┴ └─┘ + +########################## Title ########################## +title() { + title=$(playerctl --player=$Control metadata --format {{title}}) + [ -z "$title" ] && title="Eagerly awaiting the music." + echo "$title" +} + +########################## Artist ########################## +artist() { + artist=$(playerctl --player=$Control metadata --format {{artist}}) + [ -z "$artist" ] && artist="Artist" + echo "$artist" +} + +########################## Album ########################## +album() { + album=$(playerctl --player=$Control metadata --format {{album}}) + [ -z "$album" ] && album="Album" + echo "$album" +} + +########################## Status ########################## +status() { + status=$(playerctl --player=$Control status) + [ -z "$status" ] && status="Stopped" + echo "$status" +} + +########################## Time ########################## +position() { + time=$(playerctl --player=$Control position --format "{{ duration(position) }}") + [ -z "$time" ] && time="0:00" + echo "$time" +} + +positions() { + position=$(playerctl --player=$Control metadata --format "{{ duration(position) }}") + [ -z "$position" ] && position="0:00" + time=$position + if [[ $time == *:* ]]; then + minutes=${time%%:*} + seconds=${time#*:} + seconds=$((${seconds#0})) + else + minutes=${time:0:1} + seconds=${time:2:2} + fi + total_seconds=$((minutes * 60 + seconds)) + echo $total_seconds +} + +########################## Length ########################## +length() { + length=$(playerctl --player=$Control metadata --format "{{ duration(mpris:length) }}") + [ -z "$length" ] && length="0:00" + echo "$length" +} + +lengths() { + length=$(playerctl --player=$Control metadata --format "{{ duration(mpris:length) }}") + [ -z "$length" ] && length="0:00" + time=$length + if [[ $time == *:* ]]; then + minutes=${time%%:*} + seconds=${time#*:} + seconds=$((${seconds#0})) + else + minutes=${time:0:1} + seconds=${time:2:2} + fi + total_seconds=$((minutes * 60 + seconds)) + echo $total_seconds +} + +########################## trackNumber ########################## +playlist() { + playlist=$(playerctl --player=$Control metadata xesam:trackNumber) + [ -z "$playlist" ] && playlist="0" + echo "$playlist" +} + +########################## Cover ########################## +cover() { + albumart="$(playerctl --player=$Control metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')" + [ $(playerctl --player=$Control metadata mpris:artUrl) ] && curl -s "$albumart" --output $Cover || cp $bkpCover $Cover + echo "$Cover" +} + +########################## Statusicon ########################## +statusicon() { + icon="" + [ $(playerctl --player=$Control status) = "Playing" ] && icon="" + [ $(playerctl --player=$Control status) = "Paused" ] && icon="󰐊" + echo "$icon" +} + +########################## Shuffle ########################## +shufflecolor() { + color="#a0a0a0" + [ $(playerctl --player=$Control shuffle) = "On" ] && color="#9ec49f" + [ $(playerctl --player=$Control shuffle) = "Off" ] && color"#a0a0a0" + echo "$color" +} + +########################## Loop ########################## +loopicon() { + icon=" " + [ $(playerctl --player=$Control loop) = "None" ] && icon=" " + [ $(playerctl --player=$Control loop) = "Track" ] && icon" " + [ $(playerctl --player=$Control loop) = "Playlist" ] && icon=" " + echo "$icon" +} + +loopcheck() { + command=$(playerctl -p spotify loop) + + if [[ $command == "None" ]]; then + playerctl -p spotify loop Playlist + fi + + if [[ $command == "Playlist" ]]; then + playerctl -p spotify loop Track + fi + + if [[ $command == "Track" ]]; then + playerctl -p spotify loop None + fi +} + +loopcolor() { + color="#9ec49f" + [ $(playerctl --player=$Control loop) = "None" ] && color="#a0a0a0" + [ $(playerctl --player=$Control loop) = "Track" ] && color"#9ec49f" + [ $(playerctl --player=$Control loop) = "Playlist" ] && color"#9ec49f" + echo "$color" +} + +########################## Lyrics ########################## +lyrics() { + Title=$(playerctl --player=$Control metadata --format {{title}}) + Artist=$(playerctl --player=$Control metadata --format {{artist}}) + URL="https://api.lyrics.ovh/v1/$Artist/$Title" + lyrics=$(curl -s "$(echo "$URL" | sed s/" "/%20/g | sed s/"&"/%26/g | sed s/,/%2C/g | sed s/-/%2D/g)" | jq '.lyrics') + [ "$lyrics" = "null" ] && lyrics=$(curl -s --get "https://makeitpersonal.co/lyrics" --data-urlencode "artist=$Artist" --data-urlencode "title=$Title") + printf "$lyrics" | less +} + +# ┬ ┬┌─┐┬ ┌─┐ +# ├─┤├┤ │ ├─┘ +# ┴ ┴└─┘┴─┘┴ + +doc() { + echo "Usage: + MediaControl [Options] + +Options: + --previous previous song + --next next song + --toggle toggle between play-pause song + --stop stop song + --shuffle shuffle playlist + --loop loop toggle + title shows title of current song + album shows album of current song + artist shows artist of current song + status music status (playing/paused/stopped) + statusicon music status icons (playing/paused/stopped) + shufflecolor huffle status color + loopicon loop status icon + loopcolor loop status color + coverloc saves cover and shows location to cover of current song + showcover opens cover using feh + position shows current position of song + positions shows current position of song in seconds + length shows length of song + lengths shows length of song in seconds + playlist shows playlist position of current song + lyrics shows lyrics" +} + +# ┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐ +# │ │├─┘ │ ││ ││││└─┐ +# └─┘┴ ┴ ┴└─┘┘└┘└─┘ + +case $1 in +--next) playerctl --player=$Control next ;; +--previous) playerctl --player=$Control previous ;; +--toggle) playerctl --player=$Control play-pause ;; +--stop) playerctl --player=$Control stop ;; +--shuffle) playerctl --player=$Control shuffle toggle ;; +--loop) loopcheck ;; +title) title ;; +artist) artist ;; +album) album ;; +status) status ;; +statusicon) statusicon ;; +shufflecolor) shufflecolor ;; +loopicon) loopicon ;; +loopcolor) loopcolor ;; +player) echo "$Control" ;; +coverloc) cover ;; +showcover) cover | xargs feh ;; +position) position ;; +positions) positions ;; +length) length ;; +lengths) lengths ;; +playlist) playlist ;; +lyrics) lyrics ;; +*) doc ;; +esac diff --git a/configs/hyprland/eww/scripts/netspeed b/configs/hyprland/eww/scripts/netspeed new file mode 100644 index 0000000..3b4b505 --- /dev/null +++ b/configs/hyprland/eww/scripts/netspeed @@ -0,0 +1,20 @@ +#!/bin/bash +# thanks to Luke Smith + +update() { + sum=0 + for arg; do + read -r i <"$arg" + sum=$((sum + i)) + done + cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} + [ -f "$cache" ] && read -r old <"$cache" || old=0 + printf %d\\n "$sum" >"$cache" + printf %d\\n $((sum - old)) +} + +tx=$(update /sys/class/net/enp4s0/statistics/tx_bytes) +rx=$(update /sys/class/net/enp4s0/statistics/rx_bytes) + +[ "$1" = "down" ] && printf "%4sB\\n" $(numfmt --to=iec $rx) && exit +[ "$1" = "up" ] && printf "%4sB\\n" $(numfmt --to=iec $tx) && exit diff --git a/configs/hyprland/eww/scripts/network b/configs/hyprland/eww/scripts/network new file mode 100644 index 0000000..5f439c1 --- /dev/null +++ b/configs/hyprland/eww/scripts/network @@ -0,0 +1,34 @@ +#!/usr/bin/bash + +ID="$(ip link | awk '/state UP/ {print $2}')" +NAME="$(ip link | awk '/state UP/ {print $2}' | cut -c 1-6)" + +net_stat() { + if (ping -c 1 archlinux.org || ping -c 1 google.com) &>/dev/null; then + if [[ $ID == e* ]]; then + echo " " + fi + else + echo " " + fi +} + +net_color() { + if (ping -c 1 archlinux.org || ping -c 1 google.com) &>/dev/null; then + echo "#A39EC4" + else + echo "#dd6777" + fi +} + +case "$1" in +stat) + net_stat | head -n1 + ;; +icon) + net_stat | tail -n1 + ;; +color) + net_color + ;; +esac diff --git a/configs/hyprland/eww/scripts/popup b/configs/hyprland/eww/scripts/popup new file mode 100644 index 0000000..b6c5364 --- /dev/null +++ b/configs/hyprland/eww/scripts/popup @@ -0,0 +1,11 @@ +#!/usr/bin/bash + +open_updates() { + $HOME/.config/eww/scripts/updates up +} + +case "$1" in +updates) + open_updates + ;; +esac diff --git a/configs/hyprland/eww/scripts/study b/configs/hyprland/eww/scripts/study new file mode 100644 index 0000000..c194769 --- /dev/null +++ b/configs/hyprland/eww/scripts/study @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +cd ~/ESA\ 2024/ && okular Edital.pdf Horário.pdf & gnome-clocks diff --git a/configs/hyprland/eww/scripts/sysinfo.sh b/configs/hyprland/eww/scripts/sysinfo.sh new file mode 100644 index 0000000..edc23b7 --- /dev/null +++ b/configs/hyprland/eww/scripts/sysinfo.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +get_username() { + fullname=$(getent passwd "$(whoami)" | cut -d ':' -f 5 | cut -d ',' -f 1 | tr -d "\n") + if [ -z "$fullname" ]; then + username="$(whoami)" + else + username="${fullname%% *}" + fi + + # Transforma todo o texto em maiúsculas + username="${username^}" + + echo "@$username" +} +get_kernel_version() { + echo "$(uname -r)" +} + +get_operating_system() { + echo "$(cat /etc/os-release | awk 'NR==1' | awk -F '"' '{print $2}')" +} + +get_installed_packages() { + echo "$(yay -Q | wc -l)" +} + +get_window_manager() { + echo "$XDG_CURRENT_DESKTOP" +} + +get_uptime() { + echo "$(uptime -p | sed -e 's/up //g')" +} + +# Main function +main() { + case "$1" in + "--name") + get_username + ;; + "--kernel") + get_kernel_version + ;; + "--os") + get_operating_system + ;; + "--pkgs") + get_installed_packages + ;; + "--wm") + get_window_manager + ;; + "--uptime") + get_uptime + ;; + *) + echo "Usage: $0 {--name|--kernel|--os|--pkgs|--wm|--uptime}" + exit 1 + ;; + esac +} + +# Call the main function with the provided arguments +main "$@" diff --git a/configs/hyprland/eww/scripts/system b/configs/hyprland/eww/scripts/system new file mode 100644 index 0000000..59f568b --- /dev/null +++ b/configs/hyprland/eww/scripts/system @@ -0,0 +1,58 @@ +#!/usr/bin/bash + +## Files and Data +PREV_TOTAL=0 +PREV_IDLE=0 +cpuFile="/tmp/.cpu_usage" + +## Get CPU usage +get_cpu() { + if [[ -f "${cpuFile}" ]]; then + fileCont=$(cat "${cpuFile}") + PREV_TOTAL=$(echo "${fileCont}" | head -n 1) + PREV_IDLE=$(echo "${fileCont}" | tail -n 1) + fi + + CPU=($(cat /proc/stat | grep '^cpu ')) # Get the total CPU statistics. + unset CPU[0] # Discard the "cpu" prefix. + IDLE=${CPU[4]} # Get the idle CPU time. + + # Calculate the total CPU time. + TOTAL=0 + + for VALUE in "${CPU[@]:0:4}"; do + let "TOTAL=$TOTAL+$VALUE" + done + + if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then + # Calculate the CPU usage since we last checked. + let "DIFF_IDLE=$IDLE-$PREV_IDLE" + let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL" + let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10" + echo "${DIFF_USAGE}" + else + echo "?" + fi + + # Remember the total and idle CPU times for the next check. + echo "${TOTAL}" >"${cpuFile}" + echo "${IDLE}" >>"${cpuFile}" +} + +## Get Used memory +get_mem() { + printf "%.0f\n" "$(free -m | grep Mem | awk '{print ($3/$2)*100}')" +} + +get_mem_mb() { + free -m | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p' +} + +## Execute accordingly +if [[ "$1" == "--cpu" ]]; then + get_cpu +elif [[ "$1" == "--mem" ]]; then + get_mem +elif [[ "$1" == "--memb" ]]; then + get_mem_mb +fi diff --git a/configs/hyprland/eww/scripts/updates b/configs/hyprland/eww/scripts/updates new file mode 100644 index 0000000..3f621b1 --- /dev/null +++ b/configs/hyprland/eww/scripts/updates @@ -0,0 +1,26 @@ +#!/bin/bash + +if ! updates_arch=$(checkupdates 2>/dev/null | wc -l); then + updates_arch=0 +fi + +if ! updates_aur=$(yay -Qum 2>/dev/null | wc -l); then + updates_aur=0 +fi + +updates=$((updates_arch + updates_aur)) + +check() { + if [ "$updates" -gt 0 ]; then + bspc rule -a \* -o state=floating && alacritty -e $SHELL -c 'yay -Syu' + fi +} + +case "$1" in +up) + check + ;; +get) + echo "$updates" + ;; +esac diff --git a/configs/hyprland/eww/scripts/user.sh b/configs/hyprland/eww/scripts/user.sh new file mode 100644 index 0000000..a846ff4 --- /dev/null +++ b/configs/hyprland/eww/scripts/user.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +get_username() { + echo "$(whoami)" +} + +get_kernel_version() { + echo "$(uname -r)" +} + +get_operating_system() { + echo "$(cat /etc/os-release | awk 'NR==1' | awk -F '"' '{print $2}')" +} + +get_installed_packages() { + echo "$(yay -Q | wc -l)" +} + +get_window_manager() { + echo "$XDG_CURRENT_DESKTOP" +} + +# Main function +main() { + case "$1" in + "--name") + get_username + ;; + "--kernel") + get_kernel_version + ;; + "--os") + get_operating_system + ;; + "--pkgs") + get_installed_packages + ;; + "--wm") + get_window_manager + ;; + *) + echo "Usage: $0 {--name|--kernel|--os|--pkgs|--wm}" + exit 1 + ;; + esac +} + +# Call the main function with the provided arguments +main "$@" diff --git a/configs/hyprland/eww/scripts/volume b/configs/hyprland/eww/scripts/volume new file mode 100644 index 0000000..9399795 --- /dev/null +++ b/configs/hyprland/eww/scripts/volume @@ -0,0 +1,7 @@ +#!/bin/bash + +pamixer --get-volume-human | tr -d '%' + +pactl subscribe | rg --line-buffered "on sink" | while read -r _; do + pamixer --get-volume-human | tr -d '%' +done diff --git a/configs/hyprland/eww/scripts/workspace b/configs/hyprland/eww/scripts/workspace new file mode 100644 index 0000000..3bfbe8f --- /dev/null +++ b/configs/hyprland/eww/scripts/workspace @@ -0,0 +1,18 @@ +#!/bin/bash + +WORKSPACES_NUMBER=5 + +workspaces() { + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + CURRENT="$(hyprctl -j monitors | jq '.[0].activeWorkspace.name')" + + seq 1 $WORKSPACES_NUMBER | + jq --argjson windows "${WORKSPACE_WINDOWS}" \ + --argjson current "${CURRENT}" \ + --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0), current: ($current == .)})' +} + +workspaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + workspaces +done diff --git a/configs/hyprland/eww/volume/volume.scss b/configs/hyprland/eww/volume/volume.scss new file mode 100644 index 0000000..e69de29 diff --git a/configs/hyprland/eww/volume/volume.yuck b/configs/hyprland/eww/volume/volume.yuck new file mode 100644 index 0000000..3d058b2 --- /dev/null +++ b/configs/hyprland/eww/volume/volume.yuck @@ -0,0 +1,52 @@ +(defwidget volume [] + (eventbox + :onhover "eww update volume_rev=true" + :onhoverlost "eww update volume_rev=false" + (box + :class "volume" + :space-evenly false + :orientation "v" + (revealer + :class "volume-bar" + :transition "slideup" + :reveal volume_rev + (eventbox + :cursor "pointer" + :halign "center" + (scale + :orientation "v" + :tooltip {volume == "muted" ? "Muted" : "${volume}%"} + :value {volume == "muted" ? "0" : volume} + :min 0 + :max 101 + :onchange "pamixer -u && pamixer --set-volume {}" + :flipped true + ) + ) + ) + (eventbox + :cursor "pointer" + :onscroll "echo {} | sed -e 's/up/--up/g' -e 's/down/--down/g' | xargs volume" + (button + :class "volume icon" + :style {volume == 0 || volume == "muted" ? "color: #dd6777;" : "color: #cacaca;"} + :tooltip {volume == "muted" ? "Muted" : "${volume}%" } + :onclick "volume --toggle" + {volume == 0 || volume == "muted" ? "󰝟" : + volume < 30 ? "" : + volume < 75 ? "" : ""} + ) + ) + ) + ) +) + +(defwindow volume + :monitor 0 + :geometry (geometry :x "1%" + :y "0%" + :height "75%" + :width "25%" + :anchor "center left") + :reserve (struts :side "top" :distance "4%") + (volume))