(defwidget elevate_to_windows [] (revealer :transition "slideup" :reveal { show_elevation_prompt } :duration { "0ms" } ;; needs to be close to the default timeout, because the timeout is broken (box :class "input_popup" :vexpand "false" :hexpand "false" :orientation "v" :spacing 2 (label :class "input_popup_label" :text "Elevation Required" :xalign 0.5) (box :class "input_popup_input_box" (input :class "input_popup_input" :password true :timeout "1000ms" ;; this does nothing :( :onaccept "eww update show_elevation_prompt=false;eww close elevate_to_windows; echo \"{}\" | sudo -S grub-reboot 1 && systemctl reboot") )))) (defpoll clock_gradient :interval "5m" {"gcal --resource-file=/home/nixolas/.config/eww/scripts/gcalinfo -H no | ewwtilities calendar-background"}) (defwidget dash_clock_bg [] (box :class "dash_clock_bg" :style "background-image: ${clock_gradient}" )) (defwidget dash_clock [] (box :class "dash_clock" :style "background-image: url('images/dash_clock_bg.png');" :orientation "v" :vexpand "false" :hexpand "false" :spacing 1 (label :class "dash_clock_time" :halign "center" :text {formattime(EWW_TIME, "%H:%M:%S")}) (label :class "dash_clock_date" :halign "center" :text {formattime(EWW_TIME, "%B, %d %Y")}) )) (deflisten music_artist :initial "" "playerctl --follow metadata artist || true") (deflisten music_title :initial "" "playerctl --follow metadata title || true") (deflisten music_cover :initial "" "playerctl --follow metadata mpris:artUrl || true") (deflisten music_percentage :initial "0" "playerctl --follow metadata \"{{ (position * 100 / mpris:length) }}\" || true") (deflisten MUSIC_STATUS :initial "true" "playerctl --follow status") (defwidget dash_music_state [] (box :class "dash_window" :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false" (box :class "album_art" :vexpand "false" :hexpand "false" :style "background-image: url('${music_cover}');") (box :orientation "v" :class "music_controls" :spacing 10 :space-evenly "false" :vexpand "false" :hexpand "false" (label :class "music_title" :halign "center" :wrap "true" :limit-width 20 :text music_title ) (label :class "music_artist" :halign "center" :text music_artist ) (box :orientation "h" :spacing 20 :halign "center" :space-evenly "true" :vexpand "false" :hexpand "false" (button :class "music_button" :onclick "playerctl previous" "󰒫") (button :class "music_button" :onclick "playerctl play-pause" { MUSIC_STATUS == "Playing" ? "󰏤" : MUSIC_STATUS == "Paused" ? "" : "" }) (button :class "music_button" :onclick "playerctl next" "󰒬") ) (box :class "music_bar" :halign "center" :vexpand "false" :hexpand "false" (scale :min 0 :active "true" :max 100 :value music_percentage) ) ) ) ) (defwidget logout [] (box :class "dash_window" :vexpand "false" :hexpand "false" (button :class "btn_logout" :onclick "hyprctl dispatch exit" "󰍃"))) (defwidget restart [] (box :class "dash_window" :vexpand "false" :hexpand "false" (button :class "btn_restart" :onclick "systemctl reboot" "󰜉"))) (defwidget shutdown [] (box :class "dash_window" :vexpand "false" :hexpand "false" (button :class "btn_shutdown" :onclick "systemctl poweroff" "󰐥"))) (defwidget reboot_windows [] (box :class "dash_window" :vexpand "false" :hexpand "false" (button :class "btn_switch_windows" :onclick "eww open elevate_to_windows; eww update show_elevation_prompt=true" ""))) (defwindow dash_clock :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 760 :y 200 :width 400 :height 150) (dash_clock) ) (defwindow dash_clock_bg :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 760 :y 200 :width 400 :height 150) (dash_clock_bg) ) (defwindow dash_music :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 760 :y 575 :width 400 :height 150) (dash_music_state) ) (defwindow logout :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 1400 :y 200 :width 75 :height 75) (logout)) (defwindow restart :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 1400 :y 280 :width 75 :height 75) (restart)) (defwindow shutdown :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 1400 :y 360 :width 75 :height 75) (shutdown)) (defwindow reboot_windows :stacking "bg" :focusable "false" :monitor 0 :geometry (geometry :x 1400 :y 440 :width 75 :height 75) (reboot_windows)) ;; Set up prompt window for sudo password ;; that trigglers on reboot_windows, ;; and runs the windows command (defwindow elevate_to_windows :monitor 0 :exclusive false :stacking "overlay" :focusable true :geometry (geometry :anchor "center center") (elevate_to_windows) )