Add all of iogamaster modules
This commit is contained in:
14
modules/nixos/desktop/addons/eww/config/env.yuck
Normal file
14
modules/nixos/desktop/addons/eww/config/env.yuck
Normal file
@@ -0,0 +1,14 @@
|
||||
(defpoll hostname :interval "1000s" "hostnamectl hostname")
|
||||
(defpoll username :interval "1000s" "echo $USER")
|
||||
|
||||
(defpoll net :interval "100s" `nmcli -terse -fields SIGNAL,ACTIVE device wifi | awk --field-separator ':' '{if($2=="yes")print$1}'`)
|
||||
(defpoll ssid :interval "100s" `nmcli -terse -fields SSID,ACTIVE device wifi | awk --field-separator ':' '{if($2=="yes")print$1}'`)
|
||||
|
||||
(defvar profile "~/.face")
|
||||
|
||||
(defpoll dunst :interval "1s" "[ $(dunstctl is-paused) = false ] && echo || echo ")
|
||||
|
||||
(defpoll time :interval "1s" `date +'{"hour":"%H","min":"%M","sec":"%S","pretty":"%a, %e %b","day":"%A","month":"%B","dom":"%e","year":"%Y","day_num":"%d","month_num":"%m","year_num":"%y"}'`)
|
||||
|
||||
(deflisten music :initial ""
|
||||
"playerctl --follow metadata --format '{{ title }} - {{ artist }}' || true")
|
113
modules/nixos/desktop/addons/eww/config/eww.scss
Normal file
113
modules/nixos/desktop/addons/eww/config/eww.scss
Normal file
@@ -0,0 +1,113 @@
|
||||
* {
|
||||
all: unset; //Unsets everything so you can style everything from scratch
|
||||
}
|
||||
|
||||
$bg: #1e1e2e;
|
||||
$black: #313244;
|
||||
$red: #f38ba8;
|
||||
$green: #a6e3a1;
|
||||
$yellow: #f9e2af;
|
||||
$pink: #f5c2e7;
|
||||
$blue: #89b4fa;
|
||||
$purple: #cba6f7;
|
||||
$cyan: #89dceb;
|
||||
$white: #cdd6f4;
|
||||
$gray: #313244;
|
||||
|
||||
* {
|
||||
transition: 200ms ease;
|
||||
font-family: "JetBrainsMono Nerd Font";
|
||||
}
|
||||
|
||||
.bar {
|
||||
background-color: $bg;
|
||||
color: $white;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.bar2 {
|
||||
background-color: $bg;
|
||||
color: $white;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.workspaces {
|
||||
padding-left: 10;
|
||||
font-size: 20;
|
||||
}
|
||||
|
||||
.system {
|
||||
padding-right: 10;
|
||||
}
|
||||
|
||||
.module { margin: 0 5px; }
|
||||
|
||||
.metric scale trough highlight {
|
||||
all: unset;
|
||||
background-color: $blue;
|
||||
color: $black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.metric scale trough {
|
||||
all: unset;
|
||||
background-color: $gray;
|
||||
border-radius: 50px;
|
||||
min-height: 3px;
|
||||
min-width: 50px;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.metric scale trough highlight {
|
||||
all: unset;
|
||||
background-color: $blue;
|
||||
color: $black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.metric scale trough {
|
||||
all: unset;
|
||||
background-color: $gray;
|
||||
border-radius: 50px;
|
||||
min-height: 3px;
|
||||
min-width: 50px;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.bat-box scale trough highlight {
|
||||
all: unset;
|
||||
background-color: $blue;
|
||||
color: $black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.bat-box scale trough {
|
||||
all: unset;
|
||||
background-color: $gray;
|
||||
border-radius: 50px;
|
||||
min-height: 3px;
|
||||
min-width: 50px;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.bat-box scale trough highlight {
|
||||
all: unset;
|
||||
background-color: $blue;
|
||||
color: $black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.bat-box scale trough {
|
||||
all: unset;
|
||||
background-color: $gray;
|
||||
border-radius: 50px;
|
||||
min-height: 3px;
|
||||
min-width: 50px;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
|
39
modules/nixos/desktop/addons/eww/config/eww.yuck
Normal file
39
modules/nixos/desktop/addons/eww/config/eww.yuck
Normal file
@@ -0,0 +1,39 @@
|
||||
(include "./widgets/workspaces.yuck")
|
||||
(include "./widgets/music.yuck")
|
||||
(include "./widgets/metrics.yuck")
|
||||
|
||||
(defwidget bar []
|
||||
(centerbox :orientation "h"
|
||||
(box
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
(workspaces))
|
||||
(label :text "")
|
||||
(metrics)))
|
||||
|
||||
;; Windows
|
||||
(defwindow bar
|
||||
:monitor 0
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0px"
|
||||
:width "100%"
|
||||
:height "4%"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:windowtype "dock"
|
||||
:wm-ignore false
|
||||
:exclusive true
|
||||
(bar))
|
||||
(defwindow bar2
|
||||
:monitor 1
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0px"
|
||||
:width "100%"
|
||||
:height "4%"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:windowtype "dock"
|
||||
:wm-ignore false
|
||||
:exclusive true
|
||||
(bar))
|
||||
|
8
modules/nixos/desktop/addons/eww/config/scripts/battery-percent
Executable file
8
modules/nixos/desktop/addons/eww/config/scripts/battery-percent
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -f /sys/class/power_supply/BAT0/capacity ]; then
|
||||
cat /sys/class/power_supply/BAT0/capacity
|
||||
fi
|
||||
|
8
modules/nixos/desktop/addons/eww/config/scripts/battery-status
Executable file
8
modules/nixos/desktop/addons/eww/config/scripts/battery-status
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -f /sys/class/power_supply/BAT0/status]; then
|
||||
cat /sys/class/power_supply/BAT0/status
|
||||
fi
|
||||
|
83
modules/nixos/desktop/addons/eww/config/scripts/workspace
Executable file
83
modules/nixos/desktop/addons/eww/config/scripts/workspace
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ~/.config/theme/workspace_colors
|
||||
|
||||
# get initial focused workspace
|
||||
focusedws=$(hyprctl -j monitors | jaq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
|
||||
declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
|
||||
declare -A monitormap
|
||||
declare -A workspaces
|
||||
|
||||
# set color for each workspace
|
||||
status() {
|
||||
if [ "${o[$1]}" -eq 1 ]; then
|
||||
mon=${monitormap[${workspaces[$1]}]}
|
||||
|
||||
if [ $focusedws -eq "$1" ]; then
|
||||
echo -n "${colors[$mon]}"
|
||||
else
|
||||
echo -n "${dimmed[$mon]}"
|
||||
fi
|
||||
else
|
||||
echo -n "$empty"
|
||||
fi
|
||||
}
|
||||
|
||||
# handle workspace create/destroy
|
||||
workspace_event() {
|
||||
o[$1]=$2
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | gojq -r '.[]|"\(.id) \(.monitor)"')
|
||||
}
|
||||
# handle monitor (dis)connects
|
||||
monitor_event() {
|
||||
while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | gojq -r '.[]|"\(.name) \(.id) "')
|
||||
}
|
||||
|
||||
# generate the json for eww
|
||||
generate() {
|
||||
echo -n '['
|
||||
|
||||
for i in {1..10}; do
|
||||
echo -n ''$([ $i -eq 1 ] || echo ,) '{ "number": "'"$i"'", "color": "'$(status "$i")'" }'
|
||||
done
|
||||
|
||||
echo ']'
|
||||
}
|
||||
|
||||
# setup
|
||||
|
||||
# add monitors
|
||||
monitor_event
|
||||
|
||||
# add workspaces
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | gojq -r '.[]|"\(.id) \(.monitor)"')
|
||||
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
# generate initial widget
|
||||
generate
|
||||
|
||||
# main loop
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r line; do
|
||||
case ${line%>>*} in
|
||||
"workspace")
|
||||
focusedws=${line#*>>}
|
||||
;;
|
||||
"focusedmon")
|
||||
focusedws=${line#*,}
|
||||
;;
|
||||
"createworkspace")
|
||||
workspace_event "${line#*>>}" 1
|
||||
;;
|
||||
"destroyworkspace")
|
||||
workspace_event "${line#*>>}" 0
|
||||
;;
|
||||
"monitor"*)
|
||||
monitor_event
|
||||
;;
|
||||
esac
|
||||
generate
|
||||
done
|
48
modules/nixos/desktop/addons/eww/config/widgets/metrics.yuck
Normal file
48
modules/nixos/desktop/addons/eww/config/widgets/metrics.yuck
Normal file
@@ -0,0 +1,48 @@
|
||||
(defwidget metrics []
|
||||
(box :class "system" :orientation "h" :space-evenly false :halign "end"
|
||||
(_battery)
|
||||
(metric :label ""
|
||||
:value {EWW_RAM.used_mem_perc}
|
||||
:onchange "")
|
||||
(metric :label ""
|
||||
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
|
||||
:onchange "")
|
||||
))
|
||||
|
||||
(defwidget metric [label value onchange]
|
||||
(box :orientation "h"
|
||||
:class "metric"
|
||||
:space-evenly false
|
||||
(box :class "label" label)
|
||||
(scale :min 0
|
||||
:max 151
|
||||
:active {onchange != ""}
|
||||
:value value
|
||||
:onchange onchange)))
|
||||
|
||||
|
||||
|
||||
|
||||
(defpoll battery-percent :interval "30s"
|
||||
:initial ''
|
||||
"./scripts/battery-percent")
|
||||
(defpoll battery-status :interval "5s"
|
||||
:initial ''
|
||||
"./scripts/battery-status")
|
||||
|
||||
(defwidget _battery []
|
||||
(box :class "bat-box" :space-evenly false :spacing 8
|
||||
:visable {battery-status != ''}
|
||||
(label :text {battery-status == 'Charging' ? "" :
|
||||
battery-percent < 10 ? "" :
|
||||
battery-percent < 20 ? "" :
|
||||
battery-percent < 30 ? "" :
|
||||
battery-percent < 40 ? "" :
|
||||
battery-percent < 50 ? "" :
|
||||
battery-percent < 60 ? "" :
|
||||
battery-percent < 70 ? "" :
|
||||
battery-percent < 80 ? "" :
|
||||
battery-percent < 90 ? "" : ""})))
|
||||
|
||||
(defpoll time :interval "1s"
|
||||
"date '+%H:%M'")
|
@@ -0,0 +1,9 @@
|
||||
(defwidget music []
|
||||
(box :class "music"
|
||||
:orientation "h"
|
||||
:space-evenly false
|
||||
:halign "center"
|
||||
{music != "" ? " ${music}" : ""}))
|
||||
|
||||
(deflisten music :initial ""
|
||||
"playerctl --follow metadata --format '{{ title }} - {{ artist }}' || true")
|
@@ -0,0 +1,13 @@
|
||||
(defwidget workspaces []
|
||||
(eventbox
|
||||
:onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace"
|
||||
(box
|
||||
:class "module workspaces"
|
||||
:spacing 10
|
||||
(for i in workspace
|
||||
(button
|
||||
:onclick "hyprctl dispatch workspace ${i.number}"
|
||||
:class "ws"
|
||||
:style "color: ${i.color};"
|
||||
"●")))))
|
||||
(deflisten workspace "./scripts/workspace")
|
Reference in New Issue
Block a user