diff --git a/modules/home/wayland/apps/eww/bar/css/_clock.scss b/modules/home/wayland/apps/eww/bar/css/_clock.scss index 1878671..d5ec014 100644 --- a/modules/home/wayland/apps/eww/bar/css/_clock.scss +++ b/modules/home/wayland/apps/eww/bar/css/_clock.scss @@ -1,6 +1,6 @@ .calendar-win { @include window; - background-color: $bg; + background-color: $bg1; color: $fg; padding: .2em; } diff --git a/modules/home/wayland/apps/eww/bar/css/_sys.scss b/modules/home/wayland/apps/eww/bar/css/_sys.scss index 574633a..ea3a973 100644 --- a/modules/home/wayland/apps/eww/bar/css/_sys.scss +++ b/modules/home/wayland/apps/eww/bar/css/_sys.scss @@ -19,13 +19,45 @@ color: $base0B; .gpubar, .membar, .batbar { - background-color: $bg; + background-color: $bg0; margin: $gaps-window 0; } .icon-text { -padding: 5pt; -font-size: 5pt; -font-weight: 900; + padding: 5pt; + font-size: 5pt; + font-weight: 900; } + +.cpu-core-usage, .gpu-core-usage { + background-color: $bg0; + border-radius: $border-radius; + padding: 2pt; + margin: 1pt; + +} + +.cpu-core-usage trough *, .gpu-core-usage trough * { + background-color: $base0C; + border-radius: $border-radius; + padding: 2pt; +} + +.spacer { + color: $bg1; + padding: $gaps-window; +} + +.sys-win { + margin: $gaps-screen; + } + + +.sys-win-sub { + @include window; + background-color: $bg1; + color: $fg; + padding: .5em; + margin: $gaps-window; + } diff --git a/modules/home/wayland/apps/eww/bar/eww.scss b/modules/home/wayland/apps/eww/bar/eww.scss index 328ac8a..fb389e0 100644 --- a/modules/home/wayland/apps/eww/bar/eww.scss +++ b/modules/home/wayland/apps/eww/bar/eww.scss @@ -10,7 +10,6 @@ @include rounding; } - @import 'css/sys'; @import 'css/net'; @import 'css/clock'; @@ -48,7 +47,7 @@ tooltip { } .focused { - background-color: $bg; + background-color: $bg1; border-radius: 1rem; margin: .3rem; padding: .25rem; @@ -63,7 +62,7 @@ tooltip { border-right-style: none; border-bottom-right-radius: 0; border-top-right-radius: 0; - padding: 0 $gaps-window; + padding: $gaps-screen $gaps-window; margin: $gaps-screen 0; } diff --git a/modules/home/wayland/apps/eww/bar/eww.yuck b/modules/home/wayland/apps/eww/bar/eww.yuck index 4d8b121..280411d 100644 --- a/modules/home/wayland/apps/eww/bar/eww.yuck +++ b/modules/home/wayland/apps/eww/bar/eww.yuck @@ -1,11 +1,11 @@ -(include "./modules/workspaces.yuck") +(include "modules/workspaces.yuck") +(include "modules/sys.yuck") +(include "modules/net.yuck") +(include "modules/clock.yuck") -(include "./modules/sys.yuck") -(include "./modules/net.yuck") -(include "./modules/clock.yuck") - -(include "./windows/calendar.yuck") +(include "windows/calendar.yuck") +(include "windows/sys.yuck") (defwidget left [] diff --git a/modules/home/wayland/apps/eww/bar/modules/sys.yuck b/modules/home/wayland/apps/eww/bar/modules/sys.yuck index a57ddc6..48ac4a8 100644 --- a/modules/home/wayland/apps/eww/bar/modules/sys.yuck +++ b/modules/home/wayland/apps/eww/bar/modules/sys.yuck @@ -5,34 +5,37 @@ (deflisten battery "scripts/sys/battery") (defwidget sys [] - (box - :class "module" - :orientation "v" - (circular-progress - :value {EWW_CPU.avg} - :class "cpubar" - :thickness 6 - (label :class "icon-text" :text "C")) + (button + :onclick "${EWW_CMD} open --toggle sys" + (box + :class "module" + :orientation "v" + (circular-progress + :value {EWW_CPU.avg} + :class "cpubar" + :thickness 6 + (label :class "icon-text" :text "C")) - (circular-progress - :value {gpu.devices[0].GRBM2.CommandProcessor-Graphics.value} - :class "gpubar" - :thickness 6 - (label :class "icon-text" :text "G")) + (circular-progress + :value {gpu.devices[0].GRBM2.CommandProcessor-Graphics.value} + :class "gpubar" + :thickness 6 + (label :class "icon-text" :text "G")) - (circular-progress - :value {memory.percent} - :class "membar" - :thickness 6 - (label :class "icon-text" :text "M")) + (circular-progress + :value {100*memory.used/memory.total} + :class "membar" + :thickness 6 + :tooltip "${memory.human.used} / ${memory.human.total}" + (label :class "icon-text" :text "M")) - (circular-progress - :value {battery.percentage} - :class "batbar" - :visible {battery.visible} - :style "color: ${battery.color};" - :thickness 6 - (label :class "icon-text" :text "B")) - + (circular-progress + :value {battery.percentage} + :class "batbar" + :visible {battery.visible} + :style "color: ${battery.color};" + :thickness 6 + (label :class "icon-text" :text "B")) + ) ) ) diff --git a/modules/home/wayland/apps/eww/bar/scripts/sys/memory b/modules/home/wayland/apps/eww/bar/scripts/sys/memory index 89085b3..99daad4 100755 --- a/modules/home/wayland/apps/eww/bar/scripts/sys/memory +++ b/modules/home/wayland/apps/eww/bar/scripts/sys/memory @@ -8,7 +8,5 @@ human() { free --si -s 3 | rg --line-buffered Mem | while read -r line; do used=$(echo "$line" | awk '{print $3}') - perc=$(awk -v used="$used" -v total="$total" 'BEGIN{print sprintf("%.f", used/total*100)}') - - echo '{"total": "'$(human "$total")'", "used": "'$(human "$used")'", "percent": '$perc'}' + echo '{"human": { "total": "'$(human "$total")'", "used": "'$(human "$used")'"}, "total": "'$total'" , "used": "'$used'"}' done \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar/windows/sys.yuck b/modules/home/wayland/apps/eww/bar/windows/sys.yuck new file mode 100644 index 0000000..392d632 --- /dev/null +++ b/modules/home/wayland/apps/eww/bar/windows/sys.yuck @@ -0,0 +1,121 @@ + +(defwidget cpu-sys-win [] + (box + :space-evenly false + :class "sys-win-sub" + (box + (for core in {EWW_CPU.cores} + (box + :space-evenly false + :class "cpu-core ${core.core}" + (progress + :value {core.usage} + :orientation "v" + :flipped true + :class "cpu-core-usage" + :tooltip "core${core.core} @ ${core.freq}Mhz" + ) + ) + ) + ) + (box :class "spacer" "") + (progress + :value {100*memory.used/memory.total} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "RAM" + ) + ) +) + +(defwidget gpu-sys-win [] + (box + :space-evenly false + :class "sys-win-sub" + (progress + :value {gpu.devices[0].GRBM2.CommandProcessor-Compute.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "Compute" + ) + (progress + :value {gpu.devices[0].GRBM2.CommandProcessor-Fetcher.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "Fetcher" + ) + (progress + :value {gpu.devices[0].GRBM2.CommandProcessor-Graphics.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "Graphics" + ) + (box :class "spacer" "") + (progress + :value {gpu.devices[0].gpu_activity.GFX.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "GFX" + ) + (progress + :value {gpu.devices[0].gpu_activity.Memory.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "Memory" + ) + (progress + :value {gpu.devices[0].gpu_activity.MediaEngine.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "Media" + ) + (box :class "spacer" "") + (progress + :value {100*gpu.devices[0].VRAM.TotalVRAMUsage.value/gpu.devices[0].VRAM.TotalVRAM.value} + :orientation "v" + :flipped true + :class "gpu-core-usage" + :tooltip "VRAM" + ) + ) +) + +(defwidget ram-sys-win [] + (box + :space-evenly false + :class "sys-win-sub" + ) +) + + + +(defwidget sys-win [] + (box + :class "sys-win" + :space-evenly false + :orientation "v" + (box + :space-evenly false + :orientation "h" + (cpu-sys-win) + (gpu-sys-win) + ) + ) +) + +(defwindow sys + :monitor 0 + :geometry (geometry + :x "0%" + :y "0%" + :anchor "bottom right" + :width "0px" + :height "0px") + (sys-win)) \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/css/_calendar.scss b/modules/home/wayland/apps/eww/bar_old/css/_calendar.scss deleted file mode 100755 index 5256b99..0000000 --- a/modules/home/wayland/apps/eww/bar_old/css/_calendar.scss +++ /dev/null @@ -1,31 +0,0 @@ -.calendar-win { - @include window; - background-color: $bg; - color: $fg; - padding: .2em; -} - -calendar { - padding: 5px; - - :selected { - color: $base0C; - } - - .header { - color: $base05; - } - - .highlight { - color: $base0C; - font-weight: bold; - } - - .button { - color: $base0C; - } - - :indeterminate { - color: $base03; - } -} diff --git a/modules/home/wayland/apps/eww/bar_old/css/_sidebar.scss b/modules/home/wayland/apps/eww/bar_old/css/_sidebar.scss deleted file mode 100755 index a1235a6..0000000 --- a/modules/home/wayland/apps/eww/bar_old/css/_sidebar.scss +++ /dev/null @@ -1,123 +0,0 @@ -.system-menu-box { - @include window; - background-color: $bg; - color: $fg; -} - -.separator { - font-size: 1rem; -} - -.top-row { - margin: 1rem 1.5rem 0; - - .time { font-size: 2rem; } - - .date-box { - margin: 0 1rem; - - label { font-size: 1.1rem; } - - .date { - background: unset; - margin: 0 .5rem 0 0; - padding: 0; - } - } - - button { - background-color: $bg1; - border-radius: 16px; - margin-bottom: .1rem; - padding: 0 .5rem; - - label { font-size: 1.5rem; } - &:hover { background-color: $bg1; } - } -} - -.system-row { - margin: .5rem .7rem; - - label { - font-size: 1rem; - margin: 0 .1rem; - } -} - -.element { - @include rounding; - background-color: $bg1; - margin: .3rem; - - button { - @include rounding; - padding: 1rem 3rem; - - label { - font-size: 1.5rem; - } - - &:hover { - background-color: rgba(255, 255, 255, 0.2); - } - } -} - -.sliders { - @include rounding; - background-color: $bg1; - margin: .5rem 1rem; - padding: .6rem 1rem; - - scale { - margin-right: -1rem; - min-width: 21.5rem; - - trough { margin-right: 0; } - } - - box { margin: .2rem 0; } - label { font-size: 1.2rem; } -} - -.volume-slider-box, -.brightness-slider-box { - trough { background-color: $base02; } -} - -.volume-bar highlight { - @include rounding; - background-image: linear-gradient(to right, $base0B, $base0C); -} - -.brightness-bar highlight { - @include rounding; - background-image: linear-gradient(to right, $base0A, $base0B); -} - -.bottom-row { - margin: .5rem 1rem; - - .battery-icon { font-size: 2rem; } - .battery-wattage { color: $base0A; } - - .battery-status { - color: $base04; - margin: 0 .5rem; - } -} - -.bt-connected { - background-color: $base0C; - color: $base00; - - button:hover { background-color: rgba(0, 0, 0, .3); } -} - -.net-connected { - background-color: $base0C; - color: $base00; - - button:hover { background-color: rgba(0, 0, 0, .3); } -} diff --git a/modules/home/wayland/apps/eww/bar_old/css/_system.scss b/modules/home/wayland/apps/eww/bar_old/css/_system.scss deleted file mode 100755 index 1d0ae20..0000000 --- a/modules/home/wayland/apps/eww/bar_old/css/_system.scss +++ /dev/null @@ -1,76 +0,0 @@ -.membar { - color: $base08; -} - -.cpubar { - color: $base0C; -} - -.batbar { - color: $base0B; -} - -.membar, -.cpubar, -.batbar { - background-color: $bg1; -} - -.iconmem { - color: $base08; -} - -.iconcpu { - color: $base0C; -} - -.icon-text { - font-size: 3rem; - padding: .7rem; -} - -.sys-text-sub { - color: $fg; -} - -.sys-text-mem, -.sys-text-cpu { - font-size: 1rem; - font-weight: bold; -} - -.sys-icon-mem, -.sys-icon-cpu { - font-size: 1.5rem; - margin: 1.5rem; -} - -.system-info-box { - @include rounding; - background-color: $bg1; - margin: .5rem 1rem; - padding: .5rem; -} - -.sys-mem, -.sys-cpu { - background-color: $bg; -} - -.sys-icon-mem, -.sys-text-mem, -.sys-mem { - color: $base08; -} - -.sys-icon-cpu, -.sys-text-cpu, -.sys-cpu { - color: $base0C; -} - -.sys-box { - margin: .3em; - - box { margin-left: 1rem; } -} diff --git a/modules/home/wayland/apps/eww/bar_old/eww.scss b/modules/home/wayland/apps/eww/bar_old/eww.scss deleted file mode 100755 index 6929d66..0000000 --- a/modules/home/wayland/apps/eww/bar_old/eww.scss +++ /dev/null @@ -1,109 +0,0 @@ -@import 'css/colors'; - -@mixin rounding { - border-radius: 16px; -} - -@mixin window { - border: 2px solid $base03; - margin: 5px 5px 10px; - @include rounding; -} - -* { - all: unset; - font-family: "IBM Plex Mono"; - transition: 200ms ease; -} - -@import 'css/calendar'; -@import 'css/sidebar'; -@import 'css/system'; - -.bar { - background-color: $bg; - color: $fg; - border-bottom: 2px solid $base03; - - label { - font-size: 1.2rem; - } -} - -tooltip { - background: $bg; - border: 1px solid $border; - border-radius: 8px; - - label { - font-size: 1rem; - } -} - -.icon, -.icon label { font-family: Material Design Icons; } - -.ws { - border-radius: 2rem; - margin: .7rem .25rem; -} - -.focused { - background-color: $bg; - border-radius: 1rem; - margin: .3rem; - padding: .25rem; -} - -.module { margin: 0 5px; } - -.hour { - font-weight: bold; - padding-left: 5px; -} - -.minute { - padding-right: .7rem; -} - -.date { - background: $bg; - color: $base0C; - - label { - font-size: 1.2rem; - } -} - -.bright-icon { color: $base09; } -.module-bt { font-size: 1.2rem; } - -scale trough { - background-color: $bg1; - border-radius: 24px; - margin: 0 1rem; - min-height: 10px; - min-width: 70px; -} - -.workspaces { margin-left: 10px; } - -.grey { - background-color: $base02; -} - -.red { - background-color: $base0F; -} - -.orange { - background-color: $base08; -} - -.green { - background-color: $base0B; -} - -.blue { - background-color: $base0C; -} \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/eww.yuck b/modules/home/wayland/apps/eww/bar_old/eww.yuck deleted file mode 100755 index 9599c8a..0000000 --- a/modules/home/wayland/apps/eww/bar_old/eww.yuck +++ /dev/null @@ -1,44 +0,0 @@ -(include "./modules/clock.yuck") -(include "./modules/net.yuck") -(include "./modules/sys.yuck") -(include "./modules/variables.yuck") -(include "./modules/workspaces.yuck") - -(include "./windows/calendar.yuck") -(include "./windows/system.yuck") - -(defwidget left [] - (box - :space-evenly false - :halign "start" - (workspaces))) - -(defwidget right [] - (box - :space-evenly false - :halign "end" - (sys) - (clock_module))) - -(defwidget center [] - (box - :space-evenly false - :halign "center" - )) - -(defwidget bar-box [] - (centerbox - (left) - (center) - (right))) - -(defwindow bar - :monitor 0 - :geometry (geometry :x "0%" - :y "0%" - :width "100%" - :height "32px" - :anchor "top center") - :stacking "fg" - :exclusive true - (bar-box)) \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/modules/clock.yuck b/modules/home/wayland/apps/eww/bar_old/modules/clock.yuck deleted file mode 100755 index 4b13d9e..0000000 --- a/modules/home/wayland/apps/eww/bar_old/modules/clock.yuck +++ /dev/null @@ -1,24 +0,0 @@ -(defvar date_rev false) - -(defwidget clock_module [] - (eventbox - :onhover "${EWW_CMD} update date_rev=true" - :onhoverlost "${EWW_CMD} update date_rev=false" - (overlay - :class "module" - (box - :space-evenly false - (label - :text {time.hour} - :class "hour") - (label - :text ":") - (label - :text {time.minute} - :class "minute")) - (revealer - :reveal date_rev - (button - :class "date" - :onclick "${EWW_CMD} open --toggle calendar" - {time.date}))))) diff --git a/modules/home/wayland/apps/eww/bar_old/modules/net.yuck b/modules/home/wayland/apps/eww/bar_old/modules/net.yuck deleted file mode 100755 index 8f92313..0000000 --- a/modules/home/wayland/apps/eww/bar_old/modules/net.yuck +++ /dev/null @@ -1,7 +0,0 @@ -(defwidget net [] - (button - :class "module icon" - :onclick "gnome-control-center &" - :tooltip {net.name} - :style "color: ${net.color};" - {net.icon})) diff --git a/modules/home/wayland/apps/eww/bar_old/modules/sys.yuck b/modules/home/wayland/apps/eww/bar_old/modules/sys.yuck deleted file mode 100755 index 569c8d3..0000000 --- a/modules/home/wayland/apps/eww/bar_old/modules/sys.yuck +++ /dev/null @@ -1,30 +0,0 @@ -(defwidget sys [] - (box - :class "module" - :space-evenly false - :spacing 5 - (circular-progress - :value {EWW_CPU.avg} - :class "cpubar" - :thickness 3 - (button - :onclick "${EWW_CMD} open --toggle system-menu" - (label :class "icon-text" :text ""))) - - (circular-progress - :value {memory.percent} - :class "membar" - :thickness 3 - (button - :onclick "${EWW_CMD} open --toggle system-menu" - (label :class "icon-text" :text ""))) - - (circular-progress - :value {battery.percentage} - :class "batbar" - :style "color: ${battery.color};" - :thickness 3 - (button - :tooltip "${battery.percentage}%" - :onclick "${EWW_CMD} open --toggle system-menu" - (label :class "icon-text" :text ""))))) diff --git a/modules/home/wayland/apps/eww/bar_old/modules/variables.yuck b/modules/home/wayland/apps/eww/bar_old/modules/variables.yuck deleted file mode 100755 index 3ba4a51..0000000 --- a/modules/home/wayland/apps/eww/bar_old/modules/variables.yuck +++ /dev/null @@ -1,17 +0,0 @@ -(defvar bright_reveal false) -(defvar bt_rev false) -(defvar net_rev false) -(defvar time_rev false) -(defvar vol_reveal false) - -(defpoll time :interval "5s" `date +'{"date": "%d/%m", "hour": "%H", "minute": "%M", "day": "%A"}'`) - -(deflisten flightmode "scripts/flightmode") -(deflisten powermode "scripts/powermode") -(deflisten battery "scripts/battery") -(deflisten bluetooth "scripts/bluetooth") -(deflisten brightness "scripts/brightness") -(deflisten memory "scripts/memory") -(deflisten net "scripts/net") -(deflisten volume "scripts/volume") -(deflisten workspace "scripts/workspaces") diff --git a/modules/home/wayland/apps/eww/bar_old/modules/workspaces.yuck b/modules/home/wayland/apps/eww/bar_old/modules/workspaces.yuck deleted file mode 100755 index f8464c4..0000000 --- a/modules/home/wayland/apps/eww/bar_old/modules/workspaces.yuck +++ /dev/null @@ -1,13 +0,0 @@ -(defwidget workspaces [] - (eventbox - :onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace" - (box - :class "module workspaces" - (for ws in workspace - (button - :onclick "hyprctl dispatch workspace ${ws.number}" - :class "ws icon ${ws.color}" - ; :tooltip {ws.tooltip} - (box - :class `${ws.focused ? "focused" : ""}` - :height 3)))))) diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/brightness b/modules/home/wayland/apps/eww/bar_old/scripts/brightness deleted file mode 100755 index 6270197..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/brightness +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -function get_time_ms { - date -u +%s%3N -} - -icons=("󰛩" "󱩒" "󰛨") - -gen_output() { - icon="${icons[$(awk -v n="$(brillo)" 'BEGIN{print int(n/34)}')]}" - prcnt=$(brillo | xargs printf "%.*f\n" "0") - echo '{"percent": '$prcnt', "icon": "'$icon'"}' -} - -if [[ $(brillo 2>/dev/stdout 1>/dev/null | head -n1 | awk '{print $1}') == "No" ]]; then - echo '{"percent": 100, "icon": "󰛨"}' -elif [ "$1" = "" ]; then - # initial - last_time=$(get_time_ms) - gen_output - - udevadm monitor | rg --line-buffered "backlight" | while read -r _; do - current_time=$(get_time_ms) - delta=$((current_time - last_time)) - if [[ $delta -gt 50 ]]; then - gen_output - last_time=$(get_time_ms) - fi - done -fi \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/flightmode b/modules/home/wayland/apps/eww/bar_old/scripts/flightmode deleted file mode 100755 index 59e18c5..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/flightmode +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -icon() { - [ "$STATUS" = "no" ] && echo "󰀞" || echo "󰀝" -} - -toggle() { - if [ "$STATUS" = "no" ]; then - rfkill block all - else - rfkill unblock all - fi -} - -if [ "$1" = "toggle" ]; then - toggle -else - icon - rfkill event | while read -r _; do - STATUS="$(rfkill list | sed -n 2p | awk '{print $3}')" - icon - done -fi \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/net b/modules/home/wayland/apps/eww/bar_old/scripts/net deleted file mode 100755 index a41f844..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/net +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash - -function get_time_ms { - date -u +%s%3N -} - -icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨") - -function toggle() { - status=$(rfkill | grep wlan | awk '{print $4}') - - if [ "$status" = "unblocked" ]; then - rfkill block wlan - else - rfkill unblock wlan - fi -} - -function gen_wifi() { - signal=$(cat /proc/net/wireless | head -n3 | tail -n1 | awk '{print $3}') - level=$(awk -v n="$signal" 'BEGIN{print int((n-1)/20)}') - if [ "$level" -gt 4 ]; then - level=4 - fi - - icon=${icons[$level]} - color="#cba6f7" - class="net-connected" - name=$(wpa_cli status | grep \^ssid= | sed 's/ssid=//g') -} - -function gen_ethernet() { - icon="󰈀" - class="net-connected" - color="#cba6f7" - name=Wired -} - -function make_content() { - local ethernet wifi - ethernet=$(ip link | rg "^[0-9]+: en[po]+" | head -n1 | sed 's/[a-zA-Z0-9_,><:\ -]*state //g' | sed 's/ mode [a-zA-Z0-9 ]*//g') - wifi=$(wpa_cli status | rg "^wpa_state=" | sed 's/wpa_state=//g') - - # test ethernet first - if [[ $ethernet == "UP" ]]; then - gen_ethernet - elif [[ $wifi == "COMPLETED" ]]; then - gen_wifi - else - icon="󰤮" - color="#988ba2" - class="net-disconnected" - name="Disconnected" - fi - - echo '{"icon": "'$icon'", "name": "'$name'", "color": "'$color'", "class": "'$class'"}' -} - -if [ "$1" = "toggle" ]; then - toggle -else - last_time=$(get_time_ms) - make_content - ip monitor | while read -r _; do - current_time=$(get_time_ms) - delta=$((current_time - last_time)) - if [[ $delta -gt 50 ]]; then - make_content - last_time=$(get_time_ms) - fi - done -fi diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/powermode b/modules/home/wayland/apps/eww/bar_old/scripts/powermode deleted file mode 100755 index 31710ef..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/powermode +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -icon() { - [ "$STATUS" = "no" ] && echo "󰌪" || echo "󱐋" -} - -toggle() { - if [ "$STATUS" = "no" ]; then - echo "" - else - echo "" - fi -} - -if [ "$1" = "toggle" ]; then - toggle - icon -else - icon -fi \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/sys/battery b/modules/home/wayland/apps/eww/bar_old/scripts/sys/battery deleted file mode 100755 index 7855013..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/sys/battery +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -icons=("󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹") -num_icons=$(awk -v n="${#icons[@]}" 'BEGIN{print 100 / n}') -BATTERY="/sys/class/power_supply/BAT0" - -geticon() { - level=$(awk -v n="$CAPACITY" -v c="$num_icons" 'BEGIN{print int(n/c-1)}') - echo "${icons[$level]}" -} - -status() { - if [ "$STATE" = "Charging" ]; then - echo -n "charging" - - if [ "$RATE" -gt 0 ]; then - echo ", $(gettime) left" - else - echo "" - fi - elif [ "$STATE" = "Discharging" ]; then - echo "$(gettime)h left" - else - echo "fully charged" - fi -} - -color() { - [ "$CAPACITY" -le 20 ] && echo '#f38ba8' || echo '#a6e3a1' -} - -wattage() { - awk -v rate="$RATE" -v uw="1000000" 'BEGIN{print sprintf("%.1f W", rate/uw)}' -} - -gettime() { - FULL=$(cat $BATTERY/energy_full) - NOW=$(cat $BATTERY/energy_now) - - if [ "$RATE" -gt 0 ]; then - if [ "$STATE" = "Discharging" ]; then - EX="$NOW / $RATE" - else - EX="($FULL - $NOW) / $RATE" - fi - date -u -d@"$(awk -v ex="$EX" 'BEGIN{print ex * 3600}')" +%H:%M - fi -} - -if [ -d "$BATTERY" ]; then - while true; do - RATE=$(cat $BATTERY/power_now) - CAPACITY=$(cat $BATTERY/capacity) - STATE=$(cat $BATTERY/status) - - echo '{ "icon": "'$(geticon)'", "percentage": '$CAPACITY', "wattage": "'$(wattage)'", "status": "'$(status)'", "color": "'$(color)'" }' - sleep 5 - done -else - echo '{ "icon": "", "percentage": 0.0, "wattage": "", "status": "", "color": "#a6e3a1" }' -fi diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/sys/memory b/modules/home/wayland/apps/eww/bar_old/scripts/sys/memory deleted file mode 100755 index 89085b3..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/sys/memory +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -total="$(free --si | rg Mem | awk '{print $2}')" - -human() { - awk -v mem="$1" 'BEGIN{print sprintf("%.1f%s", mem/1000/(mem > 1000000 ? 1000 : 1), mem > 1000000 ? "G" : "M")}' -} - -free --si -s 3 | rg --line-buffered Mem | while read -r line; do - used=$(echo "$line" | awk '{print $3}') - perc=$(awk -v used="$used" -v total="$total" 'BEGIN{print sprintf("%.f", used/total*100)}') - - echo '{"total": "'$(human "$total")'", "used": "'$(human "$used")'", "percent": '$perc'}' -done \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/sys/volume b/modules/home/wayland/apps/eww/bar_old/scripts/sys/volume deleted file mode 100755 index dcafe42..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/sys/volume +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash - -function get_time_ms { - date -u +%s%3N -} - -volicons=("󰕿" "󰖀" "󰕾") - -vol() { - wpctl get-volume @DEFAULT_AUDIO_"$1"@ | awk '{print int($2*100)}' -} -ismuted() { - wpctl get-volume @DEFAULT_AUDIO_"$1"@ | rg -qi muted - echo -n $? -} -setvol() { - wpctl set-volume @DEFAULT_AUDIO_"$1"@ "$(awk -v n="$2" 'BEGIN{print (n / 100)}')" -} -setmute() { - wpctl set-mute @DEFAULT_AUDIO_"$1"@ toggle -} - -gen_output() { - percent="$(vol "SINK")" - lvl=$(awk -v n="$percent" 'BEGIN{print int(n/34)}') - ismuted=$(ismuted "SINK") - - if [ "$ismuted" = 1 ]; then - icon="${volicons[$lvl]}" - else - icon="󰝟" - fi - - echo '{"icon": "'$icon'", "percent": '$(vol "SINK")', "microphone": '$(vol "SOURCE")'}' -} - -if [ "$1" = "mute" ]; then - if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then - echo "Can only mute SINK or SOURCE" - exit 1 - fi - setmute "$2" -elif [ "$1" = "setvol" ]; then - if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then - echo "Can only set volume for SINK or SOURCE" - exit 1 - elif [ "$3" -lt 0 ] || [ "$3" -gt 100 ]; then - echo "Volume must be between 0 and 100" - exit 1 - fi - setvol "$2" "$3" -else - last_time=$(get_time_ms) - gen_output - - pw-cli -m 2>/dev/null | rg --line-buffered "PipeWire:Interface:Client" | while read -r event; do - current_time=$(get_time_ms) - delta=$((current_time - last_time)) - if [[ $delta -gt 50 ]]; then - gen_output - last_time=$(get_time_ms) - fi - done -fi diff --git a/modules/home/wayland/apps/eww/bar_old/scripts/workspaces b/modules/home/wayland/apps/eww/bar_old/scripts/workspaces deleted file mode 100755 index 8db57c1..0000000 --- a/modules/home/wayland/apps/eww/bar_old/scripts/workspaces +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -colors=("blue" "orange" "green" "red") -empty="grey" - -# get initial focused workspace -focusedws=$(hyprctl -j monitors | jaq -r '.[] | select(.focused == true) | .activeWorkspace.id') - -declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0) -declare -A monitormap -declare -A workspaces - -# set color for each workspace -status() { - if [ "${o[$1]}" -eq 1 ]; then - mon=${monitormap[${workspaces[$1]}]} - echo -n "${colors[$mon]}" - else - echo -n "$empty" - fi -} - -# handle workspace create/destroy -workspace_event() { - while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jaq -jr '.[] | .id, " ", .monitor, "\n"') -} -# handle monitor (dis)connects -monitor_event() { - while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | jaq -jr '.[] | .name, " ", .id, "\n"') -} - -# get all apps titles in a workspace -applist() { - ws="$1" - - apps=$(hyprctl -j clients | jaq -jr '.[] | select(.workspace.id == '"$ws"') | .title + "\\n"') - echo -En "${apps%"\n"}" -} - -# generate the json for eww -generate() { - echo -n '[' - - for i in {1..10}; do - echo -n ''"$([ "$i" -eq 1 ] || echo ,)" '{"number": "'"$i"'", "color": "'"$(status "$i")"'", "focused": '"$([ "$focusedws" = "$i" ] && echo "true" || echo "false")"'}' #, "tooltip": "'$(applist "$i")'" }' - done - - echo ']' -} - -# setup - -# add monitors -monitor_event - -# add workspaces -workspace_event - -# check occupied workspaces -for num in "${!workspaces[@]}"; do - o[$num]=1 -done -# generate initial widget -generate - -# main loop -socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "workspace|mon(itor)?" | while read -r line; do - case ${line%>>*} in - "workspace") - focusedws=${line#*>>} - ;; - "focusedmon") - focusedws=${line#*,} - ;; - "createworkspace") - o[${line#*>>}]=1 - ;; - "destroyworkspace") - o[${line#*>>}]=0 - ;; - "monitor"*) - monitor_event - ;; - esac - generate -done \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/windows/calendar.yuck b/modules/home/wayland/apps/eww/bar_old/windows/calendar.yuck deleted file mode 100755 index ad407d8..0000000 --- a/modules/home/wayland/apps/eww/bar_old/windows/calendar.yuck +++ /dev/null @@ -1,14 +0,0 @@ -(defwidget calendar-win [] - (box - :class "calendar-win" - (calendar))) - -(defwindow calendar - :monitor 0 - :geometry (geometry - :x "0%" - :y "0%" - :anchor "top right" - :width "0px" - :height "0px") - (calendar-win)) \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/bar_old/windows/system.yuck b/modules/home/wayland/apps/eww/bar_old/windows/system.yuck deleted file mode 100755 index ef59132..0000000 --- a/modules/home/wayland/apps/eww/bar_old/windows/system.yuck +++ /dev/null @@ -1,188 +0,0 @@ -(defwidget system-menu [] - (box - :class "system-menu-box" - :space-evenly false - :orientation "v" - (centerbox - :class "top-row" - (box - (label - :class "time" - :text "${time.hour}:${time.minute}") - (box - :class "date-box" - :space-evenly false - (label - :class "date" - :text {time.date} - ) - (label - :class "day" - :text {time.day} - ) - ) - ) - (label) - (box - :space-evenly false - :halign "end" - (button - :halign "end" - :class "power-button icon" - :onclick "wlogout -p layer-shell -c 10 -m 500 &" - "󰐥" - ) - ) - ) - - (centerbox - :class "system-row" - (box - :class "net-box" - :space-evenly false - :orientation "v" - (box - :class "element icon ${net.class}" - (button - :class "net-button" - :onclick "scripts/net toggle" - {net.icon} - ) - ) - (label - :text {net.name} - :xalign 0.5 - :limit-width 15 - ) - ) - - (box - :class "flightmode-box" - :space-evenly false - :orientation "v" - (box - :class "element" - (button - :class "flightmode-button" - :onclick "scripts/flightmode toggle" - flightmode - ) - ) - (label - :text "Flight Mode" - :xalign 0.5 - :limit-width 16 - ) - ) - - (box - :class "powermode-box" - :space-evenly false - :orientation "v" - (box - :class "element" - (button - :class "powermode-button" - :onclick "scripts/powermode toggle" - powermode)) - (label - :text "Power Mode" - :xalign 0.5 - :limit-width 16))) - - (box - :class "sliders" - :orientation "v" - (box - :class "volume-slider-box" - :space-evenly false - (button - :class "volume-icon icon" - :onclick "scripts/volume mute SINK" - {volume.icon}) - (scale - :class "volume-bar" - :value {volume.percent} - :onchange "scripts/volume setvol SINK {}")) - (box - :class "brightness-slider-box" - :space-evenly false - (button - :class "brightness-slider-icon icon" - {brightness.icon}) - (scale - :class "brightness-bar" - :value {brightness.percent} - :onchange "brillo -S {}"))) - - (box - :class "system-info-box" - - ; cpu - (box - :class "sys-box" - :space-evenly false - :halign "start" - (circular-progress - :value "${EWW_CPU.avg}" - :class "sys-cpu" - :thickness 3 - (label - :text "󰻠" - :class "sys-icon-cpu icon")) - (box - :orientation "v" - :vexpand false - (label - :text "CPU" - :halign "start" - :class "sys-text-cpu") - (label - :text "${round(EWW_CPU.avg,2)}%" - :halign "start" - :class "sys-text-sub") - (label - :text "${EWW_CPU.cores[0].freq} MHz" - :halign "start" - :class "sys-text-sub"))) - - ; memory - (box - :class "sys-box" - :space-evenly false - :halign "end" - (circular-progress - :value {memory.percent} - :class "sys-mem" - :thickness 3 - (label - :text "󰍛" - :class "sys-icon-mem icon")) - (box - :orientation "v" - (label - :text "RAM" - :halign "start" - :class "sys-text-mem") - (label - :text "${memory.used} | ${memory.total}" - :halign "start" - :class "sys-text-sub" - ) - ) - ) - ) - (label) - ) -) - -(defwindow system-menu - :stacking "fg" - :monitor 0 - :geometry (geometry - :x "0" - :y "0" - :width "0%" - :height "0%" - :anchor "right top") - (system-menu)) \ No newline at end of file diff --git a/modules/home/wayland/apps/eww/default.nix b/modules/home/wayland/apps/eww/default.nix index 9c03759..2be4c5c 100755 --- a/modules/home/wayland/apps/eww/default.nix +++ b/modules/home/wayland/apps/eww/default.nix @@ -35,10 +35,11 @@ $fg: $base07; - $bg: $base00; + $bg0: $base00; $bg1: $base01; - $border: $base03; + $border-color: $base03; + $border-color-focus: $base04; $border-radius: ${config.colorScheme.colors.border-radius}px; $border-width: ${config.colorScheme.colors.border-width}px; diff --git a/modules/home/wayland/hyprland/config.nix b/modules/home/wayland/hyprland/config.nix index 6cd4d05..ec00402 100755 --- a/modules/home/wayland/hyprland/config.nix +++ b/modules/home/wayland/hyprland/config.nix @@ -92,8 +92,8 @@ workspace_swipe = off } - # exec-once = eww open bar - exec-once = waybar + exec-once = eww open bar + #exec-once = waybar exec-once = dunst exec-once = swww init