mirror of
https://github.com/avinal/dotfiles.git
synced 2026-07-04 07:20:09 +05:30
add sway, waybar and rofi config
Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
COUNT=$(dunstctl count waiting)
|
||||
ENABLED=
|
||||
DISABLED=
|
||||
if [ $COUNT != 0 ]; then DISABLED=" $COUNT"; fi
|
||||
if dunstctl is-paused | grep -q "false" ; then echo $ENABLED; else echo $DISABLED; fi
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# get_weather.sh
|
||||
for i in {1..5}
|
||||
do
|
||||
text=$(curl -s "https://wttr.in/$1?format=1")
|
||||
if [[ $? == 0 ]]
|
||||
then
|
||||
text=$(echo "$text" | sed -E "s/\s+/ /g")
|
||||
tooltip=$(curl -s "https://wttr.in/$1?format=4")
|
||||
if [[ $? == 0 ]]
|
||||
then
|
||||
tooltip=$(echo "$tooltip" | sed -E "s/\s+/ /g")
|
||||
echo "{\"text\":\"$text\", \"tooltip\":\"$tooltip\"}"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "{\"text\":\"error\", \"tooltip\":\"error\"}"
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
output=$(wakatime --today)
|
||||
|
||||
# Extract hours and minutes using awk and sum the total
|
||||
total_minutes=$(echo "$output" | awk -F' ' '
|
||||
{
|
||||
for (i=1; i<=NF; i++) {
|
||||
if ($i == "hrs" || $i == "hr") total += $(i-1) * 60;
|
||||
if ($i == "mins" || $i == "min") total += $(i-1);
|
||||
}
|
||||
} END {print total}')
|
||||
|
||||
# Calculate total hours and remaining minutes
|
||||
total_hours=$((total_minutes / 60))
|
||||
remaining_minutes=$((total_minutes % 60))
|
||||
|
||||
# Print the results
|
||||
printf '{"text":"%02dh %02dm","tooltip":"%s","class":"wakatime"}' $total_hours $remaining_minutes "$output" | jq --unbuffered --compact-output
|
||||
Reference in New Issue
Block a user