DashNix/eww_desktop/eww.yuck

354 lines
13 KiB
Text

;; date definitions ;;
(defpoll clock_time :interval "1m" "date +\%I")
(defpoll clock_minute :interval "5s" "date +\%M")
(defpoll clock_date :interval "1h" "date '+%d/%m'")
;; volume definitions ;;
(defpoll volume_percent :interval "1s" "pactl get-sink-volume @DEFAULT_SINK@ | awk -F '/' ' { print $2 } ' | tr -d ' %'")
(defpoll mic_percent :interval "1s" "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'")
;; memory definitions ;;
(defpoll memory :interval "15s" "scripts/memory")
(defpoll memory_used_mb :interval "2m" "scripts/mem-ad used")
(defpoll memory_total_mb :interval "2m" "scripts/mem-ad total")
(defpoll memory_free_mb :interval "2m" "scripts/mem-ad free")
;; music definitions ;;
(defpoll Song_info :interval "2s" "scripts/music_control")
(defpoll Thumbnail :interval "2s" "scripts/music_control2")
;; calendar definitions ;;
(defpoll calendar_day :interval "20h" "date '+%d'")
(defpoll calendar_year :interval "20h" "date '+%Y'")
;; Weather vars
(defpoll weather-icon :interval "21m" "cat ~/.cache/weather/weather-icon")
(defpoll temperature :interval "21m" "cat ~/.cache/weather/weather-degree")
(defpoll weather-hex :interval "21m" "cat ~/.cache/weather/weather-hex")
(defpoll weather-stat :interval "21m" "cat ~/.cache/weather/weather-stat")
(defpoll weather-stat-side :interval "21m" "~/.config/eww/scripts/weather-trimmer")
(defpoll weather-quote :interval "21m" "~/.config/eww/scripts/getwethquote")
(defpoll weather-quote2 :interval "21m" "~/.config/eww/scripts/getwethquote2")
;; simple variables ;;
(defvar eww "$HOME/.local/bin/eww -c $HOME/.config/eww")
(defvar vol_reveal false)
(defvar br_reveal false)
(defvar music_reveal false)
(defvar wifi_rev false)
(defvar time_rev false)
(defvar current_monitor 0)
(deflisten workspace "scripts/workspace")
(deflisten currentName "scripts/current_name")
;; widgets
(defwidget bluetooth []
(box :vexpand "false" :hexpand "false" :space-evenly "false"
(button :class "module-blu" :onclick "hyprctl dispatch exec 'blueman-manager'" :wrap "false" :limit-width 12 "")
))
;; workspaces ;;
(defwidget workspaces []
(literal :content workspace))
;; memory ;;
(defwidget mem []
(box :class "mem_module" :vexpand "false" :hexpand "false"
(button :class "iconmem"
:onclick "$HOME/.config/eww/scripts/pop system"
(circular-progress :value memory
:class "membar"
:thickness 4
:tooltip "using ${memory}% ram"
:show_truncated false
:wrap false
(label :class "mem_padding" :text "")
))))
;; seperator ;;
(defwidget sep []
(box :class "module-2" :vexpand "false" :hexpand "false"
(label :class "separ" :text "|")))
;; clock ;;
(defwidget clock_module []
(eventbox :onhover "${eww} update time_rev=true"
:onhoverlost "${eww} update time_rev=false"
(button :onclick "scripts/pop calendar"
(box :class "module" :space-evenly "false" :orientation "h" :spacing "3"
(label :text clock_time :class "clock_time_class" )
(label :text "" :class "clock_time_sep" )
(label :text clock_minute :class "clock_minute_class")
(revealer :class "clock_date_class"
:transition "slideleft"
:reveal time_rev
:duration "350ms"
clock_date
)))))
;; speaker volume ;;
(defwidget volume []
(box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
(button :onclick "scripts/pop audio" :class "volume_icon" "")))
;; audio volume widget ;;
(defwidget audio []
(eventbox :onhover "scripts/pop hoverCreate"
:onhoverlost "scripts/pop hoverGet audio_ctl"
(box :class "audio-box" :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :halign "center" :space-evenly "false" :hexpand "false" :vexpand "false"
(box :class "speaker_icon" :orientation "v")
(box :orientation "v" :halign "center" :vexpand "false" :hexpand "false"
(label :class "speaker_text" :text "speaker" :valign "center" :halign "left" )
(box :class "speaker_bar" :halign "center" :vexpand "false" :hexpand "false"
(scale :value volume_percent
:space-evenly "false"
:orientation "h"
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
:tooltip "volume on ${volume_percent}%"
:max 100
:min 0))))
(label :text "" :class "audio_sep" :halign "center")
(box :halign "center" :space-evenly "false" :hexpand "false" :vexpand "false"
(box :class "mic_icon" :orientation "v")
(box :orientation "v" :halign "center" :vexpand "false" :hexpand "false"
(label :class "speaker_text" :text "mic" :valign "center" :halign "left" )
(box :class "mic_bar" :halign "center" :vexpand "false" :hexpand "false"
(scale :value mic_percent
:space-evenly "false"
:orientation "h"
:tooltip "mic on ${mic_percent}%"
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%"
:max 100
:min 0))))
(label :text "" :class "audio_sep" :halign "center")
(box :class "change_audio_box" :halign "center" :spac`e-evenly "false" :hexpand "false" :vexpand "false"
(box :class "change_audio" :orientation "v" :halign "left"
(button :onclick "scripts/change-audio internal" "󰋋"))
(box :class "change_audio" :orientation "v" :halign "right"
(button :onclick "scripts/change-audio bluetooth" ""))
))))
(defwidget cname []
(literal :class "windowname" :content currentName))
;; calendar ;;
(defwidget cal []
(eventbox :onhover "scripts/pop hoverCreate"
:onhoverlost "scripts/pop hoverGet calendar"
(box :class "cal" :orientation "v"
(box :class "cal-in"
(calendar :class "cal"
:day calendar_day
:year calendar_year)))))
(defwidget system []
(eventbox :onhover "scripts/pop hoverCreate"
:onhoverlost "scripts/pop hoverGet system"
(box :class "sys_win" :orientation "v" :space-evenly "false" :hexpand "false" :vexpand "false" :spacing 0
(box :class "sys_mem_box" :orientation "h" :space-evenly "false" :halign "start"
(circular-progress :value memory
:class "sys_mem"
:thickness 9
(label :text ""
:class "sys_icon_mem"
:limit-width 2
:show_truncated false
:wrap false
:angle 0.0))
(box :orientation "v" :space-evenly "false" :spacing 0 :hexpand "false" :vexpand "false"
(label :text "memory"
:halign "start"
:class "sys_text_mem"
:limit-width 9
:show_truncated false
:wrap false)
(label :text "${memory_used_mb} | ${memory_total_mb}mb "
:halign "start"
:class "sys_text_mem_sub"
:limit-width 22
:show_truncated false
:wrap false)
(label :text "${memory_free_mb}mb free"
:halign "start"
:class "sys_text_mem_sub"
:limit-width 22
:show_truncated false
:wrap false))))))
;; cockpit widget ;;
(defwidget cockpit []
(box :orientation "h"
(box :class "cockpit_class"
:orientation "h"
(box :orientation "v"
(box :class "cockpit_box" :orientation "v"
(box
(button :class "cockpit_button_shutdown" :onclick "hyprctl dispatch exec 'shutdown now'" "")
(button :class "cockpit_button_restart" :onclick "hyprctl dispatch exec reboot" "")
(button :class "cockpit_button_sleep" :onclick "hyprctl dispatch exec 'playerctl -a pause & swaylock -c 000000 & systemctl suspend'" "⏾"))
(label :text "" :class "audio_sep" :halign "center")
(box
(button :class "cockpit_button_settings" :onclick "hyprctl dispatch exec 'pavucontrol'" "")
(button :class "cockpit_button_settings" :onclick "scripts/change-audio bluetooth" "")))
(box :class "cockpit_box" :orientation "v"
(button :class "cockpit_docs" :onclick "hyprctl dispatch exec nautilus $HOME/Documents" "Documents ")
(label :text "" :class "cockpit_sep_top" :halign "center")
(button :class "cockpit_pics" :onclick "hyprctl dispatch exec nautilus $HOME/Pictures" "Pictures ")
(label :text "" :class "cockpit_sep_bottom" :halign "center")
(button :class "cockpit_gits" :onclick "hyprctl dispatch exec 'alacritty --working-directory $HOME/gits'" "gits ")))
(box :orientation "v"
(box :class "cockpit_box" :orientation "v"
(box :class "cockpit_clock"
(label :text clock_time :class "cockpit_clock_left" )
(label :text "" :class "cockpit_clock_sep" )
(label :text clock_minute :class "cockpit_clock_right"))
(label :text "" :class "audio_sep" :halign "center")
(box :class "cockpit_clock"
(label :text clock_date :class "cockpit_date")
))
(box :class "cockpit_box" (weather)))
(box :width 300 :height 200 :class "cockpit_box" :orientation "v"
(box :class "song_info"
(label :wrap true :text "${Song_info}"))
(box :class "album_cover" :style 'background-image: url("${Thumbnail}")')
)))
)
;; weather ;;
(defwidget weather []
(box :orientation "v" :space-evenly "false"
(box :orientation "h" :space-evenly "false"
(box :class "weather-icon" :style "color: ${weather-hex}" {weather-icon})
(box :class "temperature" "${temperature}"))
(box :orientation "v" :space-evenly "false"
(box :class "weather-stat" {weather-stat}))
(box :class "weather-quote-head"
(label :wrap true :text {weather-quote}))))
;; left side but displayed right? ;;
(defwidget left []
(box :orientation "h"
:space-evenly false
:halign "end"
:class "left_modules"
(volume)
(bluetooth)
(sep)
(mem)
(sep)
(clock_module)))
;; right side but displayed left? ;;
(defwidget right []
(box :orientation "h"
:space-evenly false
:halign "start"
:class "right_modules"
(workspaces)))
;; center widget ;;
(defwidget center []
(box :orientation "h"
:space-evenly false
:halign "center"
:class "center_modules"
(cname)))
;; bar as widget;;
(defwidget bar_1 []
(box :class "bar_class"
:orientation "h"
(right)
(center)
(left)
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Drawing Windows ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defwindow calendar
:monitor 0
:geometry (geometry :x "20px"
:y "2px"
:anchor "top right"
:width "270px"
:height "60px")
:stacking "overlay"
(cal))
(defwindow audio_ctl
:monitor 0
:geometry (geometry :x "120px"
:y "2px"
:anchor "top right"
:width "250px"
:height "230px")
:stacking "overlay"
(audio))
(defwindow system
:monitor 0
:geometry (geometry :x "50px"
:y "2px"
:anchor "top right"
:width "290px"
:height "120px")
:stacking "overlay"
(system))
;; draw the bar ;;
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "0px"
:width "3440px"
:height "10px"
:anchor "top center")
:stacking "bottom"
:wm-ignore false
:exclusive true
(bar_1))
;; draw the cockpit monitor 0 ;;
(defwindow cockpit_window_0
:monitor 0
:geometry (geometry :x "1470px"
:y "420px"
:width "600px"
:height "400px"
:anchor "center")
:stacking "overlay"
:wm-ignore false
:exclusive true
(cockpit))
;; draw the cockpit monitor 1 ;;
(defwindow cockpit_window_1
:monitor 1
:geometry (geometry
:width "600px"
:height "400px"
:anchor "center")
:stacking "overlay"
:wm-ignore false
:exclusive true
(cockpit))
;; draw the cockpit monitor 2 ;;
(defwindow cockpit_window_2
:monitor 2
:geometry (geometry
:width "600px"
:height "400px"
:anchor "center")
:stacking "overlay"
:wm-ignore false
:exclusive true
(cockpit))