1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 15:01:59 +01:00

added static sway workspace eww widget

This commit is contained in:
eoli3n 2023-11-08 15:01:15 +01:00
parent 8ffed97f67
commit d284a47a54
6 changed files with 65 additions and 14 deletions

@ -0,0 +1,3 @@
#!/bin/bash

@ -0,0 +1,3 @@
#!/bin/bash
swaymsg -t get_workspaces --raw | jq -r '.[] | select(.focused == true) | .name'

3
roles/eww/files/get-workspaces Executable file

@ -0,0 +1,3 @@
#!/bin/bash
swaymsg -t get_workspaces --raw | jq -c 'map({name: .name | tostring, output: .output, icon: .name[2:]})'

@ -29,3 +29,17 @@
dest: eww.scss dest: eww.scss
- src: eww.yuck.j2 - src: eww.yuck.j2
dest: eww.yuck 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

@ -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 all: unset; //Unsets everything so you can style everything from scratch
font-family: "jetbrains mono light", "FontAwesome6FreeRegular", "FontAwesome6FreeSolid", "FontAwesome6Brands";
font-size: 12px;
} }
//Global Styles //Global Styles
.bartop { .bartop {
background-color: #3a3a3a; background-color: $background;
color: #b0b4bc; color: #b0b4bc;
padding: 10px; padding: 10px;
} }
@ -49,6 +65,16 @@
.label-ram { .label-ram {
font-size: large; font-size: large;
} }
.workspaces button:hover { .workspaces {
color: #D35D6E; 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;
} }

@ -17,21 +17,23 @@
:onchange "") :onchange "")
time)) time))
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
(deflisten current_workspace :initial "none" "bash ~/.config/eww/scripts/get-active-workspace")
(defwidget workspaces [] (defwidget workspaces []
(box :class "workspaces" (box :class "workspaces"
:orientation "h"
:space-evenly true :space-evenly true
:halign "start" :halign "start"
:spacing 10 (label :text "${current_workspace}" :visible false)
(button :onclick "wmctrl -s 0" 1) (for workspace in workspaces
(button :onclick "wmctrl -s 1" 2) (eventbox :onclick "swaymsg workspace ${workspace.name}"
(button :onclick "wmctrl -s 2" 3) (box :class "workspace-entry ${workspace.name == current_workspace ? "current" : ""}"
(button :onclick "wmctrl -s 3" 4) (label :text "${workspace.icon}")
(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))) )
(defwidget music [] (defwidget music []
(box :class "music" (box :class "music"