add eww stuff

This commit is contained in:
elkowar 2023-03-16 17:26:29 +01:00
parent 211c367427
commit 43002a929b
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
6 changed files with 92 additions and 1 deletions

View file

@ -0,0 +1,13 @@
* {
all: unset;
}
.bar {
background-color: #1d2021;
color: #ebdbb2;
margin-left: 10px;
margin-right: 10px;
font-family: "CozetteVector";
font-size: 12px;
}

View file

@ -0,0 +1,31 @@
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace")
(defpoll time :interval "1s" "date '+%d.%m.%Y - %H:%M'")
(defwidget workspaces []
(eventbox :halign "start"
:onscroll "bash ${EWW_CONFIG_DIR}/scripts/change-active-workspace {} ${current_workspace}"
:class "workspaces-widget"
(box :space-evenly true
(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 ? "◆" : "◇"} ")))))))
(defwidget bar []
(centerbox :class "bar"
(workspaces)
"${time}"
(box :halign "end"
:space-evenly true
:width "150"
"󰁹 ${EWW_BATTERY["BAT1"].capacity}%"
"󰍛 ${round(EWW_RAM.used_mem_perc, 0)}%"
"󰻠 ${round(EWW_CPU.avg, 0)}%")))
(defwindow bar
:monitor 0
:geometry (geometry :x 0 :y 0 :width "100%" :height "30px" :anchor "top center")
:stacking "fg"
:exclusive true
(bar))

View file

@ -0,0 +1,21 @@
#! /bin/bash
function clamp {
min=$1
max=$2
val=$3
python -c "print(max($min, min($val, $max)))"
}
direction=$1
current=$2
if test "$direction" = "down"
then
target=$(clamp 1 10 $(($current+1)))
echo "jumping to $target"
hyprctl dispatch workspace $target
elif test "$direction" = "up"
then
target=$(clamp 1 10 $(($current-1)))
echo "jumping to $target"
hyprctl dispatch workspace $target
fi

View file

@ -0,0 +1,3 @@
#!/bin/bash
hyprctl monitors -j | jq --raw-output .[0].activeWorkspace.id
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^workspace>>' | stdbuf -o0 awk -F '>>|,' '{print $2}'

View file

@ -0,0 +1,11 @@
#!/bin/bash
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:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
spaces
done

View file

@ -1,6 +1,10 @@
monitor=,preferred,auto,1
exec-once = swaybg -m fill --image /home/leon/Pictures/green_leaves.jpg & mako
env = $WOBSOCK,$XDG_RUNTIME_DIR/wob.sock
exec-once = mkfifo $WOBSOCK && tail -f $WOBSOCK | wob
exec-once = eww open bar
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
@ -12,7 +16,7 @@ input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_options = compose:ralt
kb_rules =
follow_mouse = 1
@ -90,6 +94,14 @@ bind = $mainMod SHIFT, P, exec, rofi -show drun
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, v, togglesplit, # dwindle
bind = $mainMod, f, fullscreen, # dwindle
bind = ,XF86AudioRaiseVolume, exec, pamixer -ui 2 && pamixer --get-volume > $WOBSOCK
bind = ,XF86AudioLowerVolume, exec, pamixer -ud 2 && pamixer --get-volume > $WOBSOCK
bind = ,XF86AudioMute, exec, pamixer --toggle-mute && ( pamixer --get-mute && echo 0 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK
bind = ,XF86MonBrightnessDown, exec, brightnessctl set 5%- | sed -En 's/.*\(([0-9]+)%\).*/\1/p' | tee /tmp/brightness > $WOBSOCK
bind = ,XF86MonBrightnessUp, exec, brightnessctl set +5% | sed -En 's/.*\(([0-9]+)%\).*/\1/p' | tee /tmp/brightness > $WOBSOCK
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u