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": {
"*.yuck": "commonlisp"
"*.yuck": "clojure"
},
}

View file

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

View file

@ -15,13 +15,7 @@ fi
format_file() {
local file="$1"
echo "Formatting $file"
vim -E -s "$file" <<EOF
:source /path/to/your/yuck.vim
:filetype plugin indent on
:set filetype=yuck
:normal gg=G
:wq
EOF
vim -c "execute 'normal! =G' | :wq!" "$file"
}
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
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
if [ -e "$file" ]; then
format_file $file

View file

@ -1,70 +1,69 @@
(defwindow wallpaperselect
:geometry (geometry
:x 0
:y 0
:width 415
:height 600
:anchor "center")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(wallpaperselectwidget)))
:geometry (geometry
:x 0
:y 0
:width 415
:height 600
:anchor "center")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(wallpaperselectwidget)))
(defwidget wallpaperselectwidget []
(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 "")))
(eventbox
(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})
:orientation "v"
:class "unbarwidget"
:space-evenly false
(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} 󰣐")
))))
))))
: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
: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 []
(box
:orientation "h"
:space-evenly false
:vexpand true
:height "1080"
(box
:orientation "h"
:space-evenly false
:vexpand true
:height "1080"
(revealer
:transition "slideleft"
:reveal revealControlpanel
(control_widget))
(centerbox
:class "vbar"
:orientation "v"
(revealer
:transition "slideleft"
:reveal revealControlpanel
(control_widget))
(centerbox
:class "vbar"
:orientation "v"
(top)
(middle)
(bottom)
)))
;; :space-evenly true
(top)
(middle)
(bottom)
)))
(defwidget top []
(box
:orientation "v"
:space-evenly false
:valign "start"
:vexpand false
(home)
(workspaces)
(hiddenctl)
))
(defwidget top []
(box
:orientation "v"
:space-evenly false
:valign "start"
:vexpand false
(home)
(workspaces)
(hiddenctl)
))
(defwidget middle []
(box
:orientation "v"
:space-evenly false
:valign "center"
:vexpand false
:class "center_modules"
:height "180"
(playerctl)
))
(box
:orientation "v"
:space-evenly false
:valign "center"
:vexpand false
:class "center_modules"
:height "180"
(defwidget bottom []
(box
:orientation "v"
:space-evenly false
:valign "end"
:class "bottom_modules"
:vexpand false
:hexpand false
; (systemtray)
(sliders)
(clock)
; (battery)
))
(playerctl)
))
(defwidget workspaces []
(eventbox
:cursor "pointer"
:onscroll "./scripts/workspace/set-active {} ${current_workspace}"
:onhover "${EWW_CMD} update show_no_of_windows=true"
:onhoverlost "${EWW_CMD} update show_no_of_windows=false"
(box
:class "workspaces"
:space-evenly false
:orientation "v"
(defwidget bottom []
(box
:orientation "v"
:space-evenly false
:valign "end"
:class "bottom_modules"
:vexpand false
:hexpand false
; (systemtray)
(sliders)
(clock)
; (battery)
))
(for workspace in {workspacesjson}
(button
:onclick "hyprctl dispatch workspace ${workspace.id}"
(box
:height 30
:class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}"
(defwidget workspaces []
(eventbox
:cursor "pointer"
:onscroll "./scripts/workspace/set-active {} ${current_workspace}"
:onhover "${EWW_CMD} update show_no_of_windows=true"
:onhoverlost "${EWW_CMD} update show_no_of_windows=false"
(box
:class "workspaces"
:space-evenly false
:orientation "v"
(revealer
:reveal { workspace.id == current_workspace }
:transition "slideup"
:duration 500
(for workspace in {workspacesjson}
(button
:onclick "hyprctl dispatch workspace ${workspace.id}"
(box
:height 30
:class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}"
(box
:height 45
)
)
)
(revealer
:reveal { workspace.id == current_workspace }
:transition "slideup"
:duration 500
)
)
)
)
)
(box
:height 45)))
)
)
)
)
)
(defwidget home []
(box
:class "widget"
:hexpand false
:vexpand false
(eventbox
;; :onclick "~/.config/eww/meowidgets/scripts/launch"
;; :onclick "~/.config/eww/meowayland/scripts/launch"
;; :onclick "./scripts/pop control"
:onclick "${EWW_CMD} update revealControlpanel=${ !revealControlpanel }"
:onrightclick "${EWW_CMD} open wallpaperselect --toggle"
:cursor "pointer"
(label :text "" :halign "center" :class "launchicon" :style "padding: 2px 0px;"))))
(defwidget home []
(box
:class "widget"
:hexpand false
:vexpand false
(eventbox
;; :onclick "~/.config/eww/meowidgets/scripts/launch"
;; :onclick "~/.config/eww/meowayland/scripts/launch"
;; :onclick "./scripts/pop control"
:onclick "${EWW_CMD} update revealControlpanel=${ !revealControlpanel }"
:onrightclick "${EWW_CMD} open wallpaperselect --toggle"
:cursor "pointer"
(defwidget systemtray []
(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 ""))
(label :text "" :halign "center" :class "launchicon" :style "padding: 2px 0px;"))))
(revealer
:reveal revealSystray
:transition "slideup"
(systray
:icon_size 6
:prepend-new true
))
))
(defwidget systemtray []
(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
:reveal revealSystray
:transition "slideup"
(systray
:icon_size 6
:prepend-new true
))
))
(defwidget clock []
(eventbox
:cursor "pointer"
:onclick "${EWW_CMD} open calendar --toggle"
(box
:orientation "v"
:space-evenly false
:class "widget clock"
(defwidget clock []
(eventbox
:cursor "pointer"
:onclick "${EWW_CMD} open calendar --toggle"
(box
:orientation "v"
:space-evenly false
:class "widget clock"
(label :text thour)
(label :text tmin)
(label :text tpm))))
(label :text thour)
(label :text tmin)
(label :text tpm))))
(defwidget battery []
(box
: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 []
(box
: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 hiddenctl []
(eventbox
:cursor "pointer"
:onclick {reveal3 ? "${EWW_CMD} update reveal3=false" : "${EWW_CMD} update reveal3=true"}
(box
:orientation "v"
:class "widget"
:space-evenly false
(revealer
:reveal reveal3
:transition "slideup"
:duration "500ms"
(box
:class "touch"
:orientation "v"
:spacing 5
(button :onclick "swaymsg kill"
(label :class "icon" :text "󰅙"))
(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 []
(eventbox
:cursor "pointer"
:onclick {reveal3 ? "${EWW_CMD} update reveal3=false" : "${EWW_CMD} update reveal3=true"}
(box
:orientation "v"
:class "widget"
:space-evenly false
(revealer
:reveal reveal3
:transition "slideup"
:duration "500ms"
(box
:class "touch"
:orientation "v"
:spacing 5
(button :onclick "swaymsg kill"
(label :class "icon" :text "󰅙"))
(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"
;; (tasklist)))))
))))
(defwidget playerctl []
(eventbox
:cursor "pointer"
(box
:class "playerctl widget"
:orientation "v"
:space-evenly true
:spacing 6
(eventbox
:onclick "${EWW_CMD} open music --toggle"
(image :path { pcover == "" ? "./assets/image/emptympd.png" : pcover } :image-width 20 :image-height 20))
(button :onclick "playerctl previous"
(label :class "picon" :text "󰒮"))
(button :onclick "playerctl play-pause"
(label :class "picon" :text { pstatus == "Playing" ? "" : "" }))
(button :onclick "playerctl next"
(label :class "picon" :text "󰒭"))
)))
(defwidget sliders []
(box
:class "widget"
:orientation "v"
:space-evenly false
:spacing 5
:valign "end"
(button :onclick "alacritty -e nmtui" :tooltip wifi_essid
(label :class "icon" :style "font-size: 18px;" :text wifi_icon))
(reveal_on_hover
:var revealVolume
:varname "revealVolume"
(box
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"})
;; {volumemute == 'no' ? volume : " Muted"})
)
(scale
:class "volslide"
:value volume
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
:orientation "v"
:tooltip "${volume}%"
:max 101
:min 0
:flipped true))
(reveal_on_hover
:var revealMicrophone
:varname "revealMicrophone"
(box
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "" : "󰖁"}))
(scale
:class "volslide"
:value mic_volume
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%"
:orientation "v"
:tooltip "${mic_volume}%"
:max 101
:min 0
:flipped true))
(reveal_on_hover
:var revealBrightness
:varname "revealBrightness"
(box
:orientation "v"
:space-evenly false
:class "bright"
(label :class "icon" :text "󰃞"))
(scale
:class "brislide"
:onchange "brightnessctl set {}%"
:value brightness
:orientation "v"
:tooltip "${brightness}%"
:max 100
:min 0
:flipped true))
))
;; other windows
(defwindow calendar
:geometry (geometry :x "0"
:y "0"
:width "100"
:height "35"
:anchor "bottom left")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(box
:class "unbarwidget"
(calendar :day calendar_day :year calendar_year :class "cal"))))
(defwindow music
:geometry (geometry :x "0"
:y "0"
:width "440"
:height "200"
:anchor "center left")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(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 }))
)))
(defwidget playerctl []
(eventbox
:cursor "pointer"
(box
:class "playerctl widget"
:orientation "v"
:space-evenly true
:spacing 6
(eventbox
:onclick "${EWW_CMD} open music --toggle"
(image :path { pcover == "" ? "./assets/image/emptympd.png" : pcover } :image-width 20 :image-height 20))
(button :onclick "playerctl previous"
(label :class "picon" :text "󰒮"))
(button :onclick "playerctl play-pause"
(label :class "picon" :text { pstatus == "Playing" ? "" : "" }))
(button :onclick "playerctl next"
(label :class "picon" :text "󰒭"))
)))
(defwidget sliders []
(box
:class "widget"
:orientation "v"
:space-evenly false
:spacing 5
:valign "end"
(button :onclick "alacritty -e nmtui" :tooltip wifi_essid
(label :class "icon" :style "font-size: 18px;" :text wifi_icon))
(reveal_on_hover
:var revealVolume
:varname "revealVolume"
(box
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"})
;; {volumemute == 'no' ? volume : " Muted"})
)
(scale
:class "volslide"
:value volume
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
:orientation "v"
:tooltip "${volume}%"
:max 101
:min 0
:flipped true))
(reveal_on_hover
:var revealMicrophone
:varname "revealMicrophone"
(box
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "" : "󰖁"}))
(scale
:class "volslide"
:value mic_volume
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%"
:orientation "v"
:tooltip "${mic_volume}%"
:max 101
:min 0
:flipped true))
(reveal_on_hover
:var revealBrightness
:varname "revealBrightness"
(box
:orientation "v"
:space-evenly false
:class "bright"
(label :class "icon" :text "󰃞"))
(scale
:class "brislide"
:onchange "brightnessctl set {}%"
:value brightness
:orientation "v"
:tooltip "${brightness}%"
:max 100
:min 0
:flipped true))
))
;; other windows
(defwindow calendar
:geometry (geometry :x "0"
:y "0"
:width "100"
:height "35"
:anchor "bottom left")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(box
:class "unbarwidget"
(calendar :day calendar_day :year calendar_year :class "cal"))))
(defwindow music
:geometry (geometry :x "0"
:y "0"
:width "440"
:height "200"
:anchor "center left")
:stacking "overlay"
:monitor 0
(box
:class "popup"
(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