Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | calendar() { |
| 4 | LOCK_FILE="$HOME/.cache/eww-calendar.lock" |
| 5 | EWW_BIN="$HOME/.local/bin/eww/eww" |
| 6 | |
| 7 | run() { |
| 8 | ${EWW_BIN} -c $HOME/.config/eww/bar open calendar |
| 9 | } |
| 10 | |
| 11 | # Open widgets |
| 12 | if [[ ! -f "$LOCK_FILE" ]]; then |
| 13 | ${EWW_BIN} -c $HOME/.config/eww/bar close system music_win audio_ctl |
| 14 | touch "$LOCK_FILE" |
| 15 | run && echo "ok good!" |
| 16 | else |
| 17 | ${EWW_BIN} -c $HOME/.config/eww/bar close calendar |
| 18 | rm "$LOCK_FILE" && echo "closed" |
| 19 | fi |
| 20 | } |
| 21 | |
| 22 | |
| 23 | system() { |
| 24 | LOCK_FILE_MEM="$HOME/.cache/eww-system.lock" |
| 25 | EWW_BIN="$HOME/.local/bin/eww/eww" |
| 26 | |
| 27 | run() { |
| 28 | ${EWW_BIN} -c $HOME/.config/eww/bar open system |
| 29 | } |
| 30 | |
| 31 | # Open widgets |
| 32 | if [[ ! -f "$LOCK_FILE_MEM" ]]; then |
| 33 | ${EWW_BIN} -c $HOME/.config/eww/bar close calendar music_win audio_ctl |
| 34 | touch "$LOCK_FILE_MEM" |
| 35 | run && echo "ok good!" |
| 36 | else |
| 37 | ${EWW_BIN} -c $HOME/.config/eww/bar close system |
| 38 | rm "$LOCK_FILE_MEM" && echo "closed" |
| 39 | fi |
| 40 | } |
| 41 | |
| 42 | |
| 43 | music() { |
| 44 | LOCK_FILE_SONG="$HOME/.cache/eww-song.lock" |
| 45 | EWW_BIN="$HOME/.local/bin/eww/eww" |
| 46 | |
| 47 | run() { |
| 48 | ${EWW_BIN} -c $HOME/.config/eww/bar open music_win |
| 49 | } |
| 50 | |
| 51 | # Open widgets |
| 52 | if [[ ! -f "$LOCK_FILE_SONG" ]]; then |
| 53 | ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar |
| 54 | touch "$LOCK_FILE_SONG" |
| 55 | run && echo "ok good!" |
| 56 | else |
| 57 | ${EWW_BIN} -c $HOME/.config/eww/bar close music_win |
| 58 | rm "$LOCK_FILE_SONG" && echo "closed" |
| 59 | fi |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | audio() { |
| 65 | LOCK_FILE_AUDIO="$HOME/.cache/eww-audio.lock" |
| 66 | EWW_BIN="$HOME/.local/bin/eww/eww" |
| 67 | |
| 68 | run() { |
| 69 | ${EWW_BIN} -c $HOME/.config/eww/bar open audio_ctl |
| 70 | } |
| 71 | |
| 72 | # Open widgets |
| 73 | if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then |
| 74 | ${EWW_BIN} -c $HOME/.config/eww/bar close system calendar music |
| 75 | touch "$LOCK_FILE_AUDIO" |
| 76 | run && echo "ok good!" |
| 77 | else |
| 78 | ${EWW_BIN} -c $HOME/.config/eww/bar close audio_ctl |
| 79 | rm "$LOCK_FILE_AUDIO" && echo "closed" |
| 80 | fi |
| 81 | } |
| 82 | |
| 83 | |
| 84 | if [ "$1" = "calendar" ]; then |
| 85 | calendar |
| 86 | elif [ "$1" = "system" ]; then |
| 87 | system |
| 88 | elif [ "$1" = "music" ]; then |
| 89 | music |
| 90 | elif [ "$1" = "audio" ]; then |
| 91 | audio |
| 92 | fi |