1
0
Fork 0

add base dotfiles

This commit is contained in:
Lucas Sta Maria 2022-03-20 03:19:38 -04:00
commit 968449de49
No known key found for this signature in database
GPG key ID: 4B9481F3C5068E2E
31 changed files with 2121 additions and 0 deletions

146
.config/eww/eww.scss Normal file
View file

@ -0,0 +1,146 @@
// General styling
* {
all: unset;
}
scale trough {
all: unset;
background-color: #22242b;
box-shadow: 0 2px 3px 2px #06060b;
border-radius: 16px;
min-height: 10px;
min-width: 70px;
margin: 0px 10px 0px 0px;
}
// Main bar styling
.main {
background-color: #0e1419;
color: #e5e1cf;
font-family: "Noto Sans";
font-size: 12px;
}
.leftwidgets {
margin-left: 5px;
margin-right: 50px;
button {
margin: 0px 5px;
border-color: #0e1419;
border-width: 0px;
padding-left: 0em;
padding-right: 0em;
}
.occupied {
color: #919191;
}
.focused {
color: #ff6054;
}
.empty {
color: #444444;
}
}
.rightwidgets {
margin: 0px 10px 0px 5px;
}
.icon-module__icon {
margin: 0px 5px 0px 0px;
font-size: 15px;
}
.player {
color: #e5e1cf;
}
.player__container {
padding-left: 7px;
padding-right: 7px;
border-radius: 10px;
}
.player__container:hover {
background-color: hsla(210, 25%, 25%, 0.3);
}
.power__text {
margin-top: 3px;
}
.brightness__label {
margin-top: 1px;
}
.brightness__bar {
margin-left: 10px;
}
.brightness__bar trough highlight {
background-image: linear-gradient(to right, #e4c9af 30%, #f2cdcd 50%, #e0b089 100% *50);
border-radius: 10px;
min-width: 20px;
}
.volume__bar {
margin-left: 10px;
}
.volume__bar trough highlight {
background-image: linear-gradient(to right, #f2525d 30%, #cc5a61 50%, #c93640 100% *50);
border-radius: 10px;
min-width: 20px;
}
.volume__label {
margin-top: 3px;
}
.timedate__button {
padding: 3px 9px;
border-radius: 5px;
}
.timedate__button:hover {
background-color: hsla(210, 25%, 25%, 0.3);
}
// Song card styling
.songcard {
background-color: #0e1419;
color: #e5e1cf;
font-family: "Noto Sans";
font-size: 12px;
}
.songcard__title {
font-weight: 700;
font-size: 20px;
margin-top: 10px;
margin-bottom: 0px;
}
.songcard__artist {
font-weight: 500;
font-size: 14px;
margin-top: 0px;
margin-bottom: 0px;
color: #919191;
}
.songcard__controls {
margin-top: 0px;
margin-bottom: 10px;
}
.songcard__button {
margin: 0px 3px;
}

223
.config/eww/eww.yuck Normal file
View file

@ -0,0 +1,223 @@
;; Global variables
(deflisten w1 "scripts/workspaces 1")
(deflisten w2 "scripts/workspaces 2")
(deflisten w3 "scripts/workspaces 3")
(deflisten w4 "scripts/workspaces 4")
(deflisten w5 "scripts/workspaces 5")
(deflisten w6 "scripts/workspaces 6")
(deflisten w7 "scripts/workspaces 7")
(deflisten w8 "scripts/workspaces 8")
(deflisten w9 "scripts/workspaces 9")
(deflisten w10 "scripts/workspaces 10")
(deflisten w11 "scripts/workspaces 11")
(deflisten w12 "scripts/workspaces 12")
(deflisten w13 "scripts/workspaces 13")
(deflisten w14 "scripts/workspaces 14")
(deflisten w15 "scripts/workspaces 15")
(deflisten w16 "scripts/workspaces 16")
(deflisten w17 "scripts/workspaces 17")
(deflisten w18 "scripts/workspaces 18")
(deflisten w19 "scripts/workspaces 19")
(deflisten w20 "scripts/workspaces 20")
(deflisten player_listen :initial '{"show": "no", "content": ""}' "scripts/player")
(deflisten player :initial '{"content": "TEST"}' "scripts/player")
(deflisten songcardtitle :initial '(label :class "songcard__title" :text "None Playing")'
"scripts/songcardtitle")
(deflisten songcardartist :initial '(label :class "songcard__artist" :text ".")'
"scripts/songcardartist")
(defpoll songcard_button :interval "1s" "scripts/songcardplayrender")
(defpoll wifi_label :interval "1s" "scripts/wifi")
(defpoll volume_level :interval "1s" "scripts/volume")
(defpoll volume_label :initial '{"icon": "", content: "0"}'
:interval "1s"
"scripts/volumelabel")
(defpoll brightness_level :interval "1s" "scripts/brightness")
(defpoll brightness_label :interval "1s" "scripts/brightnesslabel")
(defpoll battery_level :interval "15s" "scripts/battery")
(defpoll currtime :interval "1s" "scripts/currtime")
(defvar songcard_reveal false)
(defvar brightness_reveal false)
(defvar volume_reveal false)
(defvar timedate_reveal false)
;; Main widget
(defwindow main
:monitor 0
:geometry (geometry :x "-2px"
:y "15px"
:width "98%"
:height "30px"
:anchor "top center")
:stacking "bg"
:reserve (struts :distance "50px" :side "top")
:windowtype "dialog"
:wm-ignore false
(container))
;; The main container for all the widgets
(defwidget container []
(centerbox :orientation "horizontal"
:space-evenly true
(leftwidgets)
(middlewidgets)
(rightwidgets)))
;; Left widgets
(defwidget leftwidgets []
(box :spacing 4
:orientation "horizontal"
:halign "start"
:valign "center"
:class "leftwidgets"
(literal :content w1)
(literal :content w2)
(literal :content w3)
(literal :content w4)
(literal :content w5)
(literal :content w6)
(literal :content w7)
(literal :content w8)
(literal :content w9)
(literal :content w10)
(literal :content w11)
(literal :content w12)
(literal :content w13)
(literal :content w14)
(literal :content w15)
(literal :content w16)
(literal :content w17)
(literal :content w18)
(literal :content w19)
(literal :content w20)))
;; Middle widgets
(defwidget middlewidgets []
(player))
;; Spotify widget
(defwidget player []
(button :onclick "scripts/songcardshow"
:class "player__container"
(icon-module :class "player"
:icon ""
:visible {player_listen.show == "yes"}
(literal :content {player_listen.content}))))
;; Right widgets
(defwidget rightwidgets []
(box :class "rightwidgets"
:orientation "horizontal"
:halign "end"
:valign "center"
:space-evenly "false"
:spacing 10
(wifi)
(brightness)
(volume)
(power)
(timedate)))
;; A widget that displays the current wifi SSID
(defwidget wifi []
(icon-module :icon "↑"
(literal :content {wifi_label})))
;; A widget for tracking brightness
(defwidget brightness []
(eventbox :onhover "eww update brightness_reveal=true"
:onhoverlost "eww update brightness_reveal=false"
(icon-module :icon "☼"
(literal :content {brightness_label})
(revealer :transition "slideleft"
:reveal brightness_reveal
:duration "350ms"
(scale :class "brightness__bar"
:orientation "horizontal"
:value brightness_level
:min 0
:max 100
:onchange "brightnessctl set {}%")))))
;; A widget for tracking volume
(defwidget volume []
(eventbox :onhover "eww update volume_reveal=true"
:onhoverlost "eww update volume_reveal=false"
(icon-module :icon {volume_label.icon}
(literal :content {volume_label.content})
(revealer :transition "slideleft"
:reveal volume_reveal
:duration "350ms"
(scale :class "volume__bar"
:orientation "horizontal"
:value volume_level
:min 0
:max 100
:onchange "pamixer --set-volume $(printf \"%.0f\" \"{}\")")))))
;; A widget for tracking battery
(defwidget power []
(icon-module :class "power"
:icon "⏻"
:visible true
(literal :content {battery_level})))
;; A widget for tracking time and date
(defwidget timedate []
(box :class "timedate"
:orientation "horizontal"
:space-evenly false
:valign "center"
:halign "end"
(button :class "timedate__button"
:onclick "scripts/boolflip timedate_reveal"
(literal :content {currtime}))))
;; A module with an icon attached
(defwidget icon-module [icon ?class ?visible]
(box :class "${class} icon-module"
:orientation "horizontal"
:halign "end"
:valign "center"
:space-evenly false
:visible {visible ?: true}
(label :class "icon-module__icon" :text "${icon}")
(children)))
; The song card widget
(defwindow songcard
:monitor 0
:geometry (geometry :x "0px"
:y "70px"
:width "350px"
:height "50px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "50px" :side "top")
:windowtype "dialog"
:wm-ignore false
(box :orientation "vertical"
;; song metadata
(box :orientation "vertical"
:halign "center"
:valign "top"
(literal :content {songcardtitle})
(literal :content {songcardartist})
;; song controls
(centerbox :class "songcard__controls"
:orientation "horizontal"
:valign "center"
:halign "center"
(button :onclick "scripts/songback"
:class "songcard__button"
(image :path "img/musicback.png" :image-width 20 :image-height 20))
(button :onclick "scripts/songplay"
:class "songcard__button"
(literal :content {songcard_button}))
(button :onclick "scripts/songnext"
:class "songcard__button"
(image :path "img/musicnext.png" :image-width 20 :image-height 20))))))

3
.config/eww/scripts/battery Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo "(label :class \"power__text\" :text \"$(cat /sys/class/power_supply/BAT0/capacity)%\")"

10
.config/eww/scripts/boolflip Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
var="$1"
val=`eww get ${var}`
if [ "$val" == "true" ]; then
eww update "$var"=false
else
eww update "$var"=true
fi

9
.config/eww/scripts/brightness Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
level=$(brightnessctl get)
max=$(brightnessctl max)
raw_percent=$(echo "scale=2 ; $level / $max" | bc)
percent=$(echo "$raw_percent*100" | bc)
final_percent=${percent%.*}
echo "$final_percent"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
level=$(brightnessctl get)
max=$(brightnessctl max)
raw_percent=$(echo "scale=2 ; $level / $max" | bc)
percent=$(echo "$raw_percent*100" | bc)
final_percent=${percent%.*}
echo "(label :class \"brightness__label\" :text \"$final_percent%\")"

12
.config/eww/scripts/currtime Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
var="timedate_reveal"
val=`eww get ${var}`
if [ "$val" == true ]; then
time=`date +"%F %T"`
echo "(label :text \"$time\")"
else
time=`date +"%R"`
echo "(label :text \"$time\")"
fi

17
.config/eww/scripts/player Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
echo "{\"show\": \"no\", \"content\": \"\"}"
while true
do
line=$(spt playback --status -f "%s:%a - %t" 2> /dev/null)
IFS=':' read -ra ELS <<< "$line"
button=${ELS[0]}
content=${ELS[1]}
if [ "$button" == "▶" ]; then
echo "{\"show\": \"yes\", \"content\": \"(label :text \\\"$content\\\")\"}"
else
echo "{\"show\": \"no\", \"content\": \"\"}"
fi
sleep 1
done

3
.config/eww/scripts/songback Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
spt playback --previous

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
echo "(label :class \"songcard__artist\" :text \".\")"
while true
do
content=$(spt playback --status -f "%a" 2> /dev/null)
echo "(label :class \"songcard__artist\" :text \"${content}\")"
sleep 1
done

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
button=$(spt playback --status -f "%s" 2>/dev/null)
if [ "$button" == "▶" ]; then
echo "(image :path \"img/musicpause.png\" :image-width 40 :image-height 40)"
else
echo "(image :path \"img/musicplay.png\" :image-width 40 :image-height 40)"
fi

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
show=$(eww get songcard_reveal)
if [ "$show" == "false" ]; then
eww open songcard && eww update songcard_reveal=true
else
eww close songcard && eww update songcard_reveal=false
fi
./boolflip songcard_reveal

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
echo "(label :class \"songcard__title\" :text \"None Playing\")"
while true
do
content=$(spt playback --status -f "%t" 2> /dev/null)
echo "(label :class \"songcard__title\" :text \"${content}\")"
sleep 1
done

3
.config/eww/scripts/songnext Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
spt playback --next

3
.config/eww/scripts/songplay Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
spt playback --toggle

9
.config/eww/scripts/volume Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
raw_percent=$(pamixer --get-volume-human)
if [ "$raw_percent" == "muted" ]; then
echo "0"
else
percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g')
echo "$percent"
fi

20
.config/eww/scripts/volumelabel Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
raw_percent=$(pamixer --get-volume-human)
if [ "$raw_percent" == "muted" ]; then
echo "{\"icon\": \"\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"muted\\\")\"}"
else
percent=$(echo "$raw_percent" | sed 's/[^0-9]*//g')
#if [ "$percent" -gt 66 ]; then
# icon=""
#elif [ "$percent" -gt 33 ]; then
# icon=""
#elif [ "$percent" -gt 0 ]; then
# icon=""
#else
# icon=""
#fi
icon=""
volume="$percent%"
echo "{\"icon\": \"${icon}\", \"content\": \"(label :class \\\"volume__label\\\" :text \\\"${volume}\\\")\"}"
fi

8
.config/eww/scripts/wifi Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
wifi=`nmcli c show --active | tail -n 1 | sed 's/ .*//g'`
if [ ${#wifi} -gt 0 ]; then
echo "(label :text \"${wifi}\")"
else
echo ""
fi

29
.config/eww/scripts/workspaces Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Checks if a list ($1) contains an element ($2)
contains() {
for e in $1; do
[ "$e" == "$2" ] && echo 1 && return
done
echo 0
}
workspaces() {
icon=""
isfocused=$(bspc query -D -d focused --names | grep -w "$1")
isoccupied=$(bspc query -D -d .occupied --names | grep -w "$1")
if [ ${#isfocused} -ge 1 ]; then
class="focused"
elif [ ${#isoccupied} -ge 1 ]; then
class="occupied"
else
class="empty"
fi
echo "(button :onclick \"bspc desktop -f '^$1'\" :class \"$class\" \"$icon\")"
}
workspaces $1
bspc subscribe desktop node_transfer | while read -r _ ; do
workspaces $1
done