From dccad1e64e219dd1f4e21d90c2496cbafa948032 Mon Sep 17 00:00:00 2001 From: hesam-init Date: Fri, 28 Jun 2024 09:56:54 +0330 Subject: [PATCH] feat: eww workspaces --- .scripts/setup/pkgs-installer.sh | 2 +- hypr-configs/hyprland/eww/bar/bar.scss | 192 +++++------ hypr-configs/hyprland/eww/bar/bar.yuck | 65 +++- hypr-configs/hyprland/eww/colors.scss | 2 +- .../eww/control_panel/control_panel.yuck | 322 +++++++++--------- .../hyprland/eww/dashboard/dashboard.yuck | 90 ++--- .../hyprland/eww/desktop/desktop.yuck | 24 +- hypr-configs/hyprland/eww/dock/dock.yuck | 39 ++- hypr-configs/hyprland/eww/eww.scss | 181 +++++----- hypr-configs/hyprland/eww/scripts/pop | 7 +- hypr-configs/hyprland/eww/scripts/workspaces | 54 +++ .../hyprland/eww/wallpapers/wallpapers.yuck | 62 ++-- 12 files changed, 564 insertions(+), 476 deletions(-) create mode 100755 hypr-configs/hyprland/eww/scripts/workspaces diff --git a/.scripts/setup/pkgs-installer.sh b/.scripts/setup/pkgs-installer.sh index fa188e0..1c77325 100755 --- a/.scripts/setup/pkgs-installer.sh +++ b/.scripts/setup/pkgs-installer.sh @@ -12,7 +12,7 @@ declare -A PACKAGES=( ["BASE_PACKAGES"]="inetutils v4l2loopback bind-utils zellij bat dust aria2 fzf neofetch bat zsh fish-shell brightnessctl bluez cronie git stow eza dbus seatd elogind polkit NetworkManager gnome-keyring polkit-gnome pipewire wireplumber inotify-tools xorg gnome-keyring polkit-gnome mtpfs ffmpeg libnotify" ["DEVEL_PACKAGES"]="glib pango-devel gdk-pixbuf-devel libdbusmenu-gtk3-devel glib-devel gtk+3-devel gtk-layer-shell-devel base-devel startup-notification-devel cairo-devel xcb-util-devel xcb-util-cursor-devel xcb-util-xrm-devel xcb-util-wm-devel" ["AMD_DRIVERS"]="opencv Vulkan-Headers Vulkan-Tools Vulkan-ValidationLayers-32bit mesa-vulkan-radeon mesa-vulkan-radeon-32bit vulkan-loader vulkan-loader-32bit libspa-vulkan libspa-vulkan-32bit amdvlk mesa-dri mesa-vaapi" - ["HYPRLAND_PACKAGES"]="eww nerd-fonts-symbols-ttf Waybar avizo dunst swaybg mpvpaper grim jq slurp cliphist wl-clipboard swayidle pavucontrol nemo eog pavucontrol evince xorg-server-xwayland xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-utils qt5-x11extras qt5-wayland qt6-wayland" + ["HYPRLAND_PACKAGES"]="socat eww nerd-fonts-symbols-ttf Waybar avizo dunst swaybg mpvpaper grim jq slurp cliphist wl-clipboard swayidle pavucontrol nemo eog pavucontrol evince xorg-server-xwayland xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-utils qt5-x11extras qt5-wayland qt6-wayland" ["SYSTEM_APPS"]="alacritty octoxbps blueman wifish wpa_gui glow" ) diff --git a/hypr-configs/hyprland/eww/bar/bar.scss b/hypr-configs/hyprland/eww/bar/bar.scss index be5565f..5e193d6 100644 --- a/hypr-configs/hyprland/eww/bar/bar.scss +++ b/hypr-configs/hyprland/eww/bar/bar.scss @@ -1,68 +1,84 @@ +.widget { + padding: 5px 5px; + border-radius: 5px; + background-color: $surface0; + margin: 5px 2px; + color: $white0; + // border-style: solid; + // border-color: $white0; + // border-width: 2px; +} .barwidget { - background-color: $base; - padding: 5px; + background-color: $base; + padding: 5px; } .icon { - font-size: 20px; - min-width: 1em; - min-height: 1em; - font-family: "Symbols Nerd Font"; - padding: 2px 0px; + font-size: 20px; + min-width: 1em; + min-height: 1em; + font-family: "Symbols Nerd Font"; + padding: 2px 0px; } .revealtouch { - font-size: 20px; - margin: 5px 0px; - color: $surface2; + font-size: 20px; + margin: 5px 0px; + color: $surface2; } .workspaces { - padding: 5px; -} + @extend .widget; -.workspaces label { - font-size: 18; - padding-right: 5px; - padding: 2px 5px 2px 0px; -} + * { + transition: all cubic-bezier(0.165, 0.84, 0.44, 1) 500ms; + } -.widget { - padding: 5px 5px; - border-radius: 5px; - background-color: $surface0; - margin: 5px 2px; - color: $white0; - // border-style: solid; - // border-color: $white0; - // border-width: 2px; + .workspace { + margin: 6px; + border-radius: 4px; + } + + .workspacething { + background-color: $surface2; + } + + .workspacethingactive { + background-color: $accent; + } + + .label { + // font-size: 18; + // padding-right: 5px; + // padding: 2px 5px 2px 0px; + } } .clock label { - font-size: 20px; + font-size: 20px; } -.bat_scale trough{ - min-height: 50px; - min-width: 18px; - border-radius: 5px; - slider { - all: unset; - } +.bat_scale trough { + min-height: 50px; + min-width: 18px; + border-radius: 5px; + slider { + all: unset; + } } -.bat_scale trough highlight{ - border-radius: 5px; - background-color: $accent; +.bat_scale trough highlight { + border-radius: 5px; + background-color: $accent; } .charging trough highlight { - background-color: $green; + background-color: $green; } .dying trough highlight { - background-color: $red; + background-color: $red; } // .mpd label { @@ -74,87 +90,73 @@ // } .mpd_controls label { - font-family: "Symbols Nerd Font"; - min-width: 1em; - min-height: 1em; - font-size: 30px; - padding: 15px; + font-family: "Symbols Nerd Font"; + min-width: 1em; + min-height: 1em; + font-size: 30px; + padding: 15px; } .seektime { - trough { - min-height: 10px; - min-width: 180px; + trough { + min-height: 10px; + min-width: 180px; - slider { - background-color: $white2; - border-radius: 25px; - min-height: 20px; - min-width: 20px; - margin: -10px; - } - - highlight { - background-color: $red; - } + slider { + background-color: $white2; + border-radius: 25px; + min-height: 20px; + min-width: 20px; + margin: -10px; } + + highlight { + background-color: $red; + } + } } .sidempdctl { - margin: 5px; - label { - font-size: 30px; - padding-right: 5px; - min-height: 1em; - min-width: 1em; - } + margin: 5px; + label { + font-size: 30px; + padding-right: 5px; + min-height: 1em; + min-width: 1em; + } } .mpdvolumeseek { - @extend .seektime; - trough { - min-height: 100px; - min-width: 10px; - highlight { - background-color: $white0; - } + @extend .seektime; + trough { + min-height: 100px; + min-width: 10px; + highlight { + background-color: $white0; } + } } .touch label { - font-size: 20px; + font-size: 20px; } .mtitle { - color: $white0; - font-size: 20px; - margin-top: 30px; + color: $white0; + font-size: 20px; + margin-top: 30px; } .launchicon { - @extend .icon; - color: $accent; + @extend .icon; + color: $accent; } .picon { - @extend .icon; - font-size: 18px; + @extend .icon; + font-size: 18px; } .lightning { - color: $surface0 -} - -.workspacething, .workspacethingactive { - transition: 500ms; - border-radius: 5; - margin: 6px; -} - -.workspacething { - background-color: $surface2; -} - -.workspacethingactive { - background-color: $accent; + color: $surface0; } diff --git a/hypr-configs/hyprland/eww/bar/bar.yuck b/hypr-configs/hyprland/eww/bar/bar.yuck index 3db6ed8..99c70bf 100644 --- a/hypr-configs/hyprland/eww/bar/bar.yuck +++ b/hypr-configs/hyprland/eww/bar/bar.yuck @@ -1,5 +1,5 @@ -(defwindow bar +(defwindow bar :geometry (geometry :x "0%" :y "0%" @@ -14,6 +14,7 @@ :wm-ignore false (barstruct)) + (defwidget barstruct [] (box :orientation "h" @@ -32,7 +33,7 @@ (bottom) ))) -(defwidget top [] +(defwidget top [] (box :orientation "v" :space-evenly false @@ -45,7 +46,7 @@ (hiddenctl) )) -(defwidget middle [] +(defwidget middle [] (box :orientation "v" :space-evenly false @@ -66,25 +67,57 @@ :hexpand false (stray) (sliders) - (battery) (clock) + ; (battery) )) +(defvar show_no_of_windows false) + +(deflisten workspacesdata :initial "[]" "./scripts/workspaces get-all-workspaces") + +(defpoll current_workspace :initial "0" :interval "50ms" "./scripts/workspaces get-active-workspace") + (defwidget workspaces [] - (eventbox + (eventbox :cursor "pointer" + :onscroll "./scripts/workspaces change {} ${current_workspace}" + :onhover "eww update show_no_of_windows=true" + :onhoverlost "eww update show_no_of_windows=false" (box - :class "workspaces widget" - :orientation "v" - :space-evenly false - (for workspace in {workspacejson} - (button - :onclick "swaymsg -t command workspace number ${workspace.name}" - (box - :hexpand false - :width 10 - :height { workspace.focused ? 60 : !workspace.empty ? 40 : 30} - :class { workspace.focused ? "workspacethingactive" : "workspacething"})))))) + :class "workspaces" + :space-evenly false + :orientation "v" + (for workspace in {workspacesdata} + (button + :onclick "hyprctl dispatch workspace ${workspace.id}" + (box + :hexpand false + :width 10 + :height { workspace.id == current_workspace ? 60 : 35 } + :class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}" + ) + ) + ) + ) + ) + ) + +; (defwidget workspaces [] +; (eventbox +; :cursor "pointer" +; (box +; :class "workspaces widget" +; :orientation "v" +; :space-evenly false +; (for workspace in {workspacejson} +; (button +; :onclick "swaymsg -t command workspace number ${workspace.name}" +; (box +; :hexpand false +; :width 10 +; :height { workspace.focused ? 60 : !workspace.empty ? 40 : 30} +; :class { workspace.focused ? "workspacethingactive" : "workspacething"})))))) + (defwidget home [] (box diff --git a/hypr-configs/hyprland/eww/colors.scss b/hypr-configs/hyprland/eww/colors.scss index e1e86ab..1fa078a 100644 --- a/hypr-configs/hyprland/eww/colors.scss +++ b/hypr-configs/hyprland/eww/colors.scss @@ -1 +1 @@ -@import "./themes/oxocarbon.scss" +@import "./themes/oxocarbon.scss"; diff --git a/hypr-configs/hyprland/eww/control_panel/control_panel.yuck b/hypr-configs/hyprland/eww/control_panel/control_panel.yuck index 2c78638..ffe6d5f 100644 --- a/hypr-configs/hyprland/eww/control_panel/control_panel.yuck +++ b/hypr-configs/hyprland/eww/control_panel/control_panel.yuck @@ -1,17 +1,17 @@ (defwindow control_panel :geometry (geometry - :x 10 - :y 10 - :width 340 - :height 1000 - :anchor "top left" - ) + :x 10 + :y 10 + :width 340 + :height 1000 + :anchor "top left" + ) :stacking "overlay" :monitor 0 (control_widget)) (defwidget control_widget[?short] - (box + (box :class "controlpanelwindow" :space-evenly false :orientation "v" @@ -21,80 +21,80 @@ (chooser) ;; (weather) (coolmpd :h 150 :permashow true) - (box + (box :orientation "h" - :space-evenly false + :space-evenly false :height 160 - :halign "fill" + :halign "fill" (timer) (bigslide)) - (box - :space-evenly false + (box + :space-evenly false :orientation "v" :vexpand true :visible {!short} (tricontrol) (notiweathertoggle)) - )) + )) -(defwidget tricontrol[] - (eventbox +(defwidget tricontrol[] + (eventbox :cursor "pointer" - (box + (box :class "tricontrol unbarwidget" :orientation "h" :space-evenly true - :height 60 + :height 60 :halign "fill" (button :onclick "./scripts/pop colourpick" (label :text "󰈊")) (button :onclick "./scripts/pop scrop" (label :text "󰆞")) (button :onclick "~/.config/eww/themeswitch/scripts/pop" (label :text ""))))) (defwidget chooser [] - (box + (box :orientation "v" :halign "fill" :height 60 :class "unbarwidget" :space-evenly false - (box + (box :orientation "h" - - (button - :onclick "${EWW_CMD} update reveal4=${!reveal4} reveal5=false reveal6=false" + + (button + :onclick "${EWW_CMD} update reveal4=${!reveal4} reveal5=false reveal6=false" :onrightclick "foot nvim ~/Documents/fuck.txt" (label :class {reveal4 ? "titlesel" : "title"} :text "Notes")) - (button + (button :onclick "${EWW_CMD} update reveal5=${!reveal5} reveal4=false reveal6=false" (label :class {reveal5 ? "titlesel" : "title"} :text "System")) - (button + (button :onclick "${EWW_CMD} update reveal6=${!reveal6} reveal5=false reveal4=false" (label :class {reveal6 ? "titlesel" : "title"} :text "Sway"))) - + (notes) (sysinfo) (wmctrl))) (defwidget notes [] - (revealer + (revealer :reveal reveal4 :transition "slideup" - (box + (box :height 140 - (box + (box :orientation "h" - (scroll + (scroll :hscroll true :vscroll true (label :text notesc)))))) (defwidget wmctrl [] - (revealer + (revealer :reveal reveal6 :transition "slideup" (scroll - :hscroll false + :hscroll false :vscroll true :height 140 (box @@ -102,70 +102,70 @@ :valign "fill" :space-evenly false :spacing 5 - (wmslider - :name "gaps outer" - :val gapsouter - :onchange "swaymsg gaps outer all set {}" - :max 300 - :reset "${EWW_CMD} update gapsouter=0 && swaymsg gaps outer all set 0") - (wmslider - :name "gaps inner" - :val gapsinner - :onchange "swaymsg gaps inner all set {}" + (wmslider + :name "gaps outer" + :val gapsouter + :onchange "swaymsg gaps outer all set {}" + :max 300 + :reset "${EWW_CMD} update gapsouter=0 && swaymsg gaps outer all set 0") + (wmslider + :name "gaps inner" + :val gapsinner + :onchange "swaymsg gaps inner all set {}" :max 150 - :reset "${EWW_CMD} update gapsinner=15 && swaymsg gaps inner all set 15") - (wmslider - :name "border size" - :val borderpixel - :onchange "swaymsg default_border pixel {} && swaymsg '[app_id=\".*\"] border pixel {}'" + :reset "${EWW_CMD} update gapsinner=15 && swaymsg gaps inner all set 15") + (wmslider + :name "border size" + :val borderpixel + :onchange "swaymsg default_border pixel {} && swaymsg '[app_id=\".*\"] border pixel {}'" :max 50 - :reset "${EWW_CMD} update borderpixel=2 && swaymsg default_border pixel 2 && swaymsg '[app_id=\".*\"] border pixel 2'") - (box + :reset "${EWW_CMD} update borderpixel=2 && swaymsg default_border pixel 2 && swaymsg '[app_id=\".*\"] border pixel 2'") + (box :orientation "h" - :space-evenly false + :space-evenly false :halign "center" - :spacing 10 + :spacing 10 (label :text "natural scrolling") - (checkbox + (checkbox :onchecked "swaymsg input \"type:touchpad\" natural_scroll enable" - :onunchecked "swaymsg input \"type:touchpad\" natural_scroll disable")) - (box + :onunchecked "swaymsg input \"type:touchpad\" natural_scroll disable")) + (box :orientation "h" - :space-evenly false + :space-evenly false :halign "center" :spacing 10 (label :text "disable when typing") - (checkbox + (checkbox :onchecked "swaymsg input \"type:touchpad\" dwt enable" :onunchecked "swaymsg input \"type:touchpad\" dwt disable" )) - - (box + + (box :orientation "h" - :space-evenly false + :space-evenly false :halign "center" :spacing 10 (label :text "caffeine") - (checkbox + (checkbox :onchecked "swaymsg [app_id='.*'] inhibit_idle open && ${EWW_CMD} update caffeine=true" :onunchecked "swaymsg [app_id='.*'] inhibit_idle none && ${EWW_CMD} update caffeine=false" )) -)))) + )))) (defwidget sysinfo [] - (revealer + (revealer :reveal reveal5 :transition "slideup" - (box - :orientation "h" - :height 140 - (systat :icon "󰻠" :val { EWW_CPU.avg }) - (systat :icon "󰍛" :val { EWW_RAM.used_mem_perc }) - (systat :icon "" :val { EWW_BATTERY.BAT0.capacity }) - ))) + (box + :orientation "h" + :height 140 + (systat :icon "󰻠" :val { EWW_CPU.avg }) + (systat :icon "󰍛" :val { EWW_RAM.used_mem_perc }) + (systat :icon "" :val { EWW_BATTERY.BAT0.capacity }) + ))) (defwidget wmslider [name val onchange max reset] - (box + (box :orientation "h" :space-evenly false :halign "center" @@ -173,29 +173,29 @@ :vexpand false :valign "center" :spacing 10 - (label - :text name) - (scale - :min 0 + (label + :text name) + (scale + :min 0 :max max :class "wmctrlslide" :tooltip val :value val - :onchange onchange) - (button - :onclick reset + :onchange onchange) + (button + :onclick reset :style "padding: 0px 8px 0px 3px;" - ""))) + ""))) -(defwidget systat [icon val] +(defwidget systat [icon val] (overlay - (circular-progress + (circular-progress :halign "center" :valign "center" :class "circsys" :thickness 40 - :value val) - + :value val) + (box :class "circiconcontain" :halign "center" @@ -210,7 +210,7 @@ :transition "slideup" (box :orientation "h" - :space-evenly false + :space-evenly false :height 140 :width 320 :class "unbarwidget" @@ -219,7 +219,7 @@ :hexpand true (image :style "margin: 10px;" :image-width 80 :image-height 80 :path "./image/fieshidle.gif") (scroll - :hscroll true + :hscroll true :vscroll false :hexpand true (box @@ -232,37 +232,37 @@ (label :halign "start" :text uptime :style "font-size: 12px;")))))) (defwidget notiweathertoggle[] - (box + (box :orientation "v" :halign "fill" :valign "fill" :vexpand true :class "unbarwidget" :space-evenly false - (box + (box :orientation "h" - (button - :onclick "${EWW_CMD} update revealweather=false" + (button + :onclick "${EWW_CMD} update revealweather=false" (label :class {!revealweather ? "titlesel" : "title"} :text "Notifications")) - (button + (button :onclick "${EWW_CMD} update revealweather=true" (label :class {revealweather ? "titlesel" : "title"} :text "Weather"))) - (box - :orientation "h" - :vexpand true - :hexpand true - :space-evenly false - (revealer - :reveal {!revealweather} - :transition "slideright" - (notificationlog)) - (revealer - :reveal revealweather - :transition "slideleft" - (weather))))) + (box + :orientation "h" + :vexpand true + :hexpand true + :space-evenly false + (revealer + :reveal {!revealweather} + :transition "slideright" + (notificationlog)) + (revealer + :reveal revealweather + :transition "slideleft" + (weather))))) -(defwidget weather[] +(defwidget weather[] (overlay (box :orientation "v" @@ -270,51 +270,51 @@ :valign "fill" :width 320 :vexpand true - :space-evenly false + :space-evenly false (weathermain) - (scroll + (scroll :hscroll false :vscroll true :vexpand true (box - :orientation "v" + :orientation "v" :valign "start" :space-evenly false (for hour in {weatherjson.hourly} (weatherhour :hour hour))))) - (box + (box :valign "end" :hexpand true :vexpand false :height 80 - :class "fadeoutbox") - )) + :class "fadeoutbox") + )) (defwidget weatherhour[hour] - (box + (box :class "smallentry" :orientation "h" - :height 80 + :height 80 :halign "fill" :valign "center" :vexpand false - :space-evenly true - :spacing 10 + :space-evenly true + :spacing 10 (label :style "font-size: 20px;" :text {hour.time}) - (image - :image-width 50 + (image + :image-width 50 :image-height 50 - :path "./image/weather/${hour.icon}.svg") - (box + :path "./image/weather/${hour.icon}.svg") + (box :orientation "v" - :space-evenly false + :space-evenly false :valign "center" :spacing 10 (label :halign "start" :text "${hour.FeelsLikeC}°C") (label :halign "start" :text "rain: ${hour.chanceofrain}%")))) (defwidget weathermain[] - (box + (box :class "mainentry" :orientation "h" :halign "fill" @@ -322,12 +322,12 @@ :space-evenly false :spacing 10 (image - :image-width 100 - :image-height 100 + :image-width 100 + :image-height 100 :style "margin: 10px;" - :path "./image/weather/${weatherjson.icon}.svg") + :path "./image/weather/${weatherjson.icon}.svg") (scroll - :hscroll true + :hscroll true :vscroll false :valign "fill" :hexpand true @@ -338,7 +338,7 @@ (label :halign "start" :text "← ${weatherjson.windspeedKmph} km/h") ;; (label :halign "start" :text "${weatherjson.visibility} km") ;; (label :halign "start" :text "${weatherjson.precipMM} mm") - )))) + )))) (defwidget timer[] (box @@ -366,9 +366,9 @@ (bigvol) (bigbright))) -(defwidget bigvol [] +(defwidget bigvol [] (overlay - (scale + (scale :width 50 :class "bigslide" :value volume @@ -377,15 +377,15 @@ :tooltip "${volume}%" :max 100 :min 0 - :flipped true) - (label - :class "slideicon" - :valign "end" + :flipped true) + (label + :class "slideicon" + :valign "end" :text {volumemute == 'false' ? "󰕾" : "󰖁"}))) -(defwidget bigbright [] +(defwidget bigbright [] (overlay - (scale + (scale :width 50 :class "bigslide" :value brightness @@ -394,19 +394,19 @@ :tooltip "${brightness}%" :max 100 :min 0 - :flipped true) - (label - :class "slideicon" - :valign "end" + :flipped true) + (label + :class "slideicon" + :valign "end" :text "󰃞"))) (defwidget notificationlog [] - (box + (box :halign "fill" - :valign "fill" + :valign "fill" :width 320 :vexpand true - :space-evenly false + :space-evenly false :orientation "v" (overlay :vexpand true @@ -416,48 +416,48 @@ :vexpand true :valign "fill" (box - :orientation "v" + :orientation "v" :valign "start" :space-evenly false (for noti in {notifications.notifications} (singlenotif :noti noti :initial false)))) - - (box + + (box :valign "end" :hexpand true :vexpand false :height 80 - :class "fadeoutbox")) - (box + :class "fadeoutbox")) + (box :orientation "h" (button :onclick "./scripts/notifManage --clear" (label :class "title" - :text "Clear All")) + :text "Clear All")) (button :onclick "./scripts/notifManage --toggle" (label :class { notifications.dnd ? "titlesel" : "title"} - :text "Do Not Disturb"))))) + :text "Do Not Disturb"))))) -(defwidget quote [] +(defwidget quote [] (box :class "quotewid unbarwidget" :halign "fill" :valign "fill" :vexpand true - :space-evenly false + :space-evenly false :orientation "v" - (scroll :vexpand true :hscroll true :vscroll true - (label + (scroll :vexpand true :hscroll true :vscroll true + (label :class "quote" :text {quotejson.content} - :wrap true - :width 300)) - (label + :wrap true + :width 300)) + (label :class "quoteauthor" - :text "- ${quotejson.author}"))) + :text "- ${quotejson.author}"))) (defwidget coolmpd [h permashow] (overlay @@ -467,17 +467,17 @@ :height h :class { pcover != "" ? "mpdcover" : "unbarwidget"} :style "background-image: url('${pcover}')" - :visible {permashow ? true : pcover != "" }) - (box + :visible {permashow ? true : pcover != "" }) + (box :orientation "h" - :space-evenly false + :space-evenly false :halign "center" :valign "center" :spacing 10 (image :image-width 100 :image-height 100 :path { pcover == "" ? "./image/emptympd.png" : pcover }) (box - :orientation "v" - :space-evenly false + :orientation "v" + :space-evenly false :width 200 :halign "center" :valign "center" @@ -493,11 +493,11 @@ (box :orientation "h" :class "mpd_controls" - (button :onclick "playerctl previous" + (button :onclick "playerctl previous" (label :text "󰒮")) - (button :style "padding-right: 3px;" :onclick "playerctl play-pause" + (button :style "padding-right: 3px;" :onclick "playerctl play-pause" (label :text { pstatus == "Playing" ? "" : ""} )) - (button :onclick "playerctl next" + (button :onclick "playerctl next" (label :text "󰒭"))))))) (include "./control_panel/windowswitcher.yuck") diff --git a/hypr-configs/hyprland/eww/dashboard/dashboard.yuck b/hypr-configs/hyprland/eww/dashboard/dashboard.yuck index 5374bc4..bb83806 100644 --- a/hypr-configs/hyprland/eww/dashboard/dashboard.yuck +++ b/hypr-configs/hyprland/eww/dashboard/dashboard.yuck @@ -1,23 +1,23 @@ ;; Dashboard design is made by tsukki9696 -(defwindow dashboard +(defwindow dashboard :geometry (geometry - :x 0 - :y 0 - :width 800 - :height 420 - :anchor "center") + :x 0 + :y 0 + :width 800 + :height 420 + :anchor "center") :stacking "overlay" :monitor 0 (structure)) (defwidget structure[] - (box + (box :class "popup" - :space-evenly false + :space-evenly false :orientation "v" (duser :name "Failed" :tag "failed.sh" :pfp "./image/roundpfp.png") - (box + (box :space-evenly true :orientation "h" :vexpand true @@ -35,13 +35,13 @@ (dbutt) (theme)) (dcal) - )) + )) (box :orientation "v" :space-evenly false (dnotes) (quote)) - ))) + ))) (defwidget duser [name tag pfp] (box @@ -56,13 +56,13 @@ (label :text "|" :style "color: #262626; font-size: 30px;") (box :orientation "v" - :space-evenly true + :space-evenly true :halign "start" (label :style "font-weight: bold; font-size: 18px;" :text "Hello, ${name}") (label :halign "start" :text tag)))) -(defwidget dnotes [] - (box +(defwidget dnotes [] + (box :class "notes unbarwidget" :space-evenly false :orientation "v" @@ -81,7 +81,7 @@ (box :class "mpdcover" :style "background-image: url('${pcover}')" - :height 150) + :height 150) (box :orientation "v" :space-evenly false @@ -91,70 +91,70 @@ :hscroll true :vscroll false (label :style "font-size: 18px;" :text psong)) - (scroll + (scroll :hscroll true - :vscroll false + :vscroll false (label :text partist)) - ;; (scale - ;; :hexpand false - ;; :width 60 - ;; :class "seektime" - ;; :value current - ;; :orientation "h" - ;; :min -5 - ;; :max 100 - ;; :onscroll "mpc -q seek +1" + ;; (scale + ;; :hexpand false + ;; :width 60 + ;; :class "seektime" + ;; :value current + ;; :orientation "h" + ;; :min -5 + ;; :max 100 + ;; :onscroll "mpc -q seek +1" ;; :tooltip "${ctime}/${ttime}") (box :orientation "h" :space-evenly false - :spacing 40 + :spacing 40 :halign "center" :class "dmpdcontrol" (button :onclick "./scripts/music_info --prev" (label :text "󰒮")) (button :onclick "./scripts/music_info --toggle" (label :text { pstatus == "Playing" ? "" : ""})) (button :onclick "./scripts/music_info --next" (label :text "󰒭")))))) -(defwidget dcal [] +(defwidget dcal [] (box :class "unbarwidget mincal" :height 190 :hexpand true - (calendar + (calendar :show-details false :show-heading true :show-day-names false :show-week-numbers false - :day calendar_day - :year calendar_year))) + :day calendar_day + :year calendar_year))) -(defwidget dbutt[] - (box +(defwidget dbutt[] + (box :space-evenly true :orientation "h" :height 130 - (box - :space-evenly true + (box + :space-evenly true :orientation "v" (button :class "dicons unbarwidget" :onclick "notify-send 'shutdown' 'but its impractical'" (label :text "")) (button :class "dicons unbarwidget" :onclick "notify-send 'restart' 'but its impractical'" (label :text ""))) (box - :space-evenly true + :space-evenly true :orientation "v" (button :class "dicons unbarwidget" :onclick "notify-send 'lock' 'but its impractical'" (label :text "")) (button :class "dicons unbarwidget" :onclick "notify-send 'log out' 'but its impractical'" (label :text "󰍃"))))) -(defwidget theme [] - (button +(defwidget theme [] + (button :class "unbarwidget" :vexpand true - :onclick "./scripts/toggletheme toggle" + :onclick "./scripts/toggletheme toggle" (label :style "font-size: 18px;" :text ""))) ;; (defwidget dquote [] -;; (box -;; :class "unbarwidget" -;; :height "120" -;; :valign "center" -;; (literal -;; :content quoteliteral))) + ;; (box + ;; :class "unbarwidget" + ;; :height "120" + ;; :valign "center" + ;; (literal + ;; :content quoteliteral))) diff --git a/hypr-configs/hyprland/eww/desktop/desktop.yuck b/hypr-configs/hyprland/eww/desktop/desktop.yuck index d45cdad..58bb0a4 100644 --- a/hypr-configs/hyprland/eww/desktop/desktop.yuck +++ b/hypr-configs/hyprland/eww/desktop/desktop.yuck @@ -1,30 +1,30 @@ -(defwindow desktopicons +(defwindow desktopicons :geometry (geometry - :x 20 - :y 20 - :width 100 - :height 600 - :anchor "top right") + :x 20 + :y 20 + :width 100 + :height 600 + :anchor "top right") :stacking "bottom" :monitor 0 - (box + (box :orientation "v" :space-evenly "false" :spacing 10 - - (eventbox + + (eventbox :dragtype "file" :class "desktopbox" :onclick "thunar ${homedir}/.local/share/Trash/files" :ondropped "notify-send {}" (box :orientation "v" - :space-evenly false - :height 100 + :space-evenly false + :height 100 :valign "end" (image :width 100 :height 100 :image-width 80 :image-height 80 :path trashcanpath) (label :class "desktoptext" :text "Trash"))) - + (for i in '["amogus"]' (imagesicon :name i)))) diff --git a/hypr-configs/hyprland/eww/dock/dock.yuck b/hypr-configs/hyprland/eww/dock/dock.yuck index d1aa8b9..6105df4 100644 --- a/hypr-configs/hyprland/eww/dock/dock.yuck +++ b/hypr-configs/hyprland/eww/dock/dock.yuck @@ -1,15 +1,14 @@ -(defwindow dock +(defwindow dock :geometry (geometry - :x 0 - :y 0 - :width 10 - :height 54 - :anchor "bottom center") - :stacking "overlay" + :x 0 + :y 0 + :width 10 + :height 54 + :anchor "bottom center") :monitor 0 (dockstruct)) -(defwidget dockstruct [] +(defwidget dockstruct [] (eventbox :onhover "${EWW_CMD} update revealdock=true" :onhoverlost "${EWW_CMD} update revealdock=false" @@ -18,11 +17,11 @@ :space-evenly false :valign "end" (box - :height 4) + :height 4) (revealer :reveal revealdock :transition "slideup" - (box + (box :class "popup" :height 60 :orientation "h" @@ -30,8 +29,8 @@ (tasklist :iconsize 50)))))) (defwidget tasklist [iconsize] - (box - :orientation "h" + (box + :orientation "h" :space-evenly true :spacing 10 (for task in {tasksjson} @@ -41,24 +40,24 @@ (box :orientation "v" :space-evenly false - (image + (image :image-width iconsize :image-height iconsize - :path {task.path}) - + :path {task.path}) + (scroll :hscroll true :vscroll false - (box + (box :orientation "h" :halign "center" - :space-evenly false + :space-evenly false :spacing 3 (for focus in {task.focused} - (box + (box :class "dockindicate" :hexpand false :width { focus ? 10 : 5 } - :height 3)))) - ))))) + :height 3)))) + ))))) diff --git a/hypr-configs/hyprland/eww/eww.scss b/hypr-configs/hyprland/eww/eww.scss index 46ce59f..bf1725e 100644 --- a/hypr-configs/hyprland/eww/eww.scss +++ b/hypr-configs/hyprland/eww/eww.scss @@ -1,139 +1,140 @@ -@import './colors.scss'; -@import './bar/bar.scss'; -// @import './bottom_bar/bar.scss'; -@import './control_panel/control_panel.scss'; -@import './dashboard/dashboard.scss'; -@import './dock/dock.scss'; -@import './desktop/desktop.scss'; -@import './notification/notification.scss'; +@import "./colors.scss"; +@import "./bar/bar.scss"; +// @import "./bottom_bar/bar.scss"; +@import "./control_panel/control_panel.scss"; +@import "./dashboard/dashboard.scss"; +@import "./dock/dock.scss"; +@import "./desktop/desktop.scss"; +@import "./notification/notification.scss"; * { - all: unset; - color: $white0; - font-size: 15px; - font-family: "Iosevka Nerd Font"; - // font-weight: bold; - // font-smooth: never; + all: unset; + color: $white0; + font-size: 15px; + font-family: "Iosevka Nerd Font"; + // font-weight: bold; + // font-smooth: never; } tooltip { - background-color: $surface0; - color: $white0; - border-radius: 5px; - border-style: solid; - border-width: 2px; - border-color: $surface2; + background-color: $surface0; + color: $white0; + border-radius: 5px; + border-style: solid; + border-width: 2px; + border-color: $surface2; } scale { - all: unset; - trough { - background-color: $surface2; - border-radius: 24px; - min-height: 80px; - min-width: 10px; - margin : 5px; + all: unset; - slider { - background-color: $white2; - border-radius: 25px; - min-height: 15px; - min-width: 15px; - margin: -10px; - } + trough { + background-color: $surface2; + border-radius: 24px; + min-height: 80px; + min-width: 10px; + margin: 5px; - highlight { - background-color: $white0; - border-radius: 24px; - } + slider { + background-color: $white2; + border-radius: 25px; + min-height: 15px; + min-width: 15px; + margin: -10px; } + + highlight { + background-color: $white0; + border-radius: 24px; + } + } } button { - transition-duration: 0.5s; - border-radius: 5px; -} -button:hover { - background-color: $surface2; + transition-duration: 0.5s; + border-radius: 5px; } +button:hover { + background-color: $surface2; +} calendar { - all: unset; - background-color: $surface0; - font-size: 20; - color: $white0; + all: unset; + background-color: $surface0; + font-size: 20; + color: $white0; } calendar:selected { - color: $base; - background-color: $accent; - border-radius: 25px; + color: $base; + background-color: $accent; + border-radius: 25px; } calendar.header { - color: $accent; - font-weight: bold; + color: $accent; + font-weight: bold; } calendar:indeterminate { - color: $surface2; + color: $surface2; } checkbutton { - border-radius: 24px; - background-color: $surface1; - padding: 4px; - check { - min-height: 15px; - min-width: 15px; - color: $white0; - } + border-radius: 24px; + background-color: $surface1; + padding: 4px; + check { + min-height: 15px; + min-width: 15px; + color: $white0; + } } checkbutton:checked { - check{ - border-radius: 24px; - background-color: $white0; - } + check { + border-radius: 24px; + background-color: $white0; + } } .popup { - background-color: $base; - padding: 5px; - border-radius: 5px; - border-style: solid; - border-color: $surface2; - border-width: 2px; - margin: 10px; + background-color: $base; + padding: 5px; + border-radius: 5px; + border-style: solid; + border-color: $surface2; + border-width: 2px; + margin: 10px; } entry { - // image: url('./image/screenshot.png'); - padding: 5px; - margin: 5px; - border-radius: 5px; - border-style: solid; - border-color: $surface2; - background-color: $surface1; - color: $white0; + // image: url('./image/screenshot.png'); + padding: 5px; + margin: 5px; + border-radius: 5px; + border-style: solid; + border-color: $surface2; + background-color: $surface1; + color: $white0; } .mainentry { - background-color: $surface1; - padding: 5px; - border-radius: 5px; - margin: 5px; + background-color: $surface1; + padding: 5px; + border-radius: 5px; + margin: 5px; } .mainentry label { - font-size: 18px; - color: $white0; + font-size: 18px; + color: $white0; } .smallentry { - @extend .mainentry; - label { - font-size: 15px; - } + @extend .mainentry; + label { + font-size: 15px; + } } diff --git a/hypr-configs/hyprland/eww/scripts/pop b/hypr-configs/hyprland/eww/scripts/pop index 2d87bab..68014f2 100755 --- a/hypr-configs/hyprland/eww/scripts/pop +++ b/hypr-configs/hyprland/eww/scripts/pop @@ -77,14 +77,13 @@ elif [ "$1" = "control" ]; then elif [ "$1" = "dashboard" ]; then dashboard elif [ "$1" = "colourpick" ]; then - COLOUR=$(grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | awk -F ' ' 'NR==2 {print $3}') - wl-copy "$COLOUR" - notify-send -a colourpicker -i ~/.config/eww/carbonmonoxide/image/eyedropper.png -t 3000 "$COLOUR" "Colour copied to clipboard" + hyprpicker -a + notify-send -a colourpicker -i ~/.config/eww/image/eyedropper.png -t 3000 "Colour copied to clipboard" elif [ "$1" = "scrop" ]; then # control # sleep 0.5 grim -g "$(slurp)" - | wl-copy - notify-send -a screenshot -i ~/.config/eww/carbonmonoxide/image/screenshot.png -t 3000 "Screenshot Taken" "Image copied to clipboard" + notify-send -a screenshot -i ~/.config/eww/image/screenshot.png -t 3000 "Screenshot Taken" "Image copied to clipboard" elif [ "$1" = "sscreen" ]; then # control grim - | wl-copy diff --git a/hypr-configs/hyprland/eww/scripts/workspaces b/hypr-configs/hyprland/eww/scripts/workspaces new file mode 100755 index 0000000..33838b1 --- /dev/null +++ b/hypr-configs/hyprland/eww/scripts/workspaces @@ -0,0 +1,54 @@ +#!/bin/bash + +SOCKET="/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" + +spaces() { + local workspace_windows=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 5 | jq --argjson windows "$workspace_windows" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +clamp() { + python -c "print(max($1, min($3, $2)))" +} + +get_workspaces() { + spaces + socat -u UNIX-CONNECT:"$SOCKET" - | while read -r; do + spaces + done +} + +get_active_workspace() { + hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + socat -u UNIX-CONNECT:"$SOCKET" - | stdbuf -o0 awk -F '>>|,' '/^workspace>>/ {print $2} /^focusedmon>>/ {print $3}' +} + +change_workspace() { + local direction=$1 current=$2 target + + if [[ "$direction" == "down" ]]; then + target=$(clamp 1 9 $((current + 1))) + elif [[ "$direction" == "up" ]]; then + target=$(clamp 1 9 $((current - 1))) + else + echo "Invalid direction" >&2 + return 1 + fi + + echo "Jumping to $target" + hyprctl dispatch workspace "$target" +} + +main() { + case $1 in + get-all-workspaces) get_workspaces ;; + get-active-workspace) get_active_workspace ;; + change) change_workspace "$2" "$3" ;; + *) + echo "Usage: $0 {gw|ga|c }" >&2 + exit 1 + ;; + esac +} + +main "$@" diff --git a/hypr-configs/hyprland/eww/wallpapers/wallpapers.yuck b/hypr-configs/hyprland/eww/wallpapers/wallpapers.yuck index 7bb4b7e..5ccd50a 100644 --- a/hypr-configs/hyprland/eww/wallpapers/wallpapers.yuck +++ b/hypr-configs/hyprland/eww/wallpapers/wallpapers.yuck @@ -1,71 +1,71 @@ -(defwindow wallpaperselect +(defwindow wallpaperselect :geometry (geometry - :x 0 - :y 0 - :width 415 - :height 600 - :anchor "center") + :x 0 + :y 0 + :width 415 + :height 600 + :anchor "center") :stacking "overlay" :monitor 0 :focusable true (box :class "popup" - (wallpaperselectwidget))) + (wallpaperselectwidget))) (defwidget wallpaperselectwidget [] (eventbox ;; :onhoverlost "${EWW_CMD} close wallpaperselect" - (box + (box :orientation "v" :class "unbarwidget" - :space-evenly false - (box + :space-evenly false + (box :orientation "h" :space-evenly false - (input + (input :hexpand true :onaccept "./scripts/wallhaven.py search {}" - :timeout "20000ms") - (button + :timeout "20000ms") + (button :onclick "${EWW_CMD} update wallpapers=[] && ./scripts/wallhaven.py reset" ;; :style "padding: 0px 8px 0px 3px;" - (label + (label :class "icon" - :text ""))) - + :text ""))) + (scroll :hscroll false :vscroll true :vexpand true - (box + (box :orientation "v" - :space-evenly false + :space-evenly false :valign "start" - (image + (image :style "margin: 50px 0px 5px 0px;" - :hexpand false - :vexpand false - :path "./image/fieshidle.gif" + :hexpand false + :vexpand false + :path "./image/fieshidle.gif" :visible {arraylength(wallpapers) == 0}) - - (label + + (label :visible {arraylength(wallpapers) == 0} - :text "No wallpapers yet") - + :text "No wallpapers yet") + (for wall in wallpapers - (box + (box :orientation "v" - :space-evenly false + :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 + (box :orientation "h" - :space-evenly true + :space-evenly true (label :text "${wall.views} 󰈈") (label :text "${wall.fav} 󰣐") - )))) + )))) ))))