From 7e4ccb7c6184d030bd2f64a3f8aca698b6a0427b Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Mon, 4 Nov 2024 12:00:40 -0500 Subject: [PATCH] chore(eww): delete unused eww config Signed-off-by: Lucas Sta Maria --- .config/eww/eww.scss | 161 ---------------- .config/eww/eww.yuck | 243 ------------------------- .config/eww/scripts/Makefile | 2 - .config/eww/scripts/autosus.c | 34 ---- .config/eww/scripts/battery | 12 -- .config/eww/scripts/bluetooth | 10 - .config/eww/scripts/bluetoothpanel | 3 - .config/eww/scripts/boolflip | 10 - .config/eww/scripts/brightness | 9 - .config/eww/scripts/brightnesslabel | 9 - .config/eww/scripts/currtime | 12 -- .config/eww/scripts/player | 17 -- .config/eww/scripts/powernotify | 7 - .config/eww/scripts/songback | 3 - .config/eww/scripts/songcardartist | 9 - .config/eww/scripts/songcardplayrender | 8 - .config/eww/scripts/songcardshow | 11 -- .config/eww/scripts/songcardtitle | 9 - .config/eww/scripts/songnext | 3 - .config/eww/scripts/songplay | 3 - .config/eww/scripts/volume | 9 - .config/eww/scripts/volumelabel | 20 -- .config/eww/scripts/wifi | 8 - .config/eww/scripts/workspaces | 29 --- 24 files changed, 641 deletions(-) delete mode 100644 .config/eww/eww.scss delete mode 100644 .config/eww/eww.yuck delete mode 100644 .config/eww/scripts/Makefile delete mode 100644 .config/eww/scripts/autosus.c delete mode 100755 .config/eww/scripts/battery delete mode 100755 .config/eww/scripts/bluetooth delete mode 100755 .config/eww/scripts/bluetoothpanel delete mode 100755 .config/eww/scripts/boolflip delete mode 100755 .config/eww/scripts/brightness delete mode 100755 .config/eww/scripts/brightnesslabel delete mode 100755 .config/eww/scripts/currtime delete mode 100755 .config/eww/scripts/player delete mode 100755 .config/eww/scripts/powernotify delete mode 100755 .config/eww/scripts/songback delete mode 100755 .config/eww/scripts/songcardartist delete mode 100755 .config/eww/scripts/songcardplayrender delete mode 100755 .config/eww/scripts/songcardshow delete mode 100755 .config/eww/scripts/songcardtitle delete mode 100755 .config/eww/scripts/songnext delete mode 100755 .config/eww/scripts/songplay delete mode 100755 .config/eww/scripts/volume delete mode 100755 .config/eww/scripts/volumelabel delete mode 100755 .config/eww/scripts/wifi delete mode 100755 .config/eww/scripts/workspaces diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss deleted file mode 100644 index 894f14c..0000000 --- a/.config/eww/eww.scss +++ /dev/null @@ -1,161 +0,0 @@ -// General styling - -* { - all: unset; -} - -scale trough { - all: unset; - background-color: #22242b; - box-shadow: 0 2px 3px 2px #06060b; - border-radius: 16px; - min-height: 10px; - min-width: 70px; - margin: 0px 10px 0px 0px; -} - -// Main bar styling - -.main { - background-color: #0e1419; - color: #e5e1cf; - font-family: "Noto Sans"; - font-size: 12px; -} - -.leftwidgets { - margin-left: 5px; - margin-right: 50px; - - button { - margin: 0px 5px; - border-color: #0e1419; - border-width: 0px; - padding-left: 0em; - padding-right: 0em; - } - - .occupied { - color: #919191; - } - - .focused { - color: #ff6054; - } - - .empty { - color: #444444; - } -} - -.rightwidgets { - margin: 0px 10px 0px 5px; -} - -.icon-module__icon { - margin: 0px 5px 0px 0px; - font-size: 15px; -} - -.button__container { - padding-left: 7px; - padding-right: 7px; - border-radius: 5px; -} - -.button__container:hover { - background-color: hsla(210, 25%, 25%, 0.3); -} - -.player { - color: #e5e1cf; -} - -.player__container { - padding-left: 7px; - padding-right: 7px; - border-radius: 10px; -} - -.player__container:hover { - background-color: hsla(210, 25%, 25%, 0.3); -} - -.power__text { - margin-top: 3px; -} - -.power__text_low { - margin-top: 3px; - color: #ff3333; -} - -.brightness__label { - margin-top: 1px; -} - -.brightness__bar { - margin-left: 10px; -} - -.brightness__bar trough highlight { - background-image: linear-gradient(to right, #e4c9af 30%, #f2cdcd 50%, #e0b089 100% *50); - border-radius: 10px; - min-width: 20px; -} - -.volume__bar { - margin-left: 10px; -} - -.volume__bar trough highlight { - background-image: linear-gradient(to right, #f2525d 30%, #cc5a61 50%, #c93640 100% *50); - border-radius: 10px; - min-width: 20px; -} - -.volume__label { - margin-top: 3px; -} - -.timedate__button { - padding: 3px 6px; - border-radius: 5px; -} - -.timedate__button:hover { - background-color: hsla(210, 25%, 25%, 0.3); -} - -// Song card styling - -.songcard { - background-color: #0e1419; - color: #e5e1cf; - font-family: "Noto Sans"; - font-size: 12px; -} - -.songcard__title { - font-weight: 700; - font-size: 20px; - margin-top: 10px; - margin-bottom: 0px; -} - -.songcard__artist { - font-weight: 500; - font-size: 14px; - margin-top: 0px; - margin-bottom: 0px; - color: #919191; -} - -.songcard__controls { - margin-top: 0px; - margin-bottom: 10px; -} - -.songcard__button { - margin: 0px 3px; -} diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck deleted file mode 100644 index a9a96c8..0000000 --- a/.config/eww/eww.yuck +++ /dev/null @@ -1,243 +0,0 @@ -;; Global variables -(deflisten w1 "scripts/workspaces 1") -(deflisten w2 "scripts/workspaces 2") -(deflisten w3 "scripts/workspaces 3") -(deflisten w4 "scripts/workspaces 4") -(deflisten w5 "scripts/workspaces 5") -(deflisten w6 "scripts/workspaces 6") -(deflisten w7 "scripts/workspaces 7") -(deflisten w8 "scripts/workspaces 8") -(deflisten w9 "scripts/workspaces 9") -(deflisten w10 "scripts/workspaces 10") -(deflisten w11 "scripts/workspaces 11") -(deflisten w12 "scripts/workspaces 12") -(deflisten w13 "scripts/workspaces 13") -(deflisten w14 "scripts/workspaces 14") -(deflisten w15 "scripts/workspaces 15") -(deflisten w16 "scripts/workspaces 16") -(deflisten w17 "scripts/workspaces 17") -(deflisten w18 "scripts/workspaces 18") -(deflisten w19 "scripts/workspaces 19") -(deflisten w20 "scripts/workspaces 20") - -(deflisten player_listen :initial '{"show": "no", "content": ""}' "scripts/player") -(deflisten player :initial '{"content": "TEST"}' "scripts/player") - -(deflisten songcardtitle :initial '(label :class "songcard__title" :text "None Playing")' - "scripts/songcardtitle") -(deflisten songcardartist :initial '(label :class "songcard__artist" :text ".")' - "scripts/songcardartist") - -(defpoll songcard_button :interval "1s" "scripts/songcardplayrender") -(defpoll weather_text :interval "60s" "curl 'wttr.in/Boston?m&format=%c%20%t%20(%f)'") -(defpoll wifi_label :interval "1s" "scripts/wifi") -(defpoll bluetooth_label :interval "1s" "scripts/bluetooth") -(defpoll volume_level :interval "1s" "scripts/volume") -(defpoll volume_label :initial '{"icon": "", content: "0"}' - :interval "1s" - "scripts/volumelabel") -(defpoll brightness_level :interval "1s" "scripts/brightness") -(defpoll brightness_label :interval "1s" "scripts/brightnesslabel") -(defpoll battery_level :interval "15s" "scripts/battery") -(defpoll currtime :interval "1s" "scripts/currtime") -(defpoll autosus :interval "5s" "scripts/autosus") - -(defvar songcard_reveal false) -(defvar brightness_reveal false) -(defvar volume_reveal false) -(defvar timedate_reveal false) - -;; Main widget -(defwindow main - :monitor 0 - :geometry (geometry :x "-2px" - :y "15px" - :width "98%" - :height "30px" - :anchor "top center") - :stacking "bg" - :reserve (struts :distance "50px" :side "top") - :windowtype "dialog" - :wm-ignore false - (container)) - -;; The main container for all the widgets -(defwidget container [] - (centerbox :orientation "horizontal" - :space-evenly true - (leftwidgets) - (middlewidgets) - (rightwidgets))) - -;; Left widgets -(defwidget leftwidgets [] - (box :spacing 4 - :orientation "horizontal" - :halign "start" - :valign "center" - :class "leftwidgets" - (literal :content w1) - (literal :content w2) - (literal :content w3) - (literal :content w4) - (literal :content w5) - (literal :content w6) - (literal :content w7) - (literal :content w8) - (literal :content w9) - (literal :content w10) - (literal :content w11) - (literal :content w12) - (literal :content w13) - (literal :content w14) - (literal :content w15) - (literal :content w16) - (literal :content w17) - (literal :content w18) - (literal :content w19) - (literal :content w20))) - -;; Middle widgets -(defwidget middlewidgets [] - (player)) - -;; Spotify widget -(defwidget player [] - (button :onclick "scripts/songcardshow" - :class "player__container" - (icon-module :class "player" - :icon "" - :visible {player_listen.show == "yes"} - (literal :content {player_listen.content})))) - -;; Right widgets -(defwidget rightwidgets [] - (box :class "rightwidgets" - :orientation "horizontal" - :halign "end" - :valign "center" - :space-evenly "false" - :spacing 5 - (literal :content {autosus}) - (weather) - (wifi) - (bluetooth) - (brightness) - (volume) - (power) - (timedate))) - -;; Displays the current weather -(defwidget weather [] - (label :text {weather_text})) - -;; A widget that displays the current wifi SSID -(defwidget wifi [] - (icon-module :icon "↑" - (literal :content {wifi_label}))) - -(defwidget bluetooth [] - (button :onclick "scripts/bluetoothpanel" - :class "button__container" - (icon-module :class "bluetooth" - :icon "ᛒ" - :visible true - (literal :content {bluetooth_label})))) - -;; A widget for tracking brightness -(defwidget brightness [] - (eventbox :onhover "eww update brightness_reveal=true" - :onhoverlost "eww update brightness_reveal=false" - (icon-module :icon "☼" - (literal :content {brightness_label}) - (revealer :transition "slideleft" - :reveal brightness_reveal - :duration "350ms" - (scale :class "brightness__bar" - :orientation "horizontal" - :value brightness_level - :min 0 - :max 100 - :onchange "brightnessctl set {}%"))))) - -;; A widget for tracking volume -(defwidget volume [] - (eventbox :onhover "eww update volume_reveal=true" - :onhoverlost "eww update volume_reveal=false" - (icon-module :icon {volume_label.icon} - (literal :content {volume_label.content}) - (revealer :transition "slideleft" - :reveal volume_reveal - :duration "350ms" - (scale :class "volume__bar" - :orientation "horizontal" - :value volume_level - :min 0 - :max 100 - :onchange "pamixer --set-volume $(printf \"%.0f\" \"{}\")"))))) - -;; A widget for tracking battery -(defwidget power [] - (button :onclick "scripts/powernotify" - :class "button__container" - (icon-module :class "power" - :icon "⏻" - :visible true - (literal :content {battery_level})))) - -;; A widget for tracking time and date -(defwidget timedate [] - (box :class "timedate" - :orientation "horizontal" - :space-evenly false - :valign "center" - :halign "end" - (button :class "timedate__button" - :onclick "scripts/boolflip timedate_reveal" - (literal :content {currtime})))) - - -;; A module with an icon attached -(defwidget icon-module [icon ?class ?visible] - (box :class "${class} icon-module" - :orientation "horizontal" - :halign "end" - :valign "center" - :space-evenly false - :visible {visible ?: true} - (label :class "icon-module__icon" :text "${icon}") - (children))) - -; The song card widget -(defwindow songcard - :monitor 0 - :geometry (geometry :x "0px" - :y "70px" - :width "350px" - :height "50px" - :anchor "top center") - :stacking "fg" - :reserve (struts :distance "50px" :side "top") - :windowtype "dialog" - :wm-ignore false - (box :orientation "vertical" - ;; song metadata - (box :orientation "vertical" - :halign "center" - :valign "top" - (literal :content {songcardtitle}) - (literal :content {songcardartist}) - ;; song controls - (centerbox :class "songcard__controls" - :orientation "horizontal" - :valign "center" - :halign "center" - (button :onclick "scripts/songback" - :class "songcard__button" - (image :path "img/musicback.png" :image-width 20 :image-height 20)) - (button :onclick "scripts/songplay" - :class "songcard__button" - (literal :content {songcard_button})) - (button :onclick "scripts/songnext" - :class "songcard__button" - (image :path "img/musicnext.png" :image-width 20 :image-height 20)))))) diff --git a/.config/eww/scripts/Makefile b/.config/eww/scripts/Makefile deleted file mode 100644 index 57053bf..0000000 --- a/.config/eww/scripts/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -susauto: autosus.c - clang -lX11 -lXrandr autosus.c -o autosus diff --git a/.config/eww/scripts/autosus.c b/.config/eww/scripts/autosus.c deleted file mode 100644 index 940aaac..0000000 --- a/.config/eww/scripts/autosus.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include - -int main(int argc, char **args) { - const char *display_name = ":0"; - Display *dpy = XOpenDisplay(display_name); - Window window = XDefaultRootWindow(dpy); - XRRMonitorInfo *monitor = XRRGetMonitors(dpy, window, 1, &dpy->nscreens); - - int is_laptop_screen = monitor->height == 1200 ? 1 : 0; - FILE *fp = popen( - "cat /proc/acpi/button/lid/LID0/state | grep -i closed | wc -l", "r"); - if (fp == NULL) { - exit(1); - } - - char buf[2]; - int is_closed = 0; - if (fgets(buf, sizeof(buf), fp) != NULL) { - is_closed = atoi(buf); - pclose(fp); - } else { - exit(1); - } - - if (is_closed && is_laptop_screen) { - system("systemctl suspend"); - } - - printf(""); - - return 0; -} diff --git a/.config/eww/scripts/battery b/.config/eww/scripts/battery deleted file mode 100755 index 1becd8a..0000000 --- a/.config/eww/scripts/battery +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -val=$(cat /sys/class/power_supply/BAT0/capacity) -discharging=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state" | grep -i "discharging" | wc -l) - -if [ $val -gt 19 ]; then - echo "(label :class \"power__text\" :text \"$val%\")" -elif [ $discharging -eq 0 ]; then - echo "(label :class \"power__text\" :text \"$val%\")" -else - echo "(label :class \"power__text_low\" :text \"$val%\")" -fi diff --git a/.config/eww/scripts/bluetooth b/.config/eww/scripts/bluetooth deleted file mode 100755 index 96ef8fe..0000000 --- a/.config/eww/scripts/bluetooth +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -powered=$(bluetoothctl show | grep -i "powered" | grep -i "yes" | wc -l) - -if [[ "$powered" -eq 1 ]]; then - val=$(bluetoothctl devices Connected | wc -l) - echo "(label :class \"bluetooth__label\" :text \"$val\")" -else - echo "(label :class \"bluetooth__label\" :text \"-\")" -fi diff --git a/.config/eww/scripts/bluetoothpanel b/.config/eww/scripts/bluetoothpanel deleted file mode 100755 index 4a88de9..0000000 --- a/.config/eww/scripts/bluetoothpanel +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -rofi-bluetooth diff --git a/.config/eww/scripts/boolflip b/.config/eww/scripts/boolflip deleted file mode 100755 index fb1bed0..0000000 --- a/.config/eww/scripts/boolflip +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -var="$1" -val=`eww get ${var}` - -if [ "$val" == "true" ]; then - eww update "$var"=false -else - eww update "$var"=true -fi diff --git a/.config/eww/scripts/brightness b/.config/eww/scripts/brightness deleted file mode 100755 index 9f48c36..0000000 --- a/.config/eww/scripts/brightness +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -level=$(brightnessctl get) -max=$(brightnessctl max) - -raw_percent=$(echo "scale=2 ; $level / $max" | bc) -percent=$(echo "$raw_percent*100" | bc) -final_percent=${percent%.*} -echo "$final_percent" diff --git a/.config/eww/scripts/brightnesslabel b/.config/eww/scripts/brightnesslabel deleted file mode 100755 index a438676..0000000 --- a/.config/eww/scripts/brightnesslabel +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -level=$(brightnessctl get) -max=$(brightnessctl max) - -raw_percent=$(echo "scale=2 ; $level / $max" | bc) -percent=$(echo "$raw_percent*100" | bc) -final_percent=${percent%.*} -echo "(label :class \"brightness__label\" :text \"$final_percent%\")" diff --git a/.config/eww/scripts/currtime b/.config/eww/scripts/currtime deleted file mode 100755 index c88485e..0000000 --- a/.config/eww/scripts/currtime +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -var="timedate_reveal" -val=`eww get ${var}` - -if [ "$val" == true ]; then - time=`date +"%F %T"` - echo "(label :text \"$time\")" -else - time=`date +"%R"` - echo "(label :text \"$time\")" -fi diff --git a/.config/eww/scripts/player b/.config/eww/scripts/player deleted file mode 100755 index 6750317..0000000 --- a/.config/eww/scripts/player +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -echo "{\"show\": \"no\", \"content\": \"\"}" -while true -do - line=$(spt playback --status -f "%s:%a - %t" 2> /dev/null) - IFS=':' read -ra ELS <<< "$line" - button=${ELS[0]} - content=${ELS[1]} - if [ "$button" == "▶" ]; then - echo "{\"show\": \"yes\", \"content\": \"(label :text \\\"$content\\\")\"}" - else - echo "{\"show\": \"no\", \"content\": \"\"}" - fi - - sleep 1 -done diff --git a/.config/eww/scripts/powernotify b/.config/eww/scripts/powernotify deleted file mode 100755 index 378d935..0000000 --- a/.config/eww/scripts/powernotify +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -msg=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | \ - grep -E "state|time to|percentage" | \ - awk '{$1=$1};1') - -notify-send -t 3000 "Battery Status" "$msg" diff --git a/.config/eww/scripts/songback b/.config/eww/scripts/songback deleted file mode 100755 index 54dd250..0000000 --- a/.config/eww/scripts/songback +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -spt playback --previous diff --git a/.config/eww/scripts/songcardartist b/.config/eww/scripts/songcardartist deleted file mode 100755 index 9057a1e..0000000 --- a/.config/eww/scripts/songcardartist +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo "(label :class \"songcard__artist\" :text \".\")" -while true -do - content=$(spt playback --status -f "%a" 2> /dev/null) - echo "(label :class \"songcard__artist\" :text \"${content}\")" - sleep 1 -done diff --git a/.config/eww/scripts/songcardplayrender b/.config/eww/scripts/songcardplayrender deleted file mode 100755 index 4606aa3..0000000 --- a/.config/eww/scripts/songcardplayrender +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -button=$(spt playback --status -f "%s" 2>/dev/null) -if [ "$button" == "▶" ]; then - echo "(image :path \"img/musicpause.png\" :image-width 40 :image-height 40)" -else - echo "(image :path \"img/musicplay.png\" :image-width 40 :image-height 40)" -fi diff --git a/.config/eww/scripts/songcardshow b/.config/eww/scripts/songcardshow deleted file mode 100755 index 70057d7..0000000 --- a/.config/eww/scripts/songcardshow +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -show=$(eww get songcard_reveal) - -if [ "$show" == "false" ]; then - eww open songcard && eww update songcard_reveal=true -else - eww close songcard && eww update songcard_reveal=false -fi - -./boolflip songcard_reveal diff --git a/.config/eww/scripts/songcardtitle b/.config/eww/scripts/songcardtitle deleted file mode 100755 index a593d7e..0000000 --- a/.config/eww/scripts/songcardtitle +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo "(label :class \"songcard__title\" :text \"None Playing\")" -while true -do - content=$(spt playback --status -f "%t" 2> /dev/null) - echo "(label :class \"songcard__title\" :text \"${content}\")" - sleep 1 -done diff --git a/.config/eww/scripts/songnext b/.config/eww/scripts/songnext deleted file mode 100755 index 7642fbd..0000000 --- a/.config/eww/scripts/songnext +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -spt playback --next diff --git a/.config/eww/scripts/songplay b/.config/eww/scripts/songplay deleted file mode 100755 index 60b73ab..0000000 --- a/.config/eww/scripts/songplay +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -spt playback --toggle diff --git a/.config/eww/scripts/volume b/.config/eww/scripts/volume deleted file mode 100755 index 96d4b0f..0000000 --- a/.config/eww/scripts/volume +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -raw_percent=$(pamixer --get-volume-human) -if [ "$raw_percent" == "muted" ]; then - echo "0" -else - percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g') - echo "$percent" -fi diff --git a/.config/eww/scripts/volumelabel b/.config/eww/scripts/volumelabel deleted file mode 100755 index b0f3347..0000000 --- a/.config/eww/scripts/volumelabel +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -raw_percent=$(pamixer --get-volume-human) -if [ "$raw_percent" == "muted" ]; then - echo "{\"icon\": \"\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"muted\\\")\"}" -else - percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g') - #if [ "$percent" -gt 66 ]; then - # icon="" - #elif [ "$percent" -gt 33 ]; then - # icon="" - #elif [ "$percent" -gt 0 ]; then - # icon="" - #else - # icon="" - #fi - icon="" - volume="$percent%" - echo "{\"icon\": \"${icon}\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"${volume}\\\")\"}" -fi diff --git a/.config/eww/scripts/wifi b/.config/eww/scripts/wifi deleted file mode 100755 index 73e398a..0000000 --- a/.config/eww/scripts/wifi +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -wifi=`nmcli c show --active | tail -n 1 | sed 's/ .*//g'` -if [ ${#wifi} -gt 0 ]; then - echo "(label :text \"${wifi}\")" -else - echo "" -fi diff --git a/.config/eww/scripts/workspaces b/.config/eww/scripts/workspaces deleted file mode 100755 index 1305b9c..0000000 --- a/.config/eww/scripts/workspaces +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -# Checks if a list ($1) contains an element ($2) -contains() { - for e in $1; do - [ "$e" == "$2" ] && echo 1 && return - done - echo 0 -} - -workspaces() { - icon="" - isfocused=$(bspc query -D -d focused --names | grep -w "$1") - isoccupied=$(bspc query -D -d .occupied --names | grep -w "$1") - if [ ${#isfocused} -ge 1 ]; then - class="focused" - elif [ ${#isoccupied} -ge 1 ]; then - class="occupied" - else - class="empty" - fi - - echo "(button :onclick \"bspc desktop -f '^$1'\" :class \"$class\" \"$icon\")" -} - -workspaces $1 -bspc subscribe desktop node_transfer | while read -r _ ; do - workspaces $1 -done