added eww config

This commit is contained in:
Niklas Kapelle 2023-11-27 00:34:43 +01:00
parent cd5ae55cd3
commit 6500282293
Signed by: niklas
GPG Key ID: 4EB651B36D841D16
21 changed files with 345 additions and 0 deletions

33
.config/eww/eww.scss Normal file
View File

@ -0,0 +1,33 @@
@import "/home/niklas/.cache/wal/colors.scss";
$bg: $background;
$fg: $foreground;
$border: $color2;
$text: $color6;
$focus: $color3;
$hight: 1.5rem;
* {
all: unset;
}
@mixin pill{
border: 1px solid $border;
border-radius: 24;;
padding: 0.1rem 0.5rem;
margin: 0 0.5rem;
background-color: $focus;
min-height: $hight;
}
.pill{
@include pill;
}
@import "modules/bar/bar.scss";
@import "modules/clock/clock.scss";
@import "modules/playerctl/playerctl.scss";
@import "modules/volume/volume.scss";
@import "modules/workspace/workspace.scss";
@import "modules/notifications/notifications.scss"

20
.config/eww/eww.yuck Normal file
View File

@ -0,0 +1,20 @@
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:stacking "fg"
:exclusive true
:namepspace "eww"
(bar)
)
(include "modules/bar/bar.yuck")
(include "modules/clock/clock.yuck")
(include "modules/playerctl/playerctl.yuck")
(include "modules/volume/volume.yuck")
(include "modules/workspace/workspace.yuck")
(include "modules/notifications/notifications.yuck")

View File

@ -0,0 +1,6 @@
.bar-widget {
background-color: $bg;
font-size: 16px;
color: $text;
padding: 0.2rem 0;
}

View File

@ -0,0 +1,33 @@
(defwidget bar []
(box
:class "bar-widget"
:orientation "h"
:space-evenly true
(box
:orientation "h"
:space-evenly false
:halign "start"
(workspaces)
)
(box
:orientation "h"
:space-evenly false
:halign "center"
(playerctl)
)
(box
:orientation "h"
:space-evenly false
:halign "end"
(volume_slider)
(clock)
(notifications)
)
)
)

View File

@ -0,0 +1,3 @@
.clock {
@include pill;
}

View File

@ -0,0 +1,14 @@
(defpoll time
:interval "1s"
:initial "0"
"date +%H:%M"
)
(defwidget clock []
(label
:class "clock"
:text {time}
)
)

View File

@ -0,0 +1,3 @@
.notifications {
@include pill;
}

View File

@ -0,0 +1,18 @@
(deflisten swaync
:initial "{}"
"swaync-client -swb"
)
(defwidget notifications []
(button
:class "notifications"
:onclick "swaync-client -t -sw"
:onrightclick "swaync-client -d -sw"
(label
:text "${swaync.text}"
)
)
)

View File

@ -0,0 +1,7 @@
#!/bin/bash
if [[ $1 == "down" ]]; then
playerctl --player=spotify,%any volume 0.05-
elif [[ $1 == "up" ]]; then
playerctl --player=spotify,%any volume 0.05+
fi

View File

@ -0,0 +1,3 @@
.playerctl {
@include pill;
}

View File

@ -0,0 +1,20 @@
(deflisten playerctl
:initial ""
"playerctl --player=spotify,%any -f '{{title}} - {{artist}}' metadata -F"
)
(defwidget playerctl []
(eventbox
:onscroll "modules/playerctl/playerctl-volume.sh {}"
:onmiddleclick "hyprctl dispatch togglespecialworkspace spotify"
:onclick "playerctl --player=spotify,%any play-pause"
:onrightclick "playerctl --player=spotify,%any next"
(label
:class "playerctl"
:text {playerctl}
)
)
)

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ $1 == "up" ]]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
elif [[ $1 == "down" ]]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
fi

View File

@ -0,0 +1,3 @@
#!/bin/bash
wpctl set-volume @DEFAULT_AUDIO_SINK@ $1%

View File

@ -0,0 +1,23 @@
.volume {
@include pill;
}
.volume_slider {
min-width: 6rem;
trough,
highlight {
min-height: 0.5rem;
border-radius: 25px;
border: 1px solid $border;
}
trough {
background-color: $bg;
}
highlight {
background-color: $focus;
}
}

View File

@ -0,0 +1,8 @@
#!/bin/bash
wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2 * 100)}'
pactl subscribe | rg --line-buffered "on sink" | while read -r _; do
wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2 * 100)}'
done

View File

@ -0,0 +1,57 @@
(deflisten volume
:initial 100
"modules/volume/volume.sh"
)
(defwidget volume []
(eventbox
:onscroll "modules/volume/scroll-volume.sh {}"
(label
:class "volume"
:text "${volume}%"
)
)
)
(defvar vol_reveal false)
(defwidget volume_slider []
(eventbox
:onhover "eww update vol_reveal=true"
:onhoverlost "eww update vol_reveal=false"
:onscroll "modules/volume/scroll-volume.sh {}"
(box
:space-evenly false
:orientation "h"
:spacing "3"
(button
:class "pill"
(label
:text "${volume}%"
)
)
(revealer
:transition "slideleft"
:reveal vol_reveal
(scale
:class "volume_slider"
:value volume
:orientation "h"
:min 0
:max 101
:onchange "modules/volume/set-volume.sh {}"
)
)
)
)
)

View File

@ -0,0 +1,10 @@
#!/bin/bash
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | sed -u -n -e '/^workspace>>/ s/^workspace>>//p' -e '/^focusedmon>>/ s/^focusedmon>>//p'
#socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
# stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'

View File

@ -0,0 +1,17 @@
#!/bin/bash
direction=$1
current=$2
exit 0 # For the time being this script only exist to keep current_workspace from being lazy
if [[ $direction == "down" ]]; then
target=$(($current+1))
if [[ $target == 11 ]]; then
exit 0
fi
hyprctl dispatch workspace $target
elif [[ $direction == "up" ]]; then
target=$(($current-1))
hyprctl dispatch workspace $target
fi

View File

@ -0,0 +1,17 @@
.workspaces {
margin-left: 0.2rem;
min-height: $hight;
border: 1px solid $border;
border-radius: 24px;
.workspace {
padding: 0 0.5rem;
border-radius: 24px;
}
.active {
background-color: $focus;
}
}

View File

@ -0,0 +1,33 @@
(deflisten workspaces
:initial "[]"
"modules/workspace/workspaces.sh"
)
(deflisten current_workspace
:initial "1"
"modules/workspace/get-active-workspace.sh"
)
(defwidget workspaces []
(eventbox
:onscroll "modules/workspace/scroll-current-workspace.sh {} ${current_workspace}"
(box
:orientation "h"
:space-evenly false
:class "workspaces"
:hexpand true
(for workspace in workspaces
(button
:class "workspace ${current_workspace == workspace.id ? "active" : ""}"
:onclick "hyprctl dispatch workspace ${workspace.id}"
"${workspace.id}"
)
)
)
)
)

View File

@ -0,0 +1,9 @@
#!/bin/bash
CMD="sort_by(.id) | [ .[] | select(.id > 0)]"
hyprctl workspaces -j | jq -c "$CMD"
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
hyprctl workspaces -j | jq -c "$CMD"
done