diff --git a/eww/.config/eww/eww.scss b/eww/.config/eww/eww.scss index 699bbe9..eb5e294 100644 --- a/eww/.config/eww/eww.scss +++ b/eww/.config/eww/eww.scss @@ -1,16 +1,9 @@ // Font stuff $font-size: 16px; -$icon-size: 20px; -$logo-size: 24px; +$icon-size: 18px; +$logo-size: 28px; -// Basic color -$bg-color: #181818; -$bg-alt-color: #242424; -$fg-color: #ebdbb2; -$fg-alt-color: #635c4b; -$border-color: #484848; - -// Colors +// Basic colors $black: #121212; $red: #f7768c; $green: #9ece6a; @@ -20,13 +13,20 @@ $magenta: #ad8ee6; $cyan: #449dab; $white: #787c99; +// Colors +$bg-color: #181818; +$bg-alt-color: #242424; +$fg-color: #ebdbb2; +$fg-alt-color: #635c4b; +$fg-sel-color: $blue; +$border-color: #484848; + // Misc -$anim-delay: 250ms; +$anim-transition: 250ms; * { all: unset; //Unsets everything so you can style everything from scratch - font-family: "Hack Mono"; - transition: opacity $anim-delay; + font-family: "Hack Mono", "Font Awesome"; // color: $fg-color; } @@ -42,9 +42,23 @@ $anim-delay: 250ms; } // Styles on classes (see eww.yuck for more information) +button { + transition-property: opacity, color; + transition-duration: $anim-transition; +} + +// Workspaces +.ws-active { font-weight: bold; } +.ws-inactive { opacity: 0.2; } + +.workspaces { + // background-color: $black; + // border-radius: $font-size; + // border: 1px solid $border-color; +} button.ws { - color: $fg-color; + // color: $fg-color; font-size: $font-size; margin: 4px; } @@ -54,6 +68,11 @@ button.ws:hover { opacity: 1.0; } +// Control +.control { + margin-bottom: $logo-size; +} + .icon { opacity: 0.8; font-size: $icon-size; @@ -61,28 +80,16 @@ button.ws:hover { .icon:hover { opacity: 1.0; + color: red; } +// Logo button .logo { - margin-top: $font-size; - font-size: $icon-size; + margin-top: 6px; + font-size: $logo-size; // opacity: 0.8; } .logo:hover { color: red; } - -.workspaces { - // background-color: $black; - // border-radius: $font-size; - // border: 1px solid $border-color; -} - -.ws-active { - font-weight: bold; -} - -.ws-inactive { - opacity: 0.2; -} diff --git a/eww/.config/eww/eww.yuck b/eww/.config/eww/eww.yuck index e1567a2..3b193a3 100644 --- a/eww/.config/eww/eww.yuck +++ b/eww/.config/eww/eww.yuck @@ -1,12 +1,12 @@ (defwidget bar [screen] (centerbox :orientation "v" - (box :class "segment-start" :valign "start" + (box :class "segment-start" :valign "start" :space-evenly false :orientation "v" (logo) ) - (box :class "segment-mid" :valign "middle" + (box :class "segment-mid" :valign "center" :orientation "v" (workspaces :wsp workspaces-data :ori "v") ) - (box :class "segment-end" :valign "end" + (box :class "segment-end" :valign "end" :orientation "v" (control) ) ) @@ -15,13 +15,21 @@ ;; Logo (defwidget logo [] (button :class "logo" - "Λ" + "Λ" )) (defwidget control [] - (button :class "icon volume" :valign "start" + (box :class "control" :spacing 16 :orientation "v" + (button :class "icon volume" :valign "start" "" - ) + ) + (button :class "icon music" :valign "start" + "" + ) + (button :class "icon date" :valign "start" + "" + ) + ) ) ;; Workspaces container @@ -64,10 +72,10 @@ :windowtype "dock" :geometry (geometry :x "0%" :y "0%" - :width "42px" + :width "38px" :height "100%" :anchor "left center") - :reserve (struts :side "left" :distance "42px") + :reserve (struts :side "left" :distance "38px") (bar :screen 1)) (defwindow bar-2 @@ -86,7 +94,7 @@ :geometry (geometry :x "0%" :y "0%" :width "182px" - :height "32px" + :height "38px" :anchor "right top" ) :reserve (struts :side "right" :distance "0px" :orientation "h") diff --git a/eww/.config/eww/scripts/workspace.py b/eww/.config/eww/scripts/workspace.py index cd0cbc4..dc1838c 100755 --- a/eww/.config/eww/scripts/workspace.py +++ b/eww/.config/eww/scripts/workspace.py @@ -8,19 +8,21 @@ data using wmctrl. import re import sys import json -from subprocess import check_output +from subprocess import check_output, CalledProcessError # Config HIDE_EMPTY_WS = True # Exclude empty workspaces -OVERIDE_ALL_NAMES = False -OVERIDE_ALL_NAME = "" -NAME_MAPS = { +OVERIDE_ALL_NAMES = False # Override all the WS names and use the name below +OVERIDE_ALL_NAME = "" # Name to use when overriding names +NAME_MAPS: dict[int, str] = { # Replace the indexs name with the given string # 0: "", # 1: "" } +LOG_FILE = "/tmp/eww_workspace.log" # Log file (in case of errors etc) -# NOTE: DO NOT TOUCH +# ------------ NOTE: DO NOT TOUCH ------------ + WMCTRL_SCRIPT = "wmctrl -d" PARSE_REGEX = r"^(\d+)\s+(\*|\-).+\s+(\w+)$" @@ -63,16 +65,26 @@ def parse_workspaces(): Function to get all the workspaces """ - inp = check_output(WMCTRL_SCRIPT.split(" ")) - inp = inp.decode("utf-8") - - nonempty = check_output(WMCTRL_NONEMPTY_SCRIPT.split(" ")) - nonempty = nonempty.decode("utf-8") - - nonempty_workspaces = re.findall(NONEMPTY_REGEX, - nonempty, - flags=re.MULTILINE) - nonempty_workspaces = list(map(int, nonempty_workspaces)) + try: + nonempty = check_output(WMCTRL_NONEMPTY_SCRIPT.split(" ")) + nonempty = nonempty.decode("utf-8") + + nonempty_workspaces = re.findall(NONEMPTY_REGEX, + nonempty, + flags=re.MULTILINE) + nonempty_workspaces = list(map(int, nonempty_workspaces)) + except CalledProcessError: + nonempty_workspaces = [] + + try: + inp = check_output(WMCTRL_SCRIPT.split(" ")) + inp = inp.decode("utf-8") + except CalledProcessError as err: + logfile = open(LOG_FILE, "a") + logfile.write("ERROR! COULD NOT PARSE WORKSPACES OR SOMETHING! YOU ARE ON YOUR OWN.") + logfile.write(f"{err}") + + inp = "" out = []