rework eww - still wip
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
users.elias = import ./home/default-laptop.nix;
|
||||
@@ -51,7 +50,6 @@
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
users.elias = import ./home/default-desktop.nix;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [ eww ];
|
||||
home.packages = with pkgs; [ eww jq ];
|
||||
|
||||
xdg.configFile."eww" = {
|
||||
recursive = true;
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
:orientation "horizontal"
|
||||
:space-evenly false
|
||||
:class "bar"
|
||||
;;(widgetWorkspaces)
|
||||
;;(widgetLogSeperator)
|
||||
;;(widgetLayouts)
|
||||
;;(widgetLogSeperator)
|
||||
;;(widgetWindows)
|
||||
(widgetWorkspaces)
|
||||
(widgetLogSeperator)
|
||||
(widgetLayouts)
|
||||
(widgetLogSeperator)
|
||||
(widgetWindows)
|
||||
(box :hexpand true)
|
||||
(idle_inhibitor)
|
||||
(widSep)
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
|
||||
|
||||
;; /-- XMonad Logs | Old -->
|
||||
;; /-- River State -->
|
||||
|
||||
(defvar ws1 "ws-empty")
|
||||
(defvar ws2 "ws-empty")
|
||||
@@ -210,77 +210,36 @@
|
||||
(defvar ws7 "ws-empty")
|
||||
(defvar ws8 "ws-empty")
|
||||
(defvar ws9 "ws-empty")
|
||||
|
||||
(defvar layouts "")
|
||||
(defpoll windows
|
||||
:interval "1s"
|
||||
:initial "-"
|
||||
`sh ~/.config/eww/scripts/xmonad_logs.sh`)
|
||||
`sh ~/.config/eww/scripts/ristate_read.sh`)
|
||||
|
||||
(defwidget widgetWorkspaces []
|
||||
(box
|
||||
:orientation "horizontal"
|
||||
:class "workspace-buttons"
|
||||
(button
|
||||
:onclick "wmctrl -s 0"
|
||||
:class "workspace-button ${ws1}"
|
||||
(label
|
||||
:text "1"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 1"
|
||||
:class "workspace-button ${ws2}"
|
||||
(label
|
||||
:text "2"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 2"
|
||||
:class "workspace-button ${ws3}"
|
||||
(label
|
||||
:text "3"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 3"
|
||||
:class "workspace-button ${ws4}"
|
||||
(label
|
||||
:text "4"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 4"
|
||||
:class "workspace-button ${ws5}"
|
||||
(label
|
||||
:text "5"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 5"
|
||||
:class "workspace-button ${ws6}"
|
||||
(label
|
||||
:text "6"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 6"
|
||||
:class "workspace-button ${ws7}"
|
||||
(label
|
||||
:text "7"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 7"
|
||||
:class "workspace-button ${ws8}"
|
||||
(label
|
||||
:text "8"))
|
||||
(label
|
||||
:text " ")
|
||||
(button
|
||||
:onclick "wmctrl -s 8"
|
||||
:class "workspace-button ${ws9}"
|
||||
(label
|
||||
:text "9"))))
|
||||
|
||||
(button :onclick "riverctl set-focused-tags 1" :class "workspace-button ${ws1}" (label :text "1"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 2" :class "workspace-button ${ws2}" (label :text "2"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 3" :class "workspace-button ${ws3}" (label :text "3"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 4" :class "workspace-button ${ws4}" (label :text "4"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 5" :class "workspace-button ${ws5}" (label :text "5"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 6" :class "workspace-button ${ws6}" (label :text "6"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 7" :class "workspace-button ${ws7}" (label :text "7"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 8" :class "workspace-button ${ws8}" (label :text "8"))
|
||||
(label :text " ")
|
||||
(button :onclick "riverctl set-focused-tags 9" :class "workspace-button ${ws9}" (label :text "9"))
|
||||
))
|
||||
|
||||
(defwidget widgetWindows []
|
||||
(label
|
||||
|
||||
8
home/programs/eww/src/scripts/ristate.sh
Executable file
8
home/programs/eww/src/scripts/ristate.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
TEMP_FILE="/tmp/river-eww-status"
|
||||
|
||||
while true; do
|
||||
ristate -t >"$TEMP_FILE.tmp"
|
||||
ristate -w >>"$TEMP_FILE.tmp"
|
||||
mv "$TEMP_FILE.tmp" "$TEMP_FILE"
|
||||
sleep 1
|
||||
done
|
||||
32
home/programs/eww/src/scripts/ristate_read.sh
Executable file
32
home/programs/eww/src/scripts/ristate_read.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
TEMP_FILE="/tmp/river-eww-status"
|
||||
|
||||
# Read last two lines (layout/tags and focused window)
|
||||
json=$(tail -n2 "$TEMP_FILE" | head -n1)
|
||||
win_json=$(tail -n1 "$TEMP_FILE")
|
||||
|
||||
# Extract layout
|
||||
layout=$(echo "$json" | jq -r '.layout // ""')
|
||||
|
||||
# Extract focused window title
|
||||
windows=$(echo "$win_json" | jq -r '.title // ""')
|
||||
|
||||
# Extract focused tags as array
|
||||
mapfile -t focused_tags < <(echo "$json" | jq -r '.tags.BOE // [] | .[]')
|
||||
|
||||
# Update workspace classes
|
||||
for i in $(seq 1 9); do
|
||||
class="ws-empty"
|
||||
for tag in "${focused_tags[@]}"; do
|
||||
if [[ "$tag" == "$i" ]]; then
|
||||
class="ws-current"
|
||||
break
|
||||
fi
|
||||
done
|
||||
eww update ws$i="$class"
|
||||
done
|
||||
|
||||
# Update layout
|
||||
eww update layouts="$layout"
|
||||
|
||||
# Output focused window for widget
|
||||
echo "$windows"
|
||||
@@ -1,6 +0,0 @@
|
||||
socat - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/river/status | while read -r line; do
|
||||
workspace=$(echo "$line" | jq -r '.workspace')
|
||||
layout=$(echo "$line" | jq -r '.layout')
|
||||
title=$(echo "$line" | jq -r '.title')
|
||||
echo "WS: $workspace | Layout: $layout | $title"
|
||||
done
|
||||
@@ -1,21 +0,0 @@
|
||||
line=$(cat /tmp/xmonad-eww-log)
|
||||
IFS='|' read -r workspaces layouts windows <<<"$line"
|
||||
# Workspaces
|
||||
workspaceArray=($workspaces)
|
||||
i=0
|
||||
for ws in "${workspaceArray[@]}"; do
|
||||
i=$((i + 1))
|
||||
if [[ "$ws" == [\[]* ]]; then
|
||||
eww update ws$i="ws-current"
|
||||
elif [[ "$ws" == [\(]* ]]; then
|
||||
eww update ws$i="ws-visible"
|
||||
elif [[ "$ws" == [\{]* ]]; then
|
||||
eww update ws$i="ws-hidden"
|
||||
else
|
||||
eww update ws$i="ws-empty"
|
||||
fi
|
||||
done
|
||||
# Layouts
|
||||
eww update layouts="${layouts}"
|
||||
# Windows
|
||||
echo "${windows}"
|
||||
@@ -8,7 +8,7 @@
|
||||
grim
|
||||
wl-clipboard
|
||||
rivercarro
|
||||
# river-status
|
||||
ristate
|
||||
];
|
||||
xdg.configFile."helperscripts" = {
|
||||
recursive = true;
|
||||
|
||||
@@ -2,6 +2,7 @@ hostname=$(hostname)
|
||||
|
||||
if [[ "$hostname" == "eliasLaptop" ]]; then
|
||||
eww open bar --screen eDP-1
|
||||
/home/elias/.config/eww/scripts/ristate.sh
|
||||
elif [[ "$hostname" == "eliasDesktop" ]]; then
|
||||
echo "This is another PC!"
|
||||
else
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
dotDir = "${config.xdg.configHome}/zsh";
|
||||
shellAliases = {
|
||||
update = "sudo nixos-rebuild switch";
|
||||
conWG = "ssh elias@logout.nonagon.dev -p 6969";
|
||||
|
||||
Reference in New Issue
Block a user