Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

3
Become a Fan
6.1

Description:
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 .
Last changelog:

/*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


Ratings & Comments

18 Comments

koko2k

any chance to have a kde5 version?

rpabel

I am still using KDE4. Don't know when I'll start using 5...

AdaMin

Thank you for the great app! The linked file has a wrong file extension. It is a tar.gz, not a tar.bz2 file.

sadi

I wish this plasmoid could be installed directly and automatically from within KDE's plasma workspace, panel, etc.

rieper

thank you very much! exactly what i was looking for. knowing nothing about inkscape magic: could you give me some hints how to change the icon into a custom one?

rieper

well, solved the inkscape part by making a svg with the two pics and set group labels to on/off. 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.

FrostBlue

Hi I like this idea very much. 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.

google01103

could you some how visually differentiate from the toggle composite plasmoid - maybe diff. default colors. actually allowing custom colors would differentiate different occurrence of the plasmoid for different functions

rpabel

I'm all for different styles, but I'm not an artist (anything I would design with Inkscape would look truly hideous). But, of course, I'd accept contributions any time... 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...

WildSioux

I just tried and it doesn't do anything. I am trying to set the command to turn on/off my wifi card(s) in my laptop. 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

rpabel

So it works for you if you put the command in quotation marks? 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.

WildSioux

Sorry if I caused some confusion. NO, I'm not able to run a sudo command with this. I should have been more clear in that this is a question. 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

xakde

you can always use kdesudo

rpabel

yeah, that is probably the best way to do it, kdesudo should pop up a window and ask for you password. 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...

WildSioux

...kdesudo works! 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).

rpabel

Thanks for the idea with the tooltip, I had planned to give the switch a name, but wasn't sure how to display it. I'll upload the new version in a minute.

srog

Tested with the Kubuntu 9.10 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 !!

rpabel

Thanks for the positive feedback. I developed and tested it on OpenSuSE 11.2, good to know it not only works-for-me(tm)

Pling
0 Affiliates
Details
license
version 0.2
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

Other Plasma 4 Extensions:

Icon Tasks deb build
N00bun2
last update date: 14 years ago

Score 4.3

Prayer Times Plasmoid
riyad
last update date: 13 years ago

Score 5.2

KPrayertime4 Islamic Prayer Times
ahaq
last update date: 15 years ago

Score 4.4

Hostinfo
mgraesslin
last update date: 13 years ago

Score 4.7

Monitor QuadCore Russian
kuchumovn
last update date: 16 years ago

Score 5.0

blaKjaK
werevire
last update date: 15 years ago

Score 5.0