ewwwwwwww

This commit is contained in:
Zastian Pretorius
2022-11-05 01:05:59 +00:00
parent c02c3d82f0
commit 70e011ee00
6 changed files with 509 additions and 225 deletions

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

@@ -0,0 +1,77 @@
.bar{
}
.workspaces{
padding-right: 300px;
}
.0 , .01, .02, .03, .04, .05, .06, .07, .08, .09,
.011, .022, .033, .044, .055, .066, .077, .088, .099,{
margin: 0px 0px 0px 0px;
}
/* Unoccupied */
.0 {
color: #606060;
}
/* Occupied */
.01, .02, .03, .04, .05, .06, .07, .08, .09 {
color:#959595;
font-weight: bold;
}
/* Focused */
.011, .022, .033, .044, .055, .066, .077, .088, .099{
color: #ffffff;
font-weight:bold;
}
.bar_right{
//padding left
padding-left: 130px;
}
.disk{
//font size
font-size: 12px;
//ring color lime green
color: #32CD32;
}
.cpu{
//font size
font-size: 12px;
//color dracula purple
color: #BD93F9;
}
.mem{
//font size
font-size: 12px;
//color dracula yellow
color: #F1FA8C;
}
.net{
//color dracula blue
color: #8BE9FD;
}
.time{
//color dracula orange
color: #FFB86C;
background-color: inherit;
}
.idle{
}
.idle_btn_on{
//color dracula pink
color: #FF79C6;
background-color: inherit;
}
.idle_btn_off{
//color dracula red
color: #FF5555;
background-color: inherit;
}

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

@@ -0,0 +1,54 @@
(defwindow bar
:monitor 0
:exclusive true
:geometry (geometry
:height "3%"
:width "100%"
:anchor "top center"
)
:stacking "fg"
:windowtype "dock"
(bar))
(defwindow calendar
:monitor 0
:exclusive false
:geometry (geometry
:height "20%"
:width "20%"
:anchor "top right"
)
:stacking "fg"
:windowtype "normal"
(cal))
(defwidget bar []
(box :orientation "horizontal" :class "bar"
(literal :class "workspaces" :content workspace)
(label :class "spacer" :text "")
(box :orientation "horizontal" :class "bar_right"
(circular-progress :class "disk" :value "${round(EWW_DISK[`/home`].used/EWW_DISK[`/home`].total*100,0)}"
:max-value 100 :min-value 0 :thickness 2 :size 20 "SSD")
(circular-progress :class "cpu" :value "${round(EWW_CPU.avg,0)}"
:max-value 100 :min-value 0 :thickness 2 :size 20 "CPU")
(circular-progress :class "mem" :value "${round(EWW_RAM.used_mem/EWW_RAM.total_mem*100,0)}"
:max-value 100 :min-value 0 :thickness 2 :size 20 "RAM")
(label :class "net" :text "${round(EWW_NET[`enp4s0`].NET_DOWN/131072,1)} ↓↑ ${round(EWW_NET[`enp4s0`].NET_UP/131072,1)}")
(button :class "time" :onclick "scripts/calendar calendar"
"${date.hour}:${date.min} ${date.am_pm}")
(literal :class "idle" :content idle))))
(defpoll date :interval "5s"
`date +'{"hour":"%I","min":"%M","am_pm":"%p","day":"%d","month":"%m","year":"%Y"}'`)
(defwidget cal []
(calendar :class "calendar"
:date "${date.year}-${date.month}-${date.day}"
:format "%a %d %b"))
(deflisten workspace "scripts/workspace")
(deflisten idle "scripts/idel")

View File

@@ -0,0 +1,35 @@
#!/bin/bash
calendar(){
LOCK_FILE="$HOME/.cache/eww-calendar.lock"
EWW_BIN="eww"
run() {
${EWW_BIN} -c $HOME/.config/eww open calendar
}
# Run eww daemon if not running
if [[ ! `pidof eww` ]]; then
${EWW_BIN} daemon
sleep 1
fi
# Open widgets
if [[ ! -f "$LOCK_FILE" ]]; then
touch "$LOCK_FILE"
run
else
${EWW_BIN} -c $HOME/.config/eww close calendar
rm "$LOCK_FILE"
fi
}
if [ "$1" = "launcher" ]; then
$HOME/.local/bin/launcher
elif [ "$1" = "wifi" ]; then
kitty -e nmtui
elif [ "$1" = "audio" ]; then
pavucontrol
elif [ "$1" = "calendar" ]; then
calendar
fi

14
eww/.config/eww/scripts/idel Executable file
View File

@@ -0,0 +1,14 @@
#! /bin/bash
#check if wayland-idle-inhibitor.py is running
#loop forever
while true
do
if pgrep -x "way-inhibitor" > /dev/null
then
echo "(button :class \"idle_btn_on\" :onclick \"killall way-inhibitor\"\"\")"
else
echo "(button :class \"idle_btn_off\" :onclick \"way-inhibitor &\" \"\")"
fi
sleep 1
done

View File

@@ -0,0 +1,54 @@
#! /bin/bash
#define icons for workspaces 1-9
ic=(0 一 二 三 四 五 六 七 八 九)
#initial check for occupied workspaces
for num in $(hyprctl workspaces | grep ID | sed 's/()/(1)/g' | awk 'NR>1{print $1}' RS='(' FS=')'); do
export o"$num"="$num"
done
#initial check for focused workspace
for num in $(hyprctl monitors | grep active | sed 's/()/(1)/g' | awk 'NR>1{print $1}' RS='(' FS=')'); do
export f"$num"="$num"
export fnum=f"$num"
done
workspaces() {
if [[ ${1:0:9} == "workspace" ]]; then #set focused workspace
unset -v "$fnum"
num=${1:11}
export f"$num"="$num"
export fnum=f"$num"
elif [[ ${1:0:15} == "createworkspace" ]]; then #set Occupied workspace
num=${1:17}
export o"$num"="$num"
export f"$num"="$num"
elif [[ ${1:0:16} == "destroyworkspace" ]]; then #unset unoccupied workspace
num=${1:18}
unset -v o"$num" f"$num"
fi
#output eww widget
echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" \
(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"true\" \
(button :onclick \"hyprctl dispatch workspace 1\" :onrightclick \"hyprctl dispatch workspace 1 && /home/taylor/.config/hypr/default_app\" :class \"0$o1$f1\" \"${ic[1]}\") \
(button :onclick \"hyprctl dispatch workspace 2\" :onrightclick \"hyprctl dispatch workspace 2 && /home/taylor/.config/hypr/default_app\" :class \"0$o2$f2\" \"${ic[2]}\") \
(button :onclick \"hyprctl dispatch workspace 3\" :onrightclick \"hyprctl dispatch workspace 3 && /home/taylor/.config/hypr/default_app\" :class \"0$o3$f3\" \"${ic[3]}\") \
(button :onclick \"hyprctl dispatch workspace 4\" :onrightclick \"hyprctl dispatch workspace 4 && /home/taylor/.config/hypr/default_app\" :class \"0$o4$f4\" \"${ic[4]}\") \
(button :onclick \"hyprctl dispatch workspace 5\" :onrightclick \"hyprctl dispatch workspace 5 && /home/taylor/.config/hypr/default_app\" :class \"0$o5$f5\" \"${ic[5]}\") \
(button :onclick \"hyprctl dispatch workspace 6\" :onrightclick \"hyprctl dispatch workspace 6 && /home/taylor/.config/hypr/default_app\" :class \"0$o6$f6\" \"${ic[6]}\") \
(button :onclick \"hyprctl dispatch workspace 7\" :onrightclick \"hyprctl dispatch workspace 7 && /home/taylor/.config/hypr/default_app\" :class \"0$o7$f7\" \"${ic[7]}\") \
(button :onclick \"hyprctl dispatch workspace 8\" :onrightclick \"hyprctl dispatch workspace 8 && /home/taylor/.config/hypr/default_app\" :class \"0$o8$f8\" \"${ic[8]}\") \
(button :onclick \"hyprctl dispatch workspace 9\" :onrightclick \"hyprctl dispatch workspace 9 && /home/taylor/.config/hypr/default_app\" :class \"0$o9$f9\" \"${ic[9]}\") \
)\
)"
}
workspaces
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
workspaces "$event"
done