diff --git a/home.nix b/home.nix
index 3db3a7a..11310c2 100644
--- a/home.nix
+++ b/home.nix
@@ -6,17 +6,19 @@
home.homeDirectory = "/home/pan";
imports = [
- ./programs/xdg
- ./programs/hypr
- ./programs/dunst
- ./programs/git
./programs/alacritty
- ./programs/pywal
+ ./programs/dunst
+ ./programs/eww
./programs/fish
- ./programs/nnn
- ./programs/rofi
- ./programs/nvim
+ ./programs/git
+ ./programs/hypr
./programs/mpv
+ ./programs/nnn
+ ./programs/nvim
+ ./programs/pywal
+ ./programs/rofi
+ ./programs/ssh
+ ./programs/xdg
];
home.packages = with pkgs; [
@@ -28,16 +30,12 @@
wget # Download web stuff
feh # Image viewer
appimage-run # Lets you run app images
- # Development stuff, can be removed
+ zathura # PDF viewer
+ ani-cli # Easy anime player
+
+ # Development stuff
nodejs # For compiling JS stuff
jq # May be critical for scripts?
-
- # Check if want settings?
- zathura # PDF viewer
-
- # Expand into other areas
- sshfs # SSH File system (SSH)
- eww-wayland # eww widgets (EWW)
];
# home.file = {};
diff --git a/programs/eww/config/eww.scss b/programs/eww/config/eww.scss
new file mode 100644
index 0000000..559b968
--- /dev/null
+++ b/programs/eww/config/eww.scss
@@ -0,0 +1,8 @@
+box {
+ background-color: #1E1D2F;
+ color: #D9E0EE;
+}
+
+progressbar > trough {
+ min-width: 40px;
+}
diff --git a/programs/eww/config/eww.yuck b/programs/eww/config/eww.yuck
new file mode 100644
index 0000000..e69de29
diff --git a/programs/eww/config/modules/bar.yuck b/programs/eww/config/modules/bar.yuck
new file mode 100644
index 0000000..137bb51
--- /dev/null
+++ b/programs/eww/config/modules/bar.yuck
@@ -0,0 +1,40 @@
+(include "./widgets/components/hyprwindow.yuck")
+(include "./widgets/components/hyprworkspaces.yuck")
+(include "./widgets/components/internet.yuck")
+(include "./widgets/components/japanesedate.yuck")
+(include "./widgets/components/japaneseaudio.yuck")
+
+(defwidget bar []
+ (centerbox :orientation "horizontal"
+ :style "padding: 0px 8px"
+ (box :halign "start"
+ :spacing 18
+ :space-evenly false
+ (hyprworkspaces)
+ (hyprwindow)
+ )
+ ""
+ (box :halign "end"
+ :spacing 18
+ :space-evenly false
+ (eventbox :onhover "eww open preview"
+ :onhoverlost "eww close preview"
+ barplayer
+ )
+ (internet)
+ (japaneseaudio)
+ (japanesedate)
+ (label :style "color: #FAE3B0"
+ :text bartime
+ )
+ )
+ )
+)
+
+(defpoll bartime :interval "10s"
+ "date '+%H:%M'"
+)
+
+(deflisten barplayer :initial ""
+ "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true"
+)
diff --git a/programs/eww/config/modules/components/hyprwindow.yuck b/programs/eww/config/modules/components/hyprwindow.yuck
new file mode 100644
index 0000000..2e2d519
--- /dev/null
+++ b/programs/eww/config/modules/components/hyprwindow.yuck
@@ -0,0 +1,5 @@
+(defwidget hyprwindow []
+ (label :text "${hyprwindow_listener}")
+)
+
+(deflisten hyprwindow_listener :initial "" "bash $XDG_CONFIG_HOME/eww/scripts/get-window-title")
diff --git a/programs/eww/config/modules/components/hyprworkspaces.yuck b/programs/eww/config/modules/components/hyprworkspaces.yuck
new file mode 100644
index 0000000..aa44634
--- /dev/null
+++ b/programs/eww/config/modules/components/hyprworkspaces.yuck
@@ -0,0 +1,17 @@
+(defwidget hyprworkspaces []
+ (eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget"
+ (box :space-evenly false
+ :spacing 5
+ (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}")
+ )
+ )
+ )
+ )
+ )
+ )
+
+(deflisten workspaces :initial "[]" "bash $XDG_CONFIG_HOME/eww/scripts/get-workspaces")
+(deflisten current_workspace :initial "1" "bash $XDG_CONFIG_HOME/eww/scripts/get-active-workspace")
diff --git a/programs/eww/config/modules/components/index.html b/programs/eww/config/modules/components/index.html
new file mode 100644
index 0000000..f47c072
--- /dev/null
+++ b/programs/eww/config/modules/components/index.html
@@ -0,0 +1,18 @@
+
+
+
+
+Directory listing for /eww/widgets/components/
+
+
+Directory listing for /eww/widgets/components/
+
+
+
+
+
diff --git a/programs/eww/config/modules/components/internet.yuck b/programs/eww/config/modules/components/internet.yuck
new file mode 100644
index 0000000..64aec24
--- /dev/null
+++ b/programs/eww/config/modules/components/internet.yuck
@@ -0,0 +1,8 @@
+(defwidget internet []
+ (box :spacing 0 :space-evenly false :style "color: #f5c2e7"
+ network
+ )
+)
+
+(defpoll network :interval "30s"
+ "iwgetid -r")
diff --git a/programs/eww/config/modules/components/japaneseaudio.yuck b/programs/eww/config/modules/components/japaneseaudio.yuck
new file mode 100644
index 0000000..74bbc98
--- /dev/null
+++ b/programs/eww/config/modules/components/japaneseaudio.yuck
@@ -0,0 +1,11 @@
+(defwidget japaneseaudio []
+ (eventbox :onscroll "bash -c 'if [ '{}' = 'up' ]; then pamixer -i 5; else pamixer -d 5; fi'"
+ (box :spacing 0 :space-evenly false :style "color: #96CDFB"
+ volume
+ "音"
+ )
+ )
+)
+
+(defpoll volume :interval "1s"
+ "pamixer --get-volume")
diff --git a/programs/eww/config/modules/components/japanesebattery.yuck b/programs/eww/config/modules/components/japanesebattery.yuck
new file mode 100644
index 0000000..40d45cf
--- /dev/null
+++ b/programs/eww/config/modules/components/japanesebattery.yuck
@@ -0,0 +1,9 @@
+(defwidget japanesebattery []
+ (box :spacing 0 :space-evenly false :style "color: #FAB387"
+ power
+ "電"
+ )
+)
+
+(defpoll power :interval "1m"
+ "cat /sys/class/power_supply/BAT1/capacity")
diff --git a/programs/eww/config/modules/components/japanesedate.yuck b/programs/eww/config/modules/components/japanesedate.yuck
new file mode 100644
index 0000000..fe43c00
--- /dev/null
+++ b/programs/eww/config/modules/components/japanesedate.yuck
@@ -0,0 +1,9 @@
+(defwidget japanesedate []
+ (label :style "color: #DDB6F2"
+ :text japanesedate_time
+ )
+)
+
+(defpoll japanesedate_time :interval "100s"
+ "bash $XDG_CONFIG_HOME/eww/scripts/japanesedate"
+)
diff --git a/programs/eww/config/modules/index.html b/programs/eww/config/modules/index.html
new file mode 100644
index 0000000..dd51262
--- /dev/null
+++ b/programs/eww/config/modules/index.html
@@ -0,0 +1,16 @@
+
+
+
+
+Directory listing for /eww/widgets/
+
+
+Directory listing for /eww/widgets/
+
+
+
+
+
diff --git a/programs/eww/config/modules/powerbar.yuck b/programs/eww/config/modules/powerbar.yuck
new file mode 100644
index 0000000..ac1ac1f
--- /dev/null
+++ b/programs/eww/config/modules/powerbar.yuck
@@ -0,0 +1,15 @@
+(defwidget powerbar []
+ (box
+ :orientation "vertical"
+ :spacing 8
+ :space-evenly false
+ :style "color: #FAB387"
+ (progress
+ :orientation "v"
+ :value {100 - power})
+ "電"
+ )
+)
+
+(defpoll power :interval "1m"
+ "cat /sys/class/power_supply/BAT1/capacity")
diff --git a/programs/eww/config/scripts/change-active-workspace b/programs/eww/config/scripts/change-active-workspace
new file mode 100644
index 0000000..ffaf9fc
--- /dev/null
+++ b/programs/eww/config/scripts/change-active-workspace
@@ -0,0 +1,21 @@
+#!/bin/sh
+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
diff --git a/programs/eww/config/scripts/get-active-workspace b/programs/eww/config/scripts/get-active-workspace
new file mode 100644
index 0000000..b97efdf
--- /dev/null
+++ b/programs/eww/config/scripts/get-active-workspace
@@ -0,0 +1,3 @@
+#!/bin/sh
+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}'
diff --git a/programs/eww/config/scripts/get-window-title b/programs/eww/config/scripts/get-window-title
new file mode 100644
index 0000000..c1be34a
--- /dev/null
+++ b/programs/eww/config/scripts/get-window-title
@@ -0,0 +1,3 @@
+#!/bin/sh
+hyprctl activewindow -j | jq --raw-output .title
+socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^activewindow>>' | stdbuf -o0 awk -F '>>|,' '{print $3}'
diff --git a/programs/eww/config/scripts/get-workspaces b/programs/eww/config/scripts/get-workspaces
new file mode 100644
index 0000000..68d7108
--- /dev/null
+++ b/programs/eww/config/scripts/get-workspaces
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+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
diff --git a/programs/eww/config/scripts/index.html b/programs/eww/config/scripts/index.html
new file mode 100644
index 0000000..590c85c
--- /dev/null
+++ b/programs/eww/config/scripts/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+Directory listing for /eww/scripts/
+
+
+Directory listing for /eww/scripts/
+
+
+
+
+
diff --git a/programs/eww/config/scripts/japanesedate b/programs/eww/config/scripts/japanesedate
new file mode 100644
index 0000000..7360f73
--- /dev/null
+++ b/programs/eww/config/scripts/japanesedate
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+readarray -t dateparts <<<"$(date "+%0m月%0d日%n%u")"
+
+echo -n "${dateparts[0]}["
+
+case ${dateparts[1]} in
+ 1)
+ echo -n "月"
+ ;;
+ 2)
+ echo -n "火"
+ ;;
+ 3)
+ echo -n "水"
+ ;;
+ 4)
+ echo -n "木"
+ ;;
+ 5)
+ echo -n "金"
+ ;;
+ 6)
+ echo -n "土"
+ ;;
+ 7)
+ echo -n "日"
+ ;;
+esac
+
+echo "]"
diff --git a/programs/eww/config/scripts/medpreview b/programs/eww/config/scripts/medpreview
new file mode 100644
index 0000000..3b35839
--- /dev/null
+++ b/programs/eww/config/scripts/medpreview
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+playerctl --follow metadata mpris:artUrl | stdbuf -o0 cut -c 8-
diff --git a/programs/eww/config/variables.yuck b/programs/eww/config/variables.yuck
new file mode 100644
index 0000000..e69de29
diff --git a/programs/eww/config/windows.yuck b/programs/eww/config/windows.yuck
new file mode 100644
index 0000000..29fb7c9
--- /dev/null
+++ b/programs/eww/config/windows.yuck
@@ -0,0 +1,32 @@
+(include "./widgets/bar.yuck")
+(include "./widgets/powerbar.yuck")
+
+(defwindow bar0
+ :monitor 0
+ :geometry (geometry :width "100%"
+ :height "29px"
+ :anchor "top center")
+ :stacking "fg"
+ :exclusive true
+ (bar)
+)
+
+(defwindow preview
+ :monitor 0
+ :geometry (geometry :x "100px"
+ :y "5px"
+ :anchor "top right")
+ (image :path mediapreview)
+)
+
+(defwindow powerbar0
+ :monitor 0
+ :geometry (geometry :x "100px"
+ :y "5px"
+ :anchor "top right")
+ (powerbar)
+)
+
+(deflisten mediapreview :initial "hello?"
+ "bash $XDG_CONFIG_HOME/eww/scripts/medpreview"
+)
diff --git a/programs/eww/default.nix b/programs/eww/default.nix
new file mode 100644
index 0000000..135aed8
--- /dev/null
+++ b/programs/eww/default.nix
@@ -0,0 +1,7 @@
+{ config, pkgs, ... }:
+
+{
+ programs.eww.enable = true;
+ programs.eww.package = pkgs.eww-wayland;
+ programs.eww.configDir = ./config;
+}
diff --git a/programs/ssh/default.nix b/programs/ssh/default.nix
new file mode 100644
index 0000000..4e0f26f
--- /dev/null
+++ b/programs/ssh/default.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{
+ programs.ssh.enable = true;
+ home.packages = with pkgs; [
+ sshfs # SSH File system
+ ];
+}