From d9cf8e32a767aaf6426a418e3c57c649678a23e1 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 21 Dec 2022 09:13:28 -0600 Subject: [PATCH] updating a lot of hyprland config pieces --- dunst/dunstrc | 2 +- eww/battery.yuck | 37 +++++++++ eww/eww.scss | 53 +++++++++--- eww/eww.yuck | 185 ++++++++++++++++++++---------------------- eww/scripts/appname | 3 +- eww/scripts/workspace | 7 +- eww/sidebar.yuck | 106 ++++++++++++------------ hypr/hyprland.conf | 4 +- scripts/batmon | 20 +++++ 9 files changed, 245 insertions(+), 172 deletions(-) create mode 100644 eww/battery.yuck create mode 100755 scripts/batmon diff --git a/dunst/dunstrc b/dunst/dunstrc index 01db5b2..533decc 100644 --- a/dunst/dunstrc +++ b/dunst/dunstrc @@ -243,7 +243,7 @@ # corners. # The radius will be automatically lowered if it exceeds half of the # notification height to avoid clipping text and/or icons. - corner_radius = 12 + corner_radius = 18 # Ignore the dbus closeNotification message. # Useful to enforce the timeout set by dunst configuration. Without this diff --git a/eww/battery.yuck b/eww/battery.yuck new file mode 100644 index 0000000..99e5d58 --- /dev/null +++ b/eww/battery.yuck @@ -0,0 +1,37 @@ +(defwindow battery + :geometry (geometry :x "0px" + :y "40px" + :width "200px" + :height "60px" + :anchor "bottom center") + :stacking "fg" + :monitor "0" +(battery)) + +(defwidget battery [] + (box + :class "battery-container" + :orientation "h" + :vexpand "false" + :hexpand "false" + :space-evenly "false" + :spacing 5 + (button + :class "battery-icon" + :onclick "" "") + (box + :orientation "v" + :space-evenly "false" + :vexpand "false" + :hexpand "false" + :spacing 5 + (label + :class "battery-label" + :halign "start" + :text "Battery is at ${round(EWW_BATTERY['BAT1'].capacity, 0)}%, plug it in you dope.") + (scale + :class "battery-value" + :value {EWW_BATTERY["BAT1"].capacity} + :orientation "h" + :max 100 + :min 0)))) diff --git a/eww/eww.scss b/eww/eww.scss index d369e10..67219c1 100644 --- a/eww/eww.scss +++ b/eww/eww.scss @@ -38,6 +38,7 @@ $base0E: #ff6ac1; $base0F: #b2643c; $basetransparent: rgba(40, 42, 54, 0.0); $backtransparent: rgba(40, 42, 54, 0.7); +$darktransparent: rgba(40, 42, 54, 0.97); /** General **/ .bar_class { @@ -52,7 +53,7 @@ $backtransparent: rgba(40, 42, 54, 0.7); } .side{ - background-color: $backtransparent; + background-color: $base00; border-width: 0px; padding: 30px 30px 0px 30px; border-radius: 20px 20px 20px 20px; @@ -116,17 +117,23 @@ tooltip label { border-radius: 5px; } .brightbar trough highlight { - background-image: linear-gradient(to right, $orange 30%, #f2cdcd 50%, $orange 100% *50); + background-color: $base09; border-radius: 10px; } +.brightbar { + margin-bottom: 2px; +} .volbar trough highlight { - background-image: linear-gradient(to right, #afcee0 30%, #92B6F4 50%, #77a5bf 100% *50); + background-color: $base08; border-radius: 10px; } +.volbar { + margin-bottom: 2px; +} .volume_icon { font-size: 18; color: $base08; - margin: 0px 10px 0px 10px; + margin: 0px 15px 0px 3px; } @@ -178,7 +185,7 @@ tooltip label { .bright_icon { font-size: 18; color: $base09; - margin: 0px 10px 0px 10px; + margin: 0px 15px 0px 3px; } @@ -386,18 +393,18 @@ color: $black; } .speaker_bar scale trough highlight { - all: unset; + all: unset; background-image: linear-gradient(to right, #afcee0 30%, #92B6F4 50%, #77a5bf 100% *50); - border-radius: 24px; + border-radius: 24px; } .speaker_bar scale trough { - all: unset; - background-color: $widget-background; + all: unset; + background-color: $widget-background; box-shadow: 0 6px 5px 2px $shadow; - border-radius: 24px; - min-height: 13px; - min-width: 120px; - margin : 0px 0px 5px 0px; + border-radius: 24px; + min-height: 13px; + min-width: 120px; + margin : 0px 0px 5px 0px; } @@ -688,3 +695,23 @@ scale trough { color: $white; margin: 0px 0px 0px 20px; } +.battery-container { + background-color: $darktransparent; + border-radius: 16px; +} +.battery-icon { + margin: 10px; + margin-left: 20px; + font-size: 28px; +} +.battery-value trough highlight { + background-color: $base08; + border-radius: 10px; +} +.battery-value { + margin-bottom: 30px; + margin-right: 20px; +} +.battery-label { + margin: 20px 50px 10px 40px; +} diff --git a/eww/eww.yuck b/eww/eww.yuck index 3e53fee..72e4845 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -2,6 +2,7 @@ (include "sidebar.yuck") (include "notifications.yuck") +(include "battery.yuck") (defpoll clock_time :interval "5s" "date '+\%l:\%M \%p'") (defpoll clock_date :interval "1h" "date '+%b %d, %Y'") @@ -61,55 +62,48 @@ :onclick "hyprctl dispatch killactive 1" "")))))) (defwidget bright [] - (eventbox - :onhover "${EWW_CMD} update br_reveal=true" - :onhoverlost "${EWW_CMD} update br_reveal=false" - (box - :class "module" - :space-evenly "false" - :orientation "h" - :spacing "3" - (revealer - :transition "slideright" - :reveal br_reveal - :duration "250ms" - (scale :class "brightbar" - :value brightness_percent - :orientation "h" - :tooltip "${brightness_percent}%" - :max 100 - :min 0 - :onchange "brightnessctl s {}%" )) - (label - :text "" - :class "bright_icon" - :tooltip "brightness")))) + (eventbox + :onhover "${EWW_CMD} update br_reveal=true" + :onhoverlost "${EWW_CMD} update br_reveal=false" + (box + :class "module" + :space-evenly "false" + :orientation "h" + :spacing "3" + (scale + :class "brightbar" + :value brightness_percent + :orientation "h" + :tooltip "${brightness_percent}%" + :max 100 + :min 0 + :onchange "brightnessctl s {}%" ) + (label + :text "" + :class "bright_icon" + :tooltip "brightness")))) (defwidget volume [] - (eventbox - :onhover "${EWW_CMD} update vol_reveal=true" - :onhoverlost "${EWW_CMD} update vol_reveal=false" - (box - :class "module-2" - :space-evenly "false" - :orientation "h" - :spacing "3" - (revealer - :transition "slideright" - :reveal vol_reveal - :duration "250ms" - (scale - :class "volbar" - :value volume_percent - :orientation "h" - :tooltip "${volume_percent}%" - :max 100 - :min 0 - :onchange "pamixer --set-volume {}" )) - (button - :onclick "scripts/pop audio" - :class "volume_icon" - "墳")))) + (eventbox + :onhover "${EWW_CMD} update vol_reveal=true" + :onhoverlost "${EWW_CMD} update vol_reveal=false" + (box + :class "module-2" + :space-evenly "false" + :orientation "h" + :spacing "3" + (scale + :class "volbar" + :value volume_percent + :orientation "h" + :tooltip "${volume_percent}%" + :max 100 + :min 0 + :onchange "pamixer --set-volume {}" ) + (button + :onclick "scripts/pop audio" + :class "volume_icon" + "墳")))) (defwidget wifi [] (eventbox @@ -195,23 +189,23 @@ :hexpand "false")) (defwidget clock_module [] - (eventbox - :onhover "${EWW_CMD} update time_rev=true" - :onhoverlost "${EWW_CMD} update time_rev=false" - (box - :class "module" - :space-evenly "false" - :orientation "h" - :spacing "0" - (label + (eventbox + :onhover "${EWW_CMD} update time_rev=true" + :onhoverlost "${EWW_CMD} update time_rev=false" + (box + :class "module" + :space-evenly "false" + :orientation "h" + :spacing "0" + (label :text clock_time :class "clock_time_class" ) - (revealer :transition "slideleft" - :reveal time_rev - :duration "250ms" - (button - :class "clock_date_class" - :onclick "scripts/pop calendar" clock_date))))) + (revealer :transition "slideleft" + :reveal time_rev + :duration "250ms" + (button + :class "clock_date_class" + :onclick "scripts/pop calendar" clock_date))))) (defwidget notif_button [] (box @@ -242,35 +236,36 @@ ;;define widget groups (defwidget left [] - (box - :orientation "h" - :space-evenly false - :halign "start" - :class "left_modules" - (workspaces))) + (box + :orientation "h" + :space-evenly false + :halign "start" + :class "left_modules" + :spacing 8 + (workspaces) + (appnames))) (defwidget center [] - (box - :orientation "h" - :space-evenly false - :halign "center" - :class "center_modules" - (appnames))) + (box + :orientation "h" + :space-evenly false + :halign "center" + :class "center_modules" + (clock_module))) (defwidget right [] - (box - :orientation "h" - :space-evenly false - :halign "end" - :class "right_modules" - (bright) - (volume) - (wifi) - (sep) - (bat) - (cpu) - (mem) - (sep) - (clock_module) - (notif_button))) + (box + :orientation "h" + :space-evenly false + :halign "end" + :class "right_modules" + (bright) + (volume) + (wifi) + (sep) + (bat) + (cpu) + (mem) + (sep) + (notif_button))) (defwidget bar_layout [] (centerbox @@ -384,12 +379,12 @@ :vexpand "false" :hexpand "false" (scale - :value mic_percent - :orientation "h" - :tooltip "mic on ${mic_percent}%" - :onchange "amixer -D pulse sset Capture {}%" - :max 100 - :min 0)))))) + :value mic_percent + :orientation "h" + :tooltip "mic on ${mic_percent}%" + :onchange "amixer -D pulse sset Capture {}%" + :max 100 + :min 0)))))) (defwindow audio_ctl :stacking "fg" :focusable "false" diff --git a/eww/scripts/appname b/eww/scripts/appname index a1856d8..ce80d63 100755 --- a/eww/scripts/appname +++ b/eww/scripts/appname @@ -7,8 +7,9 @@ icontheme=$(grep "gtk-icon-theme-name" "$HOME"/.config/gtk-3.0/settings.ini | cu workspaces() { if [[ ${1:0:12} == "activewindow" ]]; then #set focused workspace string=${1:14} + export title=$(echo $string | sed 's/.*,//') class="${string/,*/}" - export title=${string/,/, } + # export title=${string/,/, } [[ $title == ", " ]] && unset title export iconpath=$(geticons "$class" -s 16 -c 1 -t "$icontheme" | head -n 1) fi diff --git a/eww/scripts/workspace b/eww/scripts/workspace index 7c1fb9c..7da7be5 100755 --- a/eww/scripts/workspace +++ b/eww/scripts/workspace @@ -1,7 +1,7 @@ #!/usr/bin/env bash #define icons for workspaces 1-9 -ic=(0       "" "" ) +ic=(0    ) #initial check for occupied workspaces for num in $(hyprctl workspaces | grep ID | awk '{print $3}'); do @@ -55,11 +55,6 @@ echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xar (button :onclick \"hyprctl dispatch workspace 2\" :onrightclick \"hyprctl dispatch workspace 2 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o2$f2\" \"${ic[2]}\") \ (button :onclick \"hyprctl dispatch workspace 3\" :onrightclick \"hyprctl dispatch workspace 3 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o3$f3\" \"${ic[3]}\") \ (button :onclick \"hyprctl dispatch workspace 4\" :onrightclick \"hyprctl dispatch workspace 4 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o4$f4\" \"${ic[4]}\") \ - (button :onclick \"hyprctl dispatch workspace 5\" :onrightclick \"hyprctl dispatch workspace 5 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o5$f5\" \"${ic[5]}\") \ - (button :onclick \"hyprctl dispatch workspace 6\" :onrightclick \"hyprctl dispatch workspace 6 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o6$f6\" \"${ic[6]}\") \ - (button :onclick \"hyprctl dispatch workspace 7\" :onrightclick \"hyprctl dispatch workspace 7 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o7$f7\" \"${ic[7]}\") \ - (button :onclick \"hyprctl dispatch workspace 8\" :onrightclick \"hyprctl dispatch workspace 8 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o8$f8\" \"${ic[8]}\") \ - (button :onclick \"hyprctl dispatch workspace 9\" :onrightclick \"hyprctl dispatch workspace 9 && $HOME/.config/hypr/themes/neon/scripts/default_app\" :class \"0$o9$f9\" \"${ic[9]}\") \ )\ )" } diff --git a/eww/sidebar.yuck b/eww/sidebar.yuck index 2ad3cac..3f2485d 100644 --- a/eww/sidebar.yuck +++ b/eww/sidebar.yuck @@ -24,7 +24,7 @@ ;; background (defwidget side [] - (box + (box :class "side" :orientation "v" :space-evenly "false" @@ -47,35 +47,35 @@ ;; weather (defwidget weather [] - (box - :class "weather" - :orientation "v" - :spacing -2 - :space-evenly "false" - :vexpand "true" - :hexpand "false" - :valign "start" - :halign "center" - (label - :class "iconweather" - :halign "center" - :valign "center" - :style "color: ${HEX};" :text ICON) - (button - :onclick "scripts/weather --getdata && eww reload &" - :class "label_temp" - :valign "center" - :halign "center" - "${TEMP}"))) + (box + :class "weather" + :orientation "v" + :spacing -2 + :space-evenly "false" + :vexpand "true" + :hexpand "false" + :valign "start" + :halign "center" + (label + :class "iconweather" + :halign "center" + :valign "center" + :style "color: ${HEX};" :text ICON) + (button + :onclick "scripts/weather --getdata && eww reload &" + :class "label_temp" + :valign "center" + :halign "center" + "${TEMP}"))) (defwidget date [] - (box :class "date" :orientation "v" :valign "start" :space-evenly "false" :halign "center" + (box :class "date" :orientation "v" :valign "start" :space-evenly "false" :halign "center" (label - :text DAY) + :text DAY) (label - :text POO) - (label :class "foo" - :text FOO))) + :text POO) + (label :class "foo" + :text FOO))) (defpoll FOO :interval "6h" "date '+%d'") (defpoll DAY :interval "6h" "date '+%A'") @@ -225,31 +225,29 @@ (defwidget fetch [] (box - :class "fetch" - :orientation "v" - :space-evenly "false" - :halign "center" - :valign "start" - :spacing "10" - (label - :class "host" - :halign "start" - :text " : ${name}@${host}") - (label - :class "wm" - :halign "start" - :text " : ${wm}") - (label - :class "uptime" - :halign "start" - :text " : ${uptime}") - ;; (label - ;; :class "packages" - ;; :halign "start" - ;; :text " : ${packages}") - (label - :class "kernal" - :halign "start" - :text " : ${kernal}") - ) - ) + :class "fetch" + :orientation "v" + :space-evenly "false" + :halign "center" + :valign "start" + :spacing "10" + (label + :class "host" + :halign "start" + :text " : ${name}@${host}") + (label + :class "wm" + :halign "start" + :text " : ${wm}") + (label + :class "uptime" + :halign "start" + :text " : ${uptime}") + ;; (label + ;; :class "packages" + ;; :halign "start" + ;; :text " : ${packages}") + (label + :class "kernal" + :halign "start" + :text " : ${kernal}"))) diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index cacb4d4..69919a3 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -60,8 +60,8 @@ decoration { # if you want heavy blur, you need to up the blur_passes. # the more passes, the more you can up the blur_size without noticing artifacts. drop_shadow=true - shadow_range=30 - shadow_offset=5 5 + shadow_range=20 + shadow_offset=2 2 shadow_render_power=1 dim_inactive=true dim_strength=0.2 diff --git a/scripts/batmon b/scripts/batmon new file mode 100755 index 0000000..d346449 --- /dev/null +++ b/scripts/batmon @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +while [ 1 ]; +do + capacity=$(cat /sys/class/power_supply/BAT1/capacity) + status=$(cat /sys/class/power_supply/BAT1/status) + + if [ $status = 'Charging' ]; then + eww close battery + sleep 10 + else + if [ $capacity -le 30 ]; + then + eww open battery + else + eww close battery + fi + sleep 10 + fi +done