From e4995946589464ac7179c255d94479bd2baf0b0e Mon Sep 17 00:00:00 2001 From: hesam-init Date: Fri, 28 Jun 2024 15:16:08 +0330 Subject: [PATCH] refactor: eww main config file --- hypr-configs/hyprland/eww/eww.scss | 7 +- hypr-configs/hyprland/eww/eww.yuck | 33 --- .../hyprland/eww/src/_definitions.yuck | 31 +- .../hyprland/eww/src/bottom-bar/main.yuck | 216 -------------- .../hyprland/eww/src/bottom-bar/sidectl.yuck | 272 ------------------ .../hyprland/eww/src/bottom-bar/styles.scss | 214 -------------- hypr-configs/hyprland/eww/src/dock/main.yuck | 6 +- 7 files changed, 31 insertions(+), 748 deletions(-) delete mode 100644 hypr-configs/hyprland/eww/src/bottom-bar/main.yuck delete mode 100644 hypr-configs/hyprland/eww/src/bottom-bar/sidectl.yuck delete mode 100644 hypr-configs/hyprland/eww/src/bottom-bar/styles.scss diff --git a/hypr-configs/hyprland/eww/eww.scss b/hypr-configs/hyprland/eww/eww.scss index 7570c8c..0c317db 100644 --- a/hypr-configs/hyprland/eww/eww.scss +++ b/hypr-configs/hyprland/eww/eww.scss @@ -1,11 +1,16 @@ @import "./assets/themes/feverblush.scss"; + @import "./src/sidebar/styles.scss"; + @import "./src/control-panel/styles.scss"; + @import "./src/dashboard/styles.scss"; + @import "./src/dock/styles.scss"; + @import "./src/desktop/styles.scss"; + @import "./src/notification/styles.scss"; -// @import "./src/bottom-bar/styles.scss"; * { all: unset; diff --git a/hypr-configs/hyprland/eww/eww.yuck b/hypr-configs/hyprland/eww/eww.yuck index 05bae6b..cee5f65 100644 --- a/hypr-configs/hyprland/eww/eww.yuck +++ b/hypr-configs/hyprland/eww/eww.yuck @@ -1,44 +1,11 @@ (include "./src/utils/_revealer.yuck") (include "./src/_definitions.yuck") -;; dock -(deflisten tasksjson :initial "[]" "./scripts/tasklist.py") -(defvar revealdock false) - -;; fucking desktop icons -(defpoll trashcanpath :interval "24h" "./scripts/iconfetch.py trashcan_empty") - -;; sys info -;; (defpoll cpu :interval "1s" :run-while reveal5 "bash ./scripts/sys_info --cpu") -;; (defpoll mem :interval "1s" :run-while reveal5 "bash ./scripts/sys_info --mem") -(defvar gapsouter 0) -(defvar gapsinner 10) -(defvar borderpixel 2) -(defvar caffeine false) - -;; cava pipe ("borrowed from tail-r") -;; (deflisten cavajson :initial "[]" "./scripts/cava_pipe.sh") - -;; wallpaper thing -(defvar wallpapers "[]") - -;; windows for workspace switching -(defvar windows "[[], [], [], [], []]") - -(defpoll theme :interval "24h" "./scripts/toggletheme") - -;; (include "./src/bottom_bar/bar.yuck") (include "./src/sidebar/main.yuck") - (include "./src/control-panel/main.yuck") (include "./src/control-panel/windowswitcher.yuck") - (include "./src/wallpapers/main.yuck") - (include "./src/dashboard/main.yuck") - (include "./src/dock/main.yuck") - (include "./src/desktop/main.yuck") - (include "./src/notification/main.yuck") diff --git a/hypr-configs/hyprland/eww/src/_definitions.yuck b/hypr-configs/hyprland/eww/src/_definitions.yuck index 939dacc..f775848 100644 --- a/hypr-configs/hyprland/eww/src/_definitions.yuck +++ b/hypr-configs/hyprland/eww/src/_definitions.yuck @@ -15,6 +15,24 @@ (defpoll baticon :initial "" :interval "30s" "bash ./scripts/sys_info --baticon") (defpoll batstat :interval "30s" "cat /sys/class/power_supply/BAT0/status") (defpoll homedir :initial "" :interval "24h" "echo ~") +(defpoll theme :interval "24h" "./scripts/toggletheme") +; (defpoll cpu :interval "1s" "bash ./scripts/sys_info --cpu") +; (defpoll mem :interval "1s" "bash ./scripts/sys_info --mem") + + +(defpoll trashcanpath :interval "24h" "./scripts/iconfetch.py trashcan_empty") + +; Wallpaper +(defvar wallpapers "[]") + +;; windows for workspace switching +(defvar windows "[[], [], [], [], []]") + +; Hyprland +(defvar gapsouter 0) +(defvar gapsinner 10) +(defvar borderpixel 2) +(defvar caffeine false) ; Sidebar (defvar revealVolume false) @@ -23,14 +41,9 @@ (defvar revealControlpanel false) (defvar revealSystray false) -; Bottombar -(defvar reveal1 false) -(defvar reveal2 false) -(defvar reveal3 false) -(defvar reveal4 false) -(defvar reveal5 false) -(defvar reveal6 false) - +; Dock +(deflisten tasksjson :initial "[]" "./scripts/tasklist.py") +(defvar revealDock false) ; Workspaces (defvar show_no_of_windows false) @@ -38,7 +51,7 @@ (defpoll current_workspace :initial "0" :interval "50ms" "./scripts/workspaces get-active-workspace") ; Notifications -(deflisten notifications :initial '{ +(deflisten notifications :initial '{ "count": 0, "dnd": false, "notifications": [], diff --git a/hypr-configs/hyprland/eww/src/bottom-bar/main.yuck b/hypr-configs/hyprland/eww/src/bottom-bar/main.yuck deleted file mode 100644 index 5f1f0ad..0000000 --- a/hypr-configs/hyprland/eww/src/bottom-bar/main.yuck +++ /dev/null @@ -1,216 +0,0 @@ -(include "./src/bottom-bar/sidectl.yuck") - -(defwindow bar - :geometry (geometry - :x "0%" - :y "0%" - :width "100%" - :height 40 - :anchor "bottom center") - :exclusive true - :monitor 0 - :wm-ignore false - (barstruct)) - -(defwidget barstruct [] - ;; (box - ;; :orientation "v" - ;; :space-evenly false - (centerbox - :class "barwidget" - :orientation "h" - :height 60 - (left) - (middle) - (right)) - ;; (revealer - ;; :transition "slideup" - ;; :reveal revealcontrolpanel - ;; (box - ;; :class "barwidget" - ;; :orientation "h" - ;; :space-evenly false - ;; (box - ;; :orientation "v" - ;; :space-evenly false - ;; (user) - ;; (chooser)) - ;; (overview) - ;; (timer) - ;; (touchpad) - ;; ))) -) - -(defwidget left [] - (box - :orientation "h" - :space-evenly false - :halign "start" - :valign "fill" - (home) - (workspaces) - ;; (cavapipe) - )) - -(defwidget middle [] - (box - :orientation "h" - :space-evenly false - :halign "center" - :valign "fill" - (tasklist :iconsize 42) - )) - -(defwidget right [] - (box - :orientation "h" - :space-evenly false - :halign "end" - :valign "fill" - (button :class "widget" :onclick "./scripts/touchkey.sh && ${EWW_CMD} update revealcontrolpanel=false" - (label :class "icon" :style "padding-left: 3px;" :text "󰌌")) - (playerctl) - (sysicons) - ;; (battery) - (clock) - )) - -(defwidget workspaces [] - (eventbox - :cursor "pointer" - (box - :class "workspaces widget" - :orientation "h" - :space-evenly false - (for i in {"[0, 1, 2, 3, 4]"} - (button - :onclick "swaymsg -t command workspace number ${workspacejson[i].name}" - (box - :hexpand false - :height 10 - ;; :width { workspace.focused ? 100 : !workspace.empty ? 80 : 50} - :class { workspacejson[i].focused ? "workspacethingactive" : "workspacething"} - :orientation "h" - :space-evenly false - (box - :width 50) - (revealer - :reveal { !workspacejson[i].empty || workspacejson[i].focused } - :transition "slideright" - (box - :width 30)) - (revealer - :reveal { workspacejson[i].focused } - :transition "slideright" - (box - :width 20)) - )))))) - -(defwidget clock [] - (box - :orientation "h" - :class "clock widget" - :space-evenly false - (button - :onclick "${EWW_CMD} update reveal1=${!reveal1} reveal2=false reveal3=false" - (label :text "${thour}:${tmin} ${tpm}")))) - -(defwidget sysicons [] - (box - :class "widget" - :valign "fill" - (button - :onclick "${EWW_CMD} update reveal1=false reveal2=${!reveal2} reveal3=false" - :class "icon" - (box - :orientation "h" - :space-evenly false - :spacing 5 - (label :tooltip wifi_essid :class "icon" :text wifi_icon) - (label :tooltip "${volume}%" :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"}) - (overlay - :tooltip "${bat0}%" - (label :class "icon" :text "") - (scale - :hexpand false - :orientation "h" - :active false - :min 0 - :max 100 - :value bat0 - :class "overbat ${EWW_BATTERY.BAT0.status == 'Charging' ? 'charging' : ''}")) - )))) - -(defwidget battery [] - (box - :orientation "h" - :space-evenly false - :class "widget" - (overlay - (scale - :class "${EWW_BATTERY.BAT0.status == 'Charging' ? 'charging': bat0 < 16 ? 'dying': 'normal'} bat_scale" - :value "${bat0}" - :orientation "h" - :max 100 - :min 0 - :flipped true - :active false) - (label - :class "lightning" - :visible {EWW_BATTERY.BAT0.status == "Charging"} - :text "󱐋")) - (label :text "${bat0}%"))) - -(defwidget playerctl [] - (overlay - (box - :halign "fill" - :width 150 - :class { pcover != "" ? "mpdcover" : "widget"} - :style "background-image: url('${pcover}')") - (box - ;; :class "widget" - :orientation "h" - :space-evenly false - :spacing 5 - :halign "center" - :valign "center" - (eventbox - :onclick "${EWW_CMD} update reveal1=false reveal2=false reveal3=${!reveal3}" - (image :path { pcover == "" ? "./assets/image/emptympd.png" : pcover } :image-width 30 :image-height 30 :style "padding: 0px 5px;")) - (button :onclick "playerctl previous" - (label :class "icon" :text "󰒮")) - (button :onclick "playerctl play-pause" - (label :class "icon" :text { pstatus == "Playing" ? "" : "" })) - (button :onclick "playerctl next" - (label :class "icon" :text "󰒭")) - ))) - -(defwidget home [] - (box - :class "widget" - :hexpand false - :vexpand false - (eventbox - ;; :onclick "~/.config/eww/meowidgets/scripts/launch" - ;; :onclick "~/.config/eww/meowayland/scripts/launch" - ;; :onclick "./scripts/pop control" - :onclick "${EWW_CMD} update revealcontrolpanel=${ !revealcontrolpanel }" - :onrightclick "${EWW_CMD} open wallpaperselect --toggle" - :cursor "pointer" - (label :text "" :halign "center" :class "launchicon" :style "padding: 0px 4px;")))) - -;; (defwidget cavapipe [] - ;; (box - ;; :class "widget" - ;; :orientation "h" - ;; :space-evenly true - ;; (for bar in {cavajson} - ;; (scale - ;; :class "cavascale" - ;; :orientation "v" - ;; :value bar - ;; :min 0 - ;; :max 100 - ;; :flipped true)))) - diff --git a/hypr-configs/hyprland/eww/src/bottom-bar/sidectl.yuck b/hypr-configs/hyprland/eww/src/bottom-bar/sidectl.yuck deleted file mode 100644 index 29bff2b..0000000 --- a/hypr-configs/hyprland/eww/src/bottom-bar/sidectl.yuck +++ /dev/null @@ -1,272 +0,0 @@ - -(defwindow sidectl1 - :geometry (geometry - :x "0%" - :y "0%" - :width 320 - :height 0 - :anchor "bottom right") - :monitor 0 - :stacking "overlay" - (revealer - :reveal reveal1 - :transition "slideup" - (box - :orientation "v" - :valign "end" - :space-evenly false - (box - :height 700 - :class "popup" - (notiweathertoggle)) - - (box - :class "popup" - (box - :class "unbarwidget" - (calendar - :day calendar_day - :year calendar_year - :class ""))) - ))) - -(defwindow sidectl2 - :geometry (geometry - :x 50 - :y 0 - :width 200 - :height 0 - :anchor "bottom right") - :monitor 0 - :stacking "overlay" - (revealer - :reveal reveal2 - :transition "slideup" - (box - :class "popup" - :orientation "v" - :space-evenly false - (box - :orientation "v" - :class "widget" - :spacing 20 - :space-evenly false - - (box - :orientation "v" - :height 150 - (box - :orientation "h" - (togglebuttons - :icon wifi_icon - :class {wifi_radio == "enabled" ? "icontitlesel" : "icontitle"} - :text {wifi_radio == "enabled" ? wifi_essid == "" ? "Disconnected" : "Connected" : "Off"} - :subtext { wifi_essid == "" ? "..." : wifi_essid} - :toggle {wifi_radio == "enabled" ? "nmcli radio wifi off" : "nmcli radio wifi on"}) - - (togglebuttons - :icon "" - :class {caffeine ? "icontitlesel" : "icontitle"} - :text "Caffeine" - :subtext {caffeine ? "on" : "off"} - :toggle {caffeine ? "swaymsg [app_id='.*'] inhibit_idle none && ${EWW_CMD} update caffeine=false" : "swaymsg [app_id='.*'] inhibit_idle open && ${EWW_CMD} update caffeine=true"})) - - (box - :orientation "h" - (togglebuttons - :icon "" - :class "icontitle" - :text "Theme" - :subtext theme - :toggle "${EWW_CMD} update reveal2=false && ~/.config/eww/themeswitch/scripts/pop") - - (togglebuttons - :icon "" - :class {notifications.dnd ? "icontitlesel" : "icontitle"} - :text "Do not disturb" - :subtext {notifications.dnd ? "on" : "off"} - :toggle "./scripts/notifManage --toggle") - )) - - (sliderctl :icon {volumemute == 'false' ? "󰕾" : "󰖁"} :value volume :onchange "pamixer --set-volume {}") - (sliderctl :icon "󰃞" :value brightness :onchange "brightnessctl set {}%") - - (box - :orientation "h" - :space-evenly false - :halign "end" - (overlay - (scale - :class "${EWW_BATTERY.BAT0.status == 'Charging' ? 'charging': bat0 < 16 ? 'dying': 'normal'} bat_scale" - :value "${bat0}" - :orientation "h" - :max 100 - :min 0 - :active false) - (label - :class "lightning" - :visible {EWW_BATTERY.BAT0.status == "Charging"} - :text "󱐋")) - (label :text "${bat0}%")) - )))) - -(defwidget togglebuttons [icon class text ?subtext toggle] - (button - :onclick toggle - (box - :orientation "h" - :class class - :space-evenly false - (label - :class "icon" - :halign "start" - :text icon) - (box - :orientation "v" - :hexpand true - :halign "center" - (label - :text text) - (label - :limit-width 17 - :text subtext))))) - -(defwidget sliderctl [icon value onchange] - (box - :orientation "h" - :space-evenly false - :hexpand true - :spacing 5 - - (label - :class "icon" - :text icon - :style "margin-left: 5px;") - - (scale - :class "sliderctl" - :orientation "h" - :value value - :tooltip "${value}%" - :min 0 - :max 100 - :onchange onchange))) - -(defwindow sidectl3 - :geometry (geometry - :x 150 - :y 0 - :width 440 - :height 0 - :anchor "bottom right") - :monitor 0 - :stacking "overlay" - (revealer - :reveal reveal3 - :transition "slideup" - (box - :class "popup" - (box - :orientation "h" - :class "unbarwidget" - :space-evenly false - :spacing 20 - (image :style "margin: 5px;" :image-height 190 :image-width 190 :path { pcover == "" ? "./assets/image/emptympd.png" : pcover }) - (box - :orientation "v" - :space-evenly false - :width 210 - :height 200 - (scroll - :hscroll true - :vscroll false - (label :class "mtitle" :text psong)) - (scroll - :hscroll true - :vscroll false - (label :class "mauthor" :text partist)) - (box - :orientation "h" - :class "mpd_controls" - :style "margin-top: 10px;" - (button :onclick "playerctl previous" (label :text "󰒮")) - (button :onclick "playerctl play-pause" - (label :text { pstatus == "Playing" ? "" : ""} )) - (button :onclick "playerctl next" - (label :text "󰒭"))) - (scale - :class "seektime" - :value { ptime.position } - :orientation "h" - :onchange "playerctl position {}" - :min 0 - :max { ptime.duration } - :tooltip { ptime.readable })) - ;; (box - ;; :orientation "v" - ;; :space-evenly false - ;; :valign "center" - ;; :halign "end" - ;; :class "sidempdctl" - ;; (scale - ;; :value { pside.volume } - ;; :orientation "v" - ;; :class "mpdvolumeseek" - ;; :onchange "playerctl volume {}" - ;; :min 0 - ;; :max 100 - ;; :flipped true - ;; :tooltip "volume: ${pside.volume}") - ;; (button - ;; :onclick "playerctl shuffle toggle" - ;; (label - ;; :text {pside.shuffle == "true" ? "󰒝" : "󰒞"})) - ;; (button - ;; :onclick "playerctl loop ${pside.loop == 'Track' ? 'Playlist' : 'Track'}" - ;; (label - ;; :text {pside.loop == "Track" ? "󰑘" : "󰑖"})) - ;; ) - )))) - -(defwindow sidectl4 - :geometry (geometry - :x 0 - :y 0 - :width 340 - :height 0 - :anchor "bottom left" - ) - :stacking "overlay" - :monitor 0 - (revealer - :reveal revealcontrolpanel - :transition "slideup" - (box - :class "popup" - (control_widget :short true)))) - -(defwidget touchpad [] - (box - :class "unbarwidget" - :orientation "h" - :width 180 - (box - :orientation "h" - (box - :orientation "v" - (button :onclick "swaymsg floating toggle" - (label :class "largetouchicon" :text "󱟱")) - (button :onclick "foot -D ~" - (label :class "largetouchicon" :text "")) - (button :onclick "./scripts/pop scrop" - (label :class "largetouchicon" :text "󰆞")) - ) - (box - :orientation "v" - (button :onclick "swaymsg kill" - (label :class "largetouchicon" :text "󰅙")) - (button :onclick "${EWW_CMD} update revealcontrolpanel=false && (cd && wofi --show=drun -i -I)" - (label :class "largetouchicon" :text "󰀻")) - (button :onclick "./scripts/touchkey.sh && ${EWW_CMD} update revealcontrolpanel=false" - (label :class "largetouchicon" :text "󰌌")) - )))) diff --git a/hypr-configs/hyprland/eww/src/bottom-bar/styles.scss b/hypr-configs/hyprland/eww/src/bottom-bar/styles.scss deleted file mode 100644 index 6f15960..0000000 --- a/hypr-configs/hyprland/eww/src/bottom-bar/styles.scss +++ /dev/null @@ -1,214 +0,0 @@ - -.barwidget { - background-color: $base; - padding: 5px; -} - -.widget { - padding: 5px; - margin: 5px; - border-radius: 5px; - background-color: $surface0; - color: $white0; -} - -.icon { - font-size: 20px; - min-width: 1em; - min-height: 1em; - font-family: "Symbols Nerd Font"; - padding: 0px 2px; -} - -.largetouchicon { - font-size: 30px; - min-width: 1em; - min-height: 1em; - font-family: "Symbols Nerd Font"; - margin: 5px; - padding: 5px; - color: $white0; - background-color: $surface1; - border-radius: 5px; -} - -.workspaces { - padding: 5px; -} - -.workspacething, .workspacethingactive { - transition: 500ms ease; - border-radius: 5; - margin: 6px; -} - -.workspacething { - background-color: $surface2; -} - -.workspacethingactive { - background-color: $accent; -} - -.clock label { - font-size: 20px; - // font-weight: bold; -} - -.bat_scale { - trough { - min-height: 20px; - min-width: 50px; - border-radius: 5px; - slider { - all: unset; - } - highlight { - border-radius: 5px; - background-color: $accent; - } - } -} - -.charging trough highlight { - background-color: $green; -} - -.dying trough highlight { - background-color: $red; -} - -.lightning { - color: $surface0 -} - -// for the music popup -.mpd_controls label { - font-family: "Symbols Nerd Font"; - min-width: 1em; - min-height: 1em; - font-size: 30px; - padding: 15px; -} - -.seektime { - trough { - min-height: 10px; - min-width: 180px; - - slider { - background-color: $white2; - border-radius: 25px; - min-height: 20px; - min-width: 20px; - margin: -10px; - } - - highlight { - background-color: $accent; - } - } -} - -.sidempdctl { - margin: 5px; - label { - font-size: 30px; - padding-right: 5px; - min-height: 1em; - min-width: 1em; - } -} - -.mpdvolumeseek { - @extend .seektime; - trough { - min-height: 100px; - min-width: 10px; - highlight { - background-color: $white0; - } - } -} - -.mtitle { - color: $white0; - font-size: 20px; - margin-top: 30px; -} - -.sliderctl { - @extend .seektime; - trough { - min-height: 10px; - min-width: 350px; - } -} - -.cavascale { - all: unset; - trough { - all: unset; - border-radius: 24px; - min-height: 18px; - min-width: 5px; - margin: 1px; - highlight { - background-color: $white0; - border-radius: 24px; - } - slider { - all:unset; - } - } -} - -.icontitle { - min-width: 1em; - min-height: 1em; - margin: 5px; - padding: 5px; - label { - color: $white0; - margin: 0px 5px; - } - background-color: $surface1; - border-radius: 5px; -} - -.icontitlesel { - min-width: 1em; - min-height: 1em; - margin: 5px; - padding: 5px; - label { - color: $surface0; - margin: 0px 5px; - // font-weight: bold; - } - background-color: $accent; - border-radius: 5px; -} - -.launchicon { - @extend .icon; - color: $accent; -} - -.overbat { - all: unset; - trough { - min-height: 8px; - min-width: 10px; - border-radius: 0px; - padding: 0px 2px 1px 0px; - background-color: unset; - slider { - all: unset; - } - highlight { - // background-color: $white0; - border-radius: 0px; - } - } -} diff --git a/hypr-configs/hyprland/eww/src/dock/main.yuck b/hypr-configs/hyprland/eww/src/dock/main.yuck index 6105df4..a461818 100644 --- a/hypr-configs/hyprland/eww/src/dock/main.yuck +++ b/hypr-configs/hyprland/eww/src/dock/main.yuck @@ -10,8 +10,8 @@ (defwidget dockstruct [] (eventbox - :onhover "${EWW_CMD} update revealdock=true" - :onhoverlost "${EWW_CMD} update revealdock=false" + :onhover "${EWW_CMD} update revealDock=true" + :onhoverlost "${EWW_CMD} update revealDock=false" (box :orientation "v" :space-evenly false @@ -19,7 +19,7 @@ (box :height 4) (revealer - :reveal revealdock + :reveal revealDock :transition "slideup" (box :class "popup"