From 6570961f691410dfdddc7207f05416a4b6498c8e Mon Sep 17 00:00:00 2001 From: Jonathan DeMasi Date: Sat, 7 Mar 2026 20:13:33 -0700 Subject: [PATCH] init --- dwl-startup.sh | 18 +++++++++++++++ start-dwl.sh | 9 ++++++++ volume.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100755 dwl-startup.sh create mode 100755 start-dwl.sh create mode 100755 volume.sh diff --git a/dwl-startup.sh b/dwl-startup.sh new file mode 100755 index 0000000..9bd25e1 --- /dev/null +++ b/dwl-startup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Kill already running duplicate process +_ps="waybar mako swaybg" +for _prs in $_ps; do + if [ "$(pidof "${_prs}")" ]; then + killall -9 "${_prs}" + fi + done + +# Start our applications +swaybg --output '*' --mode fill --image /home/jonathan/Downloads/wallpaper.jpg & +mako & +#waybar & +foot --server & +swayidle -w timeout 300 'swaylock -f -c 000000' before-sleep 'swaylock -f -c 000000' & +gobar | dwlb -status-stdin all & +dwlb -font "JetBrainsMonoNerdFont:size=10" diff --git a/start-dwl.sh b/start-dwl.sh new file mode 100755 index 0000000..17e9bed --- /dev/null +++ b/start-dwl.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# --- Session settings --- +export XDG_CURRENT_DESKTOP=wlroots +export XDG_SESSION_TYPE=wayland +export XDG_SESSION_DESKTOP=wlroots + +# Starting dbus-session might require hard path. +dbus-run-session dwl -s /home/jonathan/.local/bin/dwl-startup.sh diff --git a/volume.sh b/volume.sh new file mode 100755 index 0000000..ea5ff3a --- /dev/null +++ b/volume.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +readonly CURRENT_VOLUME_CMD='pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | cut -f 2 -d"/"' +readonly VOLUME_UP_CMD="pactl set-sink-volume @DEFAULT_SINK@ +5%" +readonly VOLUME_DOWN_CMD="pactl set-sink-volume @DEFAULT_SINK@ -5%" +readonly MUTE_CMD="pactl set-sink-mute @DEFAULT_SINK@ toggle" +readonly CHECK_MUTE_CMD="pactl get-sink-mute @DEFAULT_SINK@" + +ACTION="$1" + +check_if_active_notification () { + if makoctl list | grep -q -E 'Notification.*Volume:' + then + makoctl list | grep -E 'Notification.*Volume:' | cut -f 1 -d":" | cut -f 2 -d" " + fi +} + +volume_up () { + eval "${VOLUME_UP_CMD}" +} + +volume_down () { + eval "${VOLUME_DOWN_CMD}" +} + +toggle_mute() { + eval "${MUTE_CMD}" +} + +get_current_volume () { + # Check if mute first + mute=$(eval "${CHECK_MUTE_CMD}") + if [[ "$mute" == "Mute: yes" ]]; then + echo "Muted" + else + eval "${CURRENT_VOLUME_CMD}" + fi +} + +send_notification () { + current_volume=$(get_current_volume) + active_notification=$(check_if_active_notification) + if [ -z "$active_notification" ]; then + notify-send "Volume: ${current_volume}" + else + notify-send -r ${active_notification} "Volume: ${current_volume}" + fi +} + +if [[ "$ACTION" == "up" ]]; then + volume_up + send_notification +elif [[ "$ACTION" == "down" ]]; then + volume_down + send_notification +elif [[ "$ACTION" == "mute" ]]; then + toggle_mute + send_notification +fi