
On/Off Switch
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
On/Off Switch is a simple plasmoid that executes commands when the switch is toggled.
I wrote it change the cpufreq governor from powersave to
performance, e.g.
On-Command: solid-powermanagement set cpufreq performance
Off-Command: solid-powermanagement set cpufreq powersave
The switch image (on_off_switch.svg) and a few lines of code
were taken from toggle-compositing 0.2.3 by John Varouhakis.
Contact me/Report bugs at rpabel@gmail.com .
11 years ago
/*VERSION 0.2*/
Switch can now have a name ("Label").
It is displayed in the tooltip when the
mouse hovers over the applet.
Improvements in the configuration dialog.
/*VERSION 0.1*/
First Release,
based on toggle-compositing 0.2.3
by John Varouhakis
11 years ago
/*VERSION 0.2*/
Switch can now have a name ("Label").
It is displayed in the tooltip when the
mouse hovers over the applet.
Improvements in the configuration dialog.
/*VERSION 0.1*/
First Release,
based on toggle-compositing 0.2.3
by John Varouhakis
koko2k
5 years ago
Report
rpabel
5 years ago
Report
AdaMin
8 years ago
The linked file has a wrong file extension. It is a tar.gz, not a tar.bz2 file.
Report
sadi
9 years ago
Report
rieper
9 years ago
knowing nothing about inkscape magic: could you give me some hints how to change the icon into a custom one?
Report
rieper
9 years ago
now i am stuck at the .cpp part, since my icons are square and the original icon is not.
help is very much appreciated since i have not the slightest idea what to change in the source to make squarish icons work.
Report
FrostBlue
10 years ago
I am on Lucid and I had to move the file from
/usr/local/lib/kde4/plasma_applet_on_off_switch.so
/usr/local/share/kde4/services/plasma-applet-on_off_switch.desktop
to
/usr/lib/kde4/plasma_applet_on_off_switch.so
/usr/share/kde4/services/plasma-applet-on_off_switch.desktop
Now it shows up and lets me change the settings but I dont know where to put the icon and it gives me an error.
Icon not valid
This doesnt work
/usr/local/share/apps/desktoptheme/default/widgets/on_off_switch.svg
Please help.
Report
google01103
11 years ago
actually allowing custom colors would differentiate different occurrence of the plasmoid for different functions
Report
rpabel
11 years ago
I looked at the Plasma::Svg class again, I don't think there is any way to change the color through the class interface. I really like the idea, but I don't see how to realize yet...
Report
WildSioux
11 years ago
One is internal and the other is a express card. The only way I have found to turn them on/off is with:
On: "sudo modprobe wl"
Off: "sudo modprobe -r wl"
That is my internal on in my dell laptop. Why the KDE wifi manager doesn't have this built in is beyond me.
Thanks
Report
rpabel
11 years ago
I don't really know what the best way to execute a generic command from a plasmoid is, so my first guess was to call something else. Right now, I take the string and call KRun::runCommand() . I don't really know what you can feed this method and I don't really see why quotation marks make any difference. I wanted to improve the widget over the weekend, I will also look into your issue then.
Report
WildSioux
11 years ago
That sudo command is what I run in konsole (without the quotes).
My questions; is this possible to do somehow with this on/off plasmoid? I would be cool with it if it popped up a window to enter in my password. Just so this holds and executes the command after it is entered.
Thanks
Report
xakde
11 years ago
Report
rpabel
11 years ago
I never thought to execute interactive programs with the switch, I only thought of silently executing programs. If you really need to start something with input/output or a GUI, a desktop shortcut is probably the first choice...
Alternatively, configure sudo to work without inputing your password, then it could also work with sudo...
Report
WildSioux
11 years ago
This is how I got it to work...
On Command: kdesudo modprobe wl
Off Command: sudo modprobe -r wl
with kdesudo in the off command it wouldn't turn it off. I imagine though, that since my password was already entered for kdesudo it remains open for 10-15 minutes (I can't remember the length). That is why it just works this way.
However, I believe if it has been longer than 15 minutes and the password is closed then the sudo...command to turn it off won't work. I don't have time to test it.
Also, could you please add a box in the settings to add a "Name" for the switch. If I add multiple switches I don't know what is what. Something that if it is in the panel, on mouse hover it would show the name. And if it is on the desktop, then it could show the name above/below it.
Thanks
(I will have to test having my internal wifi card turned on for more than 15 minutes and see if the sudo...command will turn it off. My guess is no).
Report
rpabel
11 years ago
Report
srog
11 years ago
With the commands:
On:
qdbus org.kde.powerdevil /modules/powerdevil setProfile Performance
OFF:
qdbus org.kde.powerdevil /modules/powerdevil setProfile Powersave
Working fine - Excellent idea - Thank you !!
Report
rpabel
11 years ago
I developed and tested it on OpenSuSE 11.2, good to know it not only works-for-me(tm)
Report