user/eww-wayland: rename to eww
This commit is contained in:
parent
438eb54cea
commit
da47e42111
7 changed files with 1 additions and 1 deletions
90
res/eww/eww.scss
Normal file
90
res/eww/eww.scss
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
$background: EWW_BACKGROUND;
|
||||
$accent: EWW_ACCENT;
|
||||
$foreground: EWW_TEXT;
|
||||
|
||||
* {
|
||||
all: unset;
|
||||
}
|
||||
|
||||
window {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.bar {
|
||||
margin: 5px 20px 0px 20px;
|
||||
}
|
||||
|
||||
.widget {
|
||||
background: $background;
|
||||
color: $foreground;
|
||||
font-family: "Noto Sans";
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
padding: 5px 15px;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.pill {
|
||||
margin-right: 5px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.extended {
|
||||
padding: 5px 15px;
|
||||
}
|
||||
|
||||
.time {
|
||||
.base {
|
||||
font-weight: 700;
|
||||
}
|
||||
.extension {
|
||||
font-weight: 500;
|
||||
color: rgba($foreground, .7);
|
||||
}
|
||||
}
|
||||
|
||||
.workspaces {
|
||||
padding: 5px 10px;
|
||||
font-size: 22px;
|
||||
|
||||
button {
|
||||
padding: 0px 2px;
|
||||
}
|
||||
|
||||
.empty, .occupied {
|
||||
color: $accent;
|
||||
}
|
||||
}
|
||||
|
||||
.widget.line-workspaces {
|
||||
color: transparent;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
font-size: 0;
|
||||
|
||||
button {
|
||||
padding: 0 13px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
background-color: $background;
|
||||
}
|
||||
|
||||
.occupied {
|
||||
background-color: $accent;
|
||||
}
|
||||
|
||||
.focused {
|
||||
background-color: $foreground;
|
||||
}
|
||||
}
|
||||
|
||||
.pill-icon {
|
||||
color: $accent;
|
||||
font-family: Material Symbols Outlined;
|
||||
font-size: 18px;
|
||||
}
|
||||
157
res/eww/eww.yuck
Normal file
157
res/eww/eww.yuck
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
(defwindow mainbar :monitor 0
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0%"
|
||||
:width "100%"
|
||||
:height "30px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive false
|
||||
:focusable false
|
||||
(bar))
|
||||
|
||||
(defwindow mainbar-ext :monitor 1
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0%"
|
||||
:width "100%"
|
||||
:height "30px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive false
|
||||
:focusable false
|
||||
(bar))
|
||||
|
||||
|
||||
(defvar bat-extended true)
|
||||
(defvar bluetooth-extended false)
|
||||
(defvar network-extended false)
|
||||
(defvar time-extended false)
|
||||
(defpoll ptime :interval "1s"
|
||||
`date +%H:%M`)
|
||||
(defpoll petimea :interval "1s" :run-while time-extended
|
||||
`date "+%A, %d %B %Y "`)
|
||||
(defpoll petimeb :interval "1s" :run-while time-extended
|
||||
`date "+:%S"`)
|
||||
(defpoll pbat_cap :interval "5s"
|
||||
`cat /sys/class/power_supply/BATT/capacity`)
|
||||
(defpoll pbat_status :interval "1s"
|
||||
`cat /sys/class/power_supply/BATT/status`)
|
||||
(defpoll network_strength :interval "1s"
|
||||
`nmcli -f IN-USE,SIGNAL device wifi | grep '*' | tr -d -c 0-9`)
|
||||
(defpoll bluetooth_device :interval "1s"
|
||||
`bluetoothctl devices Connected | grep Device | cut -d" " -f3-`)
|
||||
|
||||
(deflisten lnetwork :initial "" "./scripts/network.sh")
|
||||
(deflisten ltitle :initial "" "./scripts/title.sh")
|
||||
(deflisten lworkspaces :initial "[]" "./scripts/workspaces.sh")
|
||||
(deflisten lcurrent_workspace :initial "1" "./scripts/active-workspace.sh")
|
||||
|
||||
(defwidget bar []
|
||||
(eventbox :onscroll "./scripts/scroll.sh {}"
|
||||
(centerbox :orientation "h"
|
||||
:class "bar"
|
||||
(workspaces)
|
||||
(title)
|
||||
(right_bar))))
|
||||
|
||||
(defwidget workspaces []
|
||||
(box :class "widget workspaces"
|
||||
:halign "start"
|
||||
:valign "center"
|
||||
:vexpand true
|
||||
:hexpand true
|
||||
(for workspace in lworkspaces
|
||||
(eventbox :cursor "hand"
|
||||
(button :class "${workspace.id == lcurrent_workspace ? "focused" : (workspace.windows > 0 ? "occupied" : "empty")}"
|
||||
:onclick "hyprctl dispatch workspace ${workspace.id}"
|
||||
"${workspace.id == lcurrent_workspace ? "" : (workspace.windows > 0 ? "" : "")}")))))
|
||||
|
||||
(defwidget title []
|
||||
(literal :content ltitle))
|
||||
|
||||
(defwidget time_extension [text]
|
||||
(revealer :transition "slideleft"
|
||||
:reveal time-extended
|
||||
:duration 150
|
||||
(label :text text
|
||||
:class "extension")))
|
||||
|
||||
(defwidget right_bar []
|
||||
(box :orientation "horizontal"
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
(bluetooth)
|
||||
(network)
|
||||
(battery)
|
||||
(time)))
|
||||
|
||||
(defwidget bluetooth []
|
||||
(button :onclick `eww update bluetooth-extended=${bluetooth-extended ? "false" : "true"}`
|
||||
(box :orientation "horizontal"
|
||||
:class {"widget pill" + ((bluetooth-extended && bluetooth_device != "") ? " extended" : "")}
|
||||
:spacing {(bluetooth-extended && bluetooth_device != "") ? 5 : 0}
|
||||
:space-evenly false
|
||||
(label :text { bluetooth_device == "" ? "" : ""}
|
||||
:class "base pill-icon")
|
||||
(revealer :transition "slideleft"
|
||||
:reveal {bluetooth-extended && bluetooth_device != ""}
|
||||
:duration 150
|
||||
(label :text bluetooth_device
|
||||
:class "base")))))
|
||||
|
||||
(defwidget network []
|
||||
(button :onclick `eww update network-extended=${network-extended ? "false" : "true"}`
|
||||
(box :orientation "horizontal"
|
||||
:class {"widget pill" + ((network-extended && lnetwork != "Disconnected") ? " extended" : "")}
|
||||
:spacing {(network-extended && lnetwork != "Disconnected") ? 5 : 0}
|
||||
:space-evenly false
|
||||
(label :text {
|
||||
(lnetwork == "Disconnected") ? ""
|
||||
: (network_strength == "") ? ""
|
||||
: (network_strength < 20) ? ""
|
||||
: (network_strength < 30) ? ""
|
||||
: (network_strength < 55) ? ""
|
||||
: (network_strength < 80) ? ""
|
||||
: ""}
|
||||
:class "base pill-icon")
|
||||
(revealer :transition "slideleft"
|
||||
:reveal {network-extended && lnetwork != "Disconnected"}
|
||||
:duration 150
|
||||
(label :text lnetwork
|
||||
:class "base")))))
|
||||
|
||||
(defwidget battery []
|
||||
(button :onclick `eww update bat-extended=${bat-extended ? "false" : "true"}`
|
||||
(box :orientation "horizontal"
|
||||
:class {"widget pill" + (bat-extended ? " extended" : "")}
|
||||
:spacing {bat-extended ? 3 : 0}
|
||||
:space-evenly false
|
||||
(label :text {
|
||||
(pbat_status == "Charging" || pbat_status == "Full") ?
|
||||
( (pbat_cap < 20) ? ""
|
||||
: (pbat_cap < 50) ? ""
|
||||
: (pbat_cap < 100) ? ""
|
||||
: "" )
|
||||
: (pbat_cap < 10) ? ""
|
||||
: (pbat_cap < 20) ? ""
|
||||
: (pbat_cap < 50) ? ""
|
||||
: (pbat_cap < 80) ? ""
|
||||
: ""}
|
||||
:class "base pill-icon")
|
||||
(revealer :transition "slideleft"
|
||||
:reveal bat-extended
|
||||
:duration 150
|
||||
(label :text {pbat_cap + "%"}
|
||||
:class "base")))))
|
||||
|
||||
|
||||
(defwidget time []
|
||||
(button :onclick `eww update time-extended=${time-extended ? "false" : "true"}`
|
||||
(box :orientation "horizontal"
|
||||
:space-evenly false
|
||||
:hexpand true
|
||||
:class "widget time"
|
||||
(time_extension :text petimea)
|
||||
(label :text ptime
|
||||
:class "base")
|
||||
(time_extension :text petimeb))))
|
||||
|
||||
6
res/eww/scripts/active-workspace.sh
Executable file
6
res/eww/scripts/active-workspace.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
||||
|
||||
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
||||
19
res/eww/scripts/network.sh
Executable file
19
res/eww/scripts/network.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
init=$(nmcli -t -f name,device connection show --active | grep wlp1s0 | cut -d\: -f1)
|
||||
|
||||
if [[ -z $init ]]; then
|
||||
echo Disconnected
|
||||
else
|
||||
echo $init
|
||||
fi
|
||||
|
||||
nmcli monitor | while read -r line ; do
|
||||
if [[ $line == *"is now the primary connection" ]]; then
|
||||
conn=$(echo $line | cut -d\' -f2)
|
||||
echo $conn
|
||||
fi
|
||||
if [[ $line == "There's no primary connection" ]]; then
|
||||
echo Disconnected
|
||||
fi
|
||||
done
|
||||
18
res/eww/scripts/title.sh
Executable file
18
res/eww/scripts/title.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
out () {
|
||||
if [ -z "$1" ] || [ "$1" == "null" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo "(box :class \"widget title\" :halign \"center\" :valign \"center\" :vexpand true :hexpand true (label :text \"$1\"))"
|
||||
fi
|
||||
}
|
||||
|
||||
init=$(hyprctl activewindow -j | jq --raw-output .title)
|
||||
trunc=$(echo $init | cut -c-60)
|
||||
out "$trunc"
|
||||
|
||||
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}' | while read -r line ; do
|
||||
trunc=$(echo $line | cut -c-60)
|
||||
out "$trunc"
|
||||
done
|
||||
11
res/eww/scripts/workspaces.sh
Executable file
11
res/eww/scripts/workspaces.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
spaces (){
|
||||
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
|
||||
seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
|
||||
}
|
||||
|
||||
spaces
|
||||
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||
spaces
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue