summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-09-14 13:46:20 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-09-14 13:46:20 +0800
commita0ec345229e272af847b7c12213dab5f6829dfab (patch)
treefd5dc06afcf7629b3acff3efb03df609f6e62f6c
parenta1fa306592b4733130367749f033b8eb5f479b1d (diff)
added oneline for pipe(remember to redirect stderr -> stdout) and updates
-rwxr-xr-xhyprbri43
-rwxr-xr-xhypridle.sh10
-rwxr-xr-xhyprvol28
-rwxr-xr-xoneline7
-rwxr-xr-xsysutil.sh4
5 files changed, 76 insertions, 16 deletions
diff --git a/hyprbri b/hyprbri
new file mode 100755
index 0000000..6fe9508
--- /dev/null
+++ b/hyprbri
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+# Icons
+iDIR='/usr/share/archcraft/icons/dunst'
+
+# Notify
+notify_bl() {
+ backlight="$(brillo -G)"
+ current="${backlight%%%}"
+ if [[ "$current" -ge "0" && "$current" -le "20" ]]; then
+ icon="$iDIR"/brightness-20.png
+ elif [[ "$current" -ge "20" && "$current" -le "40" ]]; then
+ icon="$iDIR"/brightness-40.png
+ elif [[ "$current" -ge "40" && "$current" -le "60" ]]; then
+ icon="$iDIR"/brightness-60.png
+ elif [[ "$current" -ge "60" && "$current" -le "80" ]]; then
+ icon="$iDIR"/brightness-80.png
+ elif [[ "$current" -ge "80" && "$current" -le "100" ]]; then
+ icon="$iDIR"/brightness-100.png
+ fi
+ get_icon && dunstify -u low -h string:x-dunst-stack-tag:obbacklight -i "$icon" "Brightness : $(brillo -G)"
+}
+
+# Increase brightness
+inc_backlight() {
+ brillo -A 10 # && notify_bl
+}
+
+# Decrease brightness
+dec_backlight() {
+ brillo -U 10 # && notify_bl
+}
+
+# Execute accordingly
+if [[ "$1" == "--get" ]]; then
+ brillo -G
+elif [[ "$1" == "--inc" ]]; then
+ inc_backlight
+elif [[ "$1" == "--dec" ]]; then
+ dec_backlight
+else
+ brillo -G
+fi
diff --git a/hypridle.sh b/hypridle.sh
index f5384c3..d42d4f5 100755
--- a/hypridle.sh
+++ b/hypridle.sh
@@ -2,6 +2,8 @@
renice -n 19 $$
+XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
+
# arguments with signal trap
#trap idle SIGQUIT
#trap stopidle SIGILL
@@ -29,12 +31,14 @@ function idle() {
if [ $pmusic ]; then
if [[ $(playerctl status -p spotify) == "Playing" ]]; then
- m=true
+ echo true > $XDG_CACHE_HOME/playing-music
fi
fi
if [ $pmusic ]; then
playerctl --all-players pause
fi
+ brillio -O
+ brillio -S 0
}
function stopidle() {
@@ -55,10 +59,12 @@ function stopidle() {
notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" &
fi
/sbin/killall update.sh yay &
- if [ $pmusic ] && [ "$m" ]; then
+ if [ $pmusic ] && [ -f $XDG_CACHE_HOME/playing-music ]; then
playerctl play -p spotify
unset m
fi
+ rm -f $XDG_CACHE_HOME/playing-music
+ brillio -I
}
if [ "$1" ]; then
diff --git a/hyprvol b/hyprvol
index 326bce7..3980fe7 100755
--- a/hyprvol
+++ b/hyprvol
@@ -2,7 +2,7 @@
# Icons
iDIR='/usr/share/archcraft/icons/dunst'
-notify_cmd='notify-send -u low'
+# notify_cmd='notify-send -u low' # replace via syshud
# Get Volume
get_volume() {
@@ -22,7 +22,7 @@ notify_user() {
icon="$iDIR/volume-high.png"
fi
if $($HOME/scripts/sysutil.sh getSound screenshot); then $HOME/scripts/sysutil.sh playSound audio-volume-change.oga & fi
- ${notify_cmd} -i "$icon" "Volume : $current%"
+ # ${notify_cmd} -i "$icon" "Volume : $current%"
}
# Increase Volume
@@ -40,19 +40,19 @@ dec_volume() {
# Toggle Mute
toggle_mute() {
if [[ `pulsemixer --get-mute` == 0 ]]; then
- wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle & ${notify_cmd} -i "$iDIR/volume-mute.png" "Mute"
+ wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle # & ${notify_cmd} -i "$iDIR/volume-mute.png" "Mute"
else
- current="$(get_volume)"
- if [[ "$current" -eq "0" ]]; then
- icon="$iDIR/volume-mute.png"
- elif [[ ("$current" -ge "0") && ("$current" -le "40") ]]; then
- icon="$iDIR/volume-low.png"
- elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
- icon="$iDIR/volume-mid.png"
- elif [[ ("$current" -ge "60") ]]; then
- icon="$iDIR/volume-high.png"
- fi
- pulsemixer --toggle-mute & ${notify_cmd} -i "$icon" "Unmute"
+ # current="$(get_volume)"
+ # if [[ "$current" -eq "0" ]]; then
+ # icon="$iDIR/volume-mute.png"
+ # elif [[ ("$current" -ge "0") && ("$current" -le "40") ]]; then
+ # icon="$iDIR/volume-low.png"
+ # elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
+ # icon="$iDIR/volume-mid.png"
+ # elif [[ ("$current" -ge "60") ]]; then
+ # icon="$iDIR/volume-high.png"
+ # fi
+ pulsemixer --toggle-mute # & ${notify_cmd} -i "$icon" "Unmute"
fi
}
diff --git a/oneline b/oneline
new file mode 100755
index 0000000..b4915eb
--- /dev/null
+++ b/oneline
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+while read pipe; do
+ tput rc; tput el
+ printf "\r$pipe" | tr "\n" "\r"
+done
+echo
diff --git a/sysutil.sh b/sysutil.sh
index 8dba1bd..d6274c1 100755
--- a/sysutil.sh
+++ b/sysutil.sh
@@ -55,6 +55,10 @@ function volume() {
$HOME/scripts/hyprvol $@
}
+function brightness() {
+ $HOME/scripts/hyprbri $@
+}
+
if [ "$1" ]; then
$@
fi