Added wayland, hyprland and eww

This commit is contained in:
marc
2024-03-02 17:38:35 +01:00
parent 95944b2486
commit 466ddf2cd9
27 changed files with 591 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
window:
opacity: 0.85
font:
size: 8
size: 12
normal:
family: Iosevka Nerd Font
style: Regular

View File

@@ -0,0 +1,134 @@
@import './colour-scheme.scss'
*{
all: unset;
font-family: Iosevka;
font-size: 16px;
}
/** Top bar **/
.top-bar {
padding-left: 16px;
padding-right: 24px;
}
tooltip.background {
background-color: $base00;
border-radius: 10px;
color: $base07;
}
tooltip label {
margin: 6px;
}
.module {
margin: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
padding-left: 8px;
padding-right: 8px;
}
.icon {
font-size: 24px;
padding-right: 8px;
}
.separator {
padding-left: 4px;
padding-right: 4px;
color: $base02;
}
/** Wifi **/
.wifi {
color: $base0C;
}
.wifi-text {
padding-left: 8px;
}
/** Volume **/
.volume {
color: $base0A;
}
.volume-mute {
color: $base04;
}
.volume-bar {
padding-left: 8px;
highlight {
background-color: $base0A;
border-radius: 10px;
}
trough {
background-color: $base04;
min-height: 10px;
border-radius: 10px;
}
}
/** Battery **/
.battery.charging {
color: $base0B;
}
.battery.discharging {
padding-right: 0px;
color: $base04;
}
.battery-bar {
padding-left: 8px;
progress {
background-color: $base0B;
border-radius: 10px;
min-height: 10px;
}
trough {
background-color: $base04;
border-radius: 10px;
min-height: 10px;
min-width: 60px;
}
}
/** Clock **/
.clock {
color: $base05;
}
.clock-time {
padding-left: 4px;
padding-right: 4px;
}
.clock-date {
padding-left: 4px;
}
.clock-year {
padding-bottom: 8px;
font-size: 75%;
}
/** Workspaces **/
.workspace-entry {
padding-left: 8px;
padding-right: 8px;
}
.workspace-entry.occupied {
color: $base06;
}
.workspace-entry.empty {
color: $base02;
}
.workspace-entry.current {
color: $base0C;
}

View File

@@ -0,0 +1,44 @@
(include "./widgets/common.yuck")
(include "./widgets/battery.yuck")
(include "./widgets/clock.yuck")
(include "./widgets/volume.yuck")
(include "./widgets/workspaces.yuck")
(include "./widgets/wifi.yuck")
(defwindow top-bar
:monitor 0
:geometry (geometry :x "0%"
:y "8px"
:width "100%"
:height "40px"
:anchor "top center")
:stacking "fg"
:exclusive "true"
(box :class "top-bar"
:orientation "h"
:space-evenly "true"
(bar-left)
(bar-center)
(bar-right)))
(defwidget bar-left []
(box :halign "start"
:orientation "h"
(workspaces-module)))
(defwidget bar-center []
(box :halign "center"
:orientation "h"))
(defwidget bar-right []
(box :halign "end"
:orientation "h"
:space-evenly "false"
(wifi-module)
(battery-module)
(volume-module)
(sep)
(clock-module)))

View File

@@ -0,0 +1,16 @@
$base00: #1c2735;
$base01: #3e4856;
$base02: #616a76;
$base03: #838c97;
$base04: #a5adb7;
$base05: #c7cfd7;
$base06: #cfd6dd;
$base07: #d8dde3;
$base08: #ec5b5c;
$base09: #667b87;
$base0A: #547f87;
$base0B: #7c7399;
$base0C: #b25b8e;
$base0D: #b75a80;
$base0E: #d4445b;
$base0F: #5d7aa2;

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

@@ -0,0 +1 @@
@import './bars/top-bar.scss'

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

@@ -0,0 +1 @@
(include "./bars/top-bar.yuck")

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
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,7 @@
#!/bin/env bash
amixer sget Master | \
grep 'Left:' | \
sed -e 's/[^[]*\[\([0-9]*\)%\][^[]\[\(\w*\)\]/{"volume": \1, "muted": \2}/' \
-e 's/on/false/' \
-e 's/off/true/'

View File

@@ -0,0 +1,8 @@
#!/bin/env bash
CONN_INFO=$(nmcli -g in-use,ssid,signal dev wifi list | \
grep "^*" | \
sed -e 's/\*:\([^:]*\):\([0-9]*\)/ ,"ssid": "\1", "signal": \2/')
CONNECTED=$([[ -z $CONN_INFO ]] && echo "false" || echo "true")
echo "{\"connected\": \"$CONNECTED\"$CONN_INFO}"

View File

@@ -0,0 +1,11 @@
#!/bin/env bash
spaces (){
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
seq 1 6 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
}
spaces
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
spaces
done

View File

@@ -0,0 +1,21 @@
(defvar battery-reveal false)
(defwidget battery-module []
(eventbox :onhover "${EWW_CMD} update battery-reveal=true"
:onhoverlost "${EWW_CMD} update battery-reveal=false"
(box :class "module battery ${EWW_BATTERY.BAT0.status == "Discharging" ? "discharging" : "charging"}"
:orientation "h"
:space-evenly "false"
:tooltip "Battery: ${EWW_BATTERY.BAT0.capacity}%"
(label :text {EWW_BATTERY.BAT0.status == "Discharging" ?
EWW_BATTERY.BAT0.capacity < 10 ? "󰂎" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊡" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊢" : "󱊣" :
EWW_BATTERY.BAT0.capacity < 10 ? "󰢟" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊤" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊥" : "󱊦"}
:class "battery icon")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {battery-reveal}
(progress :class "battery-bar"
:orientation "h"
:valign "center"
:width 60
:value {EWW_BATTERY.BAT0.capacity})))))

View File

@@ -0,0 +1,26 @@
(defpoll clock-time :interval "1s" "date +\"%H:%M:%S\"")
(defpoll clock-date :interval "1m" "date +\"%d/%m\"")
(defpoll clock-year :interval "1h" "date +\"%Y\"")
(defvar date-reveal false)
(defwidget clock-module []
(eventbox
:onhover "${EWW_CMD} update date-reveal=true"
:onhoverlost "${EWW_CMD} update date-reveal=false"
(box
:class "module clock"
:orientation "h"
:space-evenly "false"
(label
:text clock-time
:class "clock-time")
(revealer
:transition "slideleft"
:duration "750ms"
:reveal {date-reveal}
(box
:orientation "h"
(label :text clock-date
:class "clock-date")
(label :text clock-year
:class "clock-year"))))))

View File

@@ -0,0 +1,3 @@
(defwidget sep []
(label :text "|"
:class "separator"))

View File

@@ -0,0 +1,26 @@
(defpoll vinfo
:initial "{\"volume\": 0, \"muted\": false}"
:interval "1s"
"bash ~/.config/eww/scripts/get-volume-info.sh")
(defvar volume-reveal false)
(defwidget volume-module []
(eventbox :onhover "${EWW_CMD} update volume-reveal=true"
:onhoverlost "${EWW_CMD} update volume-reveal=false"
(box :class "module volume"
:orientation "h"
:space-evenly false
:tooltip {vinfo.muted? "muted" : "Volume: ${vinfo.volume}%"}
(label :text {vinfo.muted ? "󰝟" : vinfo.volume < 10 ? "󰕿" : vinfo.volume < 70 ? "󰖀" : "󰕾"}
:class "volume icon ${vinfo.muted ? "volume-mute" : ""}")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {volume-reveal && !vinfo.muted}
(scale :class "volume-bar"
:orientation "h"
:valign "center"
:width 60
:min 0
:max 101
:value {vinfo.volume}
:onchange "amixer sset Master {}% > /dev/null")))))

View File

@@ -0,0 +1,25 @@
(defvar wifi-reveal false)
(defpoll winfo
:initial "{\"connected\": \"false\"}"
:interval "10s"
"bash ~/.config/eww/scripts/get-wifi-info.sh")
(defwidget wifi-module []
(eventbox :onhover "${EWW_CMD} update wifi-reveal=true"
:onhoverlost "${EWW_CMD} update wifi-reveal=false"
:onclick "$HOME/.config/rofi/menus/wifi/wifi.sh"
(box :class "module wifi"
:orientation "h"
:space-evenly "false"
:tooltip {winfo.connected ? "Signal: ${winfo.signal}%" : "Disconnected"}
(label :text { !winfo.connected ? "󰤭" :
winfo.signal < 25 ? "󰤟" :
winfo.signal < 50 ? "󰤢" :
winfo.signal < 75 ? "󰤥" : "󰤨"}
:class "wifi icon")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {wifi-reveal && winfo.connected}
(label :class "wifi-text"
:text {winfo.connected ? winfo.ssid : "Disconnected"})))))

View File

@@ -0,0 +1,10 @@
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace.sh")
(defwidget workspaces-module []
(box :space-evenly true
(label :text "${workspaces}${current_workspace}"
:visible false)
(for workspace in workspaces
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
(box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
(label :text "${workspace.id == current_workspace ? "" : ""}"))))))