Add click events to server blocks

master
Jonathan Hodgson 6 years ago
parent 0b4774055f
commit 0e2205b3a7
  1. 21
      i3/blocks/apache
  2. 21
      i3/blocks/mysql
  3. 21
      i3/blocks/proftp
  4. 14
      i3/i3blocks.conf

@ -5,6 +5,27 @@ STATUS=$($LAMPP status 2> /dev/null)
APACHE=$(echo "$STATUS" | grep -i apache | grep -io not > /dev/null && echo "down" || echo "up")
function toggleApache(){
if [ $APACHE = "up" ]; then
gksudo $LAMPP stopapache
else
gksudo $LAMPP startapache
fi
}
function toggleAll(){
if [ $APACHE = "up" ]; then
gksudo $LAMPP stop
else
gksudo $LAMPP start
fi
}
case $BLOCK_BUTTON in
1) toggleApache ;;
3) toggleAll ;;
esac
if [ "$APACHE" = "up" ]; then
COLOUR="#00FF00"
else

@ -5,6 +5,27 @@ STATUS=$($LAMPP status 2> /dev/null)
MYSQL=$(echo "$STATUS" | grep -i mysql | grep -io not > /dev/null && echo "down" || echo "up")
function toggleMysql(){
if [ $MYSQL = "up" ]; then
gksudo $LAMPP stopmysql
else
gksudo $LAMPP startmysql
fi
}
function toggleAll(){
if [ $MYSQL = "up" ]; then
gksudo $LAMPP stop
else
gksudo $LAMPP start
fi
}
case $BLOCK_BUTTON in
1) toggleMysql ;;
3) toggleAll ;;
esac
if [ "$MYSQL" = "up" ]; then
COLOUR="#00FF00"
else

@ -5,6 +5,27 @@ STATUS=$($LAMPP status 2> /dev/null)
PROFTP=$(echo "$STATUS" | grep -i proftp | grep -io not > /dev/null && echo "down" || echo "up")
function toggleProftp(){
if [ $PROFTP = "up" ]; then
gksudo $LAMPP stopftp
else
gksudo $LAMPP startftp
fi
}
function toggleAll(){
if [ $PROFTP = "up" ]; then
gksudo $LAMPP stop
else
gksudo $LAMPP start
fi
}
case $BLOCK_BUTTON in
1) toggleProftp ;;
3) toggleAll ;;
esac
if [ "$PROFTP" = "up" ]; then
COLOUR="#00FF00"
else

@ -39,9 +39,19 @@ instance=CAPS
interval=once
signal=11
[serverstatus]
command=~/.dotfiles/i3/blocks/server
[apachestatus]
command=~/.dotfiles/i3/blocks/apache
interval=5
separator=false
[mysqlstatus]
command=~/.dotfiles/i3/blocks/mysql
interval=5
#separator=false
#[proftpstatus]
#command=~/.dotfiles/i3/blocks/proftp
#interval=5
# Volume indicator
#

Loading…
Cancel
Save