Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] scss color property not updating when switching to desktop #1102

Open
3 tasks done
foics opened this issue May 19, 2024 · 0 comments
Open
3 tasks done

[BUG] scss color property not updating when switching to desktop #1102

foics opened this issue May 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@foics
Copy link

foics commented May 19, 2024

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

Im trying to make a bar that has the workspaces shown theres a script to get focused, occupied, and unoccupied desktops it works for the most part except in the scss part where I specify the color in button.focused it does not change the text color when i go to the desktop it only updates once I leave the desktop however everything else works fine including the background-color which doesn't make sense

Reproducing the issue

put the following code inside of eww.scss

$bg: #101419;
$contrastbg: #15191e;
$bgSecondary: #1a1e23;
$bgSecondaryAlt: #b6beca;
$fg: #b6beca;
$fgDim: #b6beca;
$watermelon: #e05f65;

// Aliases
$background: $bg;
$backgroundSecondary: $bgSecondary;
$backgroundSecondaryAlt: $bgSecondaryAlt;
$foreground: $fg;
$foregroundDim: $fgDim;

$black: #242931;
$red: #e05f65;
$blue: #70a5eb;
$cyan: #74bee9;
$blue-desaturated: #74bee9;
$magenta: #c68aee;
$purple: #c68aee;
$green: #94f7c5;
$aquamarine: #94f7c5;
$yellow: #f1cf8a;
$accent: $blue;
$javacafeMagenta: #c68aee;
$javacafeBlue: #70a5eb;

.bar {
  background-color: $bg;
  font-family: FiraCode Nerd Font Mono;
  font-size: 14px;
  color: $fg;
}

.workspaces {
    font-size: 14px;
    font-weight: normal;
    $btn-active: #ff8852;
    $btn-inactive: #ffffff;
    button.focused {
        padding: 8px;
        background-color: $contrastbg;
        border-radius: 4px;
        color: $btn-active;
        border-bottom: 1px solid $btn-active;
    }
    button.occupied {
        padding: 8px;
        color: $btn-active;
    }
    button.unoccupied {
        padding: 8px;
        color: $btn-inactive;
    }
}

code for eww.yuck

(defwidget workspaces []
  (literal :content workspace)
)
(deflisten workspace "scripts/getWorkspaces")

(defwidget left []
  (box :orientation "h"
       :space-evenly "false"
       :halign "start"
       :class "left"
    (workspaces)
  )
)

(defwidget bar []
  (box :class "bar"
       :orientation "h"
    (left)
  )
)

(defwindow bar
   :windowtype "desktop"
   :stacking "bg"
   :geometry (geometry :x "0px"
                       :y "5px"
                       :width "98%"
                       :height "20px"
                       :anchor "top center")
   :reserve (struts :distance "40px" :side "top")
   :wm-ignore false
 (bar))

place this script inside a folder called scripts and call it getWorkspaces

#!/bin/bash

spc=1

workspaces() {
  ws=($(bspc query -D --names))

  return_val="(box :class \"workspaces\" :orientation \"h\" :spacing $spc :space-evenly \"false\""

  # init counter
  i=0

  for w in "${ws[@]}"; do
    foc=
    occ=
    unocc=

    # increment counter
    (( i++ ))

    # the 3 commands below check for and list the desktops that fit the conditions
    # then its piped into grep which saves the whole word (-w) into the $w var
    # check if focused
    [ "$(bspc query -D -d focused --names | grep -w "$w")" ] && foc="focused"

    # check if occupied
    [ "$(bspc query -D -d .occupied --names | grep -w "$w")" ] && occ="occupied"

    # check if bspc is not occupied
    [ "$(bspc query -D -d .\!occupied --names | grep -w "$w")" ] && unocc="unoccupied"

    if [ -z "$foc" ] && [ -z "$occ" ] [ -z "$unocc" ]; then continue; fi

#   ic[i]=""
    ic[i]="$w"
#   if [ -n "${foc}" ]; then
#     ic[i]=""
#   fi

    return_val+=" (button :onclick \"bspc desktop -f ^${i}\" :class \"${foc} ${occ} ${unocc}\" \"${ic[i]}\")"
  done

  return_val+=")"
  echo "$return_val"
}

workspaces
bspc subscribe desktop node_transfer | while read -r _ ; do
  workspaces
done

This should reproduce the promblem when using bspwm

Expected behaviour

The workspaces listed on the bar should change to the specified color when focused on it

Additional context

No response

@foics foics added the bug Something isn't working label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant