init
This commit is contained in:
18
dwl-startup.sh
Executable file
18
dwl-startup.sh
Executable file
@@ -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"
|
||||
9
start-dwl.sh
Executable file
9
start-dwl.sh
Executable file
@@ -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
|
||||
59
volume.sh
Executable file
59
volume.sh
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user