diff --git a/etc/skel/.config/waybar/config.jsonc b/etc/skel/.config/waybar/config.jsonc index a993ae9..df07d2b 100644 --- a/etc/skel/.config/waybar/config.jsonc +++ b/etc/skel/.config/waybar/config.jsonc @@ -93,8 +93,8 @@ "format": "", "interval": "once", "return-type": "json", - "on-click": "swaymsg -q exec '$clipboard'; pkill -RTMIN+9 waybar", - "on-click-right": "swaymsg -q exec '$clipboard-del'; pkill -RTMIN+9 waybar", + "on-click": "riverctl spawn '/usr/share/river/scripts/clipboard-manager.sh --list'; pkill -RTMIN+9 waybar", + "on-click-right": "riverctl spawn '/usr/share/river/scripts/clipboard-manager.sh --del'; pkill -RTMIN+9 waybar", "on-click-middle": "rm -f ~/.cache/cliphist/db; pkill -RTMIN+9 waybar", "exec": "printf '{\"tooltip\":\"%s\"}' $(cliphist list | wc -l)' item(s) in the clipboard\r(Mid click to clear)'", "exec-if": "[ -x \"$(command -v cliphist)\" ] && [ $(cliphist list | wc -l) -gt 0 ]", @@ -161,10 +161,10 @@ }, "tooltip-format": "{icon}  {volume}% {format_source}", "on-click": "riverctl spawn /usr/share/river/scripts/pulse.sh", - "on-click-middle": "exec pulsemixer --toggle-mute && /usr/share/river/scripts/volume-notify.sh", + "on-click-middle": "pulsemixer --toggle-mute && /usr/share/river/scripts/volume-notify.sh", "on-click-right": "riverctl spawn pavucontrol", - "on-scroll-up": "exec pulsemixer --change-volume +5 && /usr/share/river/scripts/volume-notify.sh", - "on-scroll-down": "exec pulsemixer --change-volume -5 && /usr/share/river/scripts/volume-notify.sh" + "on-scroll-up": "pulsemixer --change-volume +5 && /usr/share/river/scripts/volume-notify.sh", + "on-scroll-down": "pulsemixer --change-volume -5 && /usr/share/river/scripts/volume-notify.sh" }, "clock": { diff --git a/etc/skel/.config/waybar/style.css b/etc/skel/.config/waybar/style.css index 83f9fed..4700260 100644 --- a/etc/skel/.config/waybar/style.css +++ b/etc/skel/.config/waybar/style.css @@ -70,14 +70,12 @@ window#waybar.hidden { #clock, #custom-playerctl, #custom-power, -#custom-scratchpad, #custom-wlsunset, #custom-clipboard, #custom-menu, #custom-dunst, #battery, #cpu, -#language, #memory, #network, #bluetooth, @@ -107,10 +105,6 @@ window#waybar.hidden { color: #cad3f5; } -#custom-scratchpad { - color: #f4dbd6; -} - #custom-clipboard { color: #f5a97f; } @@ -156,10 +150,6 @@ label:focus { color: #eed49f; } -#language { - color: #ee99a0; -} - #memory { color: #a6da95; } diff --git a/usr/share/river/scripts/bluetooth-manager.sh b/usr/share/river/scripts/bluetooth-manager.sh new file mode 100755 index 0000000..95be3a0 --- /dev/null +++ b/usr/share/river/scripts/bluetooth-manager.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)" +term_float="alacritty --class floating_shell -e" +FLOCK="flock --verbose -n "$HOME/.local/state/${HASH}.lock"" +$FLOCK $term_float bluetuith + diff --git a/usr/share/river/scripts/btop.sh b/usr/share/river/scripts/btop.sh new file mode 100755 index 0000000..eab4ff7 --- /dev/null +++ b/usr/share/river/scripts/btop.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)" +term_float="alacritty --class floating_shell -e" +FLOCK="flock --verbose -n "$HOME/.local/state/${HASH}.lock"" +$FLOCK $term_float btop + diff --git a/usr/share/river/scripts/calendar.sh b/usr/share/river/scripts/calendar.sh new file mode 100755 index 0000000..3c1583b --- /dev/null +++ b/usr/share/river/scripts/calendar.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)" +term_float="alacritty --class floating_shell -e" +FLOCK="flock --verbose -n "$HOME/.local/state/${HASH}.lock"" +$FLOCK $term_float calcurse + diff --git a/usr/share/river/scripts/clipboard-manager.sh b/usr/share/river/scripts/clipboard-manager.sh new file mode 100755 index 0000000..cd81b50 --- /dev/null +++ b/usr/share/river/scripts/clipboard-manager.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +case "$1" in + --list) cliphist list | fuzzel --dmenu -font -p "Select item to copy:" --lines 10 --width 60 | cliphist decode | wl-copy;; + --del) cliphist list | fuzzel --dmenu -font -p "Select item to delete:" --lines 10 --width 60 | cliphist delete;; +esac diff --git a/usr/share/river/scripts/flock.sh b/usr/share/river/scripts/flock.sh deleted file mode 100755 index 75115a4..0000000 --- a/usr/share/river/scripts/flock.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)" - -mkdir -p "$HOME/.local/state" - -flock --verbose -n "$HOME/.local/state/${HASH}.lock" "$@" diff --git a/usr/share/river/scripts/nmtui.sh b/usr/share/river/scripts/nmtui.sh index a0e89af..c94d929 100755 --- a/usr/share/river/scripts/nmtui.sh +++ b/usr/share/river/scripts/nmtui.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)" term_float="alacritty --class floating_shell -e" -$term_float nmtui connect +FLOCK="flock --verbose -n "$HOME/.local/state/${HASH}.lock"" +$FLOCK $term_float nmtui connect diff --git a/usr/share/river/scripts/sunset.sh b/usr/share/river/scripts/sunset.sh new file mode 100755 index 0000000..6e7bd2d --- /dev/null +++ b/usr/share/river/scripts/sunset.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +#Startup function +function start() { + [[ -f "$HOME/.config/wlsunset/config" ]] && source "$HOME/.config/wlsunset/config" + temp_low=${temp_low:-"4000"} + temp_high=${temp_high:-"6500"} + duration=${duration:-"900"} + sunrise=${sunrise:-"07:00"} + sunset=${sunset:-"19:00"} + location=${location:-"on"} + fallback_longitude=${fallback_longitude:-"8.7"} + fallback_latitude=${fallback_latitude:-"50.1"} + + if [ "${location}" = "on" ]; then + if [[ -z ${longitude+x} ]] || [[ -z ${latitude+x} ]]; then + GEO_CONTENT=$(curl -sL https://freegeoip.live/json/) + fi + longitude=${longitude:-$(echo "$GEO_CONTENT" | jq '.longitude // empty')} + longitude=${longitude:-$fallback_longitude} + latitude=${latitude:-$(echo "$GEO_CONTENT" | jq '.latitude // empty')} + latitude=${latitude:-$fallback_latitude} + + echo longitude: "$longitude" latitude: "$latitude" + + wlsunset -l "$latitude" -L "$longitude" -t "$temp_low" -T "$temp_high" -d "$duration" & + else + wlsunset -t "$temp_low" -T "$temp_high" -d "$duration" -S "$sunrise" -s "$sunset" & + fi +} + +#Accepts managing parameter +case $1'' in +'off') + pkill wlsunset + ;; + +'on') + start + ;; + +'toggle') + if pkill -0 wlsunset; then + pkill wlsunset + else + start + fi + ;; +'check') + command -v wlsunset + exit $? + ;; +esac + +#Returns a string for Waybar +if pkill -0 wlsunset; then + class="on" + tooltip="Night Color mode: enabled" +else + class="off" + tooltip="Night Color mode: disabled" +fi + +printf '{"alt":"%s", "tooltip":"%s"}\n' "$class" "$tooltip"