diff --git a/roles/eww/files/change-active-workspace b/roles/eww/files/change-active-workspace new file mode 100755 index 0000000..7a693aa --- /dev/null +++ b/roles/eww/files/change-active-workspace @@ -0,0 +1,3 @@ +#!/bin/bash + + diff --git a/roles/eww/files/get-active-workspace b/roles/eww/files/get-active-workspace new file mode 100755 index 0000000..e283064 --- /dev/null +++ b/roles/eww/files/get-active-workspace @@ -0,0 +1,3 @@ +#!/bin/bash + +swaymsg -t get_workspaces --raw | jq -r '.[] | select(.focused == true) | .name' diff --git a/roles/eww/files/get-workspaces b/roles/eww/files/get-workspaces new file mode 100755 index 0000000..970cdb0 --- /dev/null +++ b/roles/eww/files/get-workspaces @@ -0,0 +1,3 @@ +#!/bin/bash + +swaymsg -t get_workspaces --raw | jq -c 'map({name: .name | tostring, output: .output, icon: .name[2:]})' diff --git a/roles/eww/tasks/main.yml b/roles/eww/tasks/main.yml index 8d900a1..87ead4a 100644 --- a/roles/eww/tasks/main.yml +++ b/roles/eww/tasks/main.yml @@ -29,3 +29,17 @@ dest: eww.scss - src: eww.yuck.j2 dest: eww.yuck + +- name: create eww scripts dir + file: + path: "$HOME/.config/eww/scripts" + state: directory + +- name: copy eww scripts + copy: + src: '{{ item }}' + dest: "$HOME/.config/eww/scripts" + loop: + - get-active-workspace + - get-workspaces + #- change-active-workspace diff --git a/roles/eww/templates/eww.scss.j2 b/roles/eww/templates/eww.scss.j2 index 4893603..31f7e6e 100644 --- a/roles/eww/templates/eww.scss.j2 +++ b/roles/eww/templates/eww.scss.j2 @@ -1,10 +1,26 @@ +$background: rgba(34, 34, 34, 0.9); +$active: rgba(68, 68, 68, 0.8); +$warning: rgba(243, 249, 157, 1); +$alert: rgba(255, 92, 87, 1); +$white: rgba(239, 240, 235, 1); +$darkgrey: rgba(73, 73, 73, 1); +$grey: rgba(146, 146, 146, 1); +$red: rgba(255, 92, 87, 1); +$yellow: rgba(243, 249, 157, 1); +$blue: rgba(10, 108, 245, 1); +$purple: rgba(159, 120, 255, 1); +$green: rgba(90, 247, 142, 1); +$cyan: rgba(154, 237, 254, 1); + * { all: unset; //Unsets everything so you can style everything from scratch + font-family: "jetbrains mono light", "FontAwesome6FreeRegular", "FontAwesome6FreeSolid", "FontAwesome6Brands"; + font-size: 12px; } //Global Styles .bartop { - background-color: #3a3a3a; + background-color: $background; color: #b0b4bc; padding: 10px; } @@ -49,6 +65,16 @@ .label-ram { font-size: large; } -.workspaces button:hover { - color: #D35D6E; +.workspaces { + padding-right: 30px; +} +.workspace-entry label { + padding: 0px 10px; + color: $white; + min-width: 20px; + border-top: 1px solid transparent; + border-bottom: 2px solid transparent; +} +.workspace-entry.current label { + border-bottom: 2px solid $yellow; } diff --git a/roles/eww/templates/eww.yuck.j2 b/roles/eww/templates/eww.yuck.j2 index 74a86c1..26fc27e 100644 --- a/roles/eww/templates/eww.yuck.j2 +++ b/roles/eww/templates/eww.yuck.j2 @@ -17,21 +17,23 @@ :onchange "") time)) +(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "none" "bash ~/.config/eww/scripts/get-active-workspace") + (defwidget workspaces [] (box :class "workspaces" - :orientation "h" :space-evenly true :halign "start" - :spacing 10 - (button :onclick "wmctrl -s 0" 1) - (button :onclick "wmctrl -s 1" 2) - (button :onclick "wmctrl -s 2" 3) - (button :onclick "wmctrl -s 3" 4) - (button :onclick "wmctrl -s 4" 5) - (button :onclick "wmctrl -s 5" 6) - (button :onclick "wmctrl -s 6" 7) - (button :onclick "wmctrl -s 7" 8) - (button :onclick "wmctrl -s 8" 9))) + (label :text "${current_workspace}" :visible false) + (for workspace in workspaces + (eventbox :onclick "swaymsg workspace ${workspace.name}" + (box :class "workspace-entry ${workspace.name == current_workspace ? "current" : ""}" + (label :text "${workspace.icon}") + ) + ) + ) + ) +) (defwidget music [] (box :class "music"