From 133b8f59fb328b33da59c2214580943420a19134 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 31 May 2024 00:04:19 -0700 Subject: [PATCH 01/14] fix: Hyprland socket address update --- eww/bar/scripts/get-workspaces | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eww/bar/scripts/get-workspaces b/eww/bar/scripts/get-workspaces index 4c2070d..649bd9b 100755 --- a/eww/bar/scripts/get-workspaces +++ b/eww/bar/scripts/get-workspaces @@ -113,7 +113,9 @@ def detect(): Main entry point, detects the type of compositor used """ if signature := os.environ.get("HYPRLAND_INSTANCE_SIGNATURE", None): - socket_addr = f"/tmp/hypr/{signature}/.socket2.sock" + # See https://wiki.hyprland.org/IPC/ + xdg_runtime_dir = os.environ["XDG_RUNTIME_DIR"] + socket_addr = f"/{xdg_runtime_dir}/hypr/{signature}/.socket2.sock" return hypr_listen(socket_addr) if signature := os.environ.get("SWAYSOCK", None): return sway_listen() From 240ab803839589df72ef22bd461e014267d376bb Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 31 May 2024 14:33:53 -0700 Subject: [PATCH 02/14] feat: Moving towards eww bar only --- eww/bar/eww.scss | 41 +++++++-- eww/bar/eww.yuck | 201 ++++++++++++++++++++++++++++++++------------- hypr/hyprland.conf | 6 +- 3 files changed, 182 insertions(+), 66 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index 53d49a1..2ca1a14 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -16,7 +16,7 @@ $clock: rgba(171, 233, 179, 1.0); $media: rgba(224, 232, 224, 0.7); -$tray_background: rgba(204, 204, 204, 0.1); +$tray_bg: rgba(204, 204, 204, 0.1); $tray: #c9cbff; $keyboard: #f2cdcd; $language: #e8a2af; @@ -34,12 +34,18 @@ $battery: #b6b2b3; * { all: unset; } -.bar { - //background-color: transparent; +.vbar { + background-color: transparent; margin-left: 5px; font-size: 15px; font-family: monospace; } +.hbar { + background-color: transparent; + margin-top: 5px; + font-size: 15px; + font-family: monospace; +} .icon { font-size: 20px; @@ -105,6 +111,27 @@ box .weather { color: mix($weather_end, $weather, 100%); } } +.audio .audio-scale { + color: $audio; +} +scale { + border-radius: 5px; + min-height: 80px; + min-width: 10px; + margin: .3rem 0 .3rem 0; +} +.volume-icon { + margin: 2pt 0 2pt 0; + color: $audio; +} +box .cpu { + color: $cpu; + padding: 6pt; +} +box .memory { + color: $memory; + padding: 6pt; +} box .clock { background-color: $widget_bg; border-radius: 5; @@ -125,6 +152,11 @@ box .clock { font-family: monospace; } +.systray { + background-color: $tray_bg; + color: $tray; +} + // Styles on classes (see eww.yuck for more information) .status slider { @@ -162,6 +194,3 @@ box .clock { margin-left: 10px; margin-right: 20px; } -.label-ram { - font-size: large; -} diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 2604de7..99d1fed 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -1,6 +1,6 @@ (defvar eww "eww --config $HOME/.config/eww/bar") -(defwindow bar +(defwindow vbar :exclusive true :monitor 0 :windowtype "dock" @@ -12,20 +12,47 @@ :anchor "center left" ) :reserve (struts :side "left" :distance "20px") - (widget_bar)) -(defwidget widget_bar [] - (centerbox :orientation "v" + (centerbox + :orientation "v" (box :orientation "v" :space-evenly false :valign "start" - (box :class "launcher" :valign "start" "☯") - (widget_workspaces) + (box :class "launcher" :valign "start" :width "10px" :height "10px" "☯") + ;(label :class "launcher" :valign "start" :width "20px" :height "20px" :unindent true + ; :text "☯") + (widget-workspaces) + ) + (widget-media) + ;(widget-weather :orientation "v") + (box :orientation "v" :space-evenly false :valign "end" + (widget-tray) + (widget-audio) + (widget-cpu) + (widget-memory) + (widget-clock) ) - (widget_weather :orientation "v") - (widget_clock) - ;(media) ;(widget_status) )) +(defwindow hbar + :exclusive true + :monitor 0 + :windowtype "dock" + :geometry (geometry + :x "0%" + :y "0%" + :width "90%" + :height "20px" + :anchor "top center" + ) + :reserve (struts :side "top" :distance "20px") + (centerbox :orientation "h" + (box :orientation "h") + (box :orientation "h") + (box :orientation "h" :space-evenly false :halign "end" + (widget-cpu) + (widget-memory) + ) + )) -(defwidget widget_workspaces [] +(defwidget widget-workspaces [] (box :class "workspaces" :orientation "v" @@ -44,7 +71,7 @@ ; Weather -(defwidget widget_weather [orientation] +(defwidget widget-weather [orientation] (box :class "weather" :orientation orientation @@ -55,7 +82,7 @@ (button :onclick "scripts/popup weather" "W") )) -(defpoll weather_text :initial "" :interval "180s" +(defpoll weather-text :initial "" :interval "180s" "curl --max-time 2 wttr.in") (defwindow weather @@ -63,26 +90,109 @@ :y "50%" :width "270px" :height "60px") - (box weather_text)) + (box weather-text)) -(defwindow calendar - :geometry (geometry :x "70px" - :y "65%" - :width "270px" - :height "60px") - (cal)) +(defwidget widget-media [] + (box + :class "media" + :orientation "v" + :space-evenly false + :valign "center" + (circular-progress + :class "media" + :width 20 + :height 20 + :thickness 4 + :tooltip {music_status_listener} + :value {music_position} + :visible {music_listener != ""} + ) + (label + :angle 90 + :xalign 0.5 + :yalign 0.5 + :text {music_listener != "" ? "『${music_listener}』" : ""}) + )) -(defwidget widget_clock [] +(deflisten music_listener :initial "" + "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") +(deflisten music_status_listener :initial "" + "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") +(deflisten music_position :initial 0.5 + "playerctl --follow metadata --format '{{100.0 * position / mpris:length}}' || true") + +(defwidget widget-audio [] + (scale + :class "audio" + :orientation "v" + :min 0 + :max 100 + :value 23 + )) +(defwidget widget-audio [] + (eventbox + :onhover "${eww} update show_audio=true" + :onhoverlost "${eww} update show_audio=false" + (box + :class "audio" + :orientation "v" + :space-evenly "false" + :spacing "2" + (revealer :transition "slideup" :reveal show_audio + (scale + :class "audio-scale" + :value current-volume + :orientation "v" + :flipped true + :tooltip "Volume: ${current-volume}%" + :max 101 + :min 0 + :onchange "amixer -D pulse sset Master {}%" )) + (button + :onclick "scripts/popup audio" + :class "volume-icon" "")))) +(defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defvar show_audio false) + +(defwidget widget-cpu [] + (circular-progress + :class "cpu" + :width 20 + :height 20 + :thickness 4 + :tooltip {EWW_CPU.cores} + :value {EWW_CPU.avg} + )) +(defwidget widget-memory [] + (circular-progress + :class "memory" + :width 20 + :height 20 + :thickness 4 + :tooltip "${EWW_RAM.used_mem} / ${EWW_RAM.total_mem}" + :value {EWW_RAM.used_mem_perc} + )) +(defwidget widget-tray [] + (systray + :class "systray" + :orientation "v" + :space-evenly true + :icon-size 20 + :prepend-new true + )) + +(defwidget widget-clock [] (box :class "clock" :orientation "v" :valign "end" :spacing 1 - (box :class "icon" "") - "${clock.H}" "${clock.M}" + :width 25 (box :class "icon" "") "${clock.m}" "${clock.d}" + (box :class "icon" "") + "${clock.H}" "${clock.M}" )) (defpoll clock :initial "{}" :interval "10s" @@ -97,7 +207,7 @@ :y "65%" :width "270px" :height "60px") -(cal)) + (cal)) (defwidget cal [] @@ -117,38 +227,19 @@ ; Unused widgets -(defwidget widget_status [] - (box - :class "status" - :orientation "v" - :space-evenly false - :valign "end" - (metric :label "" - :value volume - :onchange "amixer -D pulse sset Master {}%") - (metric :label "" - :value {EWW_RAM.used_mem_perc} - :onchange "") - (widget_clock))) - - -(defwidget widget_media [] - (box :class "media" - :orientation "v" - :space-evenly false - :valign "center" - {music_listener != "" ? "『${music_listener}』" : ""} - (box :class "music_status" - :orientation "h" - :space-evenly false - :halign "center" - {music_listener != "" ? "${music_status_listener}" : ""}) - )) - -(deflisten music_listener :initial "" - "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") -(deflisten music_status_listener :initial "" - "playerctl --follow metadata --format '{{duration(position)}}/{{duration(mpris:length)}}' || true") +;(defwidget widget_status [] +; (box +; :class "status" +; :orientation "v" +; :space-evenly false +; :valign "end" +; (metric :label "" +; :value volume +; :onchange "amixer -D pulse sset Master {}%") +; (metric :label "" +; :value {EWW_RAM.used_mem_perc} +; :onchange "") +; (widget_clock))) (defwidget metric [label value onchange] diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index ad7c0b5..355431c 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -11,7 +11,7 @@ monitor=,preferred,auto,auto # See https://wiki.hyprland.org/Configuring/Keywords/ for more # waybar is executed after eww to have the intersection effect at top left -exec-once = hyprpaper & swaync & fcitx5 & eww --config ~/.config/eww/bar open bar & waybar +exec-once = hyprpaper & swaync & fcitx5 & eww --config ~/.config/eww/bar open vbar # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf @@ -52,10 +52,6 @@ decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more rounding = 10 - blur = yes - blur_size = 3 - blur_passes = 1 - blur_new_optimizations = on drop_shadow = yes shadow_range = 4 From 9ca97466a17d243ec76ddabee679b4d8bf53a3b2 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 06:14:20 -0700 Subject: [PATCH 03/14] feat: Display hyprland title in eww. Doc update 1. Replaced `grimblast` with `flameshot` 2. Updated document and removed waybar 3. Updated eww stylesheet --- README-Wayland.org | 8 +- eww/bar/eww.scss | 17 ++- eww/bar/eww.yuck | 48 +++++---- eww/bar/scripts/compositor-control | 167 +++++++++++++++++++++++++++++ eww/bar/scripts/get-workspaces | 128 ---------------------- hypr/hyprland.conf | 9 +- 6 files changed, 218 insertions(+), 159 deletions(-) create mode 100755 eww/bar/scripts/compositor-control delete mode 100755 eww/bar/scripts/get-workspaces diff --git a/README-Wayland.org b/README-Wayland.org index 876bff3..e26602b 100644 --- a/README-Wayland.org +++ b/README-Wayland.org @@ -22,8 +22,7 @@ recommended. * Status Bar and Tray -- ~waybar~: Status bar, use ~waybar-hyprland-git~ AUR repo to enable clicking! -- ~eww-wayland~: Another status bar, requires ~socat~ to listen for hyprland events. +- ~eww-wayland~: Requires ~socat~ to listen for hyprland events. * Sway @@ -57,7 +56,6 @@ This is another choice of a compositor. Note: Setup does not work with NVIDIA GPU without some tweaks. - [[https://wiki.archlinux.org/title/Hyprland][hyprland]]: window manager - Until [[https://github.com/elkowar/eww/issues/111][tray support]] has been added to ~eww~ in a stable manner, tray will be handled with waybar. - ~hyprpaper~: Wallpaper engine The command to set a wallpaper: @@ -79,12 +77,14 @@ convert $IN \ #+end_src - ~swaync~: Notification server - ~wofi~: finding programs, drop in replacement for ~rofi~ -- ~grimblast~: Screenshot engine - ~dolphin~: File explorer - ~swaylock-effects~: A simple lockscreen - ~wl-clipboard~: Provides copying - ~blueman~: Bluetooth connector +- ~grim~: Screenshot engine +- ~flameshot~: Screenshot utility; On Arch Linux, install ~flameshot-git~. + ** Configuration - ~lxappearance~: Used to configure GTK3 themes diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index 2ca1a14..9ae4ecd 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -32,7 +32,7 @@ $temperature_critical: #ff6666; $battery: #b6b2b3; -* { all: unset; } +//* { all: unset; } .vbar { background-color: transparent; @@ -52,13 +52,16 @@ $battery: #b6b2b3; } .launcher { + all: unset; font-size: 40px; - margin: -7px -5px 15px -5px; + margin: -2px -5px 5px -3px; } box .workspaces { + all: unset; border-radius: 10px; button { + all: unset; font-size: 30px; padding-left: 2px; margin: -5px -5px -5px -5px; @@ -111,7 +114,13 @@ box .weather { color: mix($weather_end, $weather, 100%); } } -.audio .audio-scale { +.audio-scale { + color: $audio; +} +.audio { + all: unset; + border: none; + background-color: transparent; color: $audio; } scale { @@ -144,6 +153,8 @@ box .clock { font-family: "Noto Serif"; padding-left: 5px; padding-right: 5px; + min-height: 15px; + min-width: 15px; color: $media; border: none; } diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 99d1fed..884a2db 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -15,9 +15,12 @@ (centerbox :orientation "v" (box :orientation "v" :space-evenly false :valign "start" - (box :class "launcher" :valign "start" :width "10px" :height "10px" "☯") - ;(label :class "launcher" :valign "start" :width "20px" :height "20px" :unindent true - ; :text "☯") + ;(box :class "launcher" :valign "start" :width "10px" :height "10px" "☯") + (label + :class "launcher" :valign "start" :width "20px" :height "20px" + :unindent true + :tooltip active-window-title + :text "☯") (widget-workspaces) ) (widget-media) @@ -66,7 +69,9 @@ "${workspace.text}")) )) (deflisten workspaces :initial "[]" - "scripts/get-workspaces") + "scripts/compositor-control workspaces") +(deflisten active-window-title :initial "" + "scripts/compositor-control active-title") ; Weather @@ -103,35 +108,33 @@ :class "media" :width 20 :height 20 - :thickness 4 - :tooltip {music_status_listener} - :value {music_position} - :visible {music_listener != ""} + :thickness 5 + ;:tooltip {music_listener_position} + :tooltip "${music_position} / ${music_length}" + :value {100.0 * music_position / (music_length / 1000000.0)} + :visible {music_listener != "" && music_length != 1} ) + ; Add play and pause buttons here? (label - :angle 90 + :angle 270 :xalign 0.5 :yalign 0.5 - :text {music_listener != "" ? "『${music_listener}』" : ""}) + :justify "center" + :text {music_listener != "" ? "『${music_listener}』" : "『』"}) )) (deflisten music_listener :initial "" "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") -(deflisten music_status_listener :initial "" +(deflisten music_listener_position :initial "" "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") -(deflisten music_position :initial 0.5 - "playerctl --follow metadata --format '{{100.0 * position / mpris:length}}' || true") +(defpoll music_position :interval "1s" + "playerctl position") +(deflisten music_length :initial 1 + "playerctl --follow metadata mpris:length") -(defwidget widget-audio [] - (scale - :class "audio" - :orientation "v" - :min 0 - :max 100 - :value 23 - )) (defwidget widget-audio [] (eventbox + :class "audio" :onhover "${eww} update show_audio=true" :onhoverlost "${eww} update show_audio=false" (box @@ -145,12 +148,15 @@ :value current-volume :orientation "v" :flipped true + :marks true :tooltip "Volume: ${current-volume}%" :max 101 :min 0 :onchange "amixer -D pulse sset Master {}%" )) (button + :class "audio" :onclick "scripts/popup audio" + :tooltip "Volume: ${current-volume}%" :class "volume-icon" "")))) (defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") (defvar show_audio false) diff --git a/eww/bar/scripts/compositor-control b/eww/bar/scripts/compositor-control new file mode 100755 index 0000000..2b02113 --- /dev/null +++ b/eww/bar/scripts/compositor-control @@ -0,0 +1,167 @@ +#!/usr/bin/env python + +""" +Utility to generate the workspace buttons for eww bar widget. + +Currently it fetches information from monitor 0. If all monitors have +synchronised workspaces this should not be a problem. +""" +import os, sys, socket, json, subprocess +from typing import Optional, Self, override + +WORKSPACE_ICONS = [ + (1, "☱"), + (2, "☲"), + (3, "☳"), + (4, "☴"), + (5, "☵"), + (6, "☶"), + (7, "☷"), + (8, "☰"), +] +EXTRA_WORKSPACE_ICONS = [ + (0, "⚌"), + (1, "⚍"), + (2, "⚎"), + (3, "⚏"), +] + +Workspaces = dict[int, bool] + +def get_widgets(workspaces: Workspaces) -> str: + """ + Create widget sexp from workspace information + """ + def get_class(k): + key = workspaces.get(k, None) + if key is None: + return "inactive" + elif key: + return "focused" + else: + return "active" + + buttons = [ + f'"id": "{k}", "text": "{icon}", "class": "{get_class(k)}"' + for k, icon in WORKSPACE_ICONS + ] + buttons = ", ".join(["{" + b + "}" for b in buttons]) + return "[" + buttons + "]" + +class CompositorHandler: + @staticmethod + def create() -> Optional[Self]: + """ + Main entry point, detects the type of compositor used + """ + if signature := os.environ.get("HYPRLAND_INSTANCE_SIGNATURE", None): + # See https://wiki.hyprland.org/IPC/ + xdg_runtime_dir = os.environ["XDG_RUNTIME_DIR"] + socket_addr = f"/{xdg_runtime_dir}/hypr/{signature}/.socket2.sock" + return HyprlandHandler(socket_addr) + if signature := os.environ.get("SWAYSOCK", None): + return SwayHandler() + return None + + def listen_workspaces(self): + pass + def listen_active_window_title(self): + pass + +class HyprlandHandler(CompositorHandler): + def __init__(self, socket_addr): + self.socket_addr = socket_addr + + def listen(self, callback): + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + try: + sock.connect(self.socket_addr) + except Exception as e: + print(f"Could not connect to {self.socket_addr}", file=sys.stderr) + raise e + + callback(data=None) + while sock: + data = sock.recv(1024) + callback(data) + + @staticmethod + def get_workspace_info() -> Workspaces: + workspaces = json.loads(os.popen("hyprctl workspaces -j").read()) + monitors = json.loads(os.popen("hyprctl monitors -j").read()) + if not monitors: + print("No monitor found!", file=sys.stderr) + return [] + + monitor, active = [ + (m["name"], m["activeWorkspace"]["id"]) for m in monitors if m["id"] == 0 + ][0] + workspaces = { + w["id"]: w["id"] == active + for w in workspaces if w["monitor"] == monitor + } + return workspaces + + @override + def listen_workspaces(self): + def callback(data): + if data is None or b"workspace" in data: + workspace_info = HyprlandHandler.get_workspace_info() + print(get_widgets(workspace_info), flush=True) + self.listen(callback) + + @override + def listen_active_window_title(self): + def callback(data): + if data is None: + active_window = json.loads(os.popen("hyprctl activewindow -j").read()) + print(active_window["title"], flush=True) + return + + prefix = b"activewindow>>" + if not data.startswith(prefix): + return + title = data[len(prefix):] + print(title, flush=True) + self.listen(callback) + + +class SwayHandler(CompositorHandler): + @staticmethod + def get_workspace_info() -> Workspaces: + workspaces = json.loads(os.popen("swaymsg --raw -t get_workspaces").read()) + # REVIEW: This has not been tested on a multi-monitor setup. + workspaces = { + int(w["num"]): w["focused"] + for w in workspaces + } + return workspaces + + def listen_workspaces(self): + with subprocess.Popen(["swaymsg", "-t", "subscribe", "-m", '["workspace"]'], stdout=subprocess.PIPE) as proc: + workspace_info = SwayHandler.get_workspace_info() + print(get_widgets(workspace_info), flush=True) + while line := proc.stdout.readline(): + # FIXME: Use the swaymsg subscribe output + # Not needed + #info = json.loads(line) + workspace_info = SwayHandler.get_workspace_info() + print(get_widgets(workspace_info), flush=True) + + +if __name__ == "__main__": + if len(sys.argv) == 1: + print("Usage: wm-control workspaces|title") + + handler = CompositorHandler.create() + if handler is None: + print("No compositor found.", file=sys.stderr) + + key = sys.argv[1] + + if key == "workspaces": + handler.listen_workspaces() + elif key == "active-title": + handler.listen_active_window_title() + else: + print(f"Unknown key: {key}", file=sys.stderr) diff --git a/eww/bar/scripts/get-workspaces b/eww/bar/scripts/get-workspaces deleted file mode 100755 index 649bd9b..0000000 --- a/eww/bar/scripts/get-workspaces +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python - -""" -Utility to generate the workspace buttons for eww bar widget. - -Currently it fetches information from monitor 0. If all monitors have -synchronised workspaces this should not be a problem. -""" -import os, sys, socket, json, subprocess -from typing import Optional - -WORKSPACE_ICONS = [ - (1, "☱"), - (2, "☲"), - (3, "☳"), - (4, "☴"), - (5, "☵"), - (6, "☶"), - (7, "☷"), - (8, "☰"), -] -EXTRA_WORKSPACE_ICONS = [ - (0, "⚌"), - (1, "⚍"), - (2, "⚎"), - (3, "⚏"), -] - -Workspaces = dict[int, bool] - -def get_widgets(workspaces: Workspaces) -> str: - """ - Create widget sexp from workspace information - """ - def get_class(k): - key = workspaces.get(k, None) - if key is None: - return "inactive" - elif key: - return "focused" - else: - return "active" - - buttons = [ - f'"id": "{k}", "text": "{icon}", "class": "{get_class(k)}"' - for k, icon in WORKSPACE_ICONS - ] - buttons = ", ".join(["{" + b + "}" for b in buttons]) - return "[" + buttons + "]" - - -# Compositor specific information - -def hypr_get_workspace_info() -> Workspaces: - workspaces = json.loads(os.popen("hyprctl workspaces -j").read()) - monitors = json.loads(os.popen("hyprctl monitors -j").read()) - if not monitors: - print("No monitor found!", file=sys.stderr) - return [] - - monitor, active = [ - (m["name"], m["activeWorkspace"]["id"]) for m in monitors if m["id"] == 0 - ][0] - workspaces = { - w["id"]: w["id"] == active - for w in workspaces if w["monitor"] == monitor - } - return workspaces - - -def hypr_listen(socket_addr: str): - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - try: - sock.connect(socket_addr) - except: - print(f"Could not connect to {socket_addr}", file=sys.stderr) - raise - - # The flush here is very important since python by default buffers! - workspace_info = hypr_get_workspace_info() - print(get_widgets(workspace_info), flush=True) - while sock: - data = sock.recv(1024) - if b"workspace" in data: - workspace_info = hypr_get_workspace_info() - print(get_widgets(workspace_info), flush=True) - - -def sway_get_workspace_info() -> Workspaces: - workspaces = json.loads(os.popen("swaymsg --raw -t get_workspaces").read()) - # REVIEW: This has not been tested on a multi-monitor setup. - workspaces = { - int(w["num"]): w["focused"] - for w in workspaces - } - return workspaces - -def sway_listen(): - proc = subprocess.Popen( - ["swaymsg", "-t", "subscribe", "-m", '["workspace"]'], stdout=subprocess.PIPE - ) - workspace_info = sway_get_workspace_info() - print(get_widgets(workspace_info), flush=True) - while line := proc.stdout.readline(): - # Not needed - info = json.loads(line) - workspace_info = sway_get_workspace_info() - print(get_widgets(workspace_info), flush=True) - - -def detect(): - """ - Main entry point, detects the type of compositor used - """ - if signature := os.environ.get("HYPRLAND_INSTANCE_SIGNATURE", None): - # See https://wiki.hyprland.org/IPC/ - xdg_runtime_dir = os.environ["XDG_RUNTIME_DIR"] - socket_addr = f"/{xdg_runtime_dir}/hypr/{signature}/.socket2.sock" - return hypr_listen(socket_addr) - if signature := os.environ.get("SWAYSOCK", None): - return sway_listen() - - print("No compositor found.", file=sys.stderr) - return None - - -if __name__ == "__main__": - detect() diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 355431c..4f4d002 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -11,7 +11,7 @@ monitor=,preferred,auto,auto # See https://wiki.hyprland.org/Configuring/Keywords/ for more # waybar is executed after eww to have the intersection effect at top left -exec-once = hyprpaper & swaync & fcitx5 & eww --config ~/.config/eww/bar open vbar +exec-once = hyprpaper & swaync & fcitx5 & flameshot & eww --config ~/.config/eww/bar open vbar # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf @@ -131,8 +131,8 @@ bind = $mainMod, space, exec, wofi --show drun -I -G #bind = $mainMod, X, exec, hyprctl switchxkblayout wooting-wootingtwo next # code:107 = PrintSc -bind = $mainMod, code:107, exec, grimblast copy screen -bind = $mainMod SHIFT, code:107, exec, grimblast copy area +bind = $mainMod, code:107, exec, flameshot gui +#bind = $mainMod SHIFT, code:107, exec, grimblast copy area # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -195,3 +195,6 @@ bind = $mainMod, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow + +bind = SUPER,Tab,cyclenext, # change focus to another window +bind = SUPER,Tab,bringactivetotop, # bring it to the top From 9147fa3fff100c5162568075c0ae955c06458a02 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 06:21:36 -0700 Subject: [PATCH 04/14] feat: Move set-workspace to compositor-control --- eww/bar/eww.yuck | 2 +- eww/bar/scripts/compositor-control | 17 +++++++++++++++++ eww/bar/scripts/workspace.sh | 4 ---- 3 files changed, 18 insertions(+), 5 deletions(-) delete mode 100755 eww/bar/scripts/workspace.sh diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 884a2db..04c95c5 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -65,7 +65,7 @@ (for workspace in workspaces (button :class "${workspace.class}" - :onclick "scripts/workspace.sh ${workspace.id}" + :onclick "scripts/compositor-control set-workspace ${workspace.id}" "${workspace.text}")) )) (deflisten workspaces :initial "[]" diff --git a/eww/bar/scripts/compositor-control b/eww/bar/scripts/compositor-control index 2b02113..5c531e1 100755 --- a/eww/bar/scripts/compositor-control +++ b/eww/bar/scripts/compositor-control @@ -67,6 +67,8 @@ class CompositorHandler: pass def listen_active_window_title(self): pass + def set_workspace(self, i): + pass class HyprlandHandler(CompositorHandler): def __init__(self, socket_addr): @@ -125,6 +127,15 @@ class HyprlandHandler(CompositorHandler): print(title, flush=True) self.listen(callback) + @override + def set_workspace(self, i): + result = os.popen(f"hyprctl dispatch workspace {i}").read() + if result != "ok\n": + raise RuntimeError(f"Failed to set workspace: {result}") + + # FIXME: Set the wallpaper too. + # ~/.config/hypr/wallpaper.sh $1 + class SwayHandler(CompositorHandler): @staticmethod @@ -163,5 +174,11 @@ if __name__ == "__main__": handler.listen_workspaces() elif key == "active-title": handler.listen_active_window_title() + elif key == "set-workspace": + if len(sys.argv) != 3: + print(f"Set workspace must be accompanied by an argument", file=sys.stderr) + + arg = sys.argv[2] + handler.set_workspace(arg) else: print(f"Unknown key: {key}", file=sys.stderr) diff --git a/eww/bar/scripts/workspace.sh b/eww/bar/scripts/workspace.sh deleted file mode 100755 index 1cc571b..0000000 --- a/eww/bar/scripts/workspace.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -hyprctl dispatch workspace $1 -~/.config/hypr/wallpaper.sh $1 From c601a17ae989b2e206c4821a6b9ea83cdf3bdcf5 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 07:11:20 -0700 Subject: [PATCH 05/14] fix: eww stylesheet and window title --- eww/bar/eww.scss | 38 +++++++++------ eww/bar/eww.yuck | 76 +++++++++++++----------------- eww/bar/scripts/compositor-control | 15 ++++-- 3 files changed, 68 insertions(+), 61 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index 9ae4ecd..b07a8fe 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -14,7 +14,9 @@ $weather: rgba(180, 220, 235, 0.8); $weather_end: rgba(171, 233, 179, 0.8); $clock: rgba(171, 233, 179, 1.0); +$media-progress-bg: #333333; $media: rgba(224, 232, 224, 0.7); +$media-paused: rgba(224, 200, 200, 0.7); $tray_bg: rgba(204, 204, 204, 0.1); $tray: #c9cbff; @@ -25,7 +27,9 @@ $audio: #fae3b0; $backlight: #f8bd96; $bluetooth: #caa9c7; $network: #bd93f9; +$cpu_bg: #333333; $cpu: #96cdfb; +$memory_bg: #333333; $memory: #88bbeb; $temperature: #ddb6f2; $temperature_critical: #ff6666; @@ -114,15 +118,10 @@ box .weather { color: mix($weather_end, $weather, 100%); } } -.audio-scale { - color: $audio; -} -.audio { - all: unset; - border: none; - background-color: transparent; - color: $audio; -} +//.audio-scale .audio .audio-icon { +// background-color: transparent; +// color: $audio; +//} scale { border-radius: 5px; min-height: 80px; @@ -134,18 +133,19 @@ scale { color: $audio; } box .cpu { + background-color: $cpu_bg; color: $cpu; - padding: 6pt; + padding: 5pt; } box .memory { + background-color: $memory_bg; color: $memory; - padding: 6pt; + padding: 5pt; } box .clock { - background-color: $widget_bg; + background-color: transparent; border-radius: 5; color: $clock; - margin-bottom: 30px; padding: 2pt 2pt 2pt 2pt; } @@ -158,7 +158,17 @@ box .clock { color: $media; border: none; } - +.media-playing { + background-color: $media-progress-bg; + color: $media; +} +.media-paused { + background-color: $media-progress-bg; + color: $media-paused; +} +.media-text-paused { + color: $media-paused; +} .status { font-family: monospace; } diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 04c95c5..3ad2d02 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -8,7 +8,7 @@ :x "0%" :y "0%" :width "20px" - :height "100%" + :height "99%" :anchor "center left" ) :reserve (struts :side "left" :distance "20px") @@ -24,7 +24,6 @@ (widget-workspaces) ) (widget-media) - ;(widget-weather :orientation "v") (box :orientation "v" :space-evenly false :valign "end" (widget-tray) (widget-audio) @@ -104,45 +103,49 @@ :orientation "v" :space-evenly false :valign "center" - (circular-progress - :class "media" - :width 20 - :height 20 - :thickness 5 - ;:tooltip {music_listener_position} - :tooltip "${music_position} / ${music_length}" - :value {100.0 * music_position / (music_length / 1000000.0)} - :visible {music_listener != "" && music_length != 1} - ) - ; Add play and pause buttons here? + (eventbox + :onclick "playerctl play-pause" + (circular-progress + :class { media-status == "Paused" ? "media-paused" : "media-playing" } + :width 20 + :height 20 + :thickness 5 + :tooltip {media-position-text} + :value {100.0 * media-position / (media-length / 1000000.0)} + :visible {media-current != "" && media-length != 1} + )) (label + :class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" } :angle 270 :xalign 0.5 :yalign 0.5 :justify "center" - :text {music_listener != "" ? "『${music_listener}』" : "『』"}) + :text {media-current != "" ? "『${media-current}』" : "『』"}) )) -(deflisten music_listener :initial "" + +(deflisten media-current :initial "" "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") -(deflisten music_listener_position :initial "" +(deflisten media-position-text :initial "" "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") -(defpoll music_position :interval "1s" +(defpoll media-position :interval "1s" "playerctl position") -(deflisten music_length :initial 1 +(deflisten media-length :initial 1 "playerctl --follow metadata mpris:length") +(deflisten media-status :initial "Stopped" + "playerctl --follow status") (defwidget widget-audio [] (eventbox :class "audio" - :onhover "${eww} update show_audio=true" - :onhoverlost "${eww} update show_audio=false" + :onhover "${eww} update show-audio=true" + :onhoverlost "${eww} update show-audio=false" (box :class "audio" :orientation "v" :space-evenly "false" :spacing "2" - (revealer :transition "slideup" :reveal show_audio + (revealer :transition "slideup" :reveal show-audio (scale :class "audio-scale" :value current-volume @@ -153,13 +156,15 @@ :max 101 :min 0 :onchange "amixer -D pulse sset Master {}%" )) - (button - :class "audio" - :onclick "scripts/popup audio" + (label + :class "audio-icon" + :width 20 :height 20 + :xalign 0.5 :yalign 0.5 + :noindent true :tooltip "Volume: ${current-volume}%" - :class "volume-icon" "")))) + :text { current-volume == 0 ? "" : (current-volume > 80 ? "" : "") })))) (defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") -(defvar show_audio false) +(defvar show-audio false) (defwidget widget-cpu [] (circular-progress @@ -194,7 +199,7 @@ :orientation "v" :valign "end" :spacing 1 - :width 25 + :width 20 (box :class "icon" "") "${clock.m}" "${clock.d}" (box :class "icon" "") @@ -231,23 +236,6 @@ (defpoll calendar_year :interval "10h" "date '+%Y'") -; Unused widgets - -;(defwidget widget_status [] -; (box -; :class "status" -; :orientation "v" -; :space-evenly false -; :valign "end" -; (metric :label "" -; :value volume -; :onchange "amixer -D pulse sset Master {}%") -; (metric :label "" -; :value {EWW_RAM.used_mem_perc} -; :onchange "") -; (widget_clock))) - - (defwidget metric [label value onchange] (box :orientation "v" diff --git a/eww/bar/scripts/compositor-control b/eww/bar/scripts/compositor-control index 5c531e1..656bf38 100755 --- a/eww/bar/scripts/compositor-control +++ b/eww/bar/scripts/compositor-control @@ -121,10 +121,19 @@ class HyprlandHandler(CompositorHandler): return prefix = b"activewindow>>" - if not data.startswith(prefix): + payload = next((l[len(prefix):] + for l in reversed(data.split(b'\n')) + if l.startswith(prefix)), None) + + if payload is None: return - title = data[len(prefix):] - print(title, flush=True) + + if b',' in payload: + _, title = payload.decode('utf-8').split(',', 1) + print(title, flush=True) + else: + print("", flush=True) + self.listen(callback) @override From aecf181eacb8f0db62494a1ab91f15ecfc687b3b Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 14:57:12 -0700 Subject: [PATCH 06/14] feat: Eww bar capture control --- eww/bar/eww.scss | 179 ++++++++++++++++------------------ eww/bar/eww.yuck | 158 ++++++++++++++++++------------ eww/bar/scripts/get-volume.sh | 3 - 3 files changed, 175 insertions(+), 165 deletions(-) delete mode 100755 eww/bar/scripts/get-volume.sh diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index b07a8fe..be13cdf 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -18,35 +18,49 @@ $media-progress-bg: #333333; $media: rgba(224, 232, 224, 0.7); $media-paused: rgba(224, 200, 200, 0.7); -$tray_bg: rgba(204, 204, 204, 0.1); +// Dims the desktop background so status icons can be seen against darker wallpapers +$status_bg: rgba(0, 0, 0, 0.3); +$tray_bg: rgba(204, 204, 204, 0.1); $tray: #c9cbff; $keyboard: #f2cdcd; $language: #e8a2af; $idle_inhibitor: #f28fad; $audio: #fae3b0; -$backlight: #f8bd96; -$bluetooth: #caa9c7; -$network: #bd93f9; +$network: #f8bd96; +$backlight: #bd93f9; $cpu_bg: #333333; $cpu: #96cdfb; $memory_bg: #333333; -$memory: #88bbeb; +// previously bluetooth colour +$memory: #caa9c7; +//$memory: #88bbeb; $temperature: #ddb6f2; $temperature_critical: #ff6666; $battery: #b6b2b3; -//* { all: unset; } +// Styles all scales +scale trough { + all: unset; + background-color: #333333; + border-radius: 5px; + min-height: 80px; + min-width: 2px; + //margin: .3rem 0 .3rem 0; +} +trough highlight { + all: unset; + background-color: #eeeeee; + border-radius: 5px; +} +trough slider { + background-color: transparent; + border-width: 0px; + border-radius: 10px; +} .vbar { background-color: transparent; - margin-left: 5px; - font-size: 15px; - font-family: monospace; -} -.hbar { - background-color: transparent; - margin-top: 5px; font-size: 15px; font-family: monospace; } @@ -58,7 +72,7 @@ $battery: #b6b2b3; .launcher { all: unset; font-size: 40px; - margin: -2px -5px 5px -3px; + margin: -2px -5px 5px 0px; } box .workspaces { @@ -88,6 +102,10 @@ box .workspaces { } } +box .status { + background-color: $status_bg; +} + box .weather { color: $weather; margin-left: 2px; @@ -118,100 +136,67 @@ box .weather { color: mix($weather_end, $weather, 100%); } } -//.audio-scale .audio .audio-icon { -// background-color: transparent; -// color: $audio; -//} -scale { - border-radius: 5px; - min-height: 80px; - min-width: 10px; - margin: .3rem 0 .3rem 0; -} -.volume-icon { - margin: 2pt 0 2pt 0; - color: $audio; -} -box .cpu { - background-color: $cpu_bg; - color: $cpu; - padding: 5pt; -} -box .memory { - background-color: $memory_bg; - color: $memory; - padding: 5pt; -} -box .clock { +.audio { background-color: transparent; - border-radius: 5; - color: $clock; - padding: 2pt 2pt 2pt 2pt; + .icon { + color: $audio; + } + color: $audio; + border-left: 2px solid $audio; + margin-bottom: 1px; + margin-top: 1px; } .media { font-family: "Noto Serif"; - padding-left: 5px; - padding-right: 5px; min-height: 15px; min-width: 15px; color: $media; border: none; -} -.media-playing { - background-color: $media-progress-bg; - color: $media; -} -.media-paused { - background-color: $media-progress-bg; - color: $media-paused; -} -.media-text-paused { - color: $media-paused; -} -.status { - font-family: monospace; + + .media-text-playing { + padding-left: 10px; + } + .media-text-paused { + padding-left: 10px; + color: $media-paused; + } + .media-playing { + background-color: $media-progress-bg; + color: $media; + } + .media-paused { + background-color: $media-progress-bg; + color: $media-paused; + } } +box .cpu { + .progress { + background-color: $cpu_bg; + } + color: $cpu; + border-left: 2px solid $cpu; + margin-bottom: 1px; + margin-top: 1px; +} +box .memory { + .progress { + background-color: $memory_bg; + } + color: $memory; + border-left: 2px solid $memory; + margin-bottom: 1px; + margin-top: 1px; +} +box .clock { + background-color: transparent; + color: $clock; + margin-top: 1px; + border-left: 2px solid $clock; +} .systray { - background-color: $tray_bg; + //background-color: $tray_bg; color: $tray; -} - -// Styles on classes (see eww.yuck for more information) - -.status slider { - all: unset; - color: #ffd5cd; -} - -.metric scale trough highlight { - all: unset; - background-color: #D35D6E; - color: #000000; - border-radius: 10px; -} -.metric scale trough { - all: unset; - background-color: #4e4e4e; - border-radius: 50px; - min-height: 3px; - min-width: 50px; - margin-left: 10px; - margin-right: 20px; -} -.metric scale trough highlight { - all: unset; - background-color: #D35D6E; - color: #000000; - border-radius: 10px; -} -.metric scale trough { - all: unset; - background-color: #4e4e4e; - border-radius: 50px; - min-height: 3px; - min-width: 50px; - margin-left: 10px; - margin-right: 20px; + border-left: 2px dotted $tray; } diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 3ad2d02..6af57f5 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -1,4 +1,5 @@ -(defvar eww "eww --config $HOME/.config/eww/bar") +(defvar eww-flags "--config $HOME/.config/eww/bar") +(defvar amixer "amixer -D pulse") (defwindow vbar :exclusive true @@ -15,7 +16,6 @@ (centerbox :orientation "v" (box :orientation "v" :space-evenly false :valign "start" - ;(box :class "launcher" :valign "start" :width "10px" :height "10px" "☯") (label :class "launcher" :valign "start" :width "20px" :height "20px" :unindent true @@ -24,14 +24,17 @@ (widget-workspaces) ) (widget-media) - (box :orientation "v" :space-evenly false :valign "end" + (box + :class "status" + :orientation "v" :space-evenly false :valign "end" (widget-tray) - (widget-audio) + (widget-volume) + (widget-microphone) + ;(widget-temperature) (widget-cpu) (widget-memory) (widget-clock) ) - ;(widget_status) )) (defwindow hbar :exclusive true @@ -73,30 +76,6 @@ "scripts/compositor-control active-title") -; Weather - -(defwidget widget-weather [orientation] - (box - :class "weather" - :orientation orientation - :space-evenly false - :valign "start" - :halign "center" - :spacing 10 - (button :onclick "scripts/popup weather" "W") - )) - -(defpoll weather-text :initial "" :interval "180s" - "curl --max-time 2 wttr.in") - -(defwindow weather - :geometry (geometry :x "70px" - :y "50%" - :width "270px" - :height "60px") - (box weather-text)) - - (defwidget widget-media [] (box :class "media" @@ -115,11 +94,12 @@ :visible {media-current != "" && media-length != 1} )) (label - :class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" } + :class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" } :angle 270 :xalign 0.5 :yalign 0.5 :justify "center" + :limit-width 120 :text {media-current != "" ? "『${media-current}』" : "『』"}) )) @@ -135,55 +115,99 @@ (deflisten media-status :initial "Stopped" "playerctl --follow status") -(defwidget widget-audio [] +(defwidget widget-volume [] (eventbox - :class "audio" - :onhover "${eww} update show-audio=true" - :onhoverlost "${eww} update show-audio=false" + :onhover "${EWW_EXECUTABLE} ${eww-flags} update show-volume=true" + :onhoverlost "${EWW_EXECUTABLE} ${eww-flags} update show-volume=false" + :onclick "${amixer} sset Master toggle" (box :class "audio" :orientation "v" :space-evenly "false" :spacing "2" - (revealer :transition "slideup" :reveal show-audio + :tooltip "Volume: ${current-volume}%" + (revealer :transition "slideup" :reveal show-volume (scale - :class "audio-scale" + :class "scale" :value current-volume :orientation "v" :flipped true :marks true - :tooltip "Volume: ${current-volume}%" :max 101 :min 0 - :onchange "amixer -D pulse sset Master {}%" )) + :onchange "${amixer} sset Master {}%" )) (label - :class "audio-icon" + :class "icon" :width 20 :height 20 :xalign 0.5 :yalign 0.5 :noindent true - :tooltip "Volume: ${current-volume}%" - :text { current-volume == 0 ? "" : (current-volume > 80 ? "" : "") })))) + :text { current-volume-state == "off" ? "" : (current-volume > 80 ? "" : "") })))) +(defwidget widget-microphone [] + (eventbox + :onhover "${EWW_EXECUTABLE} ${eww-flags} update show-microphone=true" + :onhoverlost "${EWW_EXECUTABLE} ${eww-flags} update show-microphone=false" + :onclick "${amixer} sset Capture toggle" + (box + :class "audio" + :orientation "v" + :space-evenly "false" + :spacing "2" + :tooltip "Capture : ${current-microphone}%" + (revealer :transition "slideup" :reveal show-microphone + (scale + :class "scale" + :value current-microphone + :orientation "v" + :flipped true + :marks true + :max 101 + :min 0 + :onchange "${amixer} sset Capture {}%" )) + (label + :class "icon" + :width 20 :height 20 + :xalign 0.5 :yalign 0.5 + :noindent true + :text { current-microphone-state == "off" ? "" : "" })))) (defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") -(defvar show-audio false) +(defpoll current-volume-state :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'") +(defpoll current-microphone :interval "1s" "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll current-microphone-state :interval "1s" "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $4 }'") +(defvar show-volume false) +(defvar show-microphone false) +(defwidget widget-temperature [] + (label + :class "temperature" + :width 20 + :height 20 + :tooltip {EWW_TEMPS} + :text "" + )) (defwidget widget-cpu [] - (circular-progress - :class "cpu" + (box + :class "cpu" + :orientation "v" + (circular-progress + :class "progress" :width 20 :height 20 :thickness 4 - :tooltip {EWW_CPU.cores} + :tooltip " ${round(EWW_CPU.avg, 2)}%" :value {EWW_CPU.avg} - )) + ))) (defwidget widget-memory [] - (circular-progress - :class "memory" + (box + :class "memory" + :orientation "v" + (circular-progress + :class "progress" :width 20 :height 20 :thickness 4 - :tooltip "${EWW_RAM.used_mem} / ${EWW_RAM.total_mem}" + :tooltip " ${round(100 * EWW_RAM.used_mem / EWW_RAM.total_mem, 2)}%" :value {EWW_RAM.used_mem_perc} - )) + ))) (defwidget widget-tray [] (systray :class "systray" @@ -200,7 +224,7 @@ :valign "end" :spacing 1 :width 20 - (box :class "icon" "") + ;(box :class "icon" "") "${clock.m}" "${clock.d}" (box :class "icon" "") "${clock.H}" "${clock.M}" @@ -210,7 +234,6 @@ "date '+{\"H\":\"%H\", \"M\":\"%M\", \"d\":\"%d\", \"m\":\"%m\", \"b\":\"%b\", \"Y\":\"%Y\"}'") - ; Calendar (defwindow calendar @@ -236,20 +259,25 @@ (defpoll calendar_year :interval "10h" "date '+%Y'") -(defwidget metric [label value onchange] +; Weather + +(defwidget widget-weather [orientation] (box - :orientation "v" - :class "metric" + :class "weather" + :orientation orientation :space-evenly false - (box :class "label" label) - (circular-progress :value value) - ;(scale - ; :min 0 :max 101 - ; :active {onchange != ""} - ; :orientation "v" - ; :value value - ; :onchange onchange) + :valign "start" + :halign "center" + :spacing 10 + (button :onclick "scripts/popup weather" "W") )) -(defpoll volume :initial 0 :interval "1s" - "scripts/get-volume.sh") +(defpoll weather-text :initial "" :interval "180s" + "curl --max-time 2 wttr.in") + +(defwindow weather + :geometry (geometry :x "70px" + :y "50%" + :width "270px" + :height "60px") + (box weather-text)) diff --git a/eww/bar/scripts/get-volume.sh b/eww/bar/scripts/get-volume.sh deleted file mode 100755 index a868b03..0000000 --- a/eww/bar/scripts/get-volume.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1 From 45cddf83899196dacc7028ca3fc1701b4676ff79 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 15:05:58 -0700 Subject: [PATCH 07/14] feat: Show current master/capture state --- eww/bar/eww.yuck | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 6af57f5..2f46e77 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -125,7 +125,7 @@ :orientation "v" :space-evenly "false" :spacing "2" - :tooltip "Volume: ${current-volume}%" + :tooltip "Volume: ${current-volume}% [${current-volume-state}]" (revealer :transition "slideup" :reveal show-volume (scale :class "scale" @@ -152,7 +152,7 @@ :orientation "v" :space-evenly "false" :spacing "2" - :tooltip "Capture : ${current-microphone}%" + :tooltip "Capture : ${current-microphone}% [${current-microphone-state}]" (revealer :transition "slideup" :reveal show-microphone (scale :class "scale" From 664e5ed27ab14723dbf0e2348c1146a488567148 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 15:28:59 -0700 Subject: [PATCH 08/14] chore: Remove unused hbar --- eww/bar/eww.yuck | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 2f46e77..124a503 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -36,26 +36,6 @@ (widget-clock) ) )) -(defwindow hbar - :exclusive true - :monitor 0 - :windowtype "dock" - :geometry (geometry - :x "0%" - :y "0%" - :width "90%" - :height "20px" - :anchor "top center" - ) - :reserve (struts :side "top" :distance "20px") - (centerbox :orientation "h" - (box :orientation "h") - (box :orientation "h") - (box :orientation "h" :space-evenly false :halign "end" - (widget-cpu) - (widget-memory) - ) - )) (defwidget widget-workspaces [] (box From 9b2bd7ad99509ddafcbefc8622d2d73522d72ec9 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 18:23:39 -0700 Subject: [PATCH 09/14] feat: Simplification and time display --- eww/bar/eww.scss | 26 ++++++++++++++++++-------- eww/bar/eww.yuck | 24 ++++++++++++------------ hypr/hyprland.conf | 1 - sway/launch.conf | 10 +++++----- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index be13cdf..d5cf9ea 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -23,9 +23,9 @@ $status_bg: rgba(0, 0, 0, 0.3); $tray_bg: rgba(204, 204, 204, 0.1); $tray: #c9cbff; $keyboard: #f2cdcd; -$language: #e8a2af; $idle_inhibitor: #f28fad; -$audio: #fae3b0; +$volume: #fae3b0; +$microphone: #e8a2af; $network: #f8bd96; $backlight: #bd93f9; $cpu_bg: #333333; @@ -136,15 +136,25 @@ box .weather { color: mix($weather_end, $weather, 100%); } } -.audio { +.volume { background-color: transparent; - .icon { - color: $audio; - } - color: $audio; - border-left: 2px solid $audio; + color: $volume; + border-left: 2px solid $volume; margin-bottom: 1px; margin-top: 1px; + highlight { + background-color: $volume; + } +} +.microphone { + background-color: transparent; + color: $microphone; + border-left: 2px solid $microphone; + margin-bottom: 1px; + margin-top: 1px; + highlight { + background-color: $microphone; + } } .media { diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 124a503..e051cf1 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -1,4 +1,3 @@ -(defvar eww-flags "--config $HOME/.config/eww/bar") (defvar amixer "amixer -D pulse") (defwindow vbar @@ -97,11 +96,11 @@ (defwidget widget-volume [] (eventbox - :onhover "${EWW_EXECUTABLE} ${eww-flags} update show-volume=true" - :onhoverlost "${EWW_EXECUTABLE} ${eww-flags} update show-volume=false" + :onhover "${EWW_CMD} update show-volume=true" + :onhoverlost "${EWW_CMD} update show-volume=false" :onclick "${amixer} sset Master toggle" (box - :class "audio" + :class "volume" :orientation "v" :space-evenly "false" :spacing "2" @@ -121,14 +120,14 @@ :width 20 :height 20 :xalign 0.5 :yalign 0.5 :noindent true - :text { current-volume-state == "off" ? "" : (current-volume > 80 ? "" : "") })))) + :text { current-volume-state == "off" ? "" : (current-volume > 50 ? "" : "") })))) (defwidget widget-microphone [] (eventbox - :onhover "${EWW_EXECUTABLE} ${eww-flags} update show-microphone=true" - :onhoverlost "${EWW_EXECUTABLE} ${eww-flags} update show-microphone=false" + :onhover "${EWW_CMD} update show-microphone=true" + :onhoverlost "${EWW_CMD} update show-microphone=false" :onclick "${amixer} sset Capture toggle" (box - :class "audio" + :class "microphone" :orientation "v" :space-evenly "false" :spacing "2" @@ -149,10 +148,10 @@ :xalign 0.5 :yalign 0.5 :noindent true :text { current-microphone-state == "off" ? "" : "" })))) -(defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") -(defpoll current-volume-state :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'") -(defpoll current-microphone :interval "1s" "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") -(defpoll current-microphone-state :interval "1s" "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $4 }'") +(defpoll current-volume :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll current-volume-state :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'") +(defpoll current-microphone :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll current-microphone-state :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $4 }'") (defvar show-volume false) (defvar show-microphone false) @@ -204,6 +203,7 @@ :valign "end" :spacing 1 :width 20 + :tooltip {formattime(EWW_TIME, "%F (%a) %T [%Z]")} ;(box :class "icon" "") "${clock.m}" "${clock.d}" (box :class "icon" "") diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 4f4d002..a0865ec 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -10,7 +10,6 @@ monitor=,preferred,auto,auto # See https://wiki.hyprland.org/Configuring/Keywords/ for more -# waybar is executed after eww to have the intersection effect at top left exec-once = hyprpaper & swaync & fcitx5 & flameshot & eww --config ~/.config/eww/bar open vbar # Source a file (multi-file configs) diff --git a/sway/launch.conf b/sway/launch.conf index ddd1921..f835fc7 100644 --- a/sway/launch.conf +++ b/sway/launch.conf @@ -1,9 +1,9 @@ exec /usr/share/swayfx/scripts/inactive-windows-transparency --opacity 0.8 -exec_always eww --config ~/.config/eww/bar open bar -bar { - position top - swaybar_command waybar -} +exec_always eww --config ~/.config/eww/bar open vbar +#bar { +# position top +# swaybar_command waybar +#} exec_always multibg-sway ~/.config/sway/wallpapers exec swaync exec fcitx5 From 07aef5a19b1620eff19701cfd0789b7e84b31897 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 2 Jun 2024 23:51:55 -0700 Subject: [PATCH 10/14] feat: eww temperature monitoring --- eww/bar/eww.scss | 37 +++++++++++++++++++++++--- eww/bar/eww.yuck | 67 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 83 insertions(+), 21 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index d5cf9ea..c910987 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -34,12 +34,27 @@ $memory_bg: #333333; // previously bluetooth colour $memory: #caa9c7; //$memory: #88bbeb; -$temperature: #ddb6f2; -$temperature_critical: #ff6666; -$battery: #b6b2b3; +$temperature-bg: rgba(180, 180, 180, 0.5); +$temperature: #b6b2b3; +$temperature-critical: #ff6666; +$battery: #ddb6f2; // Styles all scales +progressbar trough { + all: unset; + background-color: #333333; + border-radius: 5px; + min-height: 80px; + min-width: 2px; + //margin: .3rem 0 .3rem 0; +} +trough progress { + all: unset; + background-color: #00ff00; + border-radius: 5px; + min-width: 2px; +} scale trough { all: unset; background-color: #333333; @@ -181,6 +196,22 @@ box .weather { } } +box .temperature { + color: $temperature; + border-left: 2px solid $temperature-bg; + margin-bottom: 1px; + margin-top: 1px; +} +.temperature-progress trough progress { + background-color: $temperature; +} +.temperature-progress-cpu trough progress { + background-color: mix($cpu, $temperature, 50%); +} +.temperature-progress-critical trough progress { + background-color: $temperature-critical; +} + box .cpu { .progress { background-color: $cpu_bg; diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index e051cf1..0ac47d1 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -1,4 +1,5 @@ (defvar amixer "amixer -D pulse") +(defvar temperature-monitor "psensor") (defwindow vbar :exclusive true @@ -14,9 +15,12 @@ :reserve (struts :side "left" :distance "20px") (centerbox :orientation "v" - (box :orientation "v" :space-evenly false :valign "start" + (box + :orientation "v" :space-evenly false :valign "start" (label - :class "launcher" :valign "start" :width "20px" :height "20px" + :class "launcher" + :valign "start" + :width "20px" :height "20px" :unindent true :tooltip active-window-title :text "☯") @@ -29,7 +33,7 @@ (widget-tray) (widget-volume) (widget-microphone) - ;(widget-temperature) + (widget-temperature) (widget-cpu) (widget-memory) (widget-clock) @@ -41,7 +45,8 @@ :class "workspaces" :orientation "v" :space-evenly true - :valign "start" :spacing 10 + :spacing 10 + :valign "start" :halign "center" (for workspace in workspaces (button @@ -61,6 +66,7 @@ :orientation "v" :space-evenly false :valign "center" + :tooltip {media-position-text} (eventbox :onclick "playerctl play-pause" (circular-progress @@ -68,7 +74,6 @@ :width 20 :height 20 :thickness 5 - :tooltip {media-position-text} :value {100.0 * media-position / (media-length / 1000000.0)} :visible {media-current != "" && media-length != 1} )) @@ -148,21 +153,45 @@ :xalign 0.5 :yalign 0.5 :noindent true :text { current-microphone-state == "off" ? "" : "" })))) -(defpoll current-volume :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") -(defpoll current-volume-state :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'") -(defpoll current-microphone :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll current-volume :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll current-volume-state :interval "1s" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }'") +(defpoll current-microphone :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") (defpoll current-microphone-state :interval "1s" "amixer sget Capture | grep 'Left:' | awk -F'[][]' '{ print $4 }'") (defvar show-volume false) (defvar show-microphone false) +; FIXME: Maybe use a env var here instead +(defvar cpu-temp-key "ASUS_WMI_SENSORS_CPU_TEMPERATURE") +(defvar gpu-temp-key "AMDGPU_MEM") +(defvar temperature-threshold 80) + (defwidget widget-temperature [] - (label - :class "temperature" - :width 20 - :height 20 - :tooltip {EWW_TEMPS} - :text "" - )) + (eventbox + :onclick temperature-monitor + (box + :class "temperature" + :orientation "h" + :tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}C; GPU ${EWW_TEMPS[gpu-temp-key]}C" + :space-evenly true + :width 20 + :halign "" :valign "center" + (progress + :class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" } + :halign "center" :valign "center" + :flipped "true" + :width 3 + :orientation "v" + :value {EWW_TEMPS[cpu-temp-key]} + ) + (progress + :class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress" } + :halign "center" :valign "center" + :flipped "true" + :width 3 + :orientation "v" + :value {EWW_TEMPS[gpu-temp-key]} + ) + ))) (defwidget widget-cpu [] (box :class "cpu" @@ -205,9 +234,11 @@ :width 20 :tooltip {formattime(EWW_TIME, "%F (%a) %T [%Z]")} ;(box :class "icon" "") - "${clock.m}" "${clock.d}" - (box :class "icon" "") - "${clock.H}" "${clock.M}" + (label :text "${clock.m}") + (label :text "${clock.d}") + (label :class "icon" :text "") + (label :text "${clock.H}") + (label :text "${clock.M}") )) (defpoll clock :initial "{}" :interval "10s" From b48bfabe9a6c34dad1d95c584ccc02af806a8733 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Mon, 3 Jun 2024 00:03:45 -0700 Subject: [PATCH 11/14] fix: Icon size to 25 --- eww/bar/eww.scss | 22 ++++++++++++---------- eww/bar/eww.yuck | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index c910987..917d714 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -12,7 +12,6 @@ $workspace_hover: #2E5DFF; $widget_bg: rgba(40, 40, 40, 0.5); $weather: rgba(180, 220, 235, 0.8); $weather_end: rgba(171, 233, 179, 0.8); -$clock: rgba(171, 233, 179, 1.0); $media-progress-bg: #333333; $media: rgba(224, 232, 224, 0.7); @@ -20,7 +19,7 @@ $media-paused: rgba(224, 200, 200, 0.7); // Dims the desktop background so status icons can be seen against darker wallpapers $status_bg: rgba(0, 0, 0, 0.3); -$tray_bg: rgba(204, 204, 204, 0.1); +$tray-bg: rgba(204, 204, 204, 0.3); $tray: #c9cbff; $keyboard: #f2cdcd; $idle_inhibitor: #f28fad; @@ -28,9 +27,9 @@ $volume: #fae3b0; $microphone: #e8a2af; $network: #f8bd96; $backlight: #bd93f9; -$cpu_bg: #333333; +$cpu-bg: #333333; $cpu: #96cdfb; -$memory_bg: #333333; +$memory-bg: #333333; // previously bluetooth colour $memory: #caa9c7; //$memory: #88bbeb; @@ -38,6 +37,7 @@ $temperature-bg: rgba(180, 180, 180, 0.5); $temperature: #b6b2b3; $temperature-critical: #ff6666; $battery: #ddb6f2; +$clock: rgba(171, 233, 179, 1.0); // Styles all scales @@ -76,7 +76,7 @@ trough slider { .vbar { background-color: transparent; - font-size: 15px; + font-size: 20px; font-family: monospace; } @@ -176,6 +176,7 @@ box .weather { font-family: "Noto Serif"; min-height: 15px; min-width: 15px; + font-size: 15px; color: $media; border: none; @@ -202,19 +203,19 @@ box .temperature { margin-bottom: 1px; margin-top: 1px; } -.temperature-progress trough progress { - background-color: $temperature; -} .temperature-progress-cpu trough progress { background-color: mix($cpu, $temperature, 50%); } +.temperature-progress-gpu trough progress { + background-color: $temperature; +} .temperature-progress-critical trough progress { background-color: $temperature-critical; } box .cpu { .progress { - background-color: $cpu_bg; + background-color: $cpu-bg; } color: $cpu; border-left: 2px solid $cpu; @@ -223,7 +224,7 @@ box .cpu { } box .memory { .progress { - background-color: $memory_bg; + background-color: $memory-bg; } color: $memory; border-left: 2px solid $memory; @@ -240,4 +241,5 @@ box .clock { //background-color: $tray_bg; color: $tray; border-left: 2px dotted $tray; + border-bottom: 2px dotted $tray-bg; } diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index 0ac47d1..ab9ce69 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -8,7 +8,7 @@ :geometry (geometry :x "0%" :y "0%" - :width "20px" + :width "25px" :height "99%" :anchor "center left" ) @@ -122,7 +122,7 @@ :onchange "${amixer} sset Master {}%" )) (label :class "icon" - :width 20 :height 20 + :width 25 :height 20 :xalign 0.5 :yalign 0.5 :noindent true :text { current-volume-state == "off" ? "" : (current-volume > 50 ? "" : "") })))) @@ -149,7 +149,7 @@ :onchange "${amixer} sset Capture {}%" )) (label :class "icon" - :width 20 :height 20 + :width 25 :height 20 :xalign 0.5 :yalign 0.5 :noindent true :text { current-microphone-state == "off" ? "" : "" })))) @@ -173,7 +173,7 @@ :orientation "h" :tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}C; GPU ${EWW_TEMPS[gpu-temp-key]}C" :space-evenly true - :width 20 + :width 25 :halign "" :valign "center" (progress :class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" } @@ -184,7 +184,7 @@ :value {EWW_TEMPS[cpu-temp-key]} ) (progress - :class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress" } + :class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-gpu" } :halign "center" :valign "center" :flipped "true" :width 3 @@ -198,8 +198,8 @@ :orientation "v" (circular-progress :class "progress" - :width 20 - :height 20 + :width 25 + :height 25 :thickness 4 :tooltip " ${round(EWW_CPU.avg, 2)}%" :value {EWW_CPU.avg} @@ -210,8 +210,8 @@ :orientation "v" (circular-progress :class "progress" - :width 20 - :height 20 + :width 25 + :height 25 :thickness 4 :tooltip " ${round(100 * EWW_RAM.used_mem / EWW_RAM.total_mem, 2)}%" :value {EWW_RAM.used_mem_perc} @@ -221,7 +221,7 @@ :class "systray" :orientation "v" :space-evenly true - :icon-size 20 + :icon-size 25 :prepend-new true )) From a2eb17df7e810ffe2e46785fd0cf271e201e978d Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 7 Jun 2024 14:40:46 -0700 Subject: [PATCH 12/14] feat: Eww bar colour adjustments --- eww/bar/eww.scss | 53 ++++++++++++++++++++++++++----------- eww/bar/eww.yuck | 69 ++++++++++++++++++++++++++---------------------- 2 files changed, 76 insertions(+), 46 deletions(-) diff --git a/eww/bar/eww.scss b/eww/bar/eww.scss index 917d714..a0b7101 100644 --- a/eww/bar/eww.scss +++ b/eww/bar/eww.scss @@ -13,9 +13,13 @@ $widget_bg: rgba(40, 40, 40, 0.5); $weather: rgba(180, 220, 235, 0.8); $weather_end: rgba(171, 233, 179, 0.8); -$media-progress-bg: #333333; -$media: rgba(224, 232, 224, 0.7); -$media-paused: rgba(224, 200, 200, 0.7); +$trough: rgba(0, 0, 0, 0.5); + +$media-progress-bg: rgba(224, 232, 224, 0.1); +$media-paused-progress-bg: rgba(224, 200, 200, 0.1); +$media: rgba(224, 232, 224, 0.7); +$media-paused: rgba(224, 200, 200, 0.7); +$media-stopped: rgba(200, 200, 200, 0.5); // Dims the desktop background so status icons can be seen against darker wallpapers $status_bg: rgba(0, 0, 0, 0.3); @@ -27,23 +31,25 @@ $volume: #fae3b0; $microphone: #e8a2af; $network: #f8bd96; $backlight: #bd93f9; -$cpu-bg: #333333; + +// Unused in favour of bluetooth widget +$bluetooth: #88bbeb; $cpu: #96cdfb; -$memory-bg: #333333; +$cpu-bg: rgba(150, 205, 251, 0.3); // previously bluetooth colour $memory: #caa9c7; -//$memory: #88bbeb; +$memory-bg: rgba(202, 169, 199, 0.3); $temperature-bg: rgba(180, 180, 180, 0.5); $temperature: #b6b2b3; $temperature-critical: #ff6666; -$battery: #ddb6f2; -$clock: rgba(171, 233, 179, 1.0); +$battery: #ddb6f2; +$clock: rgba(171, 233, 179, 1.0); // Styles all scales progressbar trough { all: unset; - background-color: #333333; + background-color: $trough; border-radius: 5px; min-height: 80px; min-width: 2px; @@ -51,21 +57,20 @@ progressbar trough { } trough progress { all: unset; - background-color: #00ff00; + background-color: #00ff00; // Diagnostics colour border-radius: 5px; min-width: 2px; } scale trough { all: unset; - background-color: #333333; + background-color: $trough; border-radius: 5px; min-height: 80px; min-width: 2px; - //margin: .3rem 0 .3rem 0; } trough highlight { all: unset; - background-color: #eeeeee; + background-color: #ff0000; // Diagnostics colour border-radius: 5px; } trough slider { @@ -119,6 +124,7 @@ box .workspaces { box .status { background-color: $status_bg; + border-radius: 5px; } box .weather { @@ -187,14 +193,21 @@ box .weather { padding-left: 10px; color: $media-paused; } + .media-text-stopped { + padding-left: 10px; + color: $media-stopped; + } .media-playing { background-color: $media-progress-bg; - color: $media; } .media-paused { - background-color: $media-progress-bg; + background-color: $media-paused-progress-bg; color: $media-paused; } + .media-stopped { + background-color: $media-paused-progress-bg; + color: $media-stopped; + } } box .temperature { @@ -202,6 +215,12 @@ box .temperature { border-left: 2px solid $temperature-bg; margin-bottom: 1px; margin-top: 1px; + +} +.temperature-icon { + padding-left: 5px; + font-size: 20px; + color: mix($temperature, transparent, 70%); } .temperature-progress-cpu trough progress { background-color: mix($cpu, $temperature, 50%); @@ -235,7 +254,11 @@ box .clock { background-color: transparent; color: $clock; margin-top: 1px; + font-family: Ariel; border-left: 2px solid $clock; + .icon { + color: mix($clock, transparent, 50%); + } } .systray { //background-color: $tray_bg; diff --git a/eww/bar/eww.yuck b/eww/bar/eww.yuck index ab9ce69..be1ffa0 100644 --- a/eww/bar/eww.yuck +++ b/eww/bar/eww.yuck @@ -65,34 +65,35 @@ :class "media" :orientation "v" :space-evenly false - :valign "center" - :tooltip {media-position-text} + :valign "end" + :tooltip "${media-status == 'Paused' ? '' : media-status == 'Playing' ? '' : ''} ${media-position-text}" (eventbox :onclick "playerctl play-pause" (circular-progress - :class { media-status == "Paused" ? "media-paused" : "media-playing" } + :class { media-status == "Paused" ? "media-paused" : media-status == "Stopped" ? "media-stopped" : "media-playing" } :width 20 :height 20 :thickness 5 :value {100.0 * media-position / (media-length / 1000000.0)} - :visible {media-current != "" && media-length != 1} + :visible {media-current != "" && media-status != "Stopped"} )) (label - :class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" } + :class { media-status == "Paused" ? "media-text-paused" : media-status == "Stopped" ? "media-text-stopped" : "media-text-playing" } :angle 270 :xalign 0.5 :yalign 0.5 :justify "center" :limit-width 120 - :text {media-current != "" ? "『${media-current}』" : "『』"}) - )) + :text "『${media-current}』" + ))) (deflisten media-current :initial "" "playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true") (deflisten media-position-text :initial "" "playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true") -(defpoll media-position :interval "1s" +(defpoll media-position + :interval "1s" :run-while {media-current != ""} "playerctl position") (deflisten media-length :initial 1 "playerctl --follow metadata mpris:length") @@ -168,30 +169,36 @@ (defwidget widget-temperature [] (eventbox :onclick temperature-monitor - (box - :class "temperature" - :orientation "h" - :tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}C; GPU ${EWW_TEMPS[gpu-temp-key]}C" - :space-evenly true - :width 25 - :halign "" :valign "center" - (progress - :class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" } - :halign "center" :valign "center" - :flipped "true" - :width 3 - :orientation "v" - :value {EWW_TEMPS[cpu-temp-key]} + (overlay + (box + :class "temperature" + :orientation "h" + :tooltip "CPU ${EWW_TEMPS[cpu-temp-key]}°C; GPU ${EWW_TEMPS[gpu-temp-key]}°C" + :space-evenly true + :width 25 + :halign "" :valign "center" + (progress + :class { EWW_TEMPS[cpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-cpu" } + :halign "center" :valign "center" + :flipped "true" + :width 3 + :orientation "v" + :value {EWW_TEMPS[cpu-temp-key]} + ) + (progress + :class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-gpu" } + :halign "center" :valign "center" + :flipped "true" + :width 3 + :orientation "v" + :value {EWW_TEMPS[gpu-temp-key]} + ) ) - (progress - :class { EWW_TEMPS[gpu-temp-key] > temperature-threshold ? "temperature-progress-critical" : "temperature-progress-gpu" } - :halign "center" :valign "center" - :flipped "true" - :width 3 - :orientation "v" - :value {EWW_TEMPS[gpu-temp-key]} - ) - ))) + (label + :valign "end" + :class "temperature-icon" + :text "") + ))) (defwidget widget-cpu [] (box :class "cpu" From f4a62a983d72d23ab5a87b92da23fcbd7294842c Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 9 Jun 2024 00:39:49 -0700 Subject: [PATCH 13/14] feat: Add telegram, scad, cov modes. Fix conflict --- doom/config.org | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ doom/init.el | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/doom/config.org b/doom/config.org index 32ffb8d..f74c600 100644 --- a/doom/config.org +++ b/doom/config.org @@ -261,6 +261,23 @@ numbers are disabled. For relative line numbers, set this to ~relative~. (add-hook 'text-mode-hook #'custom/common-richtext-hook) #+end_src +** Shells + +#+begin_quote +Fish (and possibly other non-POSIX shells) is known to inject garbage +output into some of the child processes that Emacs spawns. Many Emacs +packages/utilities will choke on this output, causing unpredictable +issues. +#+end_quote + +Here we set the default shell to ~bash~ but the vterm shell to the system +~$SHELL~ variable. + +#+begin_src emacs-lisp +(setq shell-file-name (executable-find "bash")) +(setq vterm-shell (getenv "SHELL")) +#+end_src + * Package-specific Settings ** Editor @@ -344,6 +361,12 @@ Note that ~onsave~ was intentionally turned off because it messes with version c :files ("highlighting/emacs/*.el"))) #+end_src +*** Cov + +#+begin_src emacs-lisp :tangle packages.el +(package! cov) +#+end_src + *** Emacs Lisp #+begin_src emacs-lisp @@ -620,6 +643,47 @@ Add the necessary hooks for LilyPond mode. (setq rustic-indent-offset standard-indent)) #+end_src +*** SCAD + +#+begin_src emacs-lisp :tangle packages.el +(package! scad-mode) +#+end_src + +#+begin_src emacs-lisp +(use-package! scad-mode + :after-call scad-mode + :config + (add-hook 'scad-mode-hook #'custom/common-program-hook)) +(map! :after scad-mode + :localleader + :map scad-mode-map + :desc "Open" "o" #'scad-open + :desc "Export" "e" #'scad-export + :desc "Preview" "p" #'scad-preview + ) +(map! :after scad-mode + :mode scad-preview-mode + :map scad-preview-mode-map + :desc "Size+" "+" #'scad-preview-size+ + :desc "Size-" "-" #'scad-preview-size- + :desc "Distance+" "[" #'scad-preview-distance+ + :desc "Distance-" "]" #'scad-preview-distance- + :desc "Toggle Projection" "p" #'scad-preview-projection + :desc "Translate x-" "h" #'scad-preview-translate-x- + :desc "Translate x+" "l" #'scad-preview-translate-x+ + :desc "Translate y-" "j" #'scad-preview-translate-y- + :desc "Translate y+" "k" #'scad-preview-translate-y+ + :desc "Translate z-" "n" #'scad-preview-translate-z- + :desc "Translate z+" "m" #'scad-preview-translate-z+ + :desc "Rotate x-" "H" #'scad-preview-rotate-x- + :desc "Rotate x+" "L" #'scad-preview-rotate-x+ + :desc "Rotate y-" "J" #'scad-preview-rotate-y- + :desc "Rotate y+" "K" #'scad-preview-rotate-y+ + :desc "Rotate z-" "N" #'scad-preview-rotate-z- + :desc "Rotate z+" "M" #'scad-preview-rotate-z+ + ) +#+end_src + ** Tools *** Language Server Protocol (LSP) @@ -758,3 +822,26 @@ FIXME: Cleanup ~ein:markdown-mode-map~. :desc "Move cell up" "M-k" 'ein:worksheet-move-cell-up ) #+end_src + +*** Telegram + +#+begin_src emacs-lisp :tangle packages.el +(package! telega) +#+end_src + +On Arch Linux, ~telegram-tdlib~ installs to +#+begin_src text :tangle no +telegram-tdlib /usr/ +telegram-tdlib /usr/include/ +telegram-tdlib /usr/include/td/... +telegram-tdlib /usr/lib/ +telegram-tdlib /usr/lib/cmake/ +telegram-tdlib /usr/lib/cmake/... +telegram-tdlib /usr/lib/libtdactor.a +telegram-tdlib /usr/lib/... +telegram-tdlib /usr/lib/pkgconfig/... +#+end_src + +#+begin_src emacs-lisp +(setq telega-server-libs-prefix "/usr") +#+end_src diff --git a/doom/init.el b/doom/init.el index d6bd096..c67494a 100644 --- a/doom/init.el +++ b/doom/init.el @@ -24,7 +24,7 @@ company ; the ultimate code completion backend ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... - ivy ; a search engine for love and life + ;;ivy ; a search engine for love and life vertico ; the search engine of the future :ui From 7a9bd87e73d98e77b614efd6a632920e8c53f2f3 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Tue, 3 Sep 2024 13:03:19 -0700 Subject: [PATCH 14/14] fix: Remove deleted option --- hypr/hyprland.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index a0865ec..296e22b 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -84,7 +84,7 @@ dwindle { master { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - new_is_master = true + #new_is_master = true } gestures {