Skip to content

Commit

Permalink
eww: fix modules missing
Browse files Browse the repository at this point in the history
  • Loading branch information
zeapoz committed Jul 4, 2024
1 parent dbe3c9f commit c8ad675
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
6 changes: 4 additions & 2 deletions config/eww/modules/audio.yuck
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
(deflisten audio "scripts/audio")
(defvar sink_icons '["", "", "", ""]')
(defvar source_icons '["", ""]')
(defwidget audio []
(eventbox
:onrightclick "pavucontrol &"
(box :class "module audio"
:orientation "v"
(button :class "icon output"
:onclick "scripts/audio mute SINK"
"${audio.sink_icon}")
"${sink_icons[round(audio.sink_vol / 25, 0)]}")
(button :class "icon input"
:onclick "scripts/audio mute SOURCE"
"${audio.source_icon}"))))
{audio.source_vol > 0 ? source_icons[1] : source_icons[0]}))))
6 changes: 3 additions & 3 deletions config/eww/modules/hyprland.yuck
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
:orientation "v"
:visible {hyprland.submap != "null"}
(label
:class "icon ${hyprland.submap.name}"
:class "icon ${hyprland.submap?.name}"
:text "")
(label
:class "icon ${hyprland.submap.name}"
:text "${hyprland.submap.short}"))))
:class "icon ${hyprland.submap?.name}"
:text "${hyprland.submap?.short}"))))
8 changes: 6 additions & 2 deletions config/eww/modules/net.yuck
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
(deflisten net "scripts/net")
(defvar net_icons '["", ""]')
(defvar vpn_icons '["", ""]')
(defwidget net []
(box :class "module net"
:orientation "v"
:space-evenly false
(button :class "icon" :onclick "scripts/net toggle" "${net.icon}")
(button :class "icon"
:onclick "scripts/net toggle"
{net.is_eth ? net_icons[1] : net_icons[0]})
(button :class "icon"
:onclick {net.vpn ? "mullvad disconnect" : "mullvad connect"}
:onrightclick "mullvad-gui &"
"${net.vpn_icon}")))
{net.vpn ? vpn_icons[0] : vpn_icons[1]})))
13 changes: 3 additions & 10 deletions config/eww/scripts/audio
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ function set_mute() {
function get_sink() {
sink_vol=$(vol "SINK")
if is_muted "SINK"; then
sink_icon=""
else
lvl=$(awk -v n="$sink_vol" 'BEGIN{print int(n/34)}')
sink_icon="${volicons[$lvl]}"
sink_vol=0
fi
}

function get_source() {
source_vol=$(vol "SOURCE")
if is_muted "SOURCE"; then
source_icon=""
else
source_icon=""
source_vol=0
fi
}

Expand All @@ -44,11 +39,9 @@ function gen_output() {
get_sink
fi
jaq --null-input -r -c \
--arg sink_icon "$sink_icon" \
--arg sink_vol "$sink_vol" \
--arg source_icon "$source_icon" \
--arg source_vol "$source_vol" \
'{"sink_icon": $sink_icon, "sink_vol": $sink_vol, "source_icon": $source_icon, "source_vol": $source_vol}'
'{"sink_vol": $sink_vol, "source_vol": $source_vol}'
}

case "$1" in
Expand Down
11 changes: 4 additions & 7 deletions config/eww/scripts/net
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,20 @@ function toggle() {
function get_vpn() {
if nmcli con show --active | rg -q "mullvad"; then
vpn=true
vpn_icon=""
else
vpn=false
vpn_icon=""
fi
}

function gen_wifi() {
icon=""
is_eth=false
color="#cba6f7"
class="net-connected"
name=$(echo "$nm" | jaq -r 'select(.type == "wifi") .connection')
}

function gen_ethernet() {
icon=""
is_eth=true
class="net-connected"
color="#cba6f7"
name=$(echo "$nm" | jaq -r 'select(.type == "ethernet") .connection')
Expand All @@ -64,13 +62,12 @@ function make_content() {
get_vpn

jaq --null-input -r -c \
--arg icon "$icon" \
--arg is_eth "$is_eth" \
--arg name "$name" \
--arg color "$color" \
--arg class "$class" \
--arg vpn "$vpn" \
--arg vpn_icon "$vpn_icon" \
'{"icon": $icon, "name": $name, "color": $color, "class": $class, "vpn": $vpn, "vpn_icon": $vpn_icon}'
'{"is_eth": $is_eth, "name": $name, "color": $color, "class": $class, "vpn": $vpn}'
}

case "$1" in
Expand Down

0 comments on commit c8ad675

Please sign in to comment.