rework eww - still wip
This commit is contained in:
@@ -30,7 +30,6 @@
|
|||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
users.elias = import ./home/default-laptop.nix;
|
users.elias = import ./home/default-laptop.nix;
|
||||||
@@ -51,7 +50,6 @@
|
|||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
users.elias = import ./home/default-desktop.nix;
|
users.elias = import ./home/default-desktop.nix;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [ eww ];
|
home.packages = with pkgs; [ eww jq ];
|
||||||
|
|
||||||
xdg.configFile."eww" = {
|
xdg.configFile."eww" = {
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
:orientation "horizontal"
|
:orientation "horizontal"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
:class "bar"
|
:class "bar"
|
||||||
;;(widgetWorkspaces)
|
(widgetWorkspaces)
|
||||||
;;(widgetLogSeperator)
|
(widgetLogSeperator)
|
||||||
;;(widgetLayouts)
|
(widgetLayouts)
|
||||||
;;(widgetLogSeperator)
|
(widgetLogSeperator)
|
||||||
;;(widgetWindows)
|
(widgetWindows)
|
||||||
(box :hexpand true)
|
(box :hexpand true)
|
||||||
(idle_inhibitor)
|
(idle_inhibitor)
|
||||||
(widSep)
|
(widSep)
|
||||||
@@ -199,88 +199,47 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; /-- XMonad Logs | Old -->
|
;; /-- River State -->
|
||||||
|
|
||||||
(defvar ws1 "ws-empty")
|
(defvar ws1 "ws-empty")
|
||||||
(defvar ws2 "ws-empty")
|
(defvar ws2 "ws-empty")
|
||||||
(defvar ws3 "ws-empty")
|
(defvar ws3 "ws-empty")
|
||||||
(defvar ws4 "ws-empty")
|
(defvar ws4 "ws-empty")
|
||||||
(defvar ws5 "ws-empty")
|
(defvar ws5 "ws-empty")
|
||||||
(defvar ws6 "ws-empty")
|
(defvar ws6 "ws-empty")
|
||||||
(defvar ws7 "ws-empty")
|
(defvar ws7 "ws-empty")
|
||||||
(defvar ws8 "ws-empty")
|
(defvar ws8 "ws-empty")
|
||||||
(defvar ws9 "ws-empty")
|
(defvar ws9 "ws-empty")
|
||||||
(defvar layouts "")
|
|
||||||
(defpoll windows
|
(defvar layouts "")
|
||||||
|
(defpoll windows
|
||||||
:interval "1s"
|
:interval "1s"
|
||||||
:initial "-"
|
:initial "-"
|
||||||
`sh ~/.config/eww/scripts/xmonad_logs.sh`)
|
`sh ~/.config/eww/scripts/ristate_read.sh`)
|
||||||
|
|
||||||
(defwidget widgetWorkspaces []
|
(defwidget widgetWorkspaces []
|
||||||
(box
|
(box
|
||||||
:orientation "horizontal"
|
:orientation "horizontal"
|
||||||
:class "workspace-buttons"
|
:class "workspace-buttons"
|
||||||
(button
|
|
||||||
:onclick "wmctrl -s 0"
|
(button :onclick "riverctl set-focused-tags 1" :class "workspace-button ${ws1}" (label :text "1"))
|
||||||
:class "workspace-button ${ws1}"
|
(label :text " ")
|
||||||
(label
|
(button :onclick "riverctl set-focused-tags 2" :class "workspace-button ${ws2}" (label :text "2"))
|
||||||
:text "1"))
|
(label :text " ")
|
||||||
(label
|
(button :onclick "riverctl set-focused-tags 3" :class "workspace-button ${ws3}" (label :text "3"))
|
||||||
:text " ")
|
(label :text " ")
|
||||||
(button
|
(button :onclick "riverctl set-focused-tags 4" :class "workspace-button ${ws4}" (label :text "4"))
|
||||||
:onclick "wmctrl -s 1"
|
(label :text " ")
|
||||||
:class "workspace-button ${ws2}"
|
(button :onclick "riverctl set-focused-tags 5" :class "workspace-button ${ws5}" (label :text "5"))
|
||||||
(label
|
(label :text " ")
|
||||||
:text "2"))
|
(button :onclick "riverctl set-focused-tags 6" :class "workspace-button ${ws6}" (label :text "6"))
|
||||||
(label
|
(label :text " ")
|
||||||
:text " ")
|
(button :onclick "riverctl set-focused-tags 7" :class "workspace-button ${ws7}" (label :text "7"))
|
||||||
(button
|
(label :text " ")
|
||||||
:onclick "wmctrl -s 2"
|
(button :onclick "riverctl set-focused-tags 8" :class "workspace-button ${ws8}" (label :text "8"))
|
||||||
:class "workspace-button ${ws3}"
|
(label :text " ")
|
||||||
(label
|
(button :onclick "riverctl set-focused-tags 9" :class "workspace-button ${ws9}" (label :text "9"))
|
||||||
: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"))))
|
|
||||||
|
|
||||||
(defwidget widgetWindows []
|
(defwidget widgetWindows []
|
||||||
(label
|
(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
|
grim
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
rivercarro
|
rivercarro
|
||||||
# river-status
|
ristate
|
||||||
];
|
];
|
||||||
xdg.configFile."helperscripts" = {
|
xdg.configFile."helperscripts" = {
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ hostname=$(hostname)
|
|||||||
|
|
||||||
if [[ "$hostname" == "eliasLaptop" ]]; then
|
if [[ "$hostname" == "eliasLaptop" ]]; then
|
||||||
eww open bar --screen eDP-1
|
eww open bar --screen eDP-1
|
||||||
|
/home/elias/.config/eww/scripts/ristate.sh
|
||||||
elif [[ "$hostname" == "eliasDesktop" ]]; then
|
elif [[ "$hostname" == "eliasDesktop" ]]; then
|
||||||
echo "This is another PC!"
|
echo "This is another PC!"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dotDir = ".config/zsh";
|
dotDir = "${config.xdg.configHome}/zsh";
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
update = "sudo nixos-rebuild switch";
|
update = "sudo nixos-rebuild switch";
|
||||||
conWG = "ssh elias@logout.nonagon.dev -p 6969";
|
conWG = "ssh elias@logout.nonagon.dev -p 6969";
|
||||||
|
|||||||
Reference in New Issue
Block a user