You are not logged in.

#1 2008-12-27 08:57:58

kiwisaotome
Member
From: Chicago, IL
Registered: 2008-04-04
Posts: 19
Website

A starting point for pipemenus in Openbox

Does anybody know of a good "hello world" pipemenu written in python or bash? I'd like to get started with making my own pipemenus, but I'm having a hard time looking though some of the pipemenus on the Openbox website. I just need a nice clean one to look at for a starting point. Thanks. smile

Offline

#2 2008-12-27 17:13:59

thunderogg
Member
From: Rio de Janeiro
Registered: 2008-07-13
Posts: 172

Re: A starting point for pipemenus in Openbox

Hi kiwisaotome,
The idea is to make a script that creates an xml form at the time when it is called, which the openbox menu can use. It's fairly easy. Here is an example that I use. I don't remember where I got it from:

#!/bin/bash

FREQ=`cpufreq-info -p | awk '{print $3}'`

echo '<openbox_pipe_menu>'

if [ $FREQ = 'powersave' ]; then
        echo '<separator label="Powersave"/>'
else
    echo '<item label=" Powersave">'
    echo '<action name="Execute"><execute>sudo cpufreq-set -g powersave</execute></action>'
    echo '</item>'
fi

if [ $FREQ = 'ondemand' ]; then
        echo '<separator label="Ondemand"/>
else
    echo '<item label="Ondemand">'
    echo '<action name="Execute"><execute>sudo cpufreq-set -g ondemand</execute></action>'
    echo '</item>'
fi

if [ $FREQ = 'performance' ]; then
        echo '<separator label="Performance"/>'
else
    echo '<item label="Performance">'
    echo '<action name="Execute"><execute>sudo cpufreq-set -g performance</execute></action>'
    echo '</item>'
fi
echo '</openbox_pipe_menu>'

Then I call it from the openbox menu.xml where it first is declared or what ever it's called:

<menu execute="~/.config/openbox/scripts/cpufreq-pipe.sh" id="system-cpu-menu" label="CPU Governor"/>

And then called:

<menu id="system-cpu-menu"/>

Hope that helps. smile

Offline

#3 2008-12-27 23:07:23

kiwisaotome
Member
From: Chicago, IL
Registered: 2008-04-04
Posts: 19
Website

Re: A starting point for pipemenus in Openbox

This is pretty simple.  Thanks for breaking it down for me. smile

Offline

Board footer

Powered by FluxBB