feat: formatter

This commit is contained in:
hesam-init 2024-06-29 16:05:09 +03:30
parent bf9e720177
commit 9cca7e76c2
3 changed files with 359 additions and 319 deletions

View file

@ -4,15 +4,15 @@
@import "./assets/scss/windows/vbar.scss"; @import "./assets/scss/windows/vbar.scss";
@import "./assets/src/control-panel/styles.scss"; @import "./src/control-panel/styles.scss";
@import "./assets/src/dashboard/styles.scss"; @import "./src/dashboard/styles.scss";
@import "./assets/src/dock/styles.scss"; @import "./src/dock/styles.scss";
@import "./assets/src/desktop/styles.scss"; @import "./src/desktop/styles.scss";
@import "./assets/src/notification/styles.scss"; @import "./src/notification/styles.scss";
* { * {
all: unset; all: unset;

View file

@ -1 +1,41 @@
echo "Shit" #!/bin/bash
WATCH_DIR="$(pwd)"
if [ -z "$WATCH_DIR" ]; then
echo "Usage: $0 <directory>"
exit 1
fi
if [ ! -d "$WATCH_DIR" ]; then
echo "Directory $WATCH_DIR does not exist."
exit 1
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
}
last_run=0
inotifywait -m -r -e modify,create,delete,move --format '%w%f' "$WATCH_DIR" | while read -r file; do
if [[ "$file" == *.yuck ]]; then
current_time=$(date +%s%N | cut -b1-13)
if ((current_time - last_run > 500)); then
sleep 0.1
if [ -e "$file" ]; then
format_file $file
fi
last_run=$current_time
fi
fi
done

View file

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