;; VARS (defvar eww "eww -c $HOME/.config/eww/mybar") (defvar music_reveal false) (defvar cover "images/music.png") (defvar cpu_reveal false) (defvar disk_reveal false) (defvar temperature_reveal false) (defvar ram_reveal false) (defvar date_reveal false) (defvar battery_reveal false) (defvar left_bg "#120010") (defvar center_bg "#120010") (defvar right_bg "#120010") (defvar media_bar_class "bar_normal") (defvar media_bar_class_popup "bar_normal_popup") (defvar battery_image "images/battery_normal.png") (defvar us_color "rgba(230,218,252,1)") (defvar es_color "rgba(230,218,252,0.4)") (defvar day "0") (defvar month "0") (defvar year "0") (defvar wp1 "●") (defvar wp2 "○") (defvar wp3 "○") (defvar wp4 "○") (defvar wp5 "○") (defvar layout_button "") (defvar media_status "") (defvar artist "No artist") (defvar artist_parsed "No artist") (defvar title "No title") (defvar title_parsed "No title") (defvar length 100) (defvar position 0) (deflisten launch1 "scripts/workspaces") (deflisten launch2 "scripts/layout") (deflisten launch3 "scripts/media_info") (defpoll cpu_percent :interval "1s" "scripts/cpu_info") (defpoll disk_all :interval "10s" "scripts/disk_info --all") (defpoll disk_used :interval "10s" "scripts/disk_info --used") (defpoll disk_free :interval "10s" "scripts/disk_info --free") (defpoll temperature :interval "2s" "scripts/temperature_info") (defpoll ram_used :interval "2s" "scripts/ram_info --used") (defpoll ram_all :interval "2s" "scripts/ram_info --all") (defpoll ram_parsed :interval "2s" "scripts/ram_info --parsed") (defpoll battery_percent :interval "3s" "scripts/battery_info --percentage") (defpoll battery_time :interval "3s" "scripts/battery_info --time") (defpoll hour :interval "1s" "scripts/time_info --hour") (defpoll minutes :interval "1s" "scripts/time_info --minutes") (defpoll type :interval "1s" "scripts/time_info --type") (defpoll date :interval "1s" "scripts/time_info --date") ;; WINDOWS ;; Left bar (defwindow bar_left :geometry (geometry :x "10px" :y "10px" :width "150px" :height "25px") :stacking "bg" :reserve (struts :distance "70px" :side "top") :windowtype "dock" :wm-ignore "false" (widgets_left)) ;; Central bar (defwindow bar_center :geometry (geometry :x "180px" :y "10px" :width "930px" :height "50px") :stacking "bg" :reserve (struts :distance "70px" :side "top") :windowtype "dock" :wm-ignore "false" (widgets_center)) ;; Right bar (defwindow bar_right :geometry (geometry :x "1130px" :y "10px" :width "455px" :height "50px") :stacking "bg" :reserve (struts :distance "70px" :side "top") :windowtype "dock" :wm-ignore "false" (widgets_right)) ;; Calendar window (defwindow calendar :geometry (geometry :x "1465px" :y "65px" :width "415px" :height "100px") :stacking "fg" :windowtype "dock" :wm-ignore "false" (box :class "cal" :orientation "h" :valign "fill" :halign "fill" (calendar :day day :month month :year year :show-details "true" :show-heading "true" :show-day-names "true"))) ;; Music window (defwindow music :geometry (geometry :x "40px" :y "65px" :width "415px" :height "200px") :stacking "fg" :windowtype "dock" :wm-ignore "false" (box :orientation "v" :valign "fill" :halign "fill" :space-evenly "false" :class "music_box_popup" (box :orientation "h" :valign "fill" :halign "fill" :space-evenly "false" (box :valign "center" :halign "start" (image :halign "start" :class "media_art_popup" :tooltip "${title} by ${artist}" :path cover :image-height 130 :image-width 130)) (box :valign "center" :halign "fill" :orientation "v" :class "media_data_popup" :spacing 20 (label :class "media_title_popup" :markup title_parsed :halign "center") (label :class "media_artist_popup" :markup artist_parsed :halign "center") (box :orientation "h" :halign "fill" :valign "fill" :class "media_buttons_box_popup" (eventbox :cursor "pointer" (button :onclick "scripts/media_control --prev" :class "nextprev_popup" :tooltip "Previous" "")) (eventbox :cursor "pointer" (button :onclick "scripts/media_control --move -5" :class "move_popup" :tooltip "-5 seconds" "")) (eventbox :cursor "pointer" (button :onclick "scripts/media_control --toggle" :class "playpause_popup" :tooltip "Play/Pause" media_status)) (eventbox :cursor "pointer" (button :onclick "scripts/media_control --move +5" :class "move_popup" :tooltip "+5 seconds" "")) (eventbox :cursor "pointer" (button :onclick "scripts/media_control --next" :class "nextprev_popup" :tooltip "Next" "")) ))) (eventbox :cursor "pointer" :onhover "${eww} update media_bar_class_popup=\"bar_highlighted_popup\"" :onhoverlost "${eww} update media_bar_class_popup=\"bar_normal_popup\"" (box :orienttion "h" :valign "fill" :halign "fill" :class media_bar_class_popup (scale :min 0 :max length :value position :orientation "h" :onchange "scripts/media_control --seek {}" ))) )) ;; WIDGETS ;; Left widgets (defwidget widgets_left [] (eventbox :onhover "${eww} update left_bg=\"#43013b\"" :onhoverlost "${eww} update left_bg=\"#120010\"" (box :spacing 0 :space-evenly "false" :class "bars" :orientation "h" :valign "fill" :hexpand "false" :style "background-color: ${left_bg}" (workspaces) (layout)))) (defwidget workspaces [] (box :orientation "h" :halign "start" :class "workspaces" (box :orientation "h" :spacing 5 :space-evenly "false" :class "${launch1}, ${launch2}, ${launch3}" (eventbox :cursor "pointer" (button :tooltip "Switch to workspace 1" :onclick "bspc desktop -f 1" (label :markup wp1 :class "workspace_buttons"))) (eventbox :cursor "pointer" (button :tooltip "Switch to workspace 2" :onclick "bspc desktop -f 2" (label :markup wp2 :class "workspace_buttons"))) (eventbox :cursor "pointer" (button :tooltip "Switch to workspace 3" :onclick "bspc desktop -f 3" (label :markup wp3 :class "workspace_buttons"))) (eventbox :cursor "pointer" (button :tooltip "Switch to workspace 4" :onclick "bspc desktop -f 4" (label :markup wp4 :class "workspace_buttons"))) (eventbox :cursor "pointer" (button :tooltip "Switch to workspace 5" :onclick "bspc desktop -f 5" (label :markup wp5 :class "workspace_buttons"))) ))) (defwidget layout [] (box :orientation "h" :halign "start" (box :orientation "h" :space-evenly "false" (eventbox :cursor "pointer" (button :tooltip "Change current layout" :onclick "bspc desktop focused --layout next" (label :class "layout" :text layout_button))) ))) (defwidget music [] (eventbox :onhover "${eww} update music_reveal=true" :onhoverlost "${eww} update music_reveal=false" (box :class "music_box" :orientation "h" :spacing 0 :space-evenly "false" :halign "start" (eventbox :cursor "pointer" (box :space_evenly "false" :halign "start" :tooltip "${title} by ${artist}" (button :onclick "scripts/popup_music" (image :class "media_art" :path cover :image-height 40 :image-width 40)))) (box :class "media_data" :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "end" :halign "start" (label :class "media_title" :halign "center" :markup title_parsed :limit-width 15 :wrap "true" :show_truncated "true") (revealer :reveal music_reveal :transition "slideup" :duration "350ms" (box :orientation "h" :halign "center" :space-evenly "false" :class "media_buttons" :space-evenly "false" (eventbox :cursor "pointer" (button :class "prev_button" :onclick "scripts/media_control --prev" :tooltip "Previous" "")) (eventbox :cursor "pointer" (button :class "toggle_button" :onclick "scripts/media_control --toggle" :tooltip "Play/Pause" "${media_status}")) (eventbox :cursor "pointer" (button :class "next_button" :onclick "scripts/media_control --next" :tooltip "Next" "")))) (box :space-evenly "false" :class media_bar_class :halign "center" :vexpand "false" :hexpand "false" (eventbox ;;:cursor "pointer" ;; :onhover "${eww} update media_bar_class=bar_highlighted" ;; :onhoverlost "${eww} update media_bar_class=bar_normal" (scale :active "false" :min 0 :max length :value position :orientation "h" :tooltip "Seek" ;; :onchange "scripts/media_control --seek {}" ))))))) ;; Central widgets (defwidget widgets_center [] (eventbox :onhover "${eww} update center_bg=\"#43013b\"" :onhoverlost "${eww} update center_bg=\"#120010\"" (box :spacing 0 :space-evenly "true" :class "bars" :orientation "h" :valign "fill" :halign "fill" :hexpand "false" :style "background-color: ${center_bg}" (box :space-evenly "true" :orientation "h" :valign "center" :halign "fill" (cpu_status) (ram_status) (temperature_status) (disk_status) (battery_status) )))) (defwidget cpu_status [] (eventbox :onhover "${eww} update cpu_reveal=\"true\"" :onhoverlost "${eww} update cpu_reveal=\"false\"" :tooltip "CPU usage" (box :orientation "h" :space-evenly "false" :class "cpu_box" :vexpand "false" :hexpand "false" (image :class "center_icons" :path "images/cpu.png" :image-width 30 :image-height 30) (box :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "center" :class "center_boxes" (revealer :reveal "${!cpu_reveal}" :transition "slidedown" :duration "350ms" (box :orientation "v" :class "center_info" :valign "start" (label :class "center_labels" :text "${cpu_percent}%" :halign "center") (scale :min 0 :max 100 :value cpu_percent :orientation "h"))) (revealer :reveal cpu_reveal :transition "slideup" :duration "350ms" :valign "center" (box :valign "center" :class "center_revealers" (graph :thickness 3 :value cpu_percent :time-range "20s" :min 0 :max 100 :dynamic "true" :line-style "round")) ))))) (defwidget disk_status [] (eventbox :onhover "${eww} update disk_reveal=\"true\"" :onhoverlost "${eww} update disk_reveal=\"false\"" :tooltip "Disk usage" (box :orientation "h" :space-evenly "false" :class "disk_box" :vexpand "false" :hexpand "false" (image :class "center_icons" :path "images/disk.png" :image-width 30 :image-height 30) (box :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "center" :class "center_boxes" (revealer :reveal "${!disk_reveal}" :transition "slidedown" :duration "350ms" (box :orientation "v" :class "center_info" :valign "start" (label :class "center_labels" :text "${disk_used}G/${disk_all}G" :halign "center") (scale :min 0 :max disk_all :value disk_used :orientation "h"))) (revealer :reveal disk_reveal :transition "slideup" :duration "350ms" :valign "center" (box :valign "center" :halign "fill" :class "center_revealers" (label :halign "center" :text "${disk_free}G free")) ))))) (defwidget temperature_status [] (eventbox :onhover "${eww} update temperature_reveal=\"true\"" :onhoverlost "${eww} update temperature_reveal=\"false\"" :tooltip "Internal temperature" (box :orientation "h" :space-evenly "false" :class "temperature_box" :vexpand "false" :hexpand "false" (image :class "center_icons" :path "images/temperature.png" :image-width 30 :image-height 30) (box :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "center" :class "center_boxes" (revealer :reveal "${!temperature_reveal}" :transition "slidedown" :duration "350ms" (box :orientation "v" :class "center_info" :valign "start" (label :class "center_labels" :text "${temperature}°C" :halign "center") (scale :min 0 :max 100 :value temperature :orientation "h"))) (revealer :reveal temperature_reveal :transition "slideup" :duration "350ms" :valign "center" (box :valign "center" :class "center_revealers" (graph :thickness 3 :value temperature :time-range "20s" :min 0 :max 100 :dynamic "true" :line-style "round")) ))))) (defwidget ram_status [] (eventbox :onhover "${eww} update ram_reveal=\"true\"" :onhoverlost "${eww} update ram_reveal=\"false\"" :tooltip "RAM usage" (box :orientation "h" :space-evenly "false" :class "ram_box" :vexpand "false" :hexpand "false" (image :class "center_icons" :path "images/ram.png" :image-width 30 :image-height 30) (box :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "center" :class "center_boxes" (revealer :reveal "${!ram_reveal}" :transition "slidedown" :duration "350ms" (box :orientation "v" :class "center_info" :valign "start" (label :class "center_labels" :text "${ram_parsed}" :halign "center") (scale :min 0 :max ram_all :value ram_used :orientation "h"))) (revealer :reveal ram_reveal :transition "slideup" :duration "350ms" :valign "center" (box :valign "center" :class "center_revealers" (graph :thickness 3 :value ram_used :time-range "20s" :min 0 :max ram_all :dynamic "true" :line-style "round")) ))))) (defwidget battery_status [] (eventbox :onhover "${eww} update battery_reveal=\"true\"" :onhoverlost "${eww} update battery_reveal=\"false\"" :tooltip "Battery" (box :orientation "h" :space-evenly "false" :class "battery_box" :vexpand "false" :hexpand "false" (image :class "center_icons" :path battery_image :image-width 30 :image-height 30) (box :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false" :valign "center" :class "center_boxes" (revealer :reveal "${!battery_reveal}" :transition "slidedown" :duration "350ms" (box :orientation "v" :class "center_info" :valign "start" (label :class "center_labels" :text "${battery_percent}%" :halign "center") (scale :min 0 :max 100 :value battery_percent :orientation "h"))) (revealer :reveal battery_reveal :transition "slideup" :duration "350ms" :valign "center" (box :valign "center" :class "center_revealers" (label :halign "center" :text battery_time)) ))))) ;; Right widgets (defwidget widgets_right [] (eventbox :onhover "${eww} update right_bg=\"#43013b\"" :onhoverlost "${eww} update right_bg=\"#120010\"" (box :spacing 0 :space-evenly "false" :class "bars" :orientation "h" :valign "fill" :hexpand "false" :style "background-color: ${right_bg}" (power_button) (time) (keyboard) ))) (defwidget power_button [] (eventbox :cursor "pointer" :tooltip "Logout options" (button :class "power_button" :valign "center" :onclick "~/.bscripts/rofi.sh outopts" ""))) (defwidget time [] (eventbox :tooltip "Current time" :onhover "${eww} update date_reveal=true" :onhoverlost "${eww} update date_reveal=false" :cursor "pointer" (button :onclick "scripts/popup_calendar" (box :class "time_box" :space-evenly "false" :orientation "h" :valign "center" :halign "fill" (label :valign "center" :class "time" :markup "${hour}:${minutes}${type}" ) (revealer :reveal date_reveal :transition "slideright" :duration "350ms" :valign "fill" (label :valign "fill" :class "date" :markup "${date}" )))))) (defwidget keyboard [] (box :class "kb_box" :orientation "h" :valign "fill" :halign "center" "|" (box :orientation "v" :space-evenly "false" :valign "fill" :halign "center" (eventbox :cursor "pointer" :tooltip "Change layout to US english" (button :class "kb_button_us" :onclick "scripts/kb_layouts set us" :style "color: ${us_color}" :valign "center" "US")) (eventbox :cursor "pointer" :tooltip "Change layout to US spanish" (button :class "kb_button_es" :onclick "scripts/kb_layouts set es" :style "color: ${es_color}" :valign "center" "ES") ))))