
Configurable Button
Original
Plasma 5 Applets kde5 plasmoid switch
Source (link to git-repo or to original if based on someone elses unmodified work): https://github.com/pmarki/plasmoid-button
*A Configurable Button Plasmoid (yet another on-off switch)*
This is a button that allows to run script when toggled (on and off scripts) and to monitor status by status script. The new thing is an option to configure icons.
*Configuration*
The plasmoid can by configured in the settings menu:
- Plasmoid Label will be visible next to plasmoid (can be useful to distinguish couple of them). Leave empty to show only icon (feature by renn0xtek9)
- On Script will execute a script (can be a full path to a script or bash snippet) when toggling from off state to on. The icon will be changed to "On" icon.
- Off Script will execute a script (can be a full path to a script or bash snippet) when toggling from on state to off. The icon will be changed to "Off" icon.
- Status Script can be used to monitor application (or the Internet connection). The script should return 0 on success (to show "On" state), something else on error (to show "Off" state)
- Check status on startup: Run once "Status script" on system startup
- Run periodically: Run "Status Script" in defined interval
*Example usage*
1. Configuration to monitor internet connection (or server status)
- Disable On and Off scripts
- Enable Status Script on startup and to run periodically
set interval to your needs
- Add status script ping -c 2 -q example.com
2. Configuration to start a service
- Enable On script
- Add On script eg: sudo systemctl start docker (assuimg this command can be run without password)
- disable Off and Status scripts
When button will be pressed the script will be launched, if a service was started successfully the icon will stay green, otherwise the icon will go back to red.
3. Configuration to start, stop and monitor service
- Enable everything :)
*Notes*
On script should exit with 0, otherwise icon be change to red (test it by adding On script sleep 5; exit 1)
Off script exit code is not taken into account
By default plasmoid shows red (Off) icon when started, this can be easly changed: set Status script exit 0 to run once on startup
*Maybe in a future*
tooltip with custom name
tooltip or dialog with output from scripts
Credits for:
https://github.com/neicker/on-off-switch
https://github.com/MakG10/plasma-applet-server-status
for ideas. I also noticed https://github.com/Intika-Linux-Plasmoid/plasmoid-on-off-switch-commands when my plasmoid was almost done.
rajeshdrao
4 days ago
Report
abrac
16 days ago
My only gripe is that you have to have good aim with your mouse. When I press slightly left or right of the button, a pop-up appears instead. Don't know if others are experiencing this too.
Report
selplacei
19 days ago
On-script = boinccmd --set_run_mode auto
Off-script = boinccmd --set_run_mode never
Status = ! { boinccmd --get_cc_status | grep -q 'current mode: never' }
Report
HessiJames
24 days ago
Report
mrpabllo
6 months ago
Any idea how to write a script for check if music is playing?
Report
jcake
1 month ago
Report
heimdall
7 months ago
Report
tnilzon
7 months ago
Like this, it's very useful. Really waiting for the "tooltip with custom name" though.
Report
heqro
7 months ago
Report
heqro
7 months ago
Report
heqro
7 months ago
Report
abrac
16 days ago
Report
heqro
16 days ago
Report
abrac
15 days ago
Report
sdhsako
8 months ago
Report
wiert
9 months ago
Report
MichaelTunnell
10 months ago
Report
katp00p
1 year ago
Report
katp00p
1 year ago
Report
katp00p
1 year ago
Report
Phobeus
1 year ago
Report
frag
1 year ago
Report