feat(rumno): tune notification rules and timeout handling
This commit is contained in:
@@ -130,11 +130,12 @@ getAverageBrightness = do
|
||||
-- Send notification using rumno if available
|
||||
sendNotification :: Int -> IO ()
|
||||
sendNotification brightness = do
|
||||
let timeoutSeconds = "2.5"
|
||||
rumnoExists <- (== ExitSuccess) <$>
|
||||
rawSystem "sh" ["-c", "command -v rumno >/dev/null 2>&1"]
|
||||
if rumnoExists
|
||||
then do
|
||||
_ <- readProcess "rumno" ["notify", "-b", show brightness] ""
|
||||
_ <- readProcess "rumno" ["notify", "-t", timeoutSeconds, "-b", show brightness] ""
|
||||
return ()
|
||||
else putStrLn (show brightness)
|
||||
|
||||
|
||||
@@ -83,10 +83,11 @@ fi
|
||||
|
||||
# Get current brightness percentage for display
|
||||
BRIGHTNESS=$(get_brightness_percentage)
|
||||
RUMNO_TIMEOUT="${RUMNO_TIMEOUT:-2.5}"
|
||||
|
||||
# Show notification if rumno is available
|
||||
if command -v rumno &> /dev/null; then
|
||||
rumno notify -b "$BRIGHTNESS"
|
||||
rumno notify -t "$RUMNO_TIMEOUT" -b "$BRIGHTNESS"
|
||||
else
|
||||
echo "$BRIGHTNESS"
|
||||
fi
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
function pashowvolume {
|
||||
timeout="${RUMNO_TIMEOUT:-2.5}"
|
||||
if paismuted; then
|
||||
rumno notify -m
|
||||
rumno notify -t "$timeout" -m
|
||||
else
|
||||
actual=$(pavolume)
|
||||
max=100
|
||||
show=$(( actual < max ? actual : max ))
|
||||
rumno notify -v "$show"
|
||||
rumno notify -t "$timeout" -v "$show"
|
||||
fi
|
||||
}
|
||||
|
||||
pashowvolume
|
||||
|
||||
|
||||
Reference in New Issue
Block a user