eww
This commit is contained in:
108
home-manager/progs/eww/config/eww.scss
Normal file
108
home-manager/progs/eww/config/eww.scss
Normal file
@@ -0,0 +1,108 @@
|
||||
$background: #1e1e2e;
|
||||
$pink: #f5c2e7;
|
||||
$lavendar: #b4befe;
|
||||
$red: #f38ba8;
|
||||
$maroon: #eba0ac;
|
||||
$peach: #fab387;
|
||||
$yellow: #f9e2af;
|
||||
$green: #a6e3a1;
|
||||
$text: #cdd6f4;
|
||||
$subtext: #a6adc8;
|
||||
$surface: #585b70;
|
||||
|
||||
* {
|
||||
color: $text;
|
||||
font-family: CaskaydiaCove Nerd Font Mono;
|
||||
font-weight: 600;
|
||||
font-size: 10pt;
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
.red { color: $red; }
|
||||
.maroon { color: $maroon; }
|
||||
.peach { color: $peach; }
|
||||
.yellow { color: $yellow; }
|
||||
.green { color: $green; }
|
||||
.lavendar { color: $lavendar; }
|
||||
|
||||
.symbol {
|
||||
color: $lavendar;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.button {
|
||||
* {
|
||||
all: unset;
|
||||
margin: 0 5px;
|
||||
font-size:14pt;
|
||||
transition: color 0.2s ease-in-out;
|
||||
}
|
||||
&:hover * {
|
||||
color: $pink;
|
||||
}
|
||||
}
|
||||
|
||||
.bluetooth * {
|
||||
font-size: 10pt;
|
||||
padding: 0 0.3em;
|
||||
}
|
||||
|
||||
.padded > *:not(:last-child) {
|
||||
padding: 0 10px;
|
||||
border-right: 1px solid $surface;
|
||||
}
|
||||
|
||||
.background {
|
||||
border: 1px solid $pink;
|
||||
background-color: $background;
|
||||
border-radius: 12px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
scale trough {
|
||||
margin: 0 10px;
|
||||
border: none;
|
||||
background-color: #FFF;
|
||||
min-height: 3px;
|
||||
min-width: 100px;
|
||||
|
||||
& slider {
|
||||
box-shadow: none;
|
||||
background-image: none;
|
||||
border: none;
|
||||
background-color: $pink;
|
||||
min-width: 5pt;
|
||||
min-height: 5pt;
|
||||
margin: -5pt;
|
||||
}
|
||||
|
||||
& highlight {
|
||||
border: none;
|
||||
background-color: $lavendar;
|
||||
}
|
||||
}
|
||||
|
||||
.workspaces * {
|
||||
padding: 0 8px;
|
||||
font-size: 14pt;
|
||||
transition: color 0.2s ease-in-out;
|
||||
|
||||
&:hover * {
|
||||
color: $pink;
|
||||
}
|
||||
|
||||
.empty * {
|
||||
color: $subtext;
|
||||
}
|
||||
.current * {
|
||||
color: $green;
|
||||
}
|
||||
}
|
||||
|
||||
.clipboard {
|
||||
color: $subtext;
|
||||
}
|
||||
|
||||
.time {
|
||||
padding-right: 10px;
|
||||
}
|
||||
117
home-manager/progs/eww/config/eww.yuck
Normal file
117
home-manager/progs/eww/config/eww.yuck
Normal file
@@ -0,0 +1,117 @@
|
||||
(defwindow statusbar
|
||||
:monitor 0
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
:geometry (geometry
|
||||
:y "0.5%"
|
||||
:width "100%"
|
||||
:height "24px"
|
||||
:anchor "top center")
|
||||
(statusbar))
|
||||
|
||||
(defwidget statusbar []
|
||||
(centerbox
|
||||
|
||||
(brightness-ctl)
|
||||
|
||||
; (window-title)
|
||||
(time)
|
||||
(box :space-evenly false :halign 'end' :class 'padded'
|
||||
(clipboard)
|
||||
(battery)
|
||||
(bluetooth)
|
||||
(wifi))
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget cmd-slider [?symbol value command max colour]
|
||||
(box :space-evenly false
|
||||
(label :text symbol :class "symbol")
|
||||
(scale
|
||||
:min 0 :max max
|
||||
:value value
|
||||
:round-digits 0
|
||||
:timeout "200ms"
|
||||
:onchange command)
|
||||
(label :text "${value}%" :class colour)))
|
||||
|
||||
(defwidget window-title []
|
||||
(label
|
||||
:text windowtitle
|
||||
:tooltip windowtitle))
|
||||
|
||||
(defpoll windowtitle :interval "1s" `scripts/currentWindow.fish`)
|
||||
(defpoll currentworkspace :interval "1s" `scripts/currentWorkspace.fish`)
|
||||
|
||||
(defwidget brightness-ctl []
|
||||
(cmd-slider :symbol "" :value brightness
|
||||
:command `brightnessctl set {}%`
|
||||
:max 101 :colour "${
|
||||
brightness >= 80 ? "green" :
|
||||
brightness >= 50 ? "yellow" :
|
||||
brightness >= 30 ? "peach" :
|
||||
brightness >= 10 ? "maroon" : "red"
|
||||
}"))
|
||||
(defpoll brightness :interval "1s" `brightnessctl -m | awk -F, '{print $4+0}'`)
|
||||
|
||||
(defwidget clipboard []
|
||||
(label :text clipboard-short :tooltip clipboard :class "clipboard"))
|
||||
(defpoll clipboard :interval "5s" `scripts/clipboardInfo.zsh all`)
|
||||
(defpoll clipboard-short :interval "5s" `scripts/clipboardInfo.zsh head`)
|
||||
|
||||
(defwidget wifi []
|
||||
(eventbox
|
||||
:class "button ${wifi-strength.colour}"
|
||||
(label
|
||||
:text {wifi-strength.icon}
|
||||
:tooltip "Connected To: ${wifi-name}")))
|
||||
|
||||
(defpoll wifi-strength :interval "10s" `scripts/wifiInfo.zsh strength`)
|
||||
(defpoll wifi-name :interval "1m" `scripts/wifiInfo.zsh name`)
|
||||
|
||||
(defwidget bluetooth []
|
||||
(eventbox
|
||||
:class "bluetooth button ${ bluetooth-name != "" ? "green" : "lavendar" }"
|
||||
:onclick `blueman-manager &`
|
||||
(label
|
||||
:text "${bluetooth-name} ")))
|
||||
|
||||
(defpoll bluetooth-name :interval "10s" `bluetoothctl devices Connected | awk '{print $3}'`)
|
||||
|
||||
(defwidget time []
|
||||
(box
|
||||
:space-evenly false
|
||||
:class "time"
|
||||
:tooltip {time.long}
|
||||
(label :class "yellow" :text {time.hour})
|
||||
(label :text ":")
|
||||
(label :class "yellow" :text {time.minute})))
|
||||
|
||||
(defpoll time :interval "1s" `scripts/dateInfo.fish`)
|
||||
|
||||
; TODO: make this a package or something, not using rust-script
|
||||
(defpoll powerstats :interval "2s" `~/Documents/power_bat.rs`)
|
||||
|
||||
(defwidget battery []
|
||||
(box :space-evenly false
|
||||
:tooltip powerstats
|
||||
(label
|
||||
:text "${EWW_BATTERY.BAT1.status == "Charging" ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 90 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 80 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 70 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 60 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 50 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 40 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 30 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 20 ? "" :
|
||||
EWW_BATTERY.BAT1.capacity >= 10 ? "" : ""
|
||||
} "
|
||||
:class "${
|
||||
EWW_BATTERY.BAT1.capacity >= 80 ? "green" :
|
||||
EWW_BATTERY.BAT1.capacity >= 50 ? "yellow" :
|
||||
EWW_BATTERY.BAT1.capacity >= 30 ? "peach" :
|
||||
EWW_BATTERY.BAT1.capacity >= 10 ? "maroon" : "red"
|
||||
}")
|
||||
(label :text "${EWW_BATTERY.BAT1.capacity}%" :class "yellow")))
|
||||
|
||||
14
home-manager/progs/eww/config/scripts/clipboardInfo.zsh
Executable file
14
home-manager/progs/eww/config/scripts/clipboardInfo.zsh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env zsh
|
||||
if wl-paste | iconv -f UTF8 > /dev/null; then
|
||||
case $1 in
|
||||
head)
|
||||
wl-paste 2> /dev/null |
|
||||
head -1 |
|
||||
awk 'length > 20{$0 = substr($0, 1, 17) "..."} {printf "%s", $0}' |
|
||||
sed 's/^[[:space:]]*//g'
|
||||
echo "";;
|
||||
all)
|
||||
wl-paste 2> /dev/null
|
||||
true;;
|
||||
esac
|
||||
fi
|
||||
2
home-manager/progs/eww/config/scripts/currentWindow.fish
Executable file
2
home-manager/progs/eww/config/scripts/currentWindow.fish
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env fish
|
||||
niri msg focused-window | rg Title | sed -E "s/[[:space:]]+Title\: //g" | sed "s/\"//g"
|
||||
3
home-manager/progs/eww/config/scripts/currentWorkspace.fish
Executable file
3
home-manager/progs/eww/config/scripts/currentWorkspace.fish
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
niri msg workspaces | rg "^ \*" | sed -E 's/[[:space:]]+\* //g'
|
||||
2
home-manager/progs/eww/config/scripts/dateInfo.fish
Executable file
2
home-manager/progs/eww/config/scripts/dateInfo.fish
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env fish
|
||||
date +'{"long":"%a %b %e %H:%M:%S %Z %Y","hour":"%H","minute":"%M"}'
|
||||
23
home-manager/progs/eww/config/scripts/wifiInfo.zsh
Executable file
23
home-manager/progs/eww/config/scripts/wifiInfo.zsh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env zsh
|
||||
export CHARSET=ASCII
|
||||
case $1 in
|
||||
name)
|
||||
nmcli -f IN-USE,SSID d w | grep '*' | sed 's/[\* ]//g' | cat
|
||||
exit 0;;
|
||||
strength)
|
||||
str=$(nmcli -f ACTIVE,BARS d w | grep 'yes' | tr -d ' yesno')
|
||||
case ${str: 0:-1} in
|
||||
'****')
|
||||
icon=""; colour="green";;
|
||||
'***')
|
||||
icon=""; colour="yellow";;
|
||||
'**')
|
||||
icon=""; colour="peach";;
|
||||
'*')
|
||||
icon=""; colour="maroon";;
|
||||
*)
|
||||
icon=""; colour="red";;
|
||||
esac
|
||||
echo "{\"icon\":\"$icon\",\"colour\":\"$colour\"}"
|
||||
exit 0;;
|
||||
esac
|
||||
13
home-manager/progs/eww/eww.nix
Normal file
13
home-manager/progs/eww/eww.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
zsh
|
||||
bluez
|
||||
brightnessctl
|
||||
];
|
||||
|
||||
programs.eww = {
|
||||
enable = true;
|
||||
configDir = ./config;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user