Compare commits
2 commits
ba99d2ee9d
...
f689686dc5
Author | SHA1 | Date | |
---|---|---|---|
f689686dc5 | |||
6de642f4a2 |
9 changed files with 178 additions and 28 deletions
|
@ -13,9 +13,7 @@
|
||||||
|
|
||||||
(deflisten connectivity :initial '{"status": "down"}' "~/.config/eww/scripts/get-connectivity wlan0")
|
(deflisten connectivity :initial '{"status": "down"}' "~/.config/eww/scripts/get-connectivity wlan0")
|
||||||
(deflisten bluetoothinfo :initial '{"count": 0}' "~/.config/eww/scripts/get-bluetooth-info")
|
(deflisten bluetoothinfo :initial '{"count": 0}' "~/.config/eww/scripts/get-bluetooth-info")
|
||||||
(deflisten workspaces :initial "[]" "~/.config/eww/scripts/hypr/get-workspaces")
|
(deflisten hypr :initial '{"spaces": [], "current": 0, "title": ""}' "~/.config/eww/scripts/hypr/hyprstatus")
|
||||||
(deflisten current_workspace :initial "{\"id\": 1, \"title\": \"...\"}" "~/.config/eww/scripts/hypr/get-active-workspace")
|
|
||||||
(deflisten window_title :initial "{\"id\": 1, \"title\": \"...\"}" "~/.config/eww/scripts/hypr/get-window-title")
|
|
||||||
|
|
||||||
(deflisten volume :initial "{}" "~/.config/eww/scripts/get-volume")
|
(deflisten volume :initial "{}" "~/.config/eww/scripts/get-volume")
|
||||||
|
|
||||||
|
@ -55,12 +53,12 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(defwidget workspaces [monitor]
|
(defwidget workspaces [monitor]
|
||||||
(eventbox :onscroll "bash ~/.config/eww/scripts/hypr/change-active-workspace {} ${current_workspace}" :class "workspaces"
|
(eventbox :onscroll "bash ~/.config/eww/scripts/hypr/change-active-workspace {} ${hypr.current}" :class "workspaces"
|
||||||
(box :space-evenly true
|
(box :space-evenly true
|
||||||
(label :text "${workspaces}${current_workspace}" :visible false)
|
(label :text "${hypr.spaces}${hypr.current}" :visible false)
|
||||||
(for workspace in workspaces
|
(for workspace in {hypr.spaces}
|
||||||
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" :visible "${workspace.monitor == monitor}"
|
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" :visible "${workspace.monitor == monitor}"
|
||||||
(box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""}"
|
(box :class "workspace-entry ${workspace.id == hypr.current ? "current" : ""}"
|
||||||
(label :text "${workspace.id}")
|
(label :text "${workspace.id}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -70,7 +68,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(defwidget activewindow []
|
(defwidget activewindow []
|
||||||
(label :text "${window_title ?: "..."}")
|
(label :text "${hypr.title ?: "..."}")
|
||||||
)
|
)
|
||||||
|
|
||||||
(defwidget ram []
|
(defwidget ram []
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
@import "./theme.scss";
|
@import "./theme.scss";
|
||||||
@import "./bar.scss";
|
@import "./bar.scss";
|
||||||
|
@import "./timer.scss";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
all: unset;
|
all: unset;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
(include "./bar.yuck")
|
(include "./bar.yuck")
|
||||||
|
(include "./timer.yuck")
|
||||||
|
|
||||||
(defpoll bots
|
(defpoll bots
|
||||||
:initial `[]`
|
:initial `[]`
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/dash
|
|
||||||
|
|
||||||
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}'
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/dash
|
|
||||||
hyprctl activewindow -j | jq --raw-output .title
|
|
||||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}'
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/dash
|
|
||||||
|
|
||||||
spaces (){
|
|
||||||
hyprctl workspaces -j | jq -c 'map({id: .id, windows: .windows, monitor: .monitorID}) | sort_by(.id)'
|
|
||||||
}
|
|
||||||
|
|
||||||
spaces
|
|
||||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
|
||||||
spaces
|
|
||||||
done
|
|
22
bar/eww/scripts/hypr/hyprstatus
Executable file
22
bar/eww/scripts/hypr/hyprstatus
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/dash
|
||||||
|
|
||||||
|
spaces (){
|
||||||
|
hyprctl workspaces -j | jq -c 'map({id: .id, windows: .windows, monitor: .monitorID}) | sort_by(.id)'
|
||||||
|
}
|
||||||
|
|
||||||
|
current (){
|
||||||
|
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
||||||
|
}
|
||||||
|
|
||||||
|
title (){
|
||||||
|
hyprctl activewindow -j | jq --raw-output .title
|
||||||
|
}
|
||||||
|
|
||||||
|
status (){
|
||||||
|
echo "{\"spaces\": $(spaces), \"current\": \"$(current)\", \"title\": \"$(title)\"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
status
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||||
|
status
|
||||||
|
done
|
65
bar/eww/timer.scss
Normal file
65
bar/eww/timer.scss
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
.timer {
|
||||||
|
padding-left: 60px;
|
||||||
|
padding-right: 60px;
|
||||||
|
|
||||||
|
background-color: $background;
|
||||||
|
border-radius: 20px;
|
||||||
|
|
||||||
|
.timer-title {
|
||||||
|
color: $text;
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.start-button {
|
||||||
|
.circle-progress {
|
||||||
|
color: $green;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.start-icon {
|
||||||
|
color: $green;
|
||||||
|
font-size: 28px;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.timer-text {
|
||||||
|
font-size: 32px;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.work {
|
||||||
|
.start-button {
|
||||||
|
.circle-progress {
|
||||||
|
color: $red;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.start-icon {
|
||||||
|
color: $red;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.pause {
|
||||||
|
.start-button {
|
||||||
|
.circle-progress {
|
||||||
|
color: $yellow;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.start-icon {
|
||||||
|
color: $yellow;
|
||||||
|
|
||||||
|
transition: color 500ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
83
bar/eww/timer.yuck
Normal file
83
bar/eww/timer.yuck
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
(defvar WORK_TIME_SEC 1200)
|
||||||
|
(defvar PAUSE_TIME_SEC 300)
|
||||||
|
|
||||||
|
(defvar timer-state "inactive")
|
||||||
|
(defvar timer-start-time 0)
|
||||||
|
|
||||||
|
(defpoll timer-time
|
||||||
|
:interval "1s"
|
||||||
|
:run-while {timer-state != "inactive"}
|
||||||
|
`date +%s`)
|
||||||
|
|
||||||
|
(defpoll timer-work-period
|
||||||
|
:interval "20m"
|
||||||
|
:initial "first"
|
||||||
|
:run-while {timer-state == "work"}
|
||||||
|
`if [ "$(eww get timer-work-period)" == "first" ]; then
|
||||||
|
eww update timer-start-time=$(date +%s)
|
||||||
|
echo next
|
||||||
|
else
|
||||||
|
notify-send -i ~/Images/Icons/moai.jpg "Work period over" "You can take a little nap now."
|
||||||
|
eww update timer-state=pause
|
||||||
|
echo first
|
||||||
|
fi`) ; TODO: Put in a separate script
|
||||||
|
|
||||||
|
(defpoll timer-pause-period
|
||||||
|
:interval "5m"
|
||||||
|
:initial "first"
|
||||||
|
:run-while {timer-state == "pause"}
|
||||||
|
`if [ "$(eww get timer-pause-period)" == "first" ]; then
|
||||||
|
eww update timer-start-time=$(date +%s)
|
||||||
|
echo next
|
||||||
|
else
|
||||||
|
notify-send -i ~/Images/Icons/moai.jpg "Pause period over" "Back to grinding we go."
|
||||||
|
eww update timer-state=work
|
||||||
|
echo first
|
||||||
|
fi`) ; TODO: Put in a separate script
|
||||||
|
|
||||||
|
(defwidget start-button []
|
||||||
|
(button
|
||||||
|
:class "start-button"
|
||||||
|
:vexpand true
|
||||||
|
:onclick "eww update timer-state=${timer-state == "inactive" ? "work" : "inactive"} timer-work-period=first timer-pause-period=first"
|
||||||
|
(overlay
|
||||||
|
(circular-progress
|
||||||
|
:class "circle-progress"
|
||||||
|
:value 100
|
||||||
|
:thickness 6
|
||||||
|
:clockwise true)
|
||||||
|
(label :class "start-icon" :text "${timer-state == "inactive" ? 'Start' : (timer-state == "work" ? "Working" : "Pause")}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget timer []
|
||||||
|
(box
|
||||||
|
:orientation "v"
|
||||||
|
:space-evenly false
|
||||||
|
:class "timer ${timer-state}"
|
||||||
|
(label :class "timer-title" :text "Grind timer")
|
||||||
|
(start-button :valign "center" :vexpand true)
|
||||||
|
(revealer
|
||||||
|
:transition "slideup"
|
||||||
|
:reveal {timer-state != "inactive"}
|
||||||
|
(label :class "timer-text" :text "${timer-state != "inactive" ? formattime(timer-start-time - (3600 - (timer-state == "work" ? WORK_TIME_SEC : PAUSE_TIME_SEC)) - timer-time, "%H:%M:%S") : "00:20:00"}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(defwindow timer
|
||||||
|
:namespace "eww.timer"
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry
|
||||||
|
:x "6%"
|
||||||
|
:y "10%"
|
||||||
|
:width "300px"
|
||||||
|
:height "350px"
|
||||||
|
:anchor "top left")
|
||||||
|
:stacking "bg"
|
||||||
|
:focusable false
|
||||||
|
:exclusive true
|
||||||
|
(timer)
|
||||||
|
)
|
Loading…
Reference in a new issue