From 1cfc688fd2e0c06133ccfa254352093880624480 Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Thu, 1 Aug 2024 20:18:18 +0100 Subject: Remove duplicated code --- .config/eww/scripts/workspace.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to '.config/eww/scripts') diff --git a/.config/eww/scripts/workspace.sh b/.config/eww/scripts/workspace.sh index e0c34dd..91a3cf6 100755 --- a/.config/eww/scripts/workspace.sh +++ b/.config/eww/scripts/workspace.sh @@ -1,12 +1,6 @@ #! /bin/bash active() { -if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]] -then - arg=1 -else - arg=0 -fi num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).view_tags') b=0 while [[ $num -gt 0 ]] @@ -35,19 +29,19 @@ export arg="$1" o1 o2 o3 o4 o5 o6 o7 o8 o9 \ f1 f2 f3 f4 f5 f6 f7 f8 f9 -ows="$(active)" -for num in $ows; do - export o"$num"="$num" -done - -# Get Focused workspace for current monitor ID -export arg="$1" if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]] then arg=1 else arg=0 fi + +ows="$(active)" +for num in $ows; do + export o"$num"="$num" +done + +# Get Focused workspace for current monitor ID num=$(river-bedload -print focused | jq -r '.['$arg'] | select(.).focused_id') export f"$num"="$num" -- cgit v1.2.3