mirror of
https://github.com/Nickiel12/nicks-nix-config.git
synced 2024-11-25 22:25:29 -08:00
287 lines
9.2 KiB
Text
287 lines
9.2 KiB
Text
|
|
(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 "true"
|
|
(label :class "music_title"
|
|
:halign "center"
|
|
:wrap "true"
|
|
:limit-width 30
|
|
: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 dash_computer_status []
|
|
(box :class "dash_window"
|
|
:orientation "v"
|
|
:space-evenly "false"
|
|
:hexpand "false"
|
|
:vexpand "false"
|
|
(box :class "arc_container"
|
|
:hexpand "false"
|
|
:width 200
|
|
:height 200
|
|
:valign "center"
|
|
:halign "center"
|
|
(circular-progress :class "res_cpu"
|
|
:value {EWW_CPU.avg}
|
|
:thickness 5
|
|
(box :orientation "v"
|
|
:halign "center"
|
|
:valign "center"
|
|
:vexpand "false"
|
|
(label :class "small_circle_text" :text "CPU")
|
|
(label :class "small_circle_text" :text "${round(EWW_CPU.avg, 2)}%")
|
|
))
|
|
)
|
|
(box :orientation "h"
|
|
:vexpand "true"
|
|
:valign "center"
|
|
(box :class "arc_container"
|
|
:width 125
|
|
:height 125
|
|
:valign "center"
|
|
:halign "center"
|
|
(circular-progress :class "res_mem"
|
|
:value {EWW_RAM.used_mem_perc}
|
|
:thickness 5
|
|
(box :orientation "v"
|
|
:halign "center"
|
|
:valign "center"
|
|
:vexpand "false"
|
|
(label :class "small_circle_text" :text "RAM")
|
|
(label :class "small_circle_text" :text "${round(EWW_RAM.used_mem_perc, 2)}%")
|
|
)
|
|
)
|
|
)
|
|
(box :class "arc_container"
|
|
:width 125
|
|
:height 125
|
|
:valign "center"
|
|
:halign "center"
|
|
(circular-progress :class "res_hdd"
|
|
:value {EWW_DISK["/"].used_perc}
|
|
:thickness 5
|
|
(box :orientation "v"
|
|
:halign "center"
|
|
:valign "center"
|
|
:vexpand "false"
|
|
(label :class "small_circle_text" :text "Disk")
|
|
(label :class "small_circle_text" :text "${round(EWW_DISK["/"].used_perc, 2)}%")
|
|
))
|
|
))))
|
|
|
|
|
|
(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 710
|
|
:y 300
|
|
:width 500
|
|
:height 150)
|
|
(dash_clock)
|
|
)
|
|
|
|
(defwindow dash_clock_bg
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 710
|
|
:y 300
|
|
:width 500
|
|
:height 150)
|
|
(dash_clock_bg)
|
|
)
|
|
|
|
(defwindow dash_music
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 710
|
|
:y 475
|
|
:width 500
|
|
:height 150)
|
|
(dash_music_state)
|
|
)
|
|
|
|
(defwindow dash_computer_status
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 450
|
|
:y 300
|
|
:width 250
|
|
:height 350)
|
|
(dash_computer_status)
|
|
)
|
|
|
|
(defwindow logout
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 1220
|
|
:y 300
|
|
:width 75
|
|
:height 75)
|
|
(logout))
|
|
|
|
(defwindow restart
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 1220
|
|
:y 395
|
|
:width 75
|
|
:height 75)
|
|
(restart))
|
|
|
|
(defwindow shutdown
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 1220
|
|
:y 485
|
|
:width 75
|
|
:height 75)
|
|
(shutdown))
|
|
|
|
(defwindow reboot_windows
|
|
:stacking "bg"
|
|
:focusable "false"
|
|
:monitor 0
|
|
:geometry (geometry :x 1220
|
|
:y 580
|
|
: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)
|
|
)
|