added eww config
This commit is contained in:
parent
cd5ae55cd3
commit
6500282293
33
.config/eww/eww.scss
Normal file
33
.config/eww/eww.scss
Normal 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
20
.config/eww/eww.yuck
Normal 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")
|
6
.config/eww/modules/bar/bar.scss
Normal file
6
.config/eww/modules/bar/bar.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.bar-widget {
|
||||
background-color: $bg;
|
||||
font-size: 16px;
|
||||
color: $text;
|
||||
padding: 0.2rem 0;
|
||||
}
|
33
.config/eww/modules/bar/bar.yuck
Normal file
33
.config/eww/modules/bar/bar.yuck
Normal 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)
|
||||
)
|
||||
)
|
||||
)
|
3
.config/eww/modules/clock/clock.scss
Normal file
3
.config/eww/modules/clock/clock.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.clock {
|
||||
@include pill;
|
||||
}
|
14
.config/eww/modules/clock/clock.yuck
Normal file
14
.config/eww/modules/clock/clock.yuck
Normal file
@ -0,0 +1,14 @@
|
||||
(defpoll time
|
||||
:interval "1s"
|
||||
:initial "0"
|
||||
|
||||
"date +%H:%M"
|
||||
)
|
||||
|
||||
(defwidget clock []
|
||||
|
||||
(label
|
||||
:class "clock"
|
||||
:text {time}
|
||||
)
|
||||
)
|
3
.config/eww/modules/notifications/notifications.scss
Normal file
3
.config/eww/modules/notifications/notifications.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.notifications {
|
||||
@include pill;
|
||||
}
|
18
.config/eww/modules/notifications/notifications.yuck
Normal file
18
.config/eww/modules/notifications/notifications.yuck
Normal 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}"
|
||||
)
|
||||
)
|
||||
)
|
7
.config/eww/modules/playerctl/playerctl-volume.sh
Executable file
7
.config/eww/modules/playerctl/playerctl-volume.sh
Executable 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
|
3
.config/eww/modules/playerctl/playerctl.scss
Normal file
3
.config/eww/modules/playerctl/playerctl.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.playerctl {
|
||||
@include pill;
|
||||
}
|
20
.config/eww/modules/playerctl/playerctl.yuck
Normal file
20
.config/eww/modules/playerctl/playerctl.yuck
Normal 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}
|
||||
)
|
||||
)
|
||||
)
|
8
.config/eww/modules/volume/scroll-volume.sh
Executable file
8
.config/eww/modules/volume/scroll-volume.sh
Executable 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
|
||||
|
3
.config/eww/modules/volume/set-volume.sh
Executable file
3
.config/eww/modules/volume/set-volume.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ $1%
|
23
.config/eww/modules/volume/volume.scss
Normal file
23
.config/eww/modules/volume/volume.scss
Normal 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;
|
||||
}
|
||||
}
|
8
.config/eww/modules/volume/volume.sh
Executable file
8
.config/eww/modules/volume/volume.sh
Executable 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
|
||||
|
57
.config/eww/modules/volume/volume.yuck
Normal file
57
.config/eww/modules/volume/volume.yuck
Normal 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 {}"
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
10
.config/eww/modules/workspace/get-active-workspace.sh
Executable file
10
.config/eww/modules/workspace/get-active-workspace.sh
Executable 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}'
|
||||
|
17
.config/eww/modules/workspace/scroll-current-workspace.sh
Executable file
17
.config/eww/modules/workspace/scroll-current-workspace.sh
Executable 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
|
||||
|
17
.config/eww/modules/workspace/workspace.scss
Normal file
17
.config/eww/modules/workspace/workspace.scss
Normal 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;
|
||||
}
|
||||
}
|
33
.config/eww/modules/workspace/workspace.yuck
Normal file
33
.config/eww/modules/workspace/workspace.yuck
Normal 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}"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
9
.config/eww/modules/workspace/workspaces.sh
Executable file
9
.config/eww/modules/workspace/workspaces.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user