Hello everyone, I need a bit of help in making something roughly like gnome-inhibit-applet.
Since programs can inhibit xfce's power manager, it should theoretically be possible to do that with a script which gets started or killed by a second script which is run via a simple "launcher" panel plugin, thereby rudimentarily copying the basic functionality of gnome-inhibit-applet.
Now I wouldn't mind having to write that myself if something like that doesn't exist yet, but I need help in how to actually inhibit. In other words, making a script that checks whether a certain process is running (the inhibiting script), kills if it yes and calls it if no, as well as the panel icon that calls said script is no problem, but I have no idea how to write the actual inhibiting script.
I tried asking google and found something about dbus bindings, which seems to be way beyond my skills... Sadly my humble skills are limited to PHP, bash and a bit of Java. So I would like to ask if there would be someone so kind as to either write such a script that inhibits xfce's power manager and screensaver while it runs or instead at least help guide me in writing one myself without screwing up my laptop or needing to learn advanced C/C++ first >_>
do you had some efforts to write such an applet?
I just switched from gnome-2 to xfce and I miss that applet too.
I know C/C++ but I do not know how to disable the power-management and I have no idea how to write an XFCE-applet.
Thanks and regards,
Last edited by thomask (2012-01-04 21:06:47)
I’ve knocked together a quick script to turn off power management and screen blanking:
#!/bin/bash #query dpms with xset and switch status if xset -q | grep DPMS| grep -c Enabled ; then xset -dpms; xset s off notify-send DPMS "DPMS disabled" else xset +dpms; xset s on notify-send DPMS "DPMS enabled" fi
Note I don't have xscreensaver installed, so haven't checked whether that will interfere or not.
Save the script somewhere such as ~/bin/toggledpms, and set it to executable, then attach it to a launcher.
Hope this helps.
Could someone with xscreensaver installed check this works:
#!/bin/bash #query dpms with xset and switch status, also exit and restart xscreensaver if xset -q | grep DPMS| grep -c Enabled ; then xset -dpms; xset s off; xscreensaver-command -exit notify-send -i gtk-dialog-info "Screen saving is OFF" else xset +dpms; xset s on; xscreensaver & notify-send -i gtk-dialog-info "Screen saving is ON" fi
Last edited by demosthenese (2012-01-05 04:22:38)
I haven't had the time yet to test your second script. I remember using something similar in the past as a (limited, as not completely effective) workaround though (might have not thought of xscreensaver).
If it works, I might expand your script a little so it can become a panel starter icon that changes icons depending on whether active or not.
However, the original idea was a script/little prog that uses xfce power manager's inhibit interface. Unless I'm mistaken, your script turns off power management off altogether, so I guess you wouldn't get any warnings about low power anymore either?
Ok. A slightly different tack. This one uses xdotool, which you may need to install.
1. run a script to simulate tapping the ctrl key every couple of minutes.
2. have a launcher script to toggle the first script on and off.
#!/bin/bash while : do xdotool key ctrl; sleep 120 done
and the launcher script - screenpoketoggle
#!/bin/bash TASK=$HOME/bin/screenpoke if pidof -x $TASK ; then kill -9 $(pidof -x $TASK) notify-send -i gtk-dialog-info "Screen saving is ON" else $TASK & notify-send -i gtk-dialog-info "Screen saving is OFF" fi
No messing about with power management.
Nice workaround. Ugly but effective If I haven't expanded your toggle script to have its own toggling icon in, say, a month, poke me please (right now I really should write some &!$ essays >_>).
Best would of course be something that actually interfaces with xfce power manager's "inhibit" API part, but I guess there's probably just a few people on the planet who know its workings. ¯'-Ö-'¯