Compare commits

...

2 commits

Author SHA1 Message Date
663d7cf50b added volume bars 2023-10-30 21:17:26 -07:00
2d426949d9 updated volumes 2023-10-30 18:12:43 -07:00
9 changed files with 151 additions and 43 deletions

View file

@ -2,21 +2,19 @@
all: unset; //Unsets everything so you can style everything from scratch all: unset; //Unsets everything so you can style everything from scratch
} }
$bkgrnd: rgba(20, 20, 20, 0.9);
$light_bkgrnd: rgba(60, 60, 60, 0.8);
@import "./modules/center-clock.scss"
@import "./modules/volume-osd.scss"
//Global Styles //Global Styles
.bar-main { .bar-main {
background-color: rgba(30, 30, 30, 0.9); background-color: $bkgrnd;
color: #FFFFFF; color: #FFFFFF;
border-radius: 10; border-radius: 10;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
// font: 12px;
// color: #b0b4bc;
// margin: 15px;
// padding: 10px;
// margin-bottom: 0px;
// padding-bottom: 0px;
} }
.bar-section { .bar-section {
@ -28,11 +26,6 @@
color: rgba(200, 200, 200, 0.5); color: rgba(200, 200, 200, 0.5);
} }
.time {
font-weight: bold;
padding-right: 20px;
}
.alert { .alert {
color: #aa5555; color: #aa5555;
padding: 5px; padding: 5px;
@ -51,9 +44,12 @@
} }
.side-stuff { .side-stuff {
background-color: rgba(20, 20, 20, 0.9); background-color: $bkgrnd;
color: #FFFFFF; color: #FFFFFF;
border-radius: 10; border-radius: 10;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
font-size: 1.2rem;
} }

View file

@ -1,8 +1,10 @@
(defwidget bar [] (defwidget bar []
(centerbox :orientation "h" (centerbox :orientation "h"
(workspaces :current-idx current-workspace) (workspaces :current-idx current-workspace)
(music) ;; (music)
(info))) (center-clock)
(info)
))
(deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace") (deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace")
(defwidget workspaces [current-idx] (defwidget workspaces [current-idx]
@ -73,17 +75,23 @@
(defvar volume-visible false) (defvar volume-visible false)
(defwidget _volume [volume] (defwidget _volume [volume]
(box (eventbox
:hexpand false :onscroll "./scripts/volume {} ${EWW_EXECUTABLE}"
:class {volume > 100 ? "alert" : "regular"} :onclick "./scripts/volume toggle ${EWW_EXECUTABLE}"
(revealer-on-hover (box
:toggle volume-visible :hexpand false
:togglename "volume-visible" :class {(volume ?: 90) > 100 ? "alert" : "regular"}
(label :text {volume <= 0 ? "󰝟 " : (revealer-on-hover
volume < 33 ? "󰕿 " : :toggle volume-visible
volume < 66 ? "󰖀 " : :togglename "volume-visible"
volume < 99 ? "󰕾 " : "󱄡 "}) (label :text {volume <= 0 ? "󰝟 " :
(label :text "${volume}%")))) volume < 33 ? "󰕿 " :
volume < 66 ? "󰖀 " :
volume < 99 ? "󰕾 " : "󱄡 "})
(label :text "${volume ?: "??"}%")
)
(volume_scale)
)))
(defvar battery-visible false) (defvar battery-visible false)
@ -144,19 +152,11 @@
{music != "" ? "🎵${music}" : ""})) {music != "" ? "🎵${music}" : ""}))
(defpoll volume :interval "1s" (defpoll volume :interval "1s"
"pw-volume status | jq '.percentage'") {"pw-volume status | jq '.percentage // -1'" ?: 500})
(defpoll time :interval "10s" (include "windows.yuck")
"date '+%H:%M %b %d, %Y'") (include "./modules/center-clock.yuck")
(defwindow bar (defvar open_vol_osd false)
:monitor 1 (defvar ANIM_DURATION "500ms")
:exclusive true (include "./modules/volume-osd.yuck")
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View file

@ -0,0 +1,8 @@
.center-clock {
border-radius: 15;
background-color: rgba(20, 20, 20, 0.9);
color: rgba(200, 200, 200, 1.0);
padding-left: 20px;
padding-right: 20px;
font-size: 1.2rem;
}

View file

@ -0,0 +1,7 @@
(defwidget center-clock []
(label :class "center-clock"
:orientation "h"
:halign "center"
:text {formattime(EWW_TIME, "%H:%M")})
)

View file

@ -0,0 +1,32 @@
.volume-osd {
min-width: 25rem;
margin-top: 20px;
padding: 5px;
border-radius: 0.3rem;
background-color: $light_bkgrnd;
}
.volume-scale trough {
background-color: rgba(74, 139, 173, 1);
border-radius: 0.2rem;
min-height: 0.4rem;
}
.volume-scale trough highlight {
background-color: rgba(163, 255, 180, 1);
border-radius: 0.2rem;
min-height: 0.4rem;
}
.volume-icon {
margin-left: 0.75rem;
font-size: 1.5rem;
&.less {
color: rgba(150, 0, 0, 1);
};
&.more {
color: rgba(0, 150, 0, 1);
};
}

View file

@ -0,0 +1,25 @@
(defwindow vol_osd
:monitor 1
:exclusive: false
:stacking "overlay"
:geometry (geometry :anchor "top center")
(volume_osd))
(defwidget volume_osd []
(revealer :transition "slidedown"
:reveal {open_vol_osd == true ? true : false}
:duration { ANIM_DURATION }
(box :orientation "h"
:class "volume-osd"
:space-evenly false
(volume_scale))))
(defwidget volume_scale []
(overlay :hexpand true
(scale :min 0
:max 100
:active {volume != -1}
:value {volume == "-1" ? 0 : volume}
:class "volume-scale")))

View file

@ -0,0 +1,12 @@
#!/bin/sh
case $1 in
"*") command="";;
"up") command="change +4%";;
"down") command="change -4%";;
"toggle") command="mute toggle";;
esac
[ -n "$command" ] && pw-volume $command
$2 update volume=$(pw-volume status | jq '.percentage // 10')

View file

@ -0,0 +1,12 @@
(defwindow bar
:monitor 1
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View file

@ -1,4 +1,4 @@
{lib, ...}: {lib, pkgs, ...}:
let let
workspaces = workspaces =
@ -20,7 +20,23 @@ in
"$mod ALT, mouse:272, resizewindow" "$mod ALT, mouse:272, resizewindow"
]; ];
# binde, will repeat when held
#https://wiki.hyprland.org/Configuring/Binds/#bind-flags
binde = [
",XF86AudioRaiseVolume, exec, pw-volume change +1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jq '.percentage // 10')"
",XF86AudioLowerVolume, exec, pw-volume change -1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jq '.percentage // 10')"
];
# listen even when locked
bindl = [
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioNext, exec, playerctl next"
",XF86AudioNext, exec, playerctl previous"
];
bind = [ bind = [
",XF86AudioMute, exec, pw-volume mute toggle"
"$mod, RETURN, exec, kitty" "$mod, RETURN, exec, kitty"
"$mod, r, exec, rofi -show run window" "$mod, r, exec, rofi -show run window"
"$mod, q, killactive" "$mod, q, killactive"