feat: eww bar workspaces new style

This commit is contained in:
hesam-init 2024-06-29 20:47:44 +03:30
parent 59d4681c05
commit ffd6dd5220
6 changed files with 373 additions and 393 deletions

View file

@ -1,5 +1,5 @@
{ {
"files.associations": { "files.associations": {
"*.yuck": "commonlisp" "*.yuck": "clojure"
}, },
} }

View file

@ -1,17 +1,18 @@
.vbar { .vbar {
min-width: 2.4em; min-width: 2.6em;
padding: 0.5em; padding: 0.4em;
background-color: $base; background-color: $base;
.workspaces { .workspaces {
@include widget; @include widget;
padding: 4px;
* { * {
transition: all cubic-bezier(0.165, 0.84, 0.44, 1) 500ms; transition: all cubic-bezier(0.165, 0.84, 0.44, 1) 500ms;
} }
.workspace { .workspace {
margin: 6px; margin: 8px;
border-radius: 4px; border-radius: 4px;
} }

View file

@ -15,13 +15,7 @@ fi
format_file() { format_file() {
local file="$1" local file="$1"
echo "Formatting $file" echo "Formatting $file"
vim -E -s "$file" <<EOF vim -c "execute 'normal! =G' | :wq!" "$file"
:source /path/to/your/yuck.vim
:filetype plugin indent on
:set filetype=yuck
:normal gg=G
:wq
EOF
} }
last_run=0 last_run=0
@ -30,7 +24,7 @@ inotifywait -m -r -e modify,create,delete,move --format '%w%f' "$WATCH_DIR" | wh
if [[ "$file" == *.yuck ]]; then if [[ "$file" == *.yuck ]]; then
current_time=$(date +%s%N | cut -b1-13) current_time=$(date +%s%N | cut -b1-13)
if ((current_time - last_run > 500)); then if ((current_time - last_run > 2500)); then
sleep 0.1 sleep 0.1
if [ -e "$file" ]; then if [ -e "$file" ]; then
format_file $file format_file $file

View file

@ -1,70 +1,69 @@
(defwindow wallpaperselect (defwindow wallpaperselect
:geometry (geometry :geometry (geometry
:x 0 :x 0
:y 0 :y 0
:width 415 :width 415
:height 600 :height 600
:anchor "center") :anchor "center")
:stacking "overlay" :stacking "overlay"
:monitor 0 :monitor 0
(box (box
:class "popup" :class "popup"
(wallpaperselectwidget))) (wallpaperselectwidget)))
(defwidget wallpaperselectwidget [] (defwidget wallpaperselectwidget []
(eventbox (eventbox
;; :onhoverlost "${EWW_CMD} close wallpaperselect"
(box
:orientation "v"
:class "unbarwidget"
:space-evenly false
(box
:orientation "h"
:space-evenly false
(input
:hexpand true
:onaccept "./scripts/wallhaven.py search {}"
:timeout "20000ms")
(button
:onclick "${EWW_CMD} update wallpapers=[] && ./scripts/wallhaven.py reset"
;; :style "padding: 0px 8px 0px 3px;"
(label
:class "icon"
:text "")))
(scroll
:hscroll false
:vscroll true
:vexpand true
(box (box
:orientation "v" :orientation "v"
:space-evenly false :class "unbarwidget"
:valign "start" :space-evenly false
(image
:style "margin: 50px 0px 5px 0px;"
:hexpand false
:vexpand false
:path "./assets/image/fieshidle.gif"
:visible {arraylength(wallpapers) == 0})
(label
:visible {arraylength(wallpapers) == 0}
:text "No wallpapers yet")
(for wall in wallpapers
(box (box
:orientation "v" :orientation "h"
:space-evenly false :space-evenly false
:class "mainentry" (input
:spacing 5 :hexpand true
(button :onaccept "./scripts/wallhaven.py search {}"
:onclick "./scripts/wallhaven.py select ${wall.url}" :timeout "20000ms")
(image :image-height 225 :image-width 400 :path {wall.path})) (button
(box :onclick "${EWW_CMD} update wallpapers=[] && ./scripts/wallhaven.py reset"
:orientation "h" ;; :style "padding: 0px 8px 0px 3px;"
:space-evenly true (label
(label :text "${wall.views} 󰈈") :class "icon"
(label :text "${wall.fav} 󰣐") :text "")))
))))
)))) (scroll
:hscroll false
:vscroll true
:vexpand true
(box
:orientation "v"
:space-evenly false
:valign "start"
(image
:style "margin: 50px 0px 5px 0px;"
:hexpand false
:vexpand false
:path "./assets/image/fieshidle.gif"
:visible {arraylength(wallpapers) == 0})
(label
:visible {arraylength(wallpapers) == 0}
:text "No wallpapers yet")
(for wall in wallpapers
(box
:orientation "v"
:space-evenly false
:class "mainentry"
:spacing 5
(button
:onclick "./scripts/wallhaven.py select ${wall.url}"
(image :image-height 225 :image-width 400 :path {wall.path}))
(box
:orientation "h"
:space-evenly true
(label :text "${wall.views} 󰈈")
(label :text "${wall.fav} 󰣐")))))))))

View file

@ -1,336 +1,322 @@
(defwidget vbar [] (defwidget vbar []
(box (box
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
:vexpand true :vexpand true
:height "1080" :height "1080"
(revealer (revealer
:transition "slideleft" :transition "slideleft"
:reveal revealControlpanel :reveal revealControlpanel
(control_widget)) (control_widget))
(centerbox (centerbox
:class "vbar" :class "vbar"
:orientation "v" :orientation "v"
(top)
(middle)
(bottom)
)))
;; :space-evenly true (defwidget top []
(top) (box
(middle) :orientation "v"
(bottom) :space-evenly false
))) :valign "start"
:vexpand false
(defwidget top [] (home)
(box (workspaces)
:orientation "v" (hiddenctl)
:space-evenly false ))
:valign "start"
:vexpand false
(home)
(workspaces)
(hiddenctl)
))
(defwidget middle [] (defwidget middle []
(box (box
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
:valign "center" :valign "center"
:vexpand false :vexpand false
:class "center_modules" :class "center_modules"
:height "180" :height "180"
(playerctl)
))
(defwidget bottom [] (playerctl)
(box ))
:orientation "v"
:space-evenly false
:valign "end"
:class "bottom_modules"
:vexpand false
:hexpand false
; (systemtray)
(sliders)
(clock)
; (battery)
))
(defwidget workspaces [] (defwidget bottom []
(eventbox (box
:cursor "pointer" :orientation "v"
:onscroll "./scripts/workspace/set-active {} ${current_workspace}" :space-evenly false
:onhover "${EWW_CMD} update show_no_of_windows=true" :valign "end"
:onhoverlost "${EWW_CMD} update show_no_of_windows=false" :class "bottom_modules"
(box :vexpand false
:class "workspaces" :hexpand false
:space-evenly false ; (systemtray)
:orientation "v" (sliders)
(clock)
; (battery)
))
(for workspace in {workspacesjson} (defwidget workspaces []
(button (eventbox
:onclick "hyprctl dispatch workspace ${workspace.id}" :cursor "pointer"
(box :onscroll "./scripts/workspace/set-active {} ${current_workspace}"
:height 30 :onhover "${EWW_CMD} update show_no_of_windows=true"
:class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}" :onhoverlost "${EWW_CMD} update show_no_of_windows=false"
(box
:class "workspaces"
:space-evenly false
:orientation "v"
(revealer (for workspace in {workspacesjson}
:reveal { workspace.id == current_workspace } (button
:transition "slideup" :onclick "hyprctl dispatch workspace ${workspace.id}"
:duration 500 (box
:height 30
:class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}"
(box (revealer
:height 45 :reveal { workspace.id == current_workspace }
) :transition "slideup"
) :duration 500
)
) (box
) :height 45)))
) )
) )
) )
)
)
(defwidget home [] (defwidget home []
(box (box
:class "widget" :class "widget"
:hexpand false :hexpand false
:vexpand false :vexpand false
(eventbox (eventbox
;; :onclick "~/.config/eww/meowidgets/scripts/launch" ;; :onclick "~/.config/eww/meowidgets/scripts/launch"
;; :onclick "~/.config/eww/meowayland/scripts/launch" ;; :onclick "~/.config/eww/meowayland/scripts/launch"
;; :onclick "./scripts/pop control" ;; :onclick "./scripts/pop control"
:onclick "${EWW_CMD} update revealControlpanel=${ !revealControlpanel }" :onclick "${EWW_CMD} update revealControlpanel=${ !revealControlpanel }"
:onrightclick "${EWW_CMD} open wallpaperselect --toggle" :onrightclick "${EWW_CMD} open wallpaperselect --toggle"
:cursor "pointer" :cursor "pointer"
(label :text "" :halign "center" :class "launchicon" :style "padding: 2px 0px;"))))
(defwidget systemtray [] (label :text "" :halign "center" :class "launchicon" :style "padding: 2px 0px;"))))
(box
:class "widget"
:space-evenly false
:valign "end"
:orientation "v"
(eventbox
:onclick "${EWW_CMD} update revealSystray=${!revealSystray}"
(label :angle {!revealSystray ? 90 : 270} :class "revealtouch" :tooltip "reveal systray" :text ""))
(revealer (defwidget systemtray []
:reveal revealSystray (box
:transition "slideup" :class "widget"
(systray :space-evenly false
:icon_size 6 :valign "end"
:prepend-new true :orientation "v"
)) (eventbox
)) :onclick "${EWW_CMD} update revealSystray=${!revealSystray}"
(label :angle {!revealSystray ? 90 : 270} :class "revealtouch" :tooltip "reveal systray" :text ""))
(revealer
:reveal revealSystray
:transition "slideup"
(systray
:icon_size 6
:prepend-new true
))
))
(defwidget clock [] (defwidget clock []
(eventbox (eventbox
:cursor "pointer" :cursor "pointer"
:onclick "${EWW_CMD} open calendar --toggle" :onclick "${EWW_CMD} open calendar --toggle"
(box (box
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
:class "widget clock" :class "widget clock"
(label :text thour)
(label :text tmin)
(label :text tpm))))
(label :text thour) (defwidget battery []
(label :text tmin) (box
(label :text tpm)))) :orientation "v"
:space-evenly false
:class "widget"
(overlay
(scale
:class "${EWW_BATTERY.BAT0.status == 'Charging' ? 'charging': bat0 < 16 ? 'dying': 'normal'} bat_scale"
:value "${bat0}"
:orientation "v"
:max 100
:min 0
:active false
:flipped true)
(label
:class "lightning"
:visible {EWW_BATTERY.BAT0.status == "Charging"}
:text "󱐋"))
(label :text "${EWW_BATTERY.BAT0.capacity}%" :limit-width 3 :show-truncated false)))
(defwidget battery [] (defwidget hiddenctl []
(box (eventbox
:orientation "v" :cursor "pointer"
:space-evenly false :onclick {reveal3 ? "${EWW_CMD} update reveal3=false" : "${EWW_CMD} update reveal3=true"}
:class "widget" (box
(overlay :orientation "v"
(scale :class "widget"
:class "${EWW_BATTERY.BAT0.status == 'Charging' ? 'charging': bat0 < 16 ? 'dying': 'normal'} bat_scale" :space-evenly false
:value "${bat0}" (revealer
:orientation "v" :reveal reveal3
:max 100 :transition "slideup"
:min 0 :duration "500ms"
:active false (box
:flipped true) :class "touch"
(label :orientation "v"
:class "lightning" :spacing 5
:visible {EWW_BATTERY.BAT0.status == "Charging"} (button :onclick "swaymsg kill"
:text "󱐋")) (label :class "icon" :text "󰅙"))
(label :text "${EWW_BATTERY.BAT0.capacity}%" :limit-width 3 :show-truncated false))) (button :onclick "wofi --show=drun -i -I"
(label :class "icon" :text "󰀻"))
(button :onclick "./scripts/touchkey.sh"
(label :class "icon" :text "󰌌"))))
(label :angle {reveal3 ? 90 : 270} :class "revealtouch" :tooltip "touch control" :text "")
(revealer
:reveal {!reveal3}
:transition "slidedown"
))))
(defwidget hiddenctl [] (defwidget playerctl []
(eventbox (eventbox
:cursor "pointer" :cursor "pointer"
:onclick {reveal3 ? "${EWW_CMD} update reveal3=false" : "${EWW_CMD} update reveal3=true"} (box
(box :class "playerctl widget"
:orientation "v" :orientation "v"
:class "widget" :space-evenly true
:space-evenly false :spacing 6
(revealer (eventbox
:reveal reveal3 :onclick "${EWW_CMD} open music --toggle"
:transition "slideup" (image :path { pcover == "" ? "./assets/image/emptympd.png" : pcover } :image-width 20 :image-height 20))
:duration "500ms" (button :onclick "playerctl previous"
(box (label :class "picon" :text "󰒮"))
:class "touch" (button :onclick "playerctl play-pause"
:orientation "v" (label :class "picon" :text { pstatus == "Playing" ? "" : "" }))
:spacing 5 (button :onclick "playerctl next"
(button :onclick "swaymsg kill" (label :class "picon" :text "󰒭"))
(label :class "icon" :text "󰅙")) )))
(button :onclick "wofi --show=drun -i -I" (defwidget sliders []
(label :class "icon" :text "󰀻")) (box
(button :onclick "./scripts/touchkey.sh" :class "widget"
(label :class "icon" :text "󰌌")))) :orientation "v"
(label :angle {reveal3 ? 90 : 270} :class "revealtouch" :tooltip "touch control" :text "") :space-evenly false
(revealer :spacing 5
:reveal {!reveal3} :valign "end"
:transition "slidedown" (button :onclick "alacritty -e nmtui" :tooltip wifi_essid
;; (tasklist))))) (label :class "icon" :style "font-size: 18px;" :text wifi_icon))
)))) (reveal_on_hover
:var revealVolume
(defwidget playerctl [] :varname "revealVolume"
(eventbox (box
:cursor "pointer" :orientation "v"
(box :space-evenly false
:class "playerctl widget" :class "sound"
:orientation "v" (label :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"})
:space-evenly true ;; {volumemute == 'no' ? volume : " Muted"})
:spacing 6 )
(scale
(eventbox :class "volslide"
:onclick "${EWW_CMD} open music --toggle" :value volume
(image :path { pcover == "" ? "./assets/image/emptympd.png" : pcover } :image-width 20 :image-height 20)) :onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
(button :onclick "playerctl previous" :orientation "v"
(label :class "picon" :text "󰒮")) :tooltip "${volume}%"
(button :onclick "playerctl play-pause" :max 101
(label :class "picon" :text { pstatus == "Playing" ? "" : "" })) :min 0
(button :onclick "playerctl next" :flipped true))
(label :class "picon" :text "󰒭")) (reveal_on_hover
))) :var revealMicrophone
:varname "revealMicrophone"
(defwidget sliders [] (box
(box :orientation "v"
:class "widget" :space-evenly false
:orientation "v" :class "sound"
:space-evenly false (label :class "icon" :text {volumemute == 'false' ? "" : "󰖁"}))
:spacing 5 (scale
:valign "end" :class "volslide"
(button :onclick "alacritty -e nmtui" :tooltip wifi_essid :value mic_volume
(label :class "icon" :style "font-size: 18px;" :text wifi_icon)) :onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%"
:orientation "v"
(reveal_on_hover :tooltip "${mic_volume}%"
:var revealVolume :max 101
:varname "revealVolume" :min 0
(box :flipped true))
:orientation "v" (reveal_on_hover
:space-evenly false :var revealBrightness
:class "sound" :varname "revealBrightness"
(label :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"}) (box
;; {volumemute == 'no' ? volume : " Muted"}) :orientation "v"
) :space-evenly false
(scale :class "bright"
:class "volslide" (label :class "icon" :text "󰃞"))
:value volume (scale
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%" :class "brislide"
:orientation "v" :onchange "brightnessctl set {}%"
:tooltip "${volume}%" :value brightness
:max 101 :orientation "v"
:min 0 :tooltip "${brightness}%"
:flipped true)) :max 100
:min 0
(reveal_on_hover :flipped true))
:var revealMicrophone ))
:varname "revealMicrophone" ;; other windows
(box (defwindow calendar
:orientation "v" :geometry (geometry :x "0"
:space-evenly false :y "0"
:class "sound" :width "100"
(label :class "icon" :text {volumemute == 'false' ? "" : "󰖁"})) :height "35"
(scale :anchor "bottom left")
:class "volslide" :stacking "overlay"
:value mic_volume :monitor 0
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%" (box
:orientation "v" :class "popup"
:tooltip "${mic_volume}%" (box
:max 101 :class "unbarwidget"
:min 0 (calendar :day calendar_day :year calendar_year :class "cal"))))
:flipped true)) (defwindow music
:geometry (geometry :x "0"
(reveal_on_hover :y "0"
:var revealBrightness :width "440"
:varname "revealBrightness" :height "200"
(box :anchor "center left")
:orientation "v" :stacking "overlay"
:space-evenly false :monitor 0
:class "bright" (box
(label :class "icon" :text "󰃞")) :class "popup"
(scale (box
:class "brislide" :orientation "h"
:onchange "brightnessctl set {}%" :class "unbarwidget"
:value brightness :space-evenly false
:orientation "v" :spacing 20
:tooltip "${brightness}%" (image :style "margin: 5px;" :image-height 190 :image-width 190 :path { pcover == "" ? "./assets/image/emptympd.png" : pcover })
:max 100 (box
:min 0 :orientation "v"
:flipped true)) :space-evenly false
)) :width 210
:height 200
;; other windows (scroll
(defwindow calendar :hscroll true
:geometry (geometry :x "0" :vscroll false
:y "0" (label :class "mtitle" :text psong))
:width "100" (scroll
:height "35" :hscroll true
:anchor "bottom left") :vscroll false
:stacking "overlay" (label :class "mauthor" :text partist))
:monitor 0 (box
(box :orientation "h"
:class "popup" :class "mpd_controls"
(box :style "margin-top: 10px;"
:class "unbarwidget" (button :onclick "playerctl previous"
(calendar :day calendar_day :year calendar_year :class "cal")))) (label :text "󰒮"))
(button :style "padding-right: 3px;" :onclick "playerctl play-pause"
(defwindow music (label :text { pstatus == "Playing" ? "" : ""} ))
:geometry (geometry :x "0" (button :onclick "playerctl next" (label :text "󰒭")))
:y "0" (scale
:width "440" :class "seektime"
:height "200" :value { ptime.position }
:anchor "center left") :orientation "h"
:stacking "overlay" ;; :onchange "playerctl position {}"
:monitor 0 :min 0
(box :max { ptime.duration }
:class "popup" :tooltip { ptime.readable }))
(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 :style "padding-right: 3px;" :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 }))
)))

@ -1 +1 @@
Subproject commit f39d12118656eb34ff64e857bde04250609d78b5 Subproject commit 70cd2cc2b6f50df0af9b117ceb214a543471a603