Posts Tagged ‘bash’

Simple pomodoro script

This is a very basic pomodoro script I am using to avoid getting in a fixed position for hours at a time:

#!/bin/bash
 
UNIT=5
UNIT_CNT=5
PAUSE=6
 
notify-send -i clock "Starting interval..."
 
for i in $(seq $UNIT_CNT); do
    sleep ${UNIT}m
    let c=$i*$UNIT
    notify-send -i clock "$c minutes"
done
 
(for i in $(seq $PAUSE); do let c=$PAUSE-$i+1; echo -n "Pause ${c}m"; echo -e '\f'; sleep 1m; done; echo -e '\f'; echo "Work";) | sm -

(X)Ubuntu microphone mute/unmute script

The goal of this script was to have a simple script, binded with a shortcut which allows to mute/unmute all the microphones and to display a nice notification in the process. This is the simplest version working on xubuntu 14.04 with pulseaudio.

mute.sh

#!/bin/bash
 
ACTION=1 #1 mute, 0 unmute
SCNT=$(pacmd list-sources | grep muted | wc -l)
 
MUTED=$(pacmd list-sources | grep muted | grep yes)
if [ $? == 0 ]; then
    ACTION=0
    notify-send -i microphone-sensitivity-medium "Microphone" "Unmutting $SCNT sources..."
else
    notify-send -i microphone-sensitivity-muted "Microphone" "Mutting $SCNT sources..."
fi
 
#SRC=$(seq $SCNT)
SRC=$(pacmd list-sources | grep index | cut -d':' -f2 | tr -d ' ')
 
for i in $SRC; do
    #let s=$i-1
    pacmd set-source-mute $i $ACTION
done