initial import

This commit is contained in:
James Andariese 2024-03-30 09:30:52 -05:00
commit 1fccc404ef
9 changed files with 280 additions and 0 deletions

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2024 cascade
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# `eww.yuck` and friends
My personal eww config.
Install by linking or cloning to ~/.config/eww

76
eww.scss Normal file
View File

@ -0,0 +1,76 @@
// Mostly defaults -- scroll to CUSTOMIZATIONS
* {
all: unset; //Unsets everything so you can style everything from scratch
}
//Global Styles
.bar {
background-color: #3a3a3a;
color: #b0b4bc;
padding: 0px;
font-family: ComicShannsMono Nerd Font Mono
}
// Styles on classes (see eww.yuck for more information)
.sidestuff 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;
}
.label-ram {
font-size: large;
}
// CUSTOMIZATIONS
.workspaces button {
min-width: 25px;
}
.workspaces button:hover {
color: #FFDDCE;
}
button.active {
color: #000000;
//justify: center;
// text-align: center;
background-color: #AA75A9
}
button.urgent {
color: #000000;
background-color: #FF5577
}

97
eww.yuck Normal file
View File

@ -0,0 +1,97 @@
(defwidget bar []
(centerbox :orientation "h"
(leftstuff)
(music)
(rightstuff)))
(defwidget rightstuff []
(box :class "rightstuff" :orientation "h" :space-evenly false :halign "end"
(eventbox :onclick "pamixer -t"
:onscroll "scripts/scroll_volume {}"
(metric :label {muted ? "🔇" : volume > 90 ? "🔊" : volume > 0 ? "🔉" : "🔈"}
:value volume
:onchange "pamixer --set-volume {}"))
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time
;systray
))
(defwidget leftstuff []
(box :class "leftstuff" :orientation "h" :space-evenly false :halign "start"
(workspaces)
(scratches)))
(defwidget workspaces []
(eventbox
:onscroll "swaymsg workspace $(echo {} | sed -e 's/up/prev/' -e 's/down/next/')"
(box :class "workspaces"
:orientation "h"
:halign "start"
:spacing 0
(for w in { workspaces.workspaces }
(button :width 20
:onclick "swaymsg workspace ${w?.name ?: '??'}"
:class {w?.class} {w?.name ?: '??'} )))))
(defwidget scratches []
(eventbox :class "scratches"
:onscroll "swaymsg scratchpad show"
(overlay
(button :width 40
:onclick "swaymsg scratchpad show" "" )
(label :text {workspaces.exposed_scratch_count > 0 ? "📂" : "📁"}
:class "folder ${workspaces.exposed_scratch_count > 0 ? "open" : "closed"}"
:yalign 1)
(label :text `${jq(workspaces, '[.exposed_scratch_count, .scratches[].window_count]|add')}`
:yalign 0.1 ))))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
(deflisten volume
"scripts/track_volume")
(deflisten muted
"scripts/track_mute")
(deflisten workspace :initial "1" `scripts/track_workspace`)
(deflisten workspaces :initial `{"workspaces":[],"scratches":[]}` `scripts/track_workspaces`)
(defpoll time :interval "1s"
"date '+%H:%M:%S %b %d, %Y'")
(defwindow bar
:monitor 0
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "30px"
:anchor "top center")
:exclusive true
:reserve (struts :side "top" :distance "30px")
(bar))

9
scripts/scroll_volume Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
if [ "$1" = up ];then
pamixer -i 5
elif [ "$1" = down ];then
pamixer -d 5
else
pamixer --set-volume $1
fi

7
scripts/track_mute Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
pactl subscribe | while read -r ;do
case "$REPLY" in
*change*) pamixer --get-mute ;;
esac
done

7
scripts/track_volume Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
pactl subscribe | while read -r ;do
case "$REPLY" in
*change*) pamixer --get-volume | grep -E '^[0-9]+$';;
esac
done

7
scripts/track_workspace Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
swaymsg -t subscribe -m '[ "workspace" ]' | jq --unbuffered '.current.num' | while read -r;do
if [ "$REPLY" != "null" ];then
echo "$REPLY"
fi
done

63
scripts/track_workspaces Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
poll() {
swaymsg -t get_tree |
jq -c --unbuffered '.
# prep the output var
| {} as $out
# find the count of scratch windows that are exposed
| [.. | select(.type=="workspace" and .num == null)? | .focus[]] as $scratch_windows
| [.. | select(.type=="workspace" and .num)? | .focus[]] as $exposed_windows
| ($exposed_windows - ($exposed_windows - $scratch_windows)) as $exposed_scratch
| ($out | .exposed_scratch = $exposed_scratch) as $out
| ($out | .exposed_scratch_count = ($exposed_scratch | length)) as $out
# get and save the current workspace name
| (.. | select(.current_workspace)? | .current_workspace) as $cws
# now, loop over all workspaces by using the recursive descent operator (..)
# and select all the workspaces (.type == "workspace")
| [ (.. | select(.type=="workspace")?)
# if its a con or a floating_con, include it in the window count
| (.window_count = ([.. | select(.type == "con" or .type == "floating_con")?] | length))
# and delete all the extraneous info
| del(.rect,.deco_rect,.window_rect,.geometry,.nodes,.floating_nodes)
# add a default class
| (.class = ["workspace-switcher"])
# and add active class to the current workspace
| (if (.name == $cws) then .class += ["active"] | .current = true else .current = false end)
# add urgent if its urgent
| (if (.urgent) then .class += ["urgent"] end)
# now join the classes
| .class |= join(" ")
# and save to $all for further processing into $out
] as $all
# add .workspaces to $out for anything that has a workspace number
| ($out | .workspaces = [$all | .[] | select(.num)?]) as $out
# add .scratches to $out for any workspace that does _not_ have a number
# (these are distinguished by being scratch but also cant be reached by next/prev)
| ($out | .scratches = [$all | .[] | select(.num == null)]) as $out
# now that weve built up $out, we will return it.
| $out
'
}
poll
[ ${1-x} == '-d' ] && exit 0
swaymsg -t subscribe -m '[ "workspace", "window" ]' |
jq --unbuffered -c '.' |
while read -r EVENT;do
poll
done