Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
XFCE4 "toggle applet" [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3374

PostPosted: Sat Feb 13, 2016 8:13 pm    Post subject: XFCE4 "toggle applet" [SOLVED] Reply with quote

Is anyone aware of a "toggle applet" for xfce4?

Picture a "stateful button" that has two icons. Normally, you see Icon-A, and pressing the button performs Action-A. Also, when you press the button and perform Action-A, it changes the button to Icon-B. At that point, pressing the button performs Action-B and changes the icon back to Icon-A.

In other words, a push-on, push-off switch.

I'm thinking in terms of an easy interface for my wife to start and stop OpenVPN on our laptop. I don't (won't?) run NetworkManager, right now I'm handling networking just using dhcpcd and dhcpcd-ui, which doesn't handle VPNs. (Nor does WICD.)

I found "xfce4-extra/xfce4-genmon-plugin". It's not precisely what I'd like, but it's capable of doing what I need - really what my wife needs. It's a monitor, so it's a bit inefficient, but it works. Here's the script I attach to it:
Code:
#!/bin/bash

if $(ip link show | grep -q ",UP>")
then
  if $(ip link show | grep -q tun0)
  then
    echo "<img>/usr/share/icons/hicolor/48x48/apps/gcr-key-pair.png</img>"
    echo "<click>/usr/bin/sudo /etc/init.d/openvpn stop</click>"
  else
    echo "<img>/usr/share/icons/hicolor/48x48/apps/gcr-key.png</img>"
    echo "<click>/usr/bin/sudo /etc/init.d/openvpn start</click>"
  fi
else
  echo "<img>/usr/share/icons/hicolor/48x48/apps/gcr-gnupg.png</img>"
    echo "<click>/bin/true</click>"
fi

The icons used were things already installed and easy to explain to my wife.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum