This commit is contained in:
Peritia 2026-02-12 15:32:45 +01:00
parent b6b87d5aed
commit 9c72a71585
3546 changed files with 18655 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#!/bin/bash
# Get the day of the week, day of the month, month, and year
day_of_week=$(date +"%a")
day_of_month=$(date +"%d")
month=$(date +"%b")
year=$(date +"%Y")
# Remove leading zero from the day of the month
day_of_month=$(echo $day_of_month | sed 's/^0*//')
# Determine the ordinal suffix
if [[ $day_of_month -ge 11 && $day_of_month -le 13 ]]; then
suffix="th"
else
case $((day_of_month % 10)) in
1) suffix="st" ;;
2) suffix="nd" ;;
3) suffix="rd" ;;
*) suffix="th" ;;
esac
fi
# Output the formatted date
echo "${day_of_month}${suffix} $month $year"

View file

@ -0,0 +1,102 @@
* {
all: unset;
background: transparent;
font-family: Noto Sans;
}
$accent-color: #20d0fc;
window {
background: transparent;
}
.container {
padding: 0px;
background: linear-gradient(to bottom, rgba(255,255,255,0.3)0%, rgba(0,0,0,0.4)50%, rgba(0,0,0,0.5)50%, rgba(0,0,0,0.7)100%);
color: white;
border-radius: 12px;
border-style: solid;
border-width: 2px;
border-left-width: 1px;
border-top-width: 1px;
border-color: rgba(255,255,255,0.25);
border-bottom-color: rgba(0,50,50,0.8);
border-right-color: rgba(0,50,50,0.8);
box-shadow: inset 0px 0px 12px rgba(0,0,0,0.25);
}
.completelytrans {
background: none;
}
.button {
padding: 5px;
}
.button:hover {
background-color: rgba(0,255,255,0.1);
border-radius: 12px;
transition-duration: 150ms;
}
.button:active {
background-color: rgba(0,0,0,0.6);
transition-duration: 150ms;
}
.daybox {
border-radius: 8px;
margin: 5px;
}
.temperature-container {
padding: 25px;
}
.temperature {
background: rgba(0,0,0,0.5);
margin: 0px;
padding: 12px;
font-size: 18px;
}
.temp-label-header {
color: rgba(255,255,255,1);
text-shadow: 0px 0px 5px rgba(0,255,255,1);
margin-bottom: 110px;
font-size: 32px;
}
.temp-label {
font-size: 22px;
margin-bottom: 10px;
font-weight: bold;
}
.weather-label {
color: rgba(0,255,255,0.5);
margin-top: 45px;
font-size: 18px;
font-weight: bold;
}
.date-label {
background: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(0,0,0,0.2));
font-size: 16px;
font-weight: 500;
padding: 2px;
box-shadow: 0px 0px 8px rgba(0,0,0,0.45);
border-radius: 6px;
padding: 6px;
border-top-style: solid;
border-bottom-style: solid;
border-width: 1px;
border-color: rgba(255,255,255,0.25);
border-top-color: rgba(255,255,255,0.4);
color: rgba(255,255,255,0.8);
text-shadow: 0px 0px 6px black;
font-weight: bold;
}

View file

@ -0,0 +1,29 @@
#!/bin/bash
# Reload/Open eww
eww kill
eww daemon
# Day label at the top of the screen.
eww open daybox
# Wofi button -- Cancelled/still wip, I think it looks bad.
# eww open menu
# All other aesthetic gifs
eww open gif1
eww open gif2
# The temperature widget
#eww open diinkitemperature
# Call the weather polling function once initially.
# I recommend installing cron and making a cronjob that calls
# the script with --getdata every 30 minutes.
#WEATHER_POLLING="$HOME/.config/eww/scripts/weather.sh"
#bash "$WEATHER_POLLING" --getdata &
#disown
# -- Experimental gif, uncomment if you want it :D
# eww open gif3

View file

@ -0,0 +1,12 @@
{
imports = [
./main.nix
./widgets/daybox.nix
./widgets/menu.nix
./widgets/diinkitemperature.nix
./widgets/gif1.nix
./widgets/gif2.nix
./widgets/gif3.nix
];
}

View file

@ -0,0 +1,49 @@
{
config,
lib,
pkgs,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = nixosVista.eww;
in {
#
#
# Definetly not done yet the Widgets don't really work
#
#
#
options.nixosVista.eww.enable =
mkEnableOption "Modular EWW system";
config = mkIf cfg.enable {
programs.eww.enable = true;
home.packages = [
pkgs.jq
pkgs.curl
];
home.file = {
".config/eww/eww.scss".source = ./base/eww.scss;
".config/eww/eww.yuck".text = ''
;; Base EWW file
(include "eww_vars.yuck")
'';
".config/eww/eww_vars.yuck".text = ''
(defpoll DATE :interval "1s" '~/.config/eww/date_format.sh')
(defpoll uptime :interval "25s" "uptime -p | sed -e 's/up //;s/ hours,/h/;s/ minutes/m/'")
'';
".config/eww/date_format.sh".source =
./base/date_format.sh;
".config/eww/start.sh".source =
./base/start.sh;
};
};
}

View file

@ -0,0 +1,26 @@
#!/bin/bash
# Get the day of the week, day of the month, month, and year
day_of_week=$(date +"%a")
day_of_month=$(date +"%d")
month=$(date +"%b")
year=$(date +"%Y")
# Remove leading zero from the day of the month
day_of_month=$(echo $day_of_month | sed 's/^0*//')
# Determine the ordinal suffix
if [[ $day_of_month -ge 11 && $day_of_month -le 13 ]]; then
suffix="th"
else
case $((day_of_month % 10)) in
1) suffix="st" ;;
2) suffix="nd" ;;
3) suffix="rd" ;;
*) suffix="th" ;;
esac
fi
# Output the formatted date
echo "${day_of_month}${suffix} $month $year"

View file

@ -0,0 +1,29 @@
#!/bin/bash
# Reload/Open eww
eww kill
eww daemon
# Day label at the top of the screen.
eww open daybox
# Wofi button -- Cancelled/still wip, I think it looks bad.
# eww open menu
# All other aesthetic gifs
eww open gif1
eww open gif2
# The temperature widget
eww open diinkitemperature
# Call the weather polling function once initially.
# I recommend installing cron and making a cronjob that calls
# the script with --getdata every 30 minutes.
WEATHER_POLLING="$HOME/.config/eww/scripts/weather.sh"
bash "$WEATHER_POLLING" --getdata &
disown
# -- Experimental gif, uncomment if you want it :D
# eww open gif3

View file

@ -0,0 +1,150 @@
#!/bin/bash
# -- Code inspired by adi1090x on github!
## Collect data
cache_dir="$HOME/.cache/eww/weather"
cache_weather_stat=${cache_dir}/weather-stat
cache_weather_degree=${cache_dir}/weather-degree
cache_weather_quote=${cache_dir}/weather-quote
cache_weather_hex=${cache_dir}/weather-hex
cache_weather_icon=${cache_dir}/weather-icon
## WEATHER API DATA & KEYS! --------- INPUT YOUR DETAILS FROM openweathermap.org !!!
KEY=""
ID="" # Steps: 1. Go to openweathermap.org | 2. Search your City | 3. The City ID is in the URL.
UNIT="metric" # Available options : 'metric' or 'imperial'
## --------------------------------------------------------------------------------
## Make cache dir
if [[ ! -d "$cache_dir" ]]; then
mkdir -p ${cache_dir}
fi
## Get data
get_weather_data() {
weather=`curl -sf "http://api.openweathermap.org/data/2.5/weather?APPID="$KEY"&id="$ID"&units="$UNIT""`
echo ${weather}
if [ ! -z "$weather" ]; then
weather_temp=`echo "$weather" | jq ".main.temp" | cut -d "." -f 1`
weather_icon_code=`echo "$weather" | jq -r ".weather[].icon" | head -1`
weather_description=`echo "$weather" | jq -r ".weather[].description" | head -1 | sed -e "s/\b\(.\)/\u\1/g"`
#Big long if statement of doom
if [ "$weather_icon_code" == "50d" ]; then
weather_icon=" "
weather_quote="Forecast says it's misty \nMake sure you don't get lost on your way..."
weather_hex="#84afdb"
elif [ "$weather_icon_code" == "50n" ]; then
weather_icon=" "
weather_quote="Forecast says it's a misty night \nDon't go anywhere tonight or you might get lost..."
weather_hex="#84afdb"
elif [ "$weather_icon_code" == "01d" ]; then
weather_icon=" "
weather_quote="It's a sunny day, gonna be fun! \nDon't go wandering all by yourself though..."
weather_hex="#ffd86b"
elif [ "$weather_icon_code" == "01n" ]; then
weather_icon=" "
weather_quote="It's a clear night \nYou might want to take a evening stroll to relax..."
weather_hex="#fcdcf6"
elif [ "$weather_icon_code" == "02d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "02n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "03d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "03n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "04d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "04n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "09d" ]; then
weather_icon=" "
weather_quote="It's rainy, it's a great day! \nGet some ramen and watch as the rain falls..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "09n" ]; then
weather_icon=" "
weather_quote=" It's gonna rain tonight it seems \nMake sure your clothes aren't still outside..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "10d" ]; then
weather_icon=" "
weather_quote="It's rainy, it's a great day! \nGet some ramen and watch as the rain falls..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "10n" ]; then
weather_icon=" "
weather_quote=" It's gonna rain tonight it seems \nMake sure your clothes aren't still outside..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "11d" ]; then
weather_icon=""
weather_quote="There's storm for forecast today \nMake sure you don't get blown away..."
weather_hex="#ffeb57"
elif [ "$weather_icon_code" == "11n" ]; then
weather_icon=""
weather_quote="There's gonna be storms tonight \nMake sure you're warm in bed and the windows are shut..."
weather_hex="#ffeb57"
elif [ "$weather_icon_code" == "13d" ]; then
weather_icon=" "
weather_quote="It's gonna snow today \nYou'd better wear thick clothes and make a snowman as well!"
weather_hex="#e3e6fc"
elif [ "$weather_icon_code" == "13n" ]; then
weather_icon=" "
weather_quote="It's gonna snow tonight \nMake sure you get up early tomorrow to see the sights..."
weather_hex="#e3e6fc"
elif [ "$weather_icon_code" == "40d" ]; then
weather_icon=" "
weather_quote="Forecast says it's misty \nMake sure you don't get lost on your way..."
weather_hex="#84afdb"
elif [ "$weather_icon_code" == "40n" ]; then
weather_icon=" "
weather_quote="Forecast says it's a misty night \nDon't go anywhere tonight or you might get lost..."
weather_hex="#84afdb"
else
weather_icon=" "
weather_quote="Sort of odd, I don't know what to forecast \nMake sure you have a good time!"
weather_hex="#adadff"
fi
echo "$weather_icon" > ${cache_weather_icon}
echo "$weather_description" > ${cache_weather_stat}
echo "$weather_temp""°C" > ${cache_weather_degree}
echo -e "$weather_quote" > ${cache_weather_quote}
echo "$weather_hex" > ${cache_weather_hex}
else
echo "Weather Unavailable" > ${cache_weather_stat}
echo " " > ${cache_weather_icon}
echo -e "Ah well, no weather huh? \nEven if there's no weather, it's gonna be a great day!" > ${cache_weather_quote}
echo "-" > ${cache_weather_degree}
echo "#adadff" > ${tcache_weather_hex}
fi
}
## Execute
if [[ "$1" == "--getdata" ]]; then
get_weather_data
elif [[ "$1" == "--icon" ]]; then
cat ${cache_weather_icon}
elif [[ "$1" == "--temp" ]]; then
cat ${cache_weather_degree}
elif [[ "$1" == "--hex" ]]; then
cat ${cache_weather_hex}
elif [[ "$1" == "--stat" ]]; then
cat ${cache_weather_stat}
elif [[ "$1" == "--quote" ]]; then
cat ${cache_weather_quote} | head -n1
elif [[ "$1" == "--quote2" ]]; then
cat ${cache_weather_quote} | tail -n1
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View file

@ -0,0 +1,43 @@
{
config,
lib,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.daybox;
in {
options.nixosVista.eww.widgets.daybox.enable =
mkEnableOption "Daybox widget";
config = mkIf (root.enable && cfg.enable) {
home.file.".config/eww/daybox.yuck".text = ''
(defwidget daybox []
(box :halign "center" :valign "center" :class "container"
(box :halign "center" :valign "center" :class "daybox"
(label :class "date-label" :text DATE)
)
)
)
(defwindow daybox
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "noblur"
:geometry (geometry
:x "0px"
:y "30px"
:width "150px"
:height "70px"
:anchor "top center")
(daybox)
)
'';
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "daybox.yuck")
'';
};
}

View file

@ -0,0 +1,110 @@
{
config,
lib,
pkgs,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkOption types mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.diinkitemperature;
in {
options.nixosVista.eww.widgets.diinkitemperature = {
enable = mkEnableOption "Temperature widget";
apiKey = mkOption {
type = types.nullOr types.str;
default = null;
};
cityID = mkOption {
type = types.nullOr types.str;
default = null;
};
unit = mkOption {
type = types.enum ["metric" "imperial"];
default = "metric";
};
};
config = mkIf (root.enable && cfg.enable) {
assertions = [
{
assertion = cfg.apiKey != null && cfg.cityID != null;
message = "Temperature widget requires apiKey and cityID.";
}
];
home.file = {
".config/eww/images/macscreen.png".source =
./assets/macscreen.png;
".config/eww/scripts/weather.sh" = {
executable = true;
source = pkgs.writeShellScript "eww-weather" ''
API_KEY="${cfg.apiKey}"
CITY_ID="${cfg.cityID}"
UNIT="${cfg.unit}"
CACHE="$HOME/.cache/eww/weather.json"
mkdir -p "$HOME/.cache/eww"
fetch() {
${pkgs.curl}/bin/curl -s \
"https://api.openweathermap.org/data/2.5/weather?id=$CITY_ID&appid=$API_KEY&units=$UNIT" \
| ${pkgs.jq}/bin/jq '.' > "$CACHE"
}
case "$1" in
--getdata)
fetch
;;
--temp)
${pkgs.jq}/bin/jq -r '.main.temp | tostring + "°"' "$CACHE"
;;
--stat)
${pkgs.jq}/bin/jq -r '.weather[0].main' "$CACHE"
;;
--icon)
${pkgs.jq}/bin/jq -r '.weather[0].icon' "$CACHE"
;;
esac
'';
};
".config/eww/temperature.yuck".text = ''
(defpoll TEMP :interval "30s" '~/.config/eww/scripts/weather.sh --temp')
(defpoll WEATHER :interval "30s" '~/.config/eww/scripts/weather.sh --stat')
(defpoll WEATHERICON :interval "30s" '~/.config/eww/scripts/weather.sh --icon')
(defwidget diinkitemperature []
(overlay :halign "center" :valign "center" :class "temperature-container"
(image :path "images/macscreen.png" :image-width 250)
(label :text WEATHERICON :class "temp-label-header")
(label :text TEMP :class "temp-label")
(label :text WEATHER :class "weather-label")
)
)
(defwindow diinkitemperature
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
:geometry (geometry
:x "0px"
:y "360px"
:width "250px"
:height "250px"
:anchor "top right")
(diinkitemperature)
)
'';
};
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "temperature.yuck")
'';
};
}

View file

@ -0,0 +1,40 @@
{
config,
lib,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.gif1;
in {
options.nixosVista.eww.widgets.gif1.enable =
mkEnableOption "Gif1 widget";
config = mkIf (root.enable && cfg.enable) {
home.file = {
".config/eww/images/gif1.gif".source =
./assets/gif1.gif;
".config/eww/gif1.yuck".text = ''
(defwidget gif1 []
(box :halign "center" :valign "center" :class "container"
(image :path "images/gif1.gif")
)
)
(defwindow gif1
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
(gif1)
)
'';
};
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "gif1.yuck")
'';
};
}

View file

@ -0,0 +1,40 @@
{
config,
lib,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.gif2;
in {
options.nixosVista.eww.widgets.gif2.enable =
mkEnableOption "Gif2 widget";
config = mkIf (root.enable && cfg.enable) {
home.file = {
".config/eww/images/gif2.gif".source =
./assets/gif2.gif;
".config/eww/gif2.yuck".text = ''
(defwidget gif2 []
(box :halign "center" :valign "center" :class "container"
(image :path "images/gif2.gif")
)
)
(defwindow gif2
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
(gif2)
)
'';
};
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "gif2.yuck")
'';
};
}

View file

@ -0,0 +1,38 @@
{
config,
lib,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.gif3;
in {
options.nixosVista.eww.widgets.gif3.enable =
mkEnableOption "Gif3 widget";
config = mkIf (root.enable && cfg.enable) {
home.file = {
".config/eww/images/gif3.gif".source =
./assets/gif3.gif;
".config/eww/gif3.yuck".text = ''
(defwidget gif3 []
(image :path "images/gif3.gif")
)
(defwindow gif3
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
(gif3)
)
'';
};
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "gif3.yuck")
'';
};
}

View file

@ -0,0 +1,50 @@
{
config,
lib,
nixosVista,
...
}: let
inherit (lib) mkEnableOption mkIf mkAfter;
root = nixosVista.eww;
cfg = root.widgets.menu;
in {
options.nixosVista.eww.widgets.menu.enable =
mkEnableOption "Menu widget";
config = mkIf (root.enable && cfg.enable) {
home.file = {
".config/eww/images/os_logo.png".source =
./assets/os_logo.png;
".config/eww/menu.yuck".text = ''
(defwidget menu []
(box :halign "center" :valign "center" :class "container"
(button :onclick "wofi --show drun &" :class "button"
(image :path "images/os_logo.png"
:image-width 50
:image-height 50)
)
)
)
(defwindow menu
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
:geometry (geometry
:x "30px"
:y "30px"
:width "70px"
:height "70px"
:anchor "top right")
(menu)
)
'';
};
home.file.".config/eww/eww.yuck".text = mkAfter ''
(include "menu.yuck")
'';
};
}

View file

@ -0,0 +1,143 @@
{
config,
lib,
pkgs,
nixosVista,
...
}: let
cfg = nixosVista.eww;
w = cfg.widgets;
############################################################
# Window blocks
############################################################
dayboxWindow = lib.optionalString w.daybox.enable ''
(defwindow daybox
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "noblur"
:geometry (geometry
:x "0px"
:y "30px"
:width "150px"
:height "70px"
:anchor "top center")
(daybox)
)
'';
menuWindow = lib.optionalString w.menu.enable ''
(defwindow menu
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
:geometry (geometry
:x "30px"
:y "30px"
:width "70px"
:height "70px"
:anchor "top right")
(menu)
)
'';
temperatureWindow = lib.optionalString w.diinkitemperature.enable ''
(defwindow diinkitemperature
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
:geometry (geometry
:x "0px"
:y "360px"
:width "100px"
:height "100px"
:anchor "top right")
(diinkitemperature)
)
'';
gif1Window = lib.optionalString w.gif1.enable ''
(defwindow gif1
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
(gif1)
)
'';
############################################################
# Final yuck
############################################################
finalYuck = ''
(include "eww_widgets.yuck")
${dayboxWindow}
${menuWindow}
${temperatureWindow}
${gif1Window}
'';
in
{
programs.eww.enable = lib.mkIf cfg.enable true;
home.file.".config/eww/eww.yuck" = lib.mkIf cfg.enable {
text = finalYuck;
};
}
{
config,
lib,
pkgs,
nixosVista,
...
}: let
root = nixosVista.eww;
w = root.widgets.diinkitemperature;
weatherScript = pkgs.writeShellScript "weather.sh" ''
#!/usr/bin/env bash
KEY="${w.apiKey}"
ID="${w.cityID}"
UNIT="${w.unit}"
echo "Weather stub"
'';
windowBlock = lib.optionalString w.enable ''
(defwindow diinkitemperature
:monitor '["<primary>", 2, 1, 0]'
:windowtype "dock"
:stacking "bg"
:namespace "eww"
:geometry (geometry
:x "0px"
:y "360px"
:width "100px"
:height "100px"
:anchor "top right")
(diinkitemperature)
)
'';
in {
config = lib.mkIf (root.enable && w.enable) {
home.packages = [
pkgs.curl
pkgs.jq
];
home.file.".config/eww/scripts/weather.sh" = {
source = weatherScript;
executable = true;
};
nixosVista.eww.generatedYuck =
lib.mkAfter windowBlock;
};
}