From 144f573fda7694dcf30fe507e76e92f21d338a92 Mon Sep 17 00:00:00 2001 From: Spangenberg Date: Wed, 8 Nov 2023 22:32:18 +0100 Subject: [PATCH] add eww --- eww/bar/eww.scss | 36 +++++++++++++++++ eww/bar/eww.yuck | 71 +++++++++++++++++++++++++++++++++ eww/eww.scss | 1 + eww/eww.yuck | 1 + eww/launch.sh | 4 ++ eww/scripts/checksystemupdates | 24 +++++++++++ eww/scripts/network | 3 ++ eww/scripts/systemupdates | 40 +++++++++++++++++++ eww/scripts/wlogout | 3 ++ hypr/conf/autostart.conf | 3 +- scripts/updatewal-swww.sh | 2 +- scripts/wallpaper-swww.sh | 2 +- waybar/themes/cantina/style.css | 2 +- 13 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 eww/bar/eww.scss create mode 100644 eww/bar/eww.yuck create mode 100644 eww/eww.scss create mode 100644 eww/eww.yuck create mode 100755 eww/launch.sh create mode 100755 eww/scripts/checksystemupdates create mode 100755 eww/scripts/network create mode 100755 eww/scripts/systemupdates create mode 100755 eww/scripts/wlogout diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss new file mode 100644 index 0000000..d7ece3b --- /dev/null +++ b/eww/bar/eww.scss @@ -0,0 +1,36 @@ +/* @use "~/.cache/wal/colors.scss" as cols; */ + +* { all: unset; } + +// Variable Color's +$background: #1A1B26; +$foreground: #A9B1D6; + +$black: #24283B; +$gray: #565F89; +$red: #F7768E; +$green: #73DACA; +$yellow: #E0AF68; +$blue: #7AA2F7; +$magenta: #BB9AF7; +$cyan: #7DCFFF; +$white: $foreground; + +.bar{ + background-color: $background; + border-radius: 20px; + padding: 5px; +// font-size: contain; +} + +.icons{ + margin: .3rem; +} + +.launcher{ + color: $cyan; +} + +.tooltip { + background-color: white; +} diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck new file mode 100644 index 0000000..1fbbdd1 --- /dev/null +++ b/eww/bar/eww.yuck @@ -0,0 +1,71 @@ +(defpoll checkupdates :interval "60s" "scripts/systemupdates --check") +(defpoll checkupdatescount :interval "60s" "scripts/systemupdates --count") +(defpoll current-brightness :interval "1s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'") + +(defwindow bar + :monitor 0 + :stacking "fg" + :windowtype "dock" + :exclusive true + :geometry (geometry + :x "0" + :y "10" + :width "98%" + :height "3%" + :anchor "top center" + ) + (bar) +) + + +(defwidget bar [] + (box + :class "bar" + :orientatoin "h" +;; :space-evenly false + (box + :orientation "h" + :halign "start" + (launcher) + ) + (box + :orientation "h" + :halign "end" + :hexpand "true" +;; :space-evenly "false" + (bright) + (power) + ) + ) +) + +(defwidget launcher [] + (box + :orientation "h" + (button + :class "launcher" + :tooltip "App Launcher" + :onclick "bash ~/dotfiles/scripts/applauncher.sh" + "󰣇" + ) + ) +) + +(defwidget bright [] + (box + :class "icons" + :orientation "h" + :space-evenly "false" + :tooltip current-brightness + "󰃠" + ) +) + +(defwidget power [] + (button + :class "icons" + :tooltip "wlogout" + :onclick "bash ~/dotfiles/scripts/wlogout.sh" "⏻" + ) +) + diff --git a/eww/eww.scss b/eww/eww.scss new file mode 100644 index 0000000..e07cb53 --- /dev/null +++ b/eww/eww.scss @@ -0,0 +1 @@ +@import "./bar/eww.scss"; diff --git a/eww/eww.yuck b/eww/eww.yuck new file mode 100644 index 0000000..654271e --- /dev/null +++ b/eww/eww.yuck @@ -0,0 +1 @@ +(include "./bar/eww.yuck") diff --git a/eww/launch.sh b/eww/launch.sh new file mode 100755 index 0000000..67221b8 --- /dev/null +++ b/eww/launch.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +eww daemon +eww open bar diff --git a/eww/scripts/checksystemupdates b/eww/scripts/checksystemupdates new file mode 100755 index 0000000..82c4bbd --- /dev/null +++ b/eww/scripts/checksystemupdates @@ -0,0 +1,24 @@ +#!/bin/sh +# Requires pacman-contrib trizen + +# Define threshholds for color indicators +threshhold_green=0 +threshhold_yellow=25 +threshhold_red=100 + +# Calculate available updates pacman and aur (with trizen) +if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then + updates_arch=0 +fi + +if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then + updates_aur=0 +fi + +updates=$(("$updates_arch" + "$updates_aur")) + +if [[ $updates -gt 0 ]]; then + printf '󰻍' +else + printf '󰳈' +fi diff --git a/eww/scripts/network b/eww/scripts/network new file mode 100755 index 0000000..369c69c --- /dev/null +++ b/eww/scripts/network @@ -0,0 +1,3 @@ +#!/bin/bash + +kitty ~/dotfiles/scripts/networkmanager.sh diff --git a/eww/scripts/systemupdates b/eww/scripts/systemupdates new file mode 100755 index 0000000..2964c4b --- /dev/null +++ b/eww/scripts/systemupdates @@ -0,0 +1,40 @@ +#!/bin/bash + +if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then + updates_arch=0 +fi + +if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then + updates_aur=0 +fi + +updates=$(("$updates_arch" + "$updates_aur")) + +function check () { + if [[ $updates -gt 0 ]]; then + printf '󰻍' + else + printf '󰳈' + fi +} + +function count () { + printf '%s Update(s)' "$updates" +} + +function install () { + echo "Starting install updates" + echo "" + + yay + + notify-send "Update complete" +} + +if [[ $1 == "--check" ]]; then + check +elif [[ $1 == "--install" ]]; then + install +elif [[ $1 == "--count" ]]; then + count +fi diff --git a/eww/scripts/wlogout b/eww/scripts/wlogout new file mode 100755 index 0000000..94ea183 --- /dev/null +++ b/eww/scripts/wlogout @@ -0,0 +1,3 @@ +#!/bin/bash + +wlogout diff --git a/hypr/conf/autostart.conf b/hypr/conf/autostart.conf index 7f644ff..02fe877 100644 --- a/hypr/conf/autostart.conf +++ b/hypr/conf/autostart.conf @@ -6,5 +6,6 @@ exec-once = ~/dotfiles/scripts/lockscreentime.sh exec-once = ~/dotfiles/scripts/updatewal-swww.sh exec-once = ~/dotfiles/gtk/gtk.sh exec-once = hyprctl setcursor Bibata-Modern-Ice 24 -exec-once = ~/dotfiles/waybar/launch.sh +# exec-once = ~/dotfiles/waybar/launch.sh +exec-once = ~/dotfiles/eww/launch.sh exec-once = wl-paste --watch cliphist store diff --git a/scripts/updatewal-swww.sh b/scripts/updatewal-swww.sh index 4d1998d..d0fc172 100755 --- a/scripts/updatewal-swww.sh +++ b/scripts/updatewal-swww.sh @@ -19,7 +19,7 @@ swww img $wallpaper \ --transition-duration=0.7 \ --transition-pos "$( hyprctl cursorpos )" -~/dotfiles/waybar/launch.sh +# ~/dotfiles/waybar/launch.sh sleep 1 # Send notification diff --git a/scripts/wallpaper-swww.sh b/scripts/wallpaper-swww.sh index 864e0dc..02ae558 100755 --- a/scripts/wallpaper-swww.sh +++ b/scripts/wallpaper-swww.sh @@ -33,7 +33,7 @@ if [ "$selected" ]; then --transition-duration=0.7 \ --transition-pos "$( hyprctl cursorpos )" - ~/dotfiles/waybar/launch.sh +# ~/dotfiles/waybar/launch.sh sleep 1 # ----------------------------------------------------- diff --git a/waybar/themes/cantina/style.css b/waybar/themes/cantina/style.css index 2e89295..5f550bf 100644 --- a/waybar/themes/cantina/style.css +++ b/waybar/themes/cantina/style.css @@ -65,7 +65,7 @@ tooltip { border-radius: 10px; background-color: @backgroundlight; opacity:0.8; - padding:20px; + padding:10px; margin:0px; }