Python openbox pipe menu

I somewhat hijacked a different thread and my question is more suited here.
I'm using a python script to check gmail in a pipe menu. At first it was creating problems because it would create a cache but would then not load until the file was removed. To fix this, I removed the last line (which created the cache) and it all works. However, I would prefer to have it work like it was intended.
The script:
#!/usr/bin/python
# Authors: [email protected] [email protected]
# License: GPL 2.0
# Usage:
# Put an entry in your ~/.config/openbox/menu.xml like this:
# <menu id="gmail" label="gmail" execute="~/.config/openbox/scripts/gmail-openbox.py" />
# And inside <menu id="root-menu" label="openbox">, add this somewhere (wherever you want it on your menu)
# <menu id="gmail" />
import os
import sys
import logging
name = "111111"
pw = "000000"
browser = "firefox3"
filename = "/tmp/.gmail.cache"
login = "\'https://mail.google.com/mail\'"
# Allow us to run using installed `libgmail` or the one in parent directory.
try:
import libgmail
except ImportError:
# Urghhh...
sys.path.insert(1,
os.path.realpath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import libgmail
if __name__ == "__main__":
import sys
from getpass import getpass
if not os.path.isfile(filename):
ga = libgmail.GmailAccount(name, pw)
try:
ga.login()
except libgmail.GmailLoginFailure:
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
print "<openbox_pipe_menu>"
print " <item label=\"login failed.\">"
print " <action name=\"Execute\"><execute>" + browser + " " + login + "</execute></action>"
print " </item>"
print "</openbox_pipe_menu>"
raise SystemExit
else:
ga = libgmail.GmailAccount(
state = libgmail.GmailSessionState(filename = filename))
msgtotals = ga.getUnreadMsgCount()
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
print "<openbox_pipe_menu>"
print "<separator label=\"Gmail\"/>"
if msgtotals == 0:
print " <item label=\"no new messages.\">"
elif msgtotals == 1:
print " <item label=\"1 new message.\">"
else:
print " <item label=\"" + str(msgtotals) + " new messages.\">"
print " <action name=\"Execute\"><execute>" + browser + " " + login + "</execute></action>"
print " </item>"
print "</openbox_pipe_menu>"
state = libgmail.GmailSessionState(account = ga).save(filename)
The line I removed:
state = libgmail.GmailSessionState(account = ga).save(filename)
The error I'd get if the cache existed:
Traceback (most recent call last):
File "/home/shawn/.config/openbox/scripts/gmail.py", line 56, in <module>
msgtotals = ga.getUnreadMsgCount()
File "/home/shawn/.config/openbox/scripts/libgmail.py", line 547, in getUnreadMsgCount
q = "is:" + U_AS_SUBSET_UNREAD)
File "/home/shawn/.config/openbox/scripts/libgmail.py", line 428, in _parseSearchResult
return self._parsePage(_buildURL(**params))
File "/home/shawn/.config/openbox/scripts/libgmail.py", line 401, in _parsePage
items = _parsePage(self._retrievePage(urlOrRequest))
File "/home/shawn/.config/openbox/scripts/libgmail.py", line 369, in _retrievePage
if self.opener is None:
AttributeError: GmailAccount instance has no attribute 'opener'
EDIT - you might need the libgmail.py
#!/usr/bin/env python
# libgmail -- Gmail access via Python
## To get the version number of the available libgmail version.
## Reminder: add date before next release. This attribute is also
## used in the setup script.
Version = '0.1.8' # (Nov 2007)
# Original author: [email protected]
# Maintainers: Waseem ([email protected]) and Stas Z ([email protected])
# License: GPL 2.0
# NOTE:
# You should ensure you are permitted to use this script before using it
# to access Google's Gmail servers.
# Gmail Implementation Notes
# ==========================
# * Folders contain message threads, not individual messages. At present I
# do not know any way to list all messages without processing thread list.
LG_DEBUG=0
from lgconstants import *
import os,pprint
import re
import urllib
import urllib2
import mimetypes
import types
from cPickle import load, dump
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
GMAIL_URL_LOGIN = "https://www.google.com/accounts/ServiceLoginBoxAuth"
GMAIL_URL_GMAIL = "https://mail.google.com/mail/?ui=1&"
# Set to any value to use proxy.
PROXY_URL = None # e.g. libgmail.PROXY_URL = 'myproxy.org:3128'
# TODO: Get these on the fly?
STANDARD_FOLDERS = [U_INBOX_SEARCH, U_STARRED_SEARCH,
U_ALL_SEARCH, U_DRAFTS_SEARCH,
U_SENT_SEARCH, U_SPAM_SEARCH]
# Constants with names not from the Gmail Javascript:
# TODO: Move to `lgconstants.py`?
U_SAVEDRAFT_VIEW = "sd"
D_DRAFTINFO = "di"
# NOTE: All other DI_* field offsets seem to match the MI_* field offsets
DI_BODY = 19
versionWarned = False # If the Javascript version is different have we
# warned about it?
RE_SPLIT_PAGE_CONTENT = re.compile("D\((.*?)\);", re.DOTALL)
class GmailError(Exception):
Exception thrown upon gmail-specific failures, in particular a
failure to log in and a failure to parse responses.
pass
class GmailSendError(Exception):
Exception to throw if we're unable to send a message
pass
def _parsePage(pageContent):
Parse the supplied HTML page and extract useful information from
the embedded Javascript.
lines = pageContent.splitlines()
data = '\n'.join([x for x in lines if x and x[0] in ['D', ')', ',', ']']])
#data = data.replace(',,',',').replace(',,',',')
data = re.sub(',{2,}', ',', data)
result = []
try:
exec data in {'__builtins__': None}, {'D': lambda x: result.append(x)}
except SyntaxError,info:
print info
raise GmailError, 'Failed to parse data returned from gmail.'
items = result
itemsDict = {}
namesFoundTwice = []
for item in items:
name = item[0]
try:
parsedValue = item[1:]
except Exception:
parsedValue = ['']
if itemsDict.has_key(name):
# This handles the case where a name key is used more than
# once (e.g. mail items, mail body etc) and automatically
# places the values into list.
# TODO: Check this actually works properly, it's early... :-)
if len(parsedValue) and type(parsedValue[0]) is types.ListType:
for item in parsedValue:
itemsDict[name].append(item)
else:
itemsDict[name].append(parsedValue)
else:
if len(parsedValue) and type(parsedValue[0]) is types.ListType:
itemsDict[name] = []
for item in parsedValue:
itemsDict[name].append(item)
else:
itemsDict[name] = [parsedValue]
return itemsDict
def _splitBunches(infoItems):# Is this still needed ?? Stas
Utility to help make it easy to iterate over each item separately,
even if they were bunched on the page.
result= []
# TODO: Decide if this is the best approach.
for group in infoItems:
if type(group) == tuple:
result.extend(group)
else:
result.append(group)
return result
class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
def __init__(self, cookiejar):
self.cookiejar = cookiejar
def http_error_302(self, req, fp, code, msg, headers):
# The location redirect doesn't seem to change
# the hostname header appropriately, so we do
# by hand. (Is this a bug in urllib2?)
new_host = re.match(r'http[s]*://(.*?\.google\.com)',
headers.getheader('Location'))
if new_host:
req.add_header("Host", new_host.groups()[0])
result = urllib2.HTTPRedirectHandler.http_error_302(
self, req, fp, code, msg, headers)
return result
class CookieJar:
A rough cookie handler, intended to only refer to one domain.
Does no expiry or anything like that.
(The only reason this is here is so I don't have to require
the `ClientCookie` package.)
def __init__(self):
self._cookies = {}
def extractCookies(self, headers, nameFilter = None):
# TODO: Do this all more nicely?
for cookie in headers.getheaders('Set-Cookie'):
name, value = (cookie.split("=", 1) + [""])[:2]
if LG_DEBUG: print "Extracted cookie `%s`" % (name)
if not nameFilter or name in nameFilter:
self._cookies[name] = value.split(";")[0]
if LG_DEBUG: print "Stored cookie `%s` value `%s`" % (name, self._cookies[name])
if self._cookies[name] == "EXPIRED":
if LG_DEBUG:
print "We got an expired cookie: %s:%s, deleting." % (name, self._cookies[name])
del self._cookies[name]
def addCookie(self, name, value):
self._cookies[name] = value
def setCookies(self, request):
request.add_header('Cookie',
";".join(["%s=%s" % (k,v)
for k,v in self._cookies.items()]))
def _buildURL(**kwargs):
return "%s%s" % (URL_GMAIL, urllib.urlencode(kwargs))
def _paramsToMime(params, filenames, files):
mimeMsg = MIMEMultipart("form-data")
for name, value in params.iteritems():
mimeItem = MIMEText(value)
mimeItem.add_header("Content-Disposition", "form-data", name=name)
# TODO: Handle this better...?
for hdr in ['Content-Type','MIME-Version','Content-Transfer-Encoding']:
del mimeItem[hdr]
mimeMsg.attach(mimeItem)
if filenames or files:
filenames = filenames or []
files = files or []
for idx, item in enumerate(filenames + files):
# TODO: This is messy, tidy it...
if isinstance(item, str):
# We assume it's a file path...
filename = item
contentType = mimetypes.guess_type(filename)[0]
payload = open(filename, "rb").read()
else:
# We assume it's an `email.Message.Message` instance...
# TODO: Make more use of the pre-encoded information?
filename = item.get_filename()
contentType = item.get_content_type()
payload = item.get_payload(decode=True)
if not contentType:
contentType = "application/octet-stream"
mimeItem = MIMEBase(*contentType.split("/"))
mimeItem.add_header("Content-Disposition", "form-data",
name="file%s" % idx, filename=filename)
# TODO: Encode the payload?
mimeItem.set_payload(payload)
# TODO: Handle this better...?
for hdr in ['MIME-Version','Content-Transfer-Encoding']:
del mimeItem[hdr]
mimeMsg.attach(mimeItem)
del mimeMsg['MIME-Version']
return mimeMsg
class GmailLoginFailure(Exception):
Raised whenever the login process fails--could be wrong username/password,
or Gmail service error, for example.
Extract the error message like this:
try:
foobar
except GmailLoginFailure,e:
mesg = e.message# or
print e# uses the __str__
def __init__(self,message):
self.message = message
def __str__(self):
return repr(self.message)
class GmailAccount:
def __init__(self, name = "", pw = "", state = None, domain = None):
global URL_LOGIN, URL_GMAIL
self.domain = domain
if self.domain:
URL_LOGIN = "https://www.google.com/a/" + self.domain + "/LoginAction"
URL_GMAIL = "http://mail.google.com/a/" + self.domain + "/?"
else:
URL_LOGIN = GMAIL_URL_LOGIN
URL_GMAIL = GMAIL_URL_GMAIL
if name and pw:
self.name = name
self._pw = pw
self._cookieJar = CookieJar()
if PROXY_URL is not None:
import gmail_transport
self.opener = urllib2.build_opener(gmail_transport.ConnectHTTPHandler(proxy = PROXY_URL),
gmail_transport.ConnectHTTPSHandler(proxy = PROXY_URL),
SmartRedirectHandler(self._cookieJar))
else:
self.opener = urllib2.build_opener(
urllib2.HTTPHandler(debuglevel=0),
urllib2.HTTPSHandler(debuglevel=0),
SmartRedirectHandler(self._cookieJar))
elif state:
# TODO: Check for stale state cookies?
self.name, self._cookieJar = state.state
else:
raise ValueError("GmailAccount must be instantiated with " \
"either GmailSessionState object or name " \
"and password.")
self._cachedQuotaInfo = None
self._cachedLabelNames = None
def login(self):
# TODO: Throw exception if we were instantiated with state?
if self.domain:
data = urllib.urlencode({'continue': URL_GMAIL,
'at' : 'null',
'service' : 'mail',
'userName': self.name,
'password': self._pw,
else:
data = urllib.urlencode({'continue': URL_GMAIL,
'Email': self.name,
'Passwd': self._pw,
headers = {'Host': 'www.google.com',
'User-Agent': 'Mozilla/5.0 (Compatible; libgmail-python)'}
req = urllib2.Request(URL_LOGIN, data=data, headers=headers)
pageData = self._retrievePage(req)
if not self.domain:
# The GV cookie no longer comes in this page for
# "Apps", so this bottom portion is unnecessary for it.
# This requests the page that provides the required "GV" cookie.
RE_PAGE_REDIRECT = 'CheckCookie\?continue=([^"\']+)'
# TODO: Catch more failure exceptions here...?
try:
link = re.search(RE_PAGE_REDIRECT, pageData).group(1)
redirectURL = urllib2.unquote(link)
redirectURL = redirectURL.replace('\\x26', '&')
except AttributeError:
raise GmailLoginFailure("Login failed. (Wrong username/password?)")
# We aren't concerned with the actual content of this page,
# just the cookie that is returned with it.
pageData = self._retrievePage(redirectURL)
def _retrievePage(self, urlOrRequest):
if self.opener is None:
raise "Cannot find urlopener"
if not isinstance(urlOrRequest, urllib2.Request):
req = urllib2.Request(urlOrRequest)
else:
req = urlOrRequest
self._cookieJar.setCookies(req)
req.add_header('User-Agent',
'Mozilla/5.0 (Compatible; libgmail-python)')
try:
resp = self.opener.open(req)
except urllib2.HTTPError,info:
print info
return None
pageData = resp.read()
# Extract cookies here
self._cookieJar.extractCookies(resp.headers)
# TODO: Enable logging of page data for debugging purposes?
return pageData
def _parsePage(self, urlOrRequest):
Retrieve & then parse the requested page content.
items = _parsePage(self._retrievePage(urlOrRequest))
# Automatically cache some things like quota usage.
# TODO: Cache more?
# TODO: Expire cached values?
# TODO: Do this better.
try:
self._cachedQuotaInfo = items[D_QUOTA]
except KeyError:
pass
#pprint.pprint(items)
try:
self._cachedLabelNames = [category[CT_NAME] for category in items[D_CATEGORIES][0]]
except KeyError:
pass
return items
def _parseSearchResult(self, searchType, start = 0, **kwargs):
params = {U_SEARCH: searchType,
U_START: start,
U_VIEW: U_THREADLIST_VIEW,
params.update(kwargs)
return self._parsePage(_buildURL(**params))
def _parseThreadSearch(self, searchType, allPages = False, **kwargs):
Only works for thread-based results at present. # TODO: Change this?
start = 0
tot = 0
threadsInfo = []
# Option to get *all* threads if multiple pages are used.
while (start == 0) or (allPages and
len(threadsInfo) < threadListSummary[TS_TOTAL]):
items = self._parseSearchResult(searchType, start, **kwargs)
#TODO: Handle single & zero result case better? Does this work?
try:
threads = items[D_THREAD]
except KeyError:
break
else:
for th in threads:
if not type(th[0]) is types.ListType:
th = [th]
threadsInfo.append(th)
# TODO: Check if the total or per-page values have changed?
threadListSummary = items[D_THREADLIST_SUMMARY][0]
threadsPerPage = threadListSummary[TS_NUM]
start += threadsPerPage
# TODO: Record whether or not we retrieved all pages..?
return GmailSearchResult(self, (searchType, kwargs), threadsInfo)
def _retrieveJavascript(self, version = ""):
Note: `version` seems to be ignored.
return self._retrievePage(_buildURL(view = U_PAGE_VIEW,
name = "js",
ver = version))
def getMessagesByFolder(self, folderName, allPages = False):
Folders contain conversation/message threads.
`folderName` -- As set in Gmail interface.
Returns a `GmailSearchResult` instance.
*** TODO: Change all "getMessagesByX" to "getThreadsByX"? ***
return self._parseThreadSearch(folderName, allPages = allPages)
def getMessagesByQuery(self, query, allPages = False):
Returns a `GmailSearchResult` instance.
return self._parseThreadSearch(U_QUERY_SEARCH, q = query,
allPages = allPages)
def getQuotaInfo(self, refresh = False):
Return MB used, Total MB and percentage used.
# TODO: Change this to a property.
if not self._cachedQuotaInfo or refresh:
# TODO: Handle this better...
self.getMessagesByFolder(U_INBOX_SEARCH)
return self._cachedQuotaInfo[0][:3]
def getLabelNames(self, refresh = False):
# TODO: Change this to a property?
if not self._cachedLabelNames or refresh:
# TODO: Handle this better...
self.getMessagesByFolder(U_INBOX_SEARCH)
return self._cachedLabelNames
def getMessagesByLabel(self, label, allPages = False):
return self._parseThreadSearch(U_CATEGORY_SEARCH,
cat=label, allPages = allPages)
def getRawMessage(self, msgId):
# U_ORIGINAL_MESSAGE_VIEW seems the only one that returns a page.
# All the other U_* results in a 404 exception. Stas
PageView = U_ORIGINAL_MESSAGE_VIEW
return self._retrievePage(
_buildURL(view=PageView, th=msgId))
def getUnreadMessages(self):
return self._parseThreadSearch(U_QUERY_SEARCH,
q = "is:" + U_AS_SUBSET_UNREAD)
def getUnreadMsgCount(self):
items = self._parseSearchResult(U_QUERY_SEARCH,
q = "is:" + U_AS_SUBSET_UNREAD)
try:
result = items[D_THREADLIST_SUMMARY][0][TS_TOTAL_MSGS]
except KeyError:
result = 0
return result
def _getActionToken(self):
try:
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
except KeyError:
self.getLabelNames(True)
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
return at
def sendMessage(self, msg, asDraft = False, _extraParams = None):
`msg` -- `GmailComposedMessage` instance.
`_extraParams` -- Dictionary containing additional parameters
to put into POST message. (Not officially
for external use, more to make feature
additional a little easier to play with.)
Note: Now returns `GmailMessageStub` instance with populated
`id` (and `_account`) fields on success or None on failure.
# TODO: Handle drafts separately?
params = {U_VIEW: [U_SENDMAIL_VIEW, U_SAVEDRAFT_VIEW][asDraft],
U_REFERENCED_MSG: "",
U_THREAD: "",
U_DRAFT_MSG: "",
U_COMPOSEID: "1",
U_ACTION_TOKEN: self._getActionToken(),
U_COMPOSE_TO: msg.to,
U_COMPOSE_CC: msg.cc,
U_COMPOSE_BCC: msg.bcc,
"subject": msg.subject,
"msgbody": msg.body,
if _extraParams:
params.update(_extraParams)
# Amongst other things, I used the following post to work out this:
# <http://groups.google.com/groups?
# selm=mailman.1047080233.20095.python-list%40python.org>
mimeMessage = _paramsToMime(params, msg.filenames, msg.files)
#### TODO: Ughh, tidy all this up & do it better...
## This horrible mess is here for two main reasons:
## 1. The `Content-Type` header (which also contains the boundary
## marker) needs to be extracted from the MIME message so
## we can send it as the request `Content-Type` header instead.
## 2. It seems the form submission needs to use "\r\n" for new
## lines instead of the "\n" returned by `as_string()`.
## I tried changing the value of `NL` used by the `Generator` class
## but it didn't work so I'm doing it this way until I figure
## out how to do it properly. Of course, first try, if the payloads
## contained "\n" sequences they got replaced too, which corrupted
## the attachments. I could probably encode the submission,
## which would probably be nicer, but in the meantime I'm kludging
## this workaround that replaces all non-text payloads with a
## marker, changes all "\n" to "\r\n" and finally replaces the
## markers with the original payloads.
## Yeah, I know, it's horrible, but hey it works doesn't it? If you've
## got a problem with it, fix it yourself & give me the patch!
origPayloads = {}
FMT_MARKER = "&&&&&&%s&&&&&&"
for i, m in enumerate(mimeMessage.get_payload()):
if not isinstance(m, MIMEText): #Do we care if we change text ones?
origPayloads[i] = m.get_payload()
m.set_payload(FMT_MARKER % i)
mimeMessage.epilogue = ""
msgStr = mimeMessage.as_string()
contentTypeHeader, data = msgStr.split("\n\n", 1)
contentTypeHeader = contentTypeHeader.split(":", 1)
data = data.replace("\n", "\r\n")
for k,v in origPayloads.iteritems():
data = data.replace(FMT_MARKER % k, v)
req = urllib2.Request(_buildURL(), data = data)
req.add_header(*contentTypeHeader)
items = self._parsePage(req)
# TODO: Check composeid?
# Sometimes we get the success message
# but the id is 0 and no message is sent
result = None
resultInfo = items[D_SENDMAIL_RESULT][0]
if resultInfo[SM_SUCCESS]:
result = GmailMessageStub(id = resultInfo[SM_NEWTHREADID],
_account = self)
else:
raise GmailSendError, resultInfo[SM_MSG]
return result
def trashMessage(self, msg):
# TODO: Decide if we should make this a method of `GmailMessage`.
# TODO: Should we check we have been given a `GmailMessage` instance?
params = {
U_ACTION: U_DELETEMESSAGE_ACTION,
U_ACTION_MESSAGE: msg.id,
U_ACTION_TOKEN: self._getActionToken(),
items = self._parsePage(_buildURL(**params))
# TODO: Mark as trashed on success?
return (items[D_ACTION_RESULT][0][AR_SUCCESS] == 1)
def _doThreadAction(self, actionId, thread):
# TODO: Decide if we should make this a method of `GmailThread`.
# TODO: Should we check we have been given a `GmailThread` instance?
params = {
U_SEARCH: U_ALL_SEARCH, #TODO:Check this search value always works.
U_VIEW: U_UPDATE_VIEW,
U_ACTION: actionId,
U_ACTION_THREAD: thread.id,
U_ACTION_TOKEN: self._getActionToken(),
items = self._parsePage(_buildURL(**params))
return (items[D_ACTION_RESULT][0][AR_SUCCESS] == 1)
def trashThread(self, thread):
# TODO: Decide if we should make this a method of `GmailThread`.
# TODO: Should we check we have been given a `GmailThread` instance?
result = self._doThreadAction(U_MARKTRASH_ACTION, thread)
# TODO: Mark as trashed on success?
return result
def _createUpdateRequest(self, actionId): #extraData):
Helper method to create a Request instance for an update (view)
action.
Returns populated `Request` instance.
params = {
U_VIEW: U_UPDATE_VIEW,
data = {
U_ACTION: actionId,
U_ACTION_TOKEN: self._getActionToken(),
#data.update(extraData)
req = urllib2.Request(_buildURL(**params),
data = urllib.urlencode(data))
return req
# TODO: Extract additional common code from handling of labels?
def createLabel(self, labelName):
req = self._createUpdateRequest(U_CREATECATEGORY_ACTION + labelName)
# Note: Label name cache is updated by this call as well. (Handy!)
items = self._parsePage(req)
print items
return (items[D_ACTION_RESULT][0][AR_SUCCESS] == 1)
def deleteLabel(self, labelName):
# TODO: Check labelName exits?
req = self._createUpdateRequest(U_DELETECATEGORY_ACTION + labelName)
# Note: Label name cache is updated by this call as well. (Handy!)
items = self._parsePage(req)
return (items[D_ACTION_RESULT][0][AR_SUCCESS] == 1)
def renameLabel(self, oldLabelName, newLabelName):
# TODO: Check oldLabelName exits?
req = self._createUpdateRequest("%s%s^%s" % (U_RENAMECATEGORY_ACTION,
oldLabelName, newLabelName))
# Note: Label name cache is updated by this call as well. (Handy!)
items = self._parsePage(req)
return (items[D_ACTION_RESULT][0][AR_SUCCESS] == 1)
def storeFile(self, filename, label = None):
# TODO: Handle files larger than single attachment size.
# TODO: Allow file data objects to be supplied?
FILE_STORE_VERSION = "FSV_01"
FILE_STORE_SUBJECT_TEMPLATE = "%s %s" % (FILE_STORE_VERSION, "%s")
subject = FILE_STORE_SUBJECT_TEMPLATE % os.path.basename(filename)
msg = GmailComposedMessage(to="", subject=subject, body="",
filenames=[filename])
draftMsg = self.sendMessage(msg, asDraft = True)
if draftMsg and label:
draftMsg.addLabel(label)
return draftMsg
## CONTACTS SUPPORT
def getContacts(self):
Returns a GmailContactList object
that has all the contacts in it as
GmailContacts
contactList = []
# pnl = a is necessary to get *all* contacts
myUrl = _buildURL(view='cl',search='contacts', pnl='a')
myData = self._parsePage(myUrl)
# This comes back with a dictionary
# with entry 'cl'
addresses = myData['cl']
for entry in addresses:
if len(entry) >= 6 and entry[0]=='ce':
newGmailContact = GmailContact(entry[1], entry[2], entry[4], entry[5])
#### new code used to get all the notes
#### not used yet due to lockdown problems
##rawnotes = self._getSpecInfo(entry[1])
##print rawnotes
##newGmailContact = GmailContact(entry[1], entry[2], entry[4],rawnotes)
contactList.append(newGmailContact)
return GmailContactList(contactList)
def addContact(self, myContact, *extra_args):
Attempts to add a GmailContact to the gmail
address book. Returns true if successful,
false otherwise
Please note that after version 0.1.3.3,
addContact takes one argument of type
GmailContact, the contact to add.
The old signature of:
addContact(name, email, notes='') is still
supported, but deprecated.
if len(extra_args) > 0:
# The user has passed in extra arguments
# He/she is probably trying to invoke addContact
# using the old, deprecated signature of:
# addContact(self, name, email, notes='')
# Build a GmailContact object and use that instead
(name, email) = (myContact, extra_args[0])
if len(extra_args) > 1:
notes = extra_args[1]
else:
notes = ''
myContact = GmailContact(-1, name, email, notes)
# TODO: In the ideal world, we'd extract these specific
# constants into a nice constants file
# This mostly comes from the Johnvey Gmail API,
# but also from the gmail.py cited earlier
myURL = _buildURL(view='up')
myDataList = [ ('act','ec'),
('at', self._cookieJar._cookies['GMAIL_AT']), # Cookie data?
('ct_nm', myContact.getName()),
('ct_em', myContact.getEmail()),
('ct_id', -1 )
notes = myContact.getNotes()
if notes != '':
myDataList.append( ('ctf_n', notes) )
validinfokeys = [
'i', # IM
'p', # Phone
'd', # Company
'a', # ADR
'e', # Email
'm', # Mobile
'b', # Pager
'f', # Fax
't', # Title
'o', # Other
moreInfo = myContact.getMoreInfo()
ctsn_num = -1
if moreInfo != {}:
for ctsf,ctsf_data in moreInfo.items():
ctsn_num += 1
# data section header, WORK, HOME,...
sectionenum ='ctsn_%02d' % ctsn_num
myDataList.append( ( sectionenum, ctsf ))
ctsf_num = -1
if isinstance(ctsf_data[0],str):
ctsf_num += 1
# data section
subsectionenum = 'ctsf_%02d_%02d_%s' % (ctsn_num, ctsf_num, ctsf_data[0]) # ie. ctsf_00_01_p
myDataList.append( (subsectionenum, ctsf_data[1]) )
else:
for info in ctsf_data:
if validinfokeys.count(info[0]) > 0:
ctsf_num += 1
# data section
subsectionenum = 'ctsf_%02d_%02d_%s' % (ctsn_num, ctsf_num, info[0]) # ie. ctsf_00_01_p
myDataList.append( (subsectionenum, info[1]) )
myData = urllib.urlencode(myDataList)
request = urllib2.Request(myURL,
data = myData)
pageData = self._retrievePage(request)
if pageData.find("The contact was successfully added") == -1:
print pageData
if pageData.find("already has the email address") > 0:
raise Exception("Someone with same email already exists in Gmail.")
elif pageData.find("https://www.google.com/accounts/ServiceLogin"):
raise Exception("Login has expired.")
return False
else:
return True
def _removeContactById(self, id):
Attempts to remove the contact that occupies
id "id" from the gmail address book.
Returns True if successful,
False otherwise.
This is a little dangerous since you don't really
know who you're deleting. Really,
this should return the name or something of the
person we just killed.
Don't call this method.
You should be using removeContact instead.
myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up')
pageData = self._retrievePage(myURL)
if pageData.find("The contact has been deleted") == -1:
return False
else:
return True
def removeContact(self, gmailContact):
Attempts to remove the GmailContact passed in
Returns True if successful, False otherwise.
# Let's re-fetch the contact list to make
# sure we're really deleting the guy
# we think we're deleting
newContactList = self.getContacts()
newVersionOfPersonToDelete = newContactList.getContactById(gmailContact.getId())
# Ok, now we need to ensure that gmailContact
# is the same as newVersionOfPersonToDelete
# and then we can go ahead and delete him/her
if (gmailContact == newVersionOfPersonToDelete):
return self._removeContactById(gmailContact.getId())
else:
# We have a cache coherency problem -- someone
# else now occupies this ID slot.
# TODO: Perhaps signal this in some nice way
# to the end user?
print "Unable to delete."
print "Has someone else been modifying the contacts list while we have?"
print "Old version of person:",gmailContact
print "New version of person:",newVersionOfPersonToDelete
return False
## Don't remove this. contact stas
## def _getSpecInfo(self,id):
## Return all the notes data.
## This is currently not used due to the fact that it requests pages in
## a dos attack manner.
## myURL =_buildURL(search='contacts',ct_id=id,c=id,\
## at=self._cookieJar._cookies['GMAIL_AT'],view='ct')
## pageData = self._retrievePage(myURL)
## myData = self._parsePage(myURL)
## #print "\nmyData form _getSpecInfo\n",myData
## rawnotes = myData['cov'][7]
## return rawnotes
class GmailContact:
Class for storing a Gmail Contacts list entry
def __init__(self, name, email, *extra_args):
Returns a new GmailContact object
(you can then call addContact on this to commit
it to the Gmail addressbook, for example)
Consider calling setNotes() and setMoreInfo()
to add extended information to this contact
# Support populating other fields if we're trying
# to invoke this the old way, with the old constructor
# whose signature was __init__(self, id, name, email, notes='')
id = -1
notes = ''
if len(extra_args) > 0:
(id, name) = (name, email)
email = extra_args[0]
if len(extra_args) > 1:
notes = extra_args[1]
else:
notes = ''
self.id = id
self.name = name
self.email = email
self.notes = notes
self.moreInfo = {}
def __str__(self):
return "%s %s %s %s" % (self.id, self.name, self.email, self.notes)
def __eq__(self, other):
if not isinstance(other, GmailContact):
return False
return (self.getId() == other.getId()) and \
(self.getName() == other.getName()) and \
(self.getEmail() == other.getEmail()) and \
(self.getNotes() == other.getNotes())
def getId(self):
return self.id
def getName(self):
return self.name
def getEmail(self):
return self.email
def getNotes(self):
return self.notes
def setNotes(self, notes):
Sets the notes field for this GmailContact
Note that this does NOT change the note
field on Gmail's end; only adding or removing
contacts modifies them
self.notes = notes
def getMoreInfo(self):
return self.moreInfo
def setMoreInfo(self, moreInfo):
moreInfo format
Use special key values::
'i' = IM
'p' = Phone
'd' = Company
'a' = ADR
'e' = Email
'm' = Mobile
'b' = Pager
'f' = Fax
't' = Title
'o' = Other
Simple example::
moreInfo = {'Home': ( ('a','852 W Barry'),
('p', '1-773-244-1980'),
('i', 'aim:brianray34') ) }
Complex example::
moreInfo = {
'Personal': (('e', 'Home Email'),
('f', 'Home Fax')),
'Work': (('d', 'Sample Company'),
('t', 'Job Title'),
('o', 'Department: Department1'),
('o', 'Department: Department2'),
('p', 'Work Phone'),
('m', 'Mobile Phone'),
('f', 'Work Fax'),
('b', 'Pager')) }
self.moreInfo = moreInfo
def getVCard(self):
"""Returns a vCard 3.0 for this
contact, as a string"""
# The \r is is to comply with the RFC2425 section 5.8.1
vcard = "BEGIN:VCARD\r\n"
vcard += "VERSION:3.0\r\n"
## Deal with multiline notes
##vcard += "NOTE:%s\n" % self.getNotes().replace("\n","\\n")
vcard += "NOTE:%s\r\n" % self.getNotes()
# Fake-out N by splitting up whatever we get out of getName
# This might not always do 'the right thing'
# but it's a *reasonable* compromise
fullname = self.getName().split()
fullname.reverse()
vcard += "N:%s" % ';'.join(fullname) + "\r\n"
vcard += "FN:%s\r\n" % self.getName()
vcard += "EMAIL;TYPE=INTERNET:%s\r\n" % self.getEmail()
vcard += "END:VCARD\r\n\r\n"
# Final newline in case we want to put more than one in a file
return vcard
class GmailContactList:
Class for storing an entire Gmail contacts list
and retrieving contacts by Id, Email address, and name
def __init__(self, contactList):
self.contactList = contactList
def __str__(self):
return '\n'.join([str(item) for item in self.contactList])
def getCount(self):
Returns number of contacts
return len(self.contactList)
def getAllContacts(self):
Returns an array of all the
GmailContacts
return self.contactList
def getContactByName(self, name):
Gets the first contact in the
address book whose name is 'name'.
Returns False if no contact
could be found
nameList = self.getContactListByName(name)
if len(nameList) > 0:
return nameList[0]
else:
return False
def getContactByEmail(self, email):
Gets the first contact in the
address book whose name is 'email'.
As of this writing, Gmail insists
upon a unique email; i.e. two contacts
cannot share an email address.
Returns False if no contact
could be found
emailList = self.getContactListByEmail(email)
if len(emailList) > 0:
return emailList[0]
else:
return False
def getContactById(self, myId):
Gets the first contact in the
address book whose id is 'myId'.
REMEMBER: ID IS A STRING
Returns False if no contact
could be found
idList = self.getContactListById(myId)
if len(idList) > 0:
return idList[0]
else:
return False
def getContactListByName(self, name):
This function returns a LIST
of GmailContacts whose name is
'name'.
Returns an empty list if no contacts
were found
nameList = []
for entry in self.contactList:
if entry.getName() == name:
nameList.append(entry)
return nameList
def getContactListByEmail(self, email):
This function returns a LIST
of GmailContacts whose email is
'email'. As of this writing, two contacts
cannot share an email address, so this
should only return just one item.
But it doesn't hurt to be prepared?
Returns an empty list if no contacts
were found
emailList = []
for entry in self.contactList:
if entry.getEmail() == email:
emailList.append(entry)
return emailList
def getContactListById(self, myId):
This function returns a LIST
of GmailContacts whose id is
'myId'. We expect there only to
be one, but just in case!
Remember: ID IS A STRING
Returns an empty list if no contacts
were found
idList = []
for entry in self.contactList:
if entry.getId() == myId:
idList.append(entry)
return idList
def search(self, searchTerm):
This function returns a LIST
of GmailContacts whose name or
email address matches the 'searchTerm'.
Returns an empty list if no matches
were found.
searchResults = []
for entry in self.contactList:
p = re.compile(searchTerm, re.IGNORECASE)
if p.search(entry.getName()) or p.search(entry.getEmail()):
searchResults.append(entry)
return searchResults
class GmailSearchResult:
def __init__(self, account, search, threadsInfo):
`threadsInfo` -- As returned from Gmail but unbunched.
#print "\nthreadsInfo\n",threadsInfo
try:
if not type(threadsInfo[0]) is types.ListType:
threadsInfo = [threadsInfo]
except IndexError:
print "No messages found"
self._account = account
self.search = search # TODO: Turn into object + format nicely.
self._threads = []
for thread in threadsInfo:
self._threads.append(GmailThread(self, thread[0]))
def __iter__(self):
return iter(self._threads)
def __len__(self):
return len(self._threads)
def __getitem__(self,key):
return self._threads.__getitem__(key)
class GmailSessionState:
def __init__(self, account = None, filename = ""):
if account:
self.state = (account.name, account._cookieJar)
elif filename:
self.state = load(open(filename, "rb"))
else:
raise ValueError("GmailSessionState must be instantiated with " \
"either GmailAccount object or filename.")
def save(self, filename):
dump(self.state, open(filename, "wb"), -1)
class _LabelHandlerMixin(object):
Note: Because a message id can be used as a thread id this works for
messages as well as threads.
def __init__(self):
self._labels = None
def _makeLabelList(self, labelList):
self._labels = labelList
def addLabel(self, labelName):
# Note: It appears this also automatically creates new labels.
result = self._account._doThreadAction(U_ADDCATEGORY_ACTION+labelName,
self)
if not self._labels:
self._makeLabelList([])
# TODO: Caching this seems a little dangerous; suppress duplicates maybe?
self._labels.append(labelName)
return result
def removeLabel(self, labelName):
# TODO: Check label is already attached?
# Note: An error is not generated if the label is not already attached.
result = \
self._account._doThreadAction(U_REMOVECATEGORY_ACTION+labelName,
self)
removeLabel = True
try:
self._labels.remove(labelName)
except:
removeLabel = False
pass
# If we don't check both, we might end up in some weird inconsistent state
return result and removeLabel
def getLabels(self):
return self._labels
class GmailThread(_LabelHandlerMixin):
Note: As far as I can tell, the "canonical" thread id is always the same
as the id of the last message in the thread. But it appears that
the id of any message in the thread can be used to retrieve
the thread information.
def __init__(self, parent, threadsInfo):
_LabelHandlerMixin.__init__(self)
# TODO Handle this better?
self._parent = parent
self._account = self._parent._account
self.id = threadsInfo[T_THREADID] # TODO: Change when canonical updated?
self.subject = threadsInfo[T_SUBJECT_HTML]
self.snippet = threadsInfo[T_SNIPPET_HTML]
#self.extraSummary = threadInfo[T_EXTRA_SNIPPET] #TODO: What is this?
# TODO: Store other info?
# Extract number of messages in thread/conversation.
self._authors = threadsInfo[T_AUTHORS_HTML]
self.info = threadsInfo
try:
# TODO: Find out if this information can be found another way...
# (Without another page request.)
self._length = int(re.search("\((\d+?)\)\Z",
self._authors).group(1))
except AttributeError,info:
# If there's no message count then the thread only has one message.
self._length = 1
# TODO: Store information known about the last message (e.g. id)?
self._messages = []
# Populate labels
self._makeLabelList(threadsInfo[T_CATEGORIES])
def __getattr__(self, name):
Dynamically dispatch some interesting thread properties.
attrs = { 'unread': T_UNREAD,
'star': T_STAR,
'date': T_DATE_HTML,
'authors': T_AUTHORS_HTML,
'flags': T_FLAGS,
'subject': T_SUBJECT_HTML,
'snippet': T_SNIPPET_HTML,
'categories': T_CATEGORIES,
'attach': T_ATTACH_HTML,
'matching_msgid': T_MATCHING_MSGID,
'extra_snippet': T_EXTRA_SNIPPET }
if name in attrs:
return self.info[ attrs[name] ];
raise AttributeError("no attribute %s" % name)
def __len__(self):
return self._length
def __iter__(self):
if not self._messages:
self._messages = self._getMessages(self)
return iter(self._messages)
def __getitem__(self, key):
if not self._messages:
self._messages = self._getMessages(self)
try:
result = self._messages.__getitem__(key)
except IndexError:
result = []
return result
def _getMessages(self, thread):
# TODO: Do this better.
# TODO: Specify the query folder using our specific search?
items = self._account._parseSearchResult(U_QUERY_SEARCH,
view = U_CONVERSATION_VIEW,
th = thread.id,
q = "in:anywhere")
result = []
# TODO: Handle this better?
# Note: This handles both draft & non-draft messages in a thread...
for key, isDraft in [(D_MSGINFO, False), (D_DRAFTINFO, True)]:
try:
msgsInfo = items[key]
except KeyError:
# No messages of this type (e.g. draft or non-draft)
continue
else:
# TODO: Handle special case of only 1 message in thread better?
if type(msgsInfo[0]) != types.ListType:
msgsInfo = [msgsInfo]
for msg in msgsInfo:
result += [GmailMessage(thread, msg, isDraft = isDraft)]
return result
class GmailMessageStub(_LabelHandlerMixin):
Intended to be used where not all message information is known/required.
NOTE: This may go away.
# TODO: Provide way to convert this to a full `GmailMessage` instance
# or allow `GmailMessage` to be created without all info?
def __init__(self, id = None, _account = None):
_LabelHandlerMixin.__init__(self)
self.id = id
self._account = _account
class GmailMessage(object):
def __init__(self, parent, msgData, isDraft = False):
Note: `msgData` can be from either D_MSGINFO or D_DRAFTINFO.
# TODO: Automatically detect if it's a draft or not?
# TODO Handle this better?
self._parent = parent
self._account = self._parent._account
self.author = msgData[MI_AUTHORFIRSTNAME]
self.id = msgData[MI_MSGID]
self.number = msgData[MI_NUM]
self.subject = msgData[MI_SUBJECT]
self.to = msgData[MI_TO]
self.cc = msgData[MI_CC]
self.bcc = msgData[MI_BCC]
self.sender = msgData[MI_AUTHOREMAIL]
self.attachments = [GmailAttachment(self, attachmentInfo)
for attachmentInfo in msgData[MI_ATTACHINFO]]
# TODO: Populate additional fields & cache...(?)
# TODO: Handle body differently if it's from a draft?
self.isDraft = isDraft
self._source = None
def _getSource(self):
if not self._source:
# TODO: Do this more nicely...?
# TODO: Strip initial white space & fix up last line ending
# to make it legal as per RFC?
self._source = self._account.getRawMessage(self.id)
return self._source
source = property(_getSource, doc = "")
class GmailAttachment:
def __init__(self, parent, attachmentInfo):
# TODO Handle this better?
self._parent = parent
self._account = self._parent._account
self.id = attachmentInfo[A_ID]
self.filename = attachmentInfo[A_FILENAME]
self.mimetype = attachmentInfo[A_MIMETYPE]
self.filesize = attachmentInfo[A_FILESIZE]
self._content = None
def _getContent(self):
if not self._content:
# TODO: Do this a more nicely...?
self._content = self._account._retrievePage(
_buildURL(view=U_ATTACHMENT_VIEW, disp="attd",
attid=self.id, th=self._parent._parent.id))
return self._content
content = property(_getContent, doc = "")
def _getFullId(self):
Returns the "full path"/"full id" of the attachment. (Used
to refer to the file when forwarding.)
The id is of the form: "<thread_id>_<msg_id>_<attachment_id>"
return "%s_%s_%s" % (self._parent._parent.id,
self._parent.id,
self.id)
_fullId = property(_getFullId, doc = "")
class GmailComposedMessage:
def __init__(self, to, subject, body, cc = None, bcc = None,
filenames = None, files = None):
`filenames` - list of the file paths of the files to attach.
`files` - list of objects implementing sub-set of
`email.Message.Message` interface (`get_filename`,
`get_content_type`, `get_payload`). This is to
allow use of payloads from Message instances.
TODO: Change this to be simpler class we define ourselves?
self.to = to
self.subject = subject
self.body = body
self.cc = cc
self.bcc = bcc
self.filenames = filenames
self.files = files
if __name__ == "__main__":
import sys
from getpass import getpass
try:
name = sys.argv[1]
except IndexError:
name = raw_input("Gmail account name: ")
pw = getpass("Password: ")
domain = raw_input("Domain? [leave blank for Gmail]: ")
ga = GmailAccount(name, pw, domain=domain)
print "\nPlease wait, logging in..."
try:
ga.login()
except GmailLoginFailure,e:
print "\nLogin failed. (%s)" % e.message
else:
print "Login successful.\n"
# TODO: Use properties instead?
quotaInfo = ga.getQuotaInfo()
quotaMbUsed = quotaInfo[QU_SPACEUSED]
quotaMbTotal = quotaInfo[QU_QUOTA]
quotaPercent = quotaInfo[QU_PERCENT]
print "%s of %s used. (%s)\n" % (quotaMbUsed, quotaMbTotal, quotaPercent)
searches = STANDARD_FOLDERS + ga.getLabelNames()
name = None
while 1:
try:
print "Select folder or label to list: (Ctrl-C to exit)"
for optionId, optionName in enumerate(searches):
print " %d. %s" % (optionId, optionName)
while not name:
try:
name = searches[int(raw_input("Choice: "))]
except ValueError,info:
print info
name = None
if name in STANDARD_FOLDERS:
result = ga.getMessagesByFolder(name, True)
else:
result = ga.getMessagesByLabel(name, True)
if not len(result):
print "No threads found in `%s`." % name
break
name = None
tot = len(result)
i = 0
for thread in result:
print "%s messages in thread" % len(thread)
print thread.id, len(thread), thread.subject
for msg in thread:
print "\n ", msg.id, msg.number, msg.author,msg.subject
# Just as an example of other usefull things
#print " ", msg.cc, msg.bcc,msg.sender
i += 1
print
print "number of threads:",tot
print "number of messages:",i
except KeyboardInterrupt:
break
print "\n\nDone."
Last edited by Reasons (2008-03-20 01:18:27)

Thought it might help to give lines 369-relevant of the libgmail so it's easier to read
def _retrievePage(self, urlOrRequest):
if self.opener is None:
raise "Cannot find urlopener"
if not isinstance(urlOrRequest, urllib2.Request):
req = urllib2.Request(urlOrRequest)
else:
req = urlOrRequest
self._cookieJar.setCookies(req)
req.add_header('User-Agent',
'Mozilla/5.0 (Compatible; libgmail-python)')
try:
resp = self.opener.open(req)
except urllib2.HTTPError,info:
print info
return None
pageData = resp.read()
# Extract cookies here
self._cookieJar.extractCookies(resp.headers)
# TODO: Enable logging of page data for debugging purposes?
return pageData
def _parsePage(self, urlOrRequest):
Retrieve & then parse the requested page content.
items = _parsePage(self._retrievePage(urlOrRequest))
# Automatically cache some things like quota usage.
# TODO: Cache more?
# TODO: Expire cached values?
# TODO: Do this better.
try:
self._cachedQuotaInfo = items[D_QUOTA]
except KeyError:
pass
#pprint.pprint(items)
try:
self._cachedLabelNames = [category[CT_NAME] for category in items[D_CATEGORIES][0]]
except KeyError:
pass
return items
def _parseSearchResult(self, searchType, start = 0, **kwargs):
params = {U_SEARCH: searchType,
U_START: start,
U_VIEW: U_THREADLIST_VIEW,
params.update(kwargs)
return self._parsePage(_buildURL(**params))

Similar Messages

  • Scan for and connect to networks from an openbox pipe menu (netcfg)

    So the other day when i was using wifi-select (awesome tool) to connect to a friends hot-spot, i realized "hey! this would be great as an openbox pipe menu."  i'm fairly decent in bash and i knew both netcfg and wifi-select were in bash so why not rewrite it that way?
    Wifi-Pipe
    A simplified version of wifi-select which will scan for networks and populate an openbox right-click menu item with available networks.  displays security type and signal strength.  click on a network to connect via netcfg the same way wifi-select does it.
    zenity is used to ask for a password and notify of a bad connection.  one can optionally remove the netcfg profile if the connection fails.
    What's needed
    -- you have to be using netcfg to manage your wireless
    -- you have to install zenity
    -- you have to save the script as ~/.config/openbox/wifi-pipe and make it executable:
    chmod +x ~/.config/openbox/wifi-pipe
    -- you have to add a sudoers entry to allow passwordless sudo on this script and netcfg (!)
    USERNAME ALL=(ALL) NOPASSWD: /usr/bin/netcfg
    USERNAME ALL=(ALL) NOPASSWD: /home/USERNAME/.config/openbox/wifi-pipe
    -- you have to adjust  ~/.config/openbox/menu.xml like so:
    <menu id="root-menu" label="Openbox 3">
    <menu id="pipe-wifi" label="Wifi" execute="sudo /home/USERNAME/.config/openbox/wifi-pipe INTERFACE" />
    <menu id="term-menu"/>
    <item label="Run...">
    <action name="Execute">
    <command>gmrun</command>
    </action>
    </item>
    where USERNAME is you and INTERFACE is probably wlan0 or similar
    openbox --reconfigure and you should be good to go.
    The script
    #!/bin/bash
    # pbrisbin 2009
    # simplified version of wifi-select designed to output as an openbox pipe menu
    # required:
    # netcfg
    # zenity
    # NOPASSWD entries for this and netcfg through visudo
    # the following in menu.xml:
    # <menu id="pipe-wifi" label="Wifi" execute="sudo /path/to/wifi.pipe interface"/>
    # the idea is to run this script once to scan/print, then again immediately to connect.
    # therefore, if you scan but don't connect, a temp file is left in /tmp. the next scan
    # will overwrite it, and the next connect will remove it.
    # source this just to get PROFILE_DIR
    . /usr/lib/network/network
    [ -z "$PROFILE_DIR" ] && PROFILE_DIR='/etc/network.d/'
    # awk code for parsing iwlist output
    # putting it here removes the wifi-select dependency
    # and allows for my own tweaking
    # prints a list "essid=security=quality_as_percentage"
    PARSER='
    BEGIN { FS=":"; OFS="="; }
    /\<Cell/ { if (essid) print essid, security, quality[2]/quality[3]*100; security="none" }
    /\<ESSID:/ { essid=substr($2, 2, length($2) - 2) } # discard quotes
    /\<Quality=/ { split($1, quality, "[=/]") }
    /\<Encryption key:on/ { security="wep" }
    /\<IE:.*WPA.*/ { security="wpa" }
    END { if (essid) print essid, security, quality[2]/quality[3]*100 }
    errorout() {
    echo "<openbox_pipe_menu>"
    echo "<item label=\"$1\" />"
    echo "</openbox_pipe_menu>"
    exit 1
    create_profile() {
    ESSID="$1"; INTERFACE="$2"; SECURITY="$3"; KEY="$4"
    PROFILE_FILE="$PROFILE_DIR$ESSID"
    cat > "$PROFILE_FILE" << END_OF_PROFILE
    CONNECTION="wireless"
    ESSID="$ESSID"
    INTERFACE="$INTERFACE"
    DESCRIPTION="Automatically generated profile"
    SCAN="yes"
    IP="dhcp"
    TIMEOUT="10"
    SECURITY="$SECURITY"
    END_OF_PROFILE
    # i think wifi-select should adopt these perms too...
    if [ -n "$KEY" ]; then
    echo "KEY=\"$KEY\"" >> "$PROFILE_FILE"
    chmod 600 "$PROFILE_FILE"
    else
    chmod 644 "$PROFILE_FILE"
    fi
    print_menu() {
    # scan for networks
    iwlist $INTERFACE scan 2>/dev/null | awk "$PARSER" | sort -t= -nrk3 > /tmp/networks.tmp
    # exit if none found
    if [ ! -s /tmp/networks.tmp ]; then
    rm /tmp/networks.tmp
    errorout "no networks found."
    fi
    # otherwise print the menu
    local IFS='='
    echo "<openbox_pipe_menu>"
    while read ESSID SECURITY QUALITY; do
    echo "<item label=\"$ESSID ($SECURITY) ${QUALITY/.*/}%\">" # trim decimals
    echo " <action name=\"Execute\">"
    echo " <command>sudo $0 $INTERFACE connect \"$ESSID\"</command>"
    echo " </action>"
    echo "</item>"
    done < /tmp/networks.tmp
    echo "</openbox_pipe_menu>"
    connect() {
    # check for an existing profile
    PROFILE_FILE="$(grep -REl "ESSID=[\"']?$ESSID[\"']?" "$PROFILE_DIR" | grep -v '~$' | head -n1)"
    # if found use it, else create a new profile
    if [ -n "$PROFILE_FILE" ]; then
    PROFILE=$(basename "$PROFILE_FILE")
    else
    PROFILE="$ESSID"
    SECURITY="$(awk -F '=' "/$ESSID/"'{print $2}' /tmp/networks.tmp | head -n1)"
    # ask for the security key if needed
    if [ "$SECURITY" != "none" ]; then
    KEY="$(zenity --entry --title="Authentication" --text="Please enter $SECURITY key for $ESSID" --hide-text)"
    fi
    # create the new profile
    create_profile "$ESSID" "$INTERFACE" "$SECURITY" "$KEY"
    fi
    # connect
    netcfg2 "$PROFILE" >/tmp/output.tmp
    # if failed, ask about removal of created profile
    if [ $? -ne 0 ]; then
    zenity --question \
    --title="Connection failed" \
    --text="$(grep -Eo "[\-\>]\ .*$" /tmp/output.tmp) \n Remove $PROFILE_FILE?" \
    --ok-label="Remove profile"
    [ $? -eq 0 ] && rm $PROFILE_FILE
    fi
    rm /tmp/output.tmp
    rm /tmp/networks.tmp
    [ $(id -u) -ne 0 ] && errorout "root access required."
    [ -z "$1" ] && errorout "usage: $0 [interface]"
    INTERFACE="$1"; shift
    # i added a sleep if we need to explicitly bring it up
    # b/c youll get "no networks found" when you scan right away
    # this only happens if we aren't up already
    if ! ifconfig | grep -q $INTERFACE; then
    ifconfig $INTERFACE up &>/dev/null || errorout "$INTERFACE not up"
    while ! ifconfig | grep -q $INTERFACE; do sleep 1; done
    fi
    if [ "$1" = "connect" ]; then
    ESSID="$2"
    connect
    else
    print_menu
    fi
    Screenshots
    removed -- Hi-res shots available on my site
    NOTE - i have not tested this extensively but it was working for me in most cases.  any updates/fixes will be edited right into this original post.  enjoy!
    UPDATE - 10/24/2009: i moved the awk statement from wifi-select directly into the script.  this did two things: wifi-select is no longer needed on the system, and i could tweak the awk statement to be more accurate.  it now prints a true percentange.  iwlist prints something like Quality=17/70 and the original awk statement would just output 17 as the quality.  i changed to print (17/70)*100 then bash trims the decimals so you get a true percentage.
    Last edited by brisbin33 (2010-05-09 01:28:20)

    froli wrote:
    I think the script's not working ... When I type
    sh wifi-pipe
    in a term it returns nothing
    well, just to be sure you're doing it right...
    he above is only an adjustment to the OB script's print_menu() function, it's not an entire script to itself.  so, if the original OB script shows output for you with
    sh ./wifi-pipe
    then using the above pint_menu() function (with all the other supporting code) should also show output, (only really only changes the echo's so they print the info in the pekwm format).
    oh, and if neither version shows output when you rut it in a term, then you've got other issues... ;P
    here's an entire [untested] pekwm script:
    #!/bin/bash
    # pbrisbin 2009
    # simplified version of wifi-select designed to output as an pekwm pipe menu
    # required:
    # netcfg
    # zenity
    # NOPASSWD entries for this and netcfg through visudo
    # the following in pekwm config file:
    # SubMenu = "WiFi" {
    # Entry = { Actions = "Dynamic /path/to/wifi-pipe" }
    # the idea is to run this script once to scan/print, then again immediately to connect.
    # therefore, if you scan but don't connect, a temp file is left in /tmp. the next scan
    # will overwrite it, and the next connect will remove it.
    # source this to get PROFILE_DIR and SUBR_DIR
    . /usr/lib/network/network
    errorout() {
    echo "Dynamic {"
    echo " Entry = \"$1\""
    echo "}"
    exit 1
    create_profile() {
    ESSID="$1"; INTERFACE="$2"; SECURITY="$3"; KEY="$4"
    PROFILE_FILE="$PROFILE_DIR$ESSID"
    cat > "$PROFILE_FILE" << END_OF_PROFILE
    CONNECTION="wireless"
    ESSID="$ESSID"
    INTERFACE="$INTERFACE"
    DESCRIPTION="Automatically generated profile"
    SCAN="yes"
    IP="dhcp"
    TIMEOUT="10"
    SECURITY="$SECURITY"
    END_OF_PROFILE
    # i think wifi-select should adopt these perms too...
    if [ -n "$KEY" ]; then
    echo "KEY=\"$KEY\"" >> "$PROFILE_FILE"
    chmod 600 "$PROFILE_FILE"
    else
    chmod 644 "$PROFILE_FILE"
    fi
    print_menu() {
    # scan for networks
    iwlist $INTERFACE scan 2>/dev/null | awk -f $SUBR_DIR/parse-iwlist.awk | sort -t= -nrk3 > /tmp/networks.tmp
    # exit if none found
    if [ ! -s /tmp/networks.tmp ]; then
    rm /tmp/networks.tmp
    errorout "no networks found."
    fi
    # otherwise print the menu
    echo "Dynamic {"
    IFS='='
    cat /tmp/networks.tmp | while read ESSID SECURITY QUALITY; do
    echo "Entry = \"$ESSID ($SECURITY) $QUALITY%\" {"
    echo " Actions = \"Exec sudo $0 $INTERFACE connect \\\"$ESSID\\\"\"</command>"
    echo "}"
    done
    unset IFS
    echo "}"
    connect() {
    # check for an existing profile
    PROFILE_FILE="$(grep -REl "ESSID=[\"']?$ESSID[\"']?" "$PROFILE_DIR" | grep -v '~$' | head -n1)"
    # if found use it, else create a new profile
    if [ -n "$PROFILE_FILE" ]; then
    PROFILE=$(basename "$PROFILE_FILE")
    else
    PROFILE="$ESSID"
    SECURITY="$(awk -F '=' "/$ESSID/"'{print $2}' /tmp/networks.tmp | head -n1)"
    # ask for the security key if needed
    if [ "$SECURITY" != "none" ]; then
    KEY="$(zenity --entry --title="Authentication" --text="Please enter $SECURITY key for $ESSID" --hide-text)"
    fi
    # create the new profile
    create_profile "$ESSID" "$INTERFACE" "$SECURITY" "$KEY"
    fi
    # connect
    netcfg2 "$PROFILE" >/tmp/output.tmp
    # if failed, ask about removal of created profile
    if [ $? -ne 0 ]; then
    zenity --question \
    --title="Connection failed" \
    --text="$(grep -Eo "[\-\>]\ .*$" /tmp/output.tmp) \n Remove $PROFILE_FILE?" \
    --ok-label="Remove profile"
    [ $? -eq 0 ] && rm $PROFILE_FILE
    fi
    rm /tmp/output.tmp
    rm /tmp/networks.tmp
    [ $(id -u) -ne 0 ] && errorout "root access required."
    [ -z "$1" ] && errorout "usage: $0 [interface]"
    INTERFACE="$1"; shift
    # i added a sleep if we need to explicitly bring it up
    # b/c youll get "no networks found" when you scan right away
    # this only happens if we aren't up already
    if ! ifconfig | grep -q $INTERFACE; then
    ifconfig $INTERFACE up &>/dev/null || errorout "$INTERFACE not up"
    sleep 3
    fi
    if [ "$1" = "connect" ]; then
    ESSID="$2"
    connect
    else
    print_menu
    fi
    exit 0

  • Obmocmenu: Music on Console (moc) pipe menu for Openbox

    Sourceforge Project Page
    AUR Package
    Screenshot
    This is a simple menu for controlling the music player moc. I use moc version 2.5.0-alpha4 (found in the AUR) which has quite a few more features than 2.4.4 in [extra]. Still, this script should work fine with the moc in the official repos.
    You may also be interested in obdevicemenu: Udisks pipe menu for Openbox.
    Let me know if there are any bugs, or any additions or improvements you'd like to see.
    Last edited by jnguyen (2011-03-10 15:31:57)

    0.8.4 released, with the ability to add a random album/directory/song to the playlist, a feature which moc itself is missing. If zenity is installed, a dialog box pops up that allows you to add the specified number of random entries (e.g. 3 random albums). See the configuration file for details.

  • EeePc control (pipe menu)

    Here is a simple pipe menu script to control some eeePc features:
    cpu governors\frequence (cpufreq-utils)
    bluetooth, touchpad, webcam and card reader (acpi-eeepc-generic).
    tested on an eeePc 1000H.
    ## ozzolo's eee-control pipe menu for Openbox
    ## v 0.2
    ## tested on Asus eeePC 1000H
    ## 1) copy the script in ~/.config/openbox/pipemenus/eee-control.sh
    ## 2) change permissions: "chmod +x ~/.config/openbox/pipemenus/eee-control.sh"
    ## 3) edit ~/.config/openbox/menu.xml
    ## add <menu execute="~/.config/openbox/pipemenus/eee-control.sh" id="eee-control" label="eee control"/>
    ## 4) edit /etc/sudoers: "sudo EDITOR=nano visudo"
    ## add <your_username> ALL=NOPASSWD: /usr/bin/cpufreq-set, /etc/acpi/eeepc/
    echo "<openbox_pipe_menu>"
    CPUmodel=$(cat /proc/cpuinfo | grep -m 1 "model name" | sed 's/.*: \| \|(R)\|(TM)//g')
    EEEPCmodel=$(cat /etc/conf.d/acpi-eeepc-generic.conf | grep -m 1 "EEEPC_MODEL" | sed 's/.*=\|"//g')
    echo "<separator label=\"Asus EEEPC $EEEPCmodel $CPUmodel\"/>"
    # CPU - cpufreq-utils #
    CPU0gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
    CPU1gov=$(cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor)
    availGOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
    availFREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies)
    CPUfreq=$(cat /proc/cpuinfo | grep -m 2 "cpu MHz" | sed 's/.*: \|.000//g')
    echo "<menu id=\"eeecontrol-cpu\" label=\"CPU: $CPU0gov/$CPU1gov - $CPUfreq Mhz\">"
    i=1
    for xgov in $availGOV
    do
    if [ $xgov = "userspace" ]
    then
    j=1
    for xfreq in $availFREQ
    do
    xfreq=`expr $xfreq / 1000`
    echo "<item label=\"set: $xgov $xfreq Mhz\"><action name=\"Execute\"><execute>sudo cpufreq-set -c 0 -f $xfreq</execute></action><action name=\"Execute\"><execute>sudo cpufreq-set -c 1 -f $xfreq</execute></action></item>"
    let "j+=1"
    done
    else
    echo "<item label=\"set: $xgov\"><action name=\"Execute\"><execute>sudo cpufreq-set -c 0 -g $xgov</execute></action><action name=\"Execute\"><execute>sudo cpufreq-set -c 1 -g $xgov</execute></action></item>"
    let "i+=1"
    fi
    done
    echo "</menu>"
    # CPU end #
    # ACPI - acpi-eeepc-generic #
    statesDIR=/var/eeepc/states
    scriptsDIR=/etc/acpi/eeepc
    TPstate=$(cat $statesDIR/touchpad | sed 's/0/Off/' | sed 's/1/On/')
    echo "<item label=\"toggle Touchpad (now $TPstate) \"><action name=\"Execute\"><execute>sudo $scriptsDIR/acpi-eeepc-generic-toggle-touchpad.sh</execute></action></item>"
    BTstate=$(cat $statesDIR/bluetooth | sed 's/0/Off/' | sed 's/1/On/')
    echo "<item label=\"toggle Bluetooth (now $BTstate) \"><action name=\"Execute\"><execute>sudo $scriptsDIR/acpi-eeepc-generic-toggle-bluetooth.sh</execute></action></item>"
    CAMstate=$(cat $statesDIR/camera | sed 's/0/Off/' | sed 's/1/On/')
    echo "<item label=\"toggle Webcam (now $CAMstate) \"><action name=\"Execute\"><execute>sudo $scriptsDIR/acpi-eeepc-generic-toggle-webcam.sh</execute></action></item>"
    CARDstate=$(cat $statesDIR/cardr | sed 's/0/Off/' | sed 's/1/On/')
    echo "<item label=\"toggle Card Reader (now $CARDstate) \"><action name=\"Execute\"><execute>sudo $scriptsDIR/acpi-eeepc-generic-toggle-cardr.sh</execute></action></item>"
    # ACPI end #
    echo "</openbox_pipe_menu>"

    That's really strange.
    It's telling you that there is something wrong in your sed expression, I believe the thermal one:
    sed -nr "s/.*(\<[[:digit:]]+\.[[:digit:]]) degrees.*/\1°C/p"
    For what it's worth, this runs correctly on my machine. You don't have some odd version of sed, do you?
    I also don't understand why the 'Battery' and 'Thermal' variables in the script are not being substituted in the echo commands. You haven't substituted single quotes for double quotes in the script, have you? In other words, you haven't done this:
    echo '<openbox_pipe_menu>'
    echo ' <item label="Battery: $Battery"/>'
    echo ' <item label="Temperature: $Thermal"/>'
    echo '</openbox_pipe_menu>'
    This wouldn't work since the variables wouldn't be substituted correctly.  Bash doesn't substitute the variable values within single quotes. The middle two echo's have to be like this:
    echo " <item label=\"Battery: $Battery\"/>"
    echo " <item label=\"Temperature: $Thermal\"/>"
    or like this:
    printf ' <item label="Battery: %s"/>\n' "$Battery"
    printf ' <item label="Temperature: %s"/>\n' "$Thermal"

  • [SOLVED] Openbox Application Menu

    Good evening everyone!
    Just done a clean install of Arch and now working on my applications menu. I want a automatically generated application menu exactly like ArchBang.
    I have installed openbox-menu and all I get is "Menu not found, Please specify a menu specification file.". How do I get a menu like ArchBang without using ArchBang?
    Thanks in advance!
    Nic
    Last edited by Toxcity (2012-02-11 16:34:27)

    You're welcome mate! :)
    <menu id="apps-menu" label="Applications" execute="python2 /home/nic/.config/openbox/scripts/apps"/>
    That's the line I have in my menu.xml for the menu, it points to the script called apps. Below is the script:
    #!/usr/bin/python
    import xdg.Menu, xdg.DesktopEntry, xdg.Config
    import re, sys, os
    from xml.sax.saxutils import escape
    icons = True
    try:
    from gi.repository import Gtk
    except ImportError:
    icons = False
    def icon_attr(entry):
    if icons is False:
    return ''
    name = entry.getIcon()
    if os.path.exists(name):
    return ' icon="' + name + '"'
    # work around broken .desktop files
    # unless the icon is a full path it should not have an extension
    name = re.sub('\..{3,4}$', '', name)
    # imlib2 cannot load svg
    iconinfo = theme.lookup_icon(name, 22, Gtk.IconLookupFlags.NO_SVG)
    if iconinfo:
    iconfile = iconinfo.get_filename()
    iconinfo.free()
    if iconfile:
    return ' icon="' + iconfile + '"'
    return ''
    def entry_name(entry):
    return escape(entry.getName().encode('utf-8', 'xmlcharrefreplace'))
    def walk_menu(entry):
    if isinstance(entry, xdg.Menu.Menu) and entry.Show is True:
    print '<menu id="%s" label="%s"%s>' \
    % (entry_name(entry),
    entry_name(entry),
    escape(icon_attr(entry)))
    map(walk_menu, entry.getEntries())
    print '</menu>'
    elif isinstance(entry, xdg.Menu.MenuEntry) and entry.Show is True:
    print ' <item label="%s"%s>' % \
    (entry_name(entry.DesktopEntry).replace('"', ''),
    escape(icon_attr(entry.DesktopEntry)))
    command = re.sub(' -caption "%c"| -caption %c', ' -caption "%s"' % entry_name(entry.DesktopEntry), entry.DesktopEntry.getExec())
    command = re.sub(' [^ ]*%[fFuUdDnNickvm]', '', command)
    if entry.DesktopEntry.getTerminal():
    command = 'xterm -title "%s" -e %s' % \
    (entry_name(entry.DesktopEntry), command)
    print ' <action name="Execute">' + \
    '<command>%s</command></action>' % command
    print ' </item>'
    if len(sys.argv) > 1:
    menufile = sys.argv[1] + '.menu'
    else:
    menufile = 'applications.menu'
    lang = os.environ.get('LANG')
    if lang:
    xdg.Config.setLocale(lang)
    # lie to get the same menu as in GNOME
    xdg.Config.setWindowManager('GNOME')
    if icons:
    theme = Gtk.IconTheme.get_default()
    menu = xdg.Menu.parse(menufile)
    print '<?xml version="1.0" encoding="UTF-8"?>'
    print '<openbox_pipe_menu>'
    map(walk_menu, menu.getEntries())
    print '</openbox_pipe_menu>'
    Make sure you have gnome-menu installed and it should work fine. I am not the author of the script so cannot take any praise for it. ;)

  • [Openbox] Wine menu in Openbox menu?

    Is there a way to get the wine menu in openbox? I mean in gnome its in Applications>Wine and it has all the configure, wine uninstall wine software etc etc and it also automatically updates when new software is installed. Is it possible to have something like that in openbox?

    You could try making your own Wine menu in Openbox through Obmenu or by directly modifying the ~/.config/openbox/menu.xml

  • *SOLVED* Can´t right click in Openbox for Menu, Mouse poin......

    Hi all, i have this weird problem, well the title say it all
    this is my conkyrc file
    avoid flicker
    double_buffer yes
    #own window to run simultanious 2 or more conkys
    own_window yes
    own_window_transparent yes
    own_window_type desktop
    own_window_hints undecorate,sticky,skip_taskbar,skip_pager
    #borders
    draw_borders no
    border_margin 1
    #shades
    draw_shades no
    #position
    gap_x 6
    gap_y 6
    alignment top_center
    #behaviour
    update_interval 1
    #colour
    default_color ffffff
    #default_shade_color 0000003d352a
    own_window_colour 000000
    #font
    use_xft yes
    xftfont AvantGarde Md BT:pixelsize=12
    #bauhaus to prevent window from moving
    use_spacer no
    minimum_size 1262 0
    TEXT
    ${alignc}Kernel: ${color D7D3C5}$kernel | ${color}Processes: ${color D7D3C5}$processes ${color}Running: ${color D7D3C5}$running_processes | ${color}Cpu: ${color D7D3C5}${cpu}% ${color}Temp: ${color D7D3C5}${acpitemp}C | ${color}Mem: ${color D7D3C5}$memperc% | ${color}Batt: ${color D7D3C5}${battery} | ${color}Root: ${color D7D3C5}${font}${fs_free /} / ${fs_size /} | ${color}Home: ${color D7D3C5}${fs_free /home} / ${fs_size /home}
    I have it horizontal right now, but i want to make it vertical, but if the mous ponter is in the conkys "area", i mean the whole screen, i cant bring the openbox menu
    Screen:
    I tried changing, own_window_type desktop to normal, and i can do right click, but conky starts to flicker and everytime i right-click conky kinda dissapear, and i do have "db" loaded in xorg.conf : s
    Any help is really apreciated
    Last edited by AlmaMater (2007-09-25 02:00:55)

    Yes i did, but i get that "dissapearing thing" when i right click, i dont know why
    heres another screen to show that problem
    **EDITED**
    I fix it, by removing:
    use_spacer no
    minimum_size 1262 0
    Thanks for the help tho
    Cheers
    Last edited by AlmaMater (2007-09-25 02:00:13)

  • Problem with showing battery and system information in openbox

    I wanted to install docks( in open box wm ) which give me battery life information and some thing like that but when I run them terminal give me this error :
    CPU frequency scaling NOT available
    No power management subsystem detected
    No power management support...
    what should I do
    Last edited by sarsanaee (2013-08-08 15:14:42)

    well.. dockapps are veery old fashioned way to do that. If you look at wmpower app on that site you see it hasn't been updated for nearly five years, so i'm not surprised if it's not working on a modern system.
    many people use conky to display power status on openbox, so you might want to look into that..
    you can add power applet to various panels (xfce-panel, gnome-panel etc.) and use the panel with your openbox session
    you could also code/google for openbox pipe menu script that does what you need
    if none of those options work for you i found this git repository that seems to be still maintaied that holds wmpower and some other dockapps: http://repo.or.cz/w/dockapps.git
    unfortunately couldn't find PKGBUILD for that on AUR...
    Last edited by ooo (2013-08-09 11:25:56)

  • Separate panel or task list for mimized and not-minimized windows

    I am using OpenBox and I am looking into how to have two task lists (or panels), one with minimized windows and second with non-minimized windows. xfce-panel can show only minimized windows, but cannot show only non-minimized windows.
    Is there any panel/task list which can do this?

    xpixelz wrote:All what I found right now is that you may set properties on windows you don't want to show up in taskbar playing a little with "wmctrl -r yourapp -b toggle,skip_taskbar" and "-b toggle,skip_pager".
    wmctrl -r :ACTIVE: -b toggle,skip_taskbar is interesting possibility. I can use wmctrl to apply skip_taskbar to do custom "archive" command - minimize and apply skip_taskbar. But only way how to list such a "archived" windows and possible unminimize + remove skip_taskbar would be custom Openbox pipe menu. It is a way, but I was hoping for simpler one.
    Last edited by stabele (2012-12-31 13:43:23)

  • Something for Arch Linux users

    Hi,
    Thought this might be of some use to you Arch users out there ....
    A lotto generator
    Its an Openbox pipe menu but I am sure it could be changed to work in most WM's (including wmiiii!)
    Here
    Enjoy!

    Hmm... my state just got a lottery... maybe it's time to start playing it... *(searches for loose money to spend on lotto tickets and those little orange peanut shaped marshmallows., feels self getting fatter)*

  • HOWTO: Openbox Menu Icon in PyPanel

    Using Openbox and PyPanel (or similar) and are tired of either having to minimize windows or adjust maximum window size to leave space for right-clicking on the desktop?  Do you have a keyboard shortcut set up to open the menu, but also want to be able to use the mouse to open the menu easier?  I have a solution!
    Create an icon to launch the Openbox application menu on PyPanel.
    This will allow you to click on an icon on PyPanel which opens the OpenBox menu, similar to Gnome's application menu.
    Example:
    Requirements:
    Openbox Window Manager
    PyPanel (dock/panel application)
    xdotool
    obkey - to edit key shortcuts to OpenBox's rc.xml (not required, but used in this howto)
    Recommendations:
    archlinux-artwork
    Procedure:
    1) If you don't already have PyPanel installed, install it now (as root).
    pacman -S pypanel
    2) Launch pypanel in an application launcher, or the terminal (as normal user):
    pypanel &&
    3) Install xdotool (allows for launching keyboard shortcuts via command line) (as root)
    pacman -S xdotool
    4) If you do not have obkey installed, install it with yaourt (recommended) or download the tar.gz and run the python script:
    yaourt -S obkey-git
    OR
    Go to the obkey site or download the .tar.gz by clicking here
    Extract the .tar.gz:
    tar -xvf ./obkey-dev-abf0bb12.tar.gz
    Enter the obkey-dev directory:
    cd ./obkey-dev
    Run obkey and point it to the openbox rc.xml (as normal user!):
    ./obkey ~/.config/openbox/rc.xml
    5) In obkey, find an existing key or create a new key binding by clicking "Insert sibling key" at the top. Note: Ctrl+alt combinations did not seem to work for me to create this menu launcher.
    - If it's an existing key, select it, then click on the action in the bottom right-hand pane.  A window should pop up.  Find and select "ShowMenu"
    - If it's a new key, select it, enter in the key combination you want to use in the key (text) box (for example, C-M for Ctrl+M), then click the green "Insert Action" button at the bottom.  Click on the new "Focus" action.  A window should pop up.  Find and select "ShowMenu"
    In the ShowMenu action, at the top there should be a box for "menu:"  Enter in "root-menu" in this box.
    Now save by clicking the green arrow + hard drive in the top left corner of obkey.  Now you should be able to use that key combination to open the root-menu. If not, try restarting the X Server.
    Example:
    6) This is optional, but if you want a nice Arch icon for your new menu launcher, you can grab mine.  If you want to use your own image, it cannot be .svg, so I converted a .svg icon to .png from the the official Arch Artwork package (archlinux-artwork in the repos).  If you want to just use mine:
    Enter the following commands to get the image and set it up for the next step:
    mkdir ~/.icons/archlinux/icons/
    wget -P ~/.icons/archlinux/icons/ http://img297.imageshack.us/img297/1378/archlinuxiconcrystal128.png
    7) Open up your ~/.pypanelrc with your favorite text editor (e.g. nano or gedit). 
    Scroll down to a line starting with "LAUNCH_LIST"  Most likely it will have a line like this by default:
    ("gimp-2.2", "/usr/share/imlib2/data/images/paper.png")
    Change the line to the following to use xdotool and the key you assigned in step 5, as well as the icon image we just downloaded (Note: make sure to change /home/user to your specific home directory!):
    ("xdotool key ctrl+m", "/home/user/.icons/archlinux/icons/archlinuxiconcrystal128.png")
    Next, locate a line about 15 more down starting with "APPICONS."  Change this value from 0 to 1.
    APPICONS = 1 # Show application icons
    Finally, about 20 lines down, you will see a section for Panel Layout.
    There are 5 sections for the panel:  Desktop, Tasks, Tray, Clock, and Launcher.  They can be assigned, in order of left to right on the panel, with numbers 1-5 and 0 for disabled.  Choose a location you want your Launcher to be and set the value from 1-5.  You can play around with this by setting the values, then restarting pypanel.
    Here is how I have set mine (I disabled Desktop since I only use one desktop/workspace and do not need it to say which one I am on):
    DESKTOP = 0 # Desktop name section
    TASKS = 2 # Task names section
    TRAY = 3 # System tray section
    CLOCK = 4 # Clock section
    LAUNCHER = 1 # Application launcher section
    8) Finally, kill and restart PyPanel and enjoy!
    killall pypanel && pypanel
    9) Tell me how it went, what you think, what I could improve on, etc!
    Last edited by CheesyBeef (2009-03-24 22:22:39)

    Vighi wrote:
    Very nice guide got it working almost straight away :-)
    Had to restart X in order to get key-binding to work though. And I put /home/username/.icons/archlinux/icons/archlinuxiconcrystal128.png instead of ~/ because somehow I got couldn't find logo error when pypanel started.
    BTW sexy pypanel look you have. All the info in your .dotfiles link? will get to it tomorrow I guess. Thanks!
    Thanks very much for using my guide and responding!
    I will fix that ~/ directory problem and say to use the home directory. 
    And yes, that configuration is in my .dotfiles at the moment   You can follow that link or just grab it here: http://dotfiles.org/~CheesyBeef/.pypanelrc
    Thanks again!

  • Having issues with pipe-menus in openbox

    by issues, i just can't get it to work.
    "Invalid output from pipe-menu 'openbox-menu'"
    if i just run openbox-menu, it just gives me the error "File /etc/xdg/menus/applications.menu doesn't exist. Can't create menu"
    i can't, for the life of me, figure out how to create that file.

    Hi,
    Sorry you're having problems.
    How To get Help Quickly
    http://forums.adobe.com/thread/470404
    Post a URL to your test page so we can *SEE* what you see.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Obtap - An openbox menu generator like none before. (BETA)

    (When I say none before I mean none that I could find. If I could find one, I wouldn't have to make this then. Anyway..)
    Hey guys, I'm here to present my project 'obtap'. It's inspired by obmenugen, a great menu generator written in D which I've used before obtap. The reason I don't use it anymore is because it wasn't as customizable as I'd of liked it to be and that's why I've made obtap.
    I've developed a small (under <150KiB, only using the C++ standard library which means you don't have to install any dependencies) Openbox menu generator that's grown to do many things:
    obtap can generate pipe menus, static menus, a dynamically updating menu (basically a menu with it's contents a pipe menu).
    obtap can easily add separators for menu layout and edit entries in such ways of renaming/merging categories, setting entry categories, renaming entries and deleting entries.
    obtap has command line options to specify menu type (pipe, static, dynamic), the configuration file and the output.
    The selling point, I'd say at least, is that obtap can (but doesn't have to) load desktop files from directories as entries, which you can then process with the above methods.
    Here's my menu:
    That's created using this configuration file:
    # Jookia's obtap configuration file.
    output(~/.config/openbox/menu.xml)
    type(openboxDynamic)
    locations(/usr/share/applications,/usr/share/applications/kde4)
    extensions(desktop)
    obeyOnlyShowIn(GNOME,KDE,XFCE)
    ignoreCategories(GTK,GNOME,Qt)
    alphabetize(true)
    customEntry(Logout;shutdown-dialog.py)
    customEntry(Reconfigure Openbox;openbox --reconfigure;Utilities)
    customEntry(Nitrogen;nitrogen;Settings)
    replaceCategoryName(AudioVideo;Multimedia)
    replaceCategoryName(Game;Games)
    replaceCategoryName(Graphics;Multimedia)
    replaceCategoryName(Utility;Utilities)
    replaceCategoryName(System;Utilities)
    replaceEntryName(GNU Image Manipulation Program;GIMP)
    deleteEntry(Root Terminal)
    deleteEntry(Open Folder with Thunar)
    menuEntry(separator;Applications)
    menuEntry(categories)
    menuEntry(separator)
    menuEntry(entry;Logout)
    Here's how to get it from the GitHub page.
    git clone git://github.com/Jookia/obtap.git
    cd obtap
    make
    bin/obtap -c goodies/example.conf
    openbox --reconfigure
    That'll create a dynamic example menu and update Openbox.
    To edit it, edit example.conf or copy it to ~/.config/obtap.conf and run obtap without the '-c goodies/example.conf'.
    You can also install it by using the PKGBUILD in the goodies folder.
    I don't have much to say. Uh.. Thanks for reading and if you do use it, I'd love to know.
    Last edited by Jookia (2010-11-07 22:35:46)

    Ok here's for the verbose result, it's pointing to "`/.config/obtap.conf" which is resulting
    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <openbox_menu xmlns="http://openbox.org/3.4/menu">
    <menu id="root-menu" label="" execute=
    "/home/martin/obtap -c /home/martin/.config/obtap.conf -t openboxpipe -o -"
    />
    </openbox_menu>
    It's have an exactly same results like when you first time invoke obtap before install it to your /usr/bin
    Here's the obtap output schema
    <openbox_pipe_menu>
    <separator label="Applications"/>
    <menu id="menu-utilities" label="Utilities">
    <item label="Shutter">
    <action name="Execute">
    <command>shutter</command>
    </action>
    </item>
    <item label="Bulk Rename">
    <action name="Execute">
    <command>/usr/lib/ThunarBulkRename</command>
    </action>
    </item>
    <item label="UNetbootin">
    <action name="Execute">
    <command>su -c /usr/sbin/unetbootin</command>
    </action>
    </item>
    <item label="Cairo Composite Manager">
    <action name="Execute">
    <command>cairo-compmgr</command>
    </action>
    </item>
    <item label="SUSE Studio Imagewriter">
    <action name="Execute">
    <command>imagewriter</command>
    </action>
    </item>
    <item label="Avahi Zeroconf Browser">
    <action name="Execute">
    <command>/usr/bin/avahi-discover</command>
    </action>
    </item>
    <item label="Htop">
    <action name="Execute">
    <command>htop</command>
    </action>
    </item>
    <item label="Terminator">
    <action name="Execute">
    <command>terminator</command>
    </action>
    </item>
    <item label="GSmartControl">
    <action name="Execute">
    <command>"/usr/bin/gsmartcontrol-root"</command>
    </action>
    </item>
    <item label="GParted">
    <action name="Execute">
    <command>gksu /usr/sbin/gparted</command>
    </action>
    </item>
    <item label="gVim">
    <action name="Execute">
    <command>gvim</command>
    </action>
    </item>
    <item label="Thunar File Manager">
    <action name="Execute">
    <command>Thunar</command>
    </action>
    </item>
    <item label="CoverGloobus">
    <action name="Execute">
    <command>covergloobus</command>
    </action>
    </item>
    <item label="Squeeze">
    <action name="Execute">
    <command>squeeze</command>
    </action>
    </item>
    <item label="Disk Utility">
    <action name="Execute">
    <command>palimpsest</command>
    </action>
    </item>
    </menu>
    <menu id="menu-settings" label="Settings">
    <item label="Notifications">
    <action name="Execute">
    <command>xfce4-notifyd-config</command>
    </action>
    </item>
    <item label="Openbox Configuration Manager">
    <action name="Execute">
    <command>obconf</command>
    </action>
    </item>
    <item label="TintWizard">
    <action name="Execute">
    <command>tintwizard</command>
    </action>
    </item>
    <item label="File Manager">
    <action name="Execute">
    <command>thunar-settings</command>
    </action>
    </item>
    <item label="Removable Drives and Media">
    <action name="Execute">
    <command>/usr/lib/xfce4/thunar-volman-settings</command>
    </action>
    </item>
    <item label="Qt Config ">
    <action name="Execute">
    <command>/usr/bin/qtconfig</command>
    </action>
    </item>
    <item label="CoverGloobus Configuration">
    <action name="Execute">
    <command>covergloobus-config</command>
    </action>
    </item>
    <item label="Preferred Applications">
    <action name="Execute">
    <command>libfm-pref-apps</command>
    </action>
    </item>
    <item label="Customize Look and Feel">
    <action name="Execute">
    <command>lxappearance</command>
    </action>
    </item>
    </menu>
    <menu id="menu-network" label="Network">
    <item label="IcedTea Web Start">
    <action name="Execute">
    <command>/usr/bin/javaws</command>
    </action>
    </item>
    <item label="Avahi VNC Server Browser">
    <action name="Execute">
    <command>/usr/bin/bvnc</command>
    </action>
    </item>
    <item label="Firefox - Safe Mode">
    <action name="Execute">
    <command>firefox -safe-mode</command>
    </action>
    </item>
    <item label="Avahi SSH Server Browser">
    <action name="Execute">
    <command>/usr/bin/bssh</command>
    </action>
    </item>
    <item label="Firefox">
    <action name="Execute">
    <command>firefox</command>
    </action>
    </item>
    <item label="Midori">
    <action name="Execute">
    <command>midori</command>
    </action>
    </item>
    <item label="XChat IRC">
    <action name="Execute">
    <command>xchat</command>
    </action>
    </item>
    <item label="Pidgin Internet Messenger">
    <action name="Execute">
    <command>pidgin</command>
    </action>
    </item>
    </menu>
    <menu id="menu-development" label="Development">
    <item label="Qt Designer">
    <action name="Execute">
    <command>/usr/bin/designer</command>
    </action>
    </item>
    <item label="CMake">
    <action name="Execute">
    <command>cmake-gui</command>
    </action>
    </item>
    <item label="Qt Linguist">
    <action name="Execute">
    <command>/usr/bin/linguist</command>
    </action>
    </item>
    <item label="OpenJDK Monitoring &amp; Management Console">
    <action name="Execute">
    <command>/usr/bin/jconsole</command>
    </action>
    </item>
    <item label="Geany">
    <action name="Execute">
    <command>geany</command>
    </action>
    </item>
    <item label="Qt Assistant">
    <action name="Execute">
    <command>/usr/bin/assistant</command>
    </action>
    </item>
    <item label="OpenJDK Policy Tool">
    <action name="Execute">
    <command>/usr/bin/policytool</command>
    </action>
    </item>
    </menu>
    <menu id="menu-multimedia" label="Multimedia">
    <item label="Document Viewer">
    <action name="Execute">
    <command>evince</command>
    </action>
    </item>
    <item label="DeaDBeeF">
    <action name="Execute">
    <command>deadbeef</command>
    </action>
    </item>
    <item label="Mirage">
    <action name="Execute">
    <command>mirage</command>
    </action>
    </item>
    <item label="VLC media player">
    <action name="Execute">
    <command>vlc</command>
    </action>
    </item>
    <item label="GIMP">
    <action name="Execute">
    <command>gimp-2.6</command>
    </action>
    </item>
    </menu>
    <menu id="menu-openbox" label="Openbox">
    <item label="Reconfigure Openbox">
    <action name="Execute">
    <command>openbox --reconfigure</command>
    </action>
    </item>
    </menu>
    <separator/>
    <menu id="menu-openbox" label="Openbox">
    <item label="Reconfigure Openbox">
    <action name="Execute">
    <command>openbox --reconfigure</command>
    </action>
    </item>
    </menu>
    <item label="Logout">
    <action name="Execute">
    <command>shutdown-dialog.py</command>
    </action>
    </item>
    </openbox_pipe_menu>
    I guess the problem is "Htop" is a CLi program and normally when i want to invoke unetbootin / imagewriter, i'm using "gksu <command>" using manual menu.xml configuration.
    Hope it's help

  • [SOLVED] Openbox-menu saying Menu not found...

    Hello all,
    I installed Arch with Openbox. For the menu, I want to use openbox-menu to see my Applications.
    In menu.xml, I put the line:
    <menu execute="openbox-menu" id="desktop-app-menu" label="Applications"/>
    But when I point it in the menu, I get:
    Menu not found. Please specify a menu specification file.
    I get the same result in Terminal either as a user or as root.
    These are the "menu" packages I have installed:
    [philippe@phil-bureau ~]$ pacman -Qs menu
    local/dmenu-xft 4.5-1
    Dynamic X menu - with xft support
    local/gnome-menus 3.2.0.1-1
    GNOME menu specifications
    local/gnome-menus2 3.0.1-1
    GNOME menu specifications
    local/libdbusmenu-qt 0.9.0-2
    A library that provides a Qt implementation of the DBusMenu spec
    local/lxmenu-data 0.1.2-1 (lxde)
    freedesktop.org desktop menus for LXDE
    local/menu-cache 0.3.2-1 (lxde)
    Caches to speed up freedesktop.org's application menus use.
    local/obmenu 1.0-9
    Openbox menu editor.
    local/openbox-menu 0.3.6.6-1
    Dynamic XDG menu for openbox
    local/openbox-xdgmenu 0.3-2
    fast xdg-menu converter to xml-pipe-menu
    Any help/ideas/suggestions are welcome!
    Thanks
    Philippe
    Last edited by Philippe1 (2012-02-17 16:30:22)

    Hey guys, thanks for the quick response!
    Openbox-menu comes from AUR and the menu.xml is a copy of my Archbang installation. And yes, openbox-menu works like a charm on Archbang. So what am I missing?
    Here is the menu.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd">
    <menu id="root-menu" label="Openbox 3.5">
    <item label="Fichiers">
    <action name="Execute">
    <execute>
    nautilus
    </execute>
    </action>
    </item>
    <item label="Internet">
    <action name="Execute">
    <execute>
    chromium
    </execute>
    </action>
    </item>
    <item label="Minitube">
    <action name="Execute">
    <execute>
    minitube
    </execute>
    </action>
    </item>
    <item label="Jeux de cartes">
    <action name="Execute">
    <execute>
    pysol
    </execute>
    </action>
    </item>
    <item label="LibreOffice Writer">
    <action name="Execute">
    <execute>
    libreoffice -writer
    </execute>
    </action>
    </item>
    <item label="LibreOffice Calc">
    <action name="Execute">
    <execute>
    libreoffice -calc
    </execute>
    </action>
    </item>
    <item label="Terminal">
    <action name="Execute">
    <execute>
    sakura
    </execute>
    </action>
    </item>
    <separator/>
    <menu execute="openbox-menu" id="desktop-app-menu" label="Applications"/>
    <menu execute="~/.config/openbox/pipemenus/obpipemenu-places ~/" id="places" label="Places"/>
    <menu execute="~/.config/openbox/pipemenus/obrecent.sh ~/" id="recent" label="Recent Files"/>
    <menu id="Preferences" label="Preferences">
    <menu id="root-menu-90523" label="Conky Config">
    <item label="Edit .conkyrc">
    <action name="Execute">
    <execute>
    leafpad ~/.conkyrc
    </execute>
    </action>
    </item>
    <item label="Restart Conky">
    <action name="Execute">
    <execute>
    conkywonky
    </execute>
    </action>
    </item>
    </menu>
    <menu id="root-menu-891528" label="Eye Candy">
    <item label="No effects">
    <action name="Execute">
    <execute>
    ~/.config/openbox/scripts/xcompmgr.sh unset
    </execute>
    </action>
    </item>
    <item label="Transparency">
    <action name="Execute">
    <execute>
    ~/.config/openbox/scripts/xcompmgr.sh set
    </execute>
    </action>
    </item>
    <item label="Transparency, fading">
    <action name="Execute">
    <execute>
    ~/.config/openbox/scripts/xcompmgr.sh setshaded
    </execute>
    </action>
    </item>
    <item label="Transparency, fading shadows">
    <action name="Execute">
    <execute>
    ~/.config/openbox/scripts/xcompmgr.sh setshadowshade
    </execute>
    </action>
    </item>
    </menu>
    <menu id="root-menu-525118" label="Openbox Config">
    <item label="Edit autostart">
    <action name="Execute">
    <execute>
    leafpad ~/.config/openbox/autostart
    </execute>
    </action>
    </item>
    <item label="GUI Menu Editor">
    <action name="Execute">
    <execute>
    obmenu
    </execute>
    </action>
    </item>
    <item label="GUI Config Tool">
    <action name="Execute">
    <execute>
    obconf
    </execute>
    </action>
    </item>
    <item label="Key Editor">
    <action name="Execute">
    <execute>
    obkey
    </execute>
    </action>
    </item>
    <item label="Reconfigure">
    <action name="Reconfigure"/>
    </item>
    <item label="Restart">
    <action name="Restart"/>
    </item>
    </menu>
    <menu id="root-menu-23433" label="Take Screenshot">
    <item label="Now">
    <action name="Execute">
    <execute>
    scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/ &amp; geeqie ~/$f'
    </execute>
    </action>
    </item>
    <item label="In 5 Seconds...">
    <action name="Execute">
    <execute>
    scrot -d 5 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/ &amp; geeqie ~/$f'
    </execute>
    </action>
    </item>
    <item label="In 10 Seconds...">
    <action name="Execute">
    <execute>
    scrot -d 10 '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/ &amp; geeqie ~/$f'
    </execute>
    </action>
    </item>
    <item label="Selected Area... (click &amp; drag mouse)">
    <action name="Execute">
    <execute>
    scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/ &amp; geeqie ~/$f'
    </execute>
    </action>
    </item>
    </menu>
    <menu id="root-menu-571948" label="tint2 config">
    <item label="Edit tint2rc">
    <action name="Execute">
    <execute>
    leafpad ~/.config/tint2/tint2rc
    </execute>
    </action>
    </item>
    <item label="Tint Wizard">
    <action name="Execute">
    <execute>
    tintwizard.py
    </execute>
    </action>
    </item>
    </menu>
    <item label="Edit /etc/rc.conf">
    <action name="Execute">
    <execute>
    sudo leafpad /etc/rc.conf
    </execute>
    </action>
    </item>
    <item label="Input Device Preferences">
    <action name="Execute">
    <execute>
    lxinput
    </execute>
    </action>
    </item>
    <item label="Screen Resolution">
    <action name="Execute">
    <execute>
    arandr
    </execute>
    </action>
    </item>
    <item label="User Interface Settings">
    <action name="Execute">
    <execute>
    lxappearance
    </execute>
    </action>
    </item>
    <item label="Wallpaper">
    <action name="Execute">
    <execute>
    nitrogen
    </execute>
    </action>
    </item>
    </menu>
    <separator/>
    <item label="Exit">
    <action name="Execute">
    <execute>
    oblogout
    </execute>
    </action>
    </item>
    </menu>
    </openbox_menu>
    Thanks again!

  • Openbox menu etc doesn´t show [SOLVED]

    Hi, I really need some help here.
    I can´t figure out what the hell is wrong with my openbox.
    I had it running smooth, and because Im new to Linux and Arch I played around I guess and configured.
    Somehow I guess I have configured somesthing totally wrong and now my Openbox don´t work as it should.
    I have tried to replace the rc.xml, menu.xml and the autostart.sh with the defaults and still it doesn´t help!
    When I start Openbox pypanel is supposed to be started, it worked before.
    The only thing that comes up when I log in on openbox now is Conky and nothing else. The right click menu nothing works.
    I will post some configs that is related to the subject and I would be very glad if someone could guide me
    Btw im running Openbox with Gnome.
    rc.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Do not edit this file, it will be overwritten on install.
    Copy the file to $HOME/.config/openbox/ instead. -->
    <openbox_config xmlns="http://openbox.org/3.4/rc">
    <resistance>
    <strength>10</strength>
    <screen_edge_strength>20</screen_edge_strength>
    </resistance>
    <focus>
    <focusNew>yes</focusNew>
    <!-- always try to focus new windows when they appear. other rules do
    apply -->
    <followMouse>no</followMouse>
    <!-- move focus to a window when you move the mouse into it -->
    <focusLast>yes</focusLast>
    <!-- focus the last used window when changing desktops, instead of the one
    under the mouse pointer. when followMouse is enabled -->
    <underMouse>no</underMouse>
    <!-- move focus under the mouse, even when the mouse is not moving -->
    <focusDelay>200</focusDelay>
    <!-- when followMouse is enabled, the mouse must be inside the window for
    this many milliseconds (1000 = 1 sec) before moving focus to it -->
    <raiseOnFocus>no</raiseOnFocus>
    <!-- when followMouse is enabled, and a window is given focus by moving the
    mouse into it, also raise the window -->
    </focus>
    <placement>
    <policy>Smart</policy>
    <!-- 'Smart' or 'UnderMouse' -->
    <center>yes</center>
    <!-- whether to place windows in the center of the free area found or
    the top left corner -->
    <monitor>Any</monitor>
    <!-- with Smart placement on a multi-monitor system, try to place new windows
    on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
    the active window is -->
    </placement>
    <theme>
    <name>Clearlooks</name>
    <titleLayout>NLIMC</titleLayout>
    <!--
    available characters are NDSLIMC, each can occur at most once.
    N: window icon
    L: window label (AKA title).
    I: iconify
    M: maximize
    C: close
    S: shade (roll up/down)
    D: omnipresent (on all desktops).
    -->
    <keepBorder>yes</keepBorder>
    <animateIconify>yes</animateIconify>
    <font place="ActiveWindow">
    <name>sans</name>
    <size>8</size>
    <!-- font size in points -->
    <weight>bold</weight>
    <!-- 'bold' or 'normal' -->
    <slant>normal</slant>
    <!-- 'italic' or 'normal' -->
    </font>
    <font place="InactiveWindow">
    <name>sans</name>
    <size>8</size>
    <!-- font size in points -->
    <weight>bold</weight>
    <!-- 'bold' or 'normal' -->
    <slant>normal</slant>
    <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuHeader">
    <name>sans</name>
    <size>9</size>
    <!-- font size in points -->
    <weight>normal</weight>
    <!-- 'bold' or 'normal' -->
    <slant>normal</slant>
    <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuItem">
    <name>sans</name>
    <size>9</size>
    <!-- font size in points -->
    <weight>normal</weight>
    <!-- 'bold' or 'normal' -->
    <slant>normal</slant>
    <!-- 'italic' or 'normal' -->
    </font>
    <font place="OnScreenDisplay">
    <name>sans</name>
    <size>9</size>
    <!-- font size in points -->
    <weight>bold</weight>
    <!-- 'bold' or 'normal' -->
    <slant>normal</slant>
    <!-- 'italic' or 'normal' -->
    </font>
    </theme>
    <desktops>
    <!-- this stuff is only used at startup, pagers allow you to change them
    during a session
    these are default values to use when other ones are not already set
    by other applications, or saved in your session
    use obconf if you want to change these without having to log out
    and back in -->
    <number>4</number>
    <firstdesk>1</firstdesk>
    <names>
    <!-- set names up here if you want to, like this:
    <name>desktop 1</name>
    <name>desktop 2</name>
    -->
    </names>
    <popupTime>875</popupTime>
    <!-- The number of milliseconds to show the popup for when switching
    desktops. Set this to 0 to disable the popup. -->
    </desktops>
    <resize>
    <drawContents>yes</drawContents>
    <popupShow>Nonpixel</popupShow>
    <!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -->
    <popupPosition>Center</popupPosition>
    <!-- 'Center', 'Top', or 'Fixed' -->
    <popupFixedPosition>
    <!-- these are used if popupPosition is set to 'Fixed' -->
    <x>10</x>
    <!-- positive number for distance from left edge, negative number for
    distance from right edge, or 'Center' -->
    <y>10</y>
    <!-- positive number for distance from top edge, negative number for
    distance from bottom edge, or 'Center' -->
    </popupFixedPosition>
    </resize>
    <!-- You can reserve a portion of your screen where windows will not cover when
    they are maximized, or when they are initially placed.
    Many programs reserve space automatically, but you can use this in other
    cases. -->
    <margins>
    <top>0</top>
    <bottom>0</bottom>
    <left>0</left>
    <right>0</right>
    </margins>
    <dock>
    <position>TopLeft</position>
    <!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -->
    <floatingX>0</floatingX>
    <floatingY>0</floatingY>
    <noStrut>no</noStrut>
    <stacking>Above</stacking>
    <!-- 'Above', 'Normal', or 'Below' -->
    <direction>Vertical</direction>
    <!-- 'Vertical' or 'Horizontal' -->
    <autoHide>no</autoHide>
    <hideDelay>300</hideDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <showDelay>300</showDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <moveButton>Middle</moveButton>
    <!-- 'Left', 'Middle', 'Right' -->
    </dock>
    <keyboard>
    <chainQuitKey>C-g</chainQuitKey>
    <!-- Keybindings for desktop switching -->
    <keybind key="C-A-Left">
    <action name="DesktopLeft"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="C-A-Right">
    <action name="DesktopRight"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="C-A-Up">
    <action name="DesktopUp"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="C-A-Down">
    <action name="DesktopDown"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="S-A-Left">
    <action name="SendToDesktopLeft"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="S-A-Right">
    <action name="SendToDesktopRight"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="S-A-Up">
    <action name="SendToDesktopUp"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="S-A-Down">
    <action name="SendToDesktopDown"><dialog>no</dialog><wrap>no</wrap></action>
    </keybind>
    <keybind key="W-F1">
    <action name="Desktop"><desktop>1</desktop></action>
    </keybind>
    <keybind key="W-F2">
    <action name="Desktop"><desktop>2</desktop></action>
    </keybind>
    <keybind key="W-F3">
    <action name="Desktop"><desktop>3</desktop></action>
    </keybind>
    <keybind key="W-F4">
    <action name="Desktop"><desktop>4</desktop></action>
    </keybind>
    <keybind key="W-d">
    <action name="ToggleShowDesktop"/>
    </keybind>
    <!-- Keybindings for windows -->
    <keybind key="A-F4">
    <action name="Close"/>
    </keybind>
    <keybind key="A-Escape">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    </keybind>
    <keybind key="A-space">
    <action name="ShowMenu"><menu>client-menu</menu></action>
    </keybind>
    <!-- Keybindings for window switching -->
    <keybind key="A-Tab">
    <action name="NextWindow"/>
    </keybind>
    <keybind key="A-S-Tab">
    <action name="PreviousWindow"/>
    </keybind>
    <keybind key="C-A-Tab">
    <action name="NextWindow">
    <panels>yes</panels><desktop>yes</desktop>
    </action>
    </keybind>
    <!-- Keybindings for running applications -->
    <keybind key="W-e">
    <action name="Execute">
    <startupnotify>
    <enabled>true</enabled>
    <name>Konqueror</name>
    </startupnotify>
    <command>kfmclient openProfile filemanagement</command>
    </action>
    </keybind>
    </keyboard>
    <mouse>
    <dragThreshold>8</dragThreshold>
    <!-- number of pixels the mouse must move before a drag begins -->
    <doubleClickTime>200</doubleClickTime>
    <!-- in milliseconds (1000 = 1 second) -->
    <screenEdgeWarpTime>400</screenEdgeWarpTime>
    <!-- Time before changing desktops when the pointer touches the edge of the
    screen while moving a window, in milliseconds (1000 = 1 second).
    Set this to 0 to disable warping -->
    <context name="Frame">
    <mousebind button="A-Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="A-Left" action="Click">
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="A-Left" action="Drag">
    <action name="Move"/>
    </mousebind>
    <mousebind button="A-Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="A-Right" action="Drag">
    <action name="Resize"/>
    </mousebind>
    <mousebind button="A-Middle" action="Press">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    </mousebind>
    <mousebind button="A-Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="A-Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="C-A-Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="C-A-Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="A-S-Up" action="Click">
    <action name="SendToDesktopPrevious"/>
    </mousebind>
    <mousebind button="A-S-Down" action="Click">
    <action name="SendToDesktopNext"/>
    </mousebind>
    </context>
    <context name="Titlebar">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Move"/>
    </mousebind>
    <mousebind button="Left" action="DoubleClick">
    <action name="ToggleMaximizeFull"/>
    </mousebind>
    <mousebind button="Middle" action="Press">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    </mousebind>
    <mousebind button="Up" action="Click">
    <action name="Shade"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    <action name="Lower"/>
    </mousebind>
    <mousebind button="Down" action="Click">
    <action name="Unshade"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="ShowMenu"><menu>client-menu</menu></action>
    </mousebind>
    </context>
    <context name="Top">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"><edge>top</edge></action>
    </mousebind>
    </context>
    <context name="Left">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"><edge>left</edge></action>
    </mousebind>
    </context>
    <context name="Right">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"><edge>right</edge></action>
    </mousebind>
    </context>
    <context name="Bottom">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"><edge>bottom</edge></action>
    </mousebind>
    <mousebind button="Middle" action="Press">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="ShowMenu"><menu>client-menu</menu></action>
    </mousebind>
    </context>
    <context name="BLCorner">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"/>
    </mousebind>
    </context>
    <context name="BRCorner">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"/>
    </mousebind>
    </context>
    <context name="TLCorner">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"/>
    </mousebind>
    </context>
    <context name="TRCorner">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Drag">
    <action name="Resize"/>
    </mousebind>
    </context>
    <context name="Client">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Middle" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    </context>
    <context name="Icon">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    <action name="ShowMenu"><menu>client-menu</menu></action>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="ShowMenu"><menu>client-menu</menu></action>
    </mousebind>
    </context>
    <context name="AllDesktops">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Click">
    <action name="ToggleOmnipresent"/>
    </mousebind>
    </context>
    <context name="Shade">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Click">
    <action name="ToggleShade"/>
    </mousebind>
    </context>
    <context name="Iconify">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Left" action="Click">
    <action name="Iconify"/>
    </mousebind>
    </context>
    <context name="Maximize">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Middle" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Click">
    <action name="ToggleMaximizeFull"/>
    </mousebind>
    <mousebind button="Middle" action="Click">
    <action name="ToggleMaximizeVert"/>
    </mousebind>
    <mousebind button="Right" action="Click">
    <action name="ToggleMaximizeHorz"/>
    </mousebind>
    </context>
    <context name="Close">
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </mousebind>
    <mousebind button="Left" action="Click">
    <action name="Close"/>
    </mousebind>
    </context>
    <context name="Desktop">
    <mousebind button="Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="A-Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="A-Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="C-A-Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="C-A-Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
    </mousebind>
    </context>
    <context name="Root">
    <!-- Menus -->
    <mousebind button="Middle" action="Press">
    <action name="ShowMenu"><menu>client-list-combined-menu</menu></action>
    </mousebind>
    <mousebind button="Right" action="Press">
    <action name="ShowMenu"><menu>root-menu</menu></action>
    </mousebind>
    </context>
    <context name="MoveResize">
    <mousebind button="Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    <mousebind button="A-Up" action="Click">
    <action name="DesktopPrevious"/>
    </mousebind>
    <mousebind button="A-Down" action="Click">
    <action name="DesktopNext"/>
    </mousebind>
    </context>
    </mouse>
    <menu>
    <!-- You can specify more than one menu file in here and they are all loaded,
    just don't make menu ids clash or, well, it'll be kind of pointless -->
    <!-- default menu file (or custom one in $HOME/.config/openbox/) -->
    <file>menu.xml</file>
    <hideDelay>200</hideDelay>
    <!-- if a press-release lasts longer than this setting (in milliseconds), the
    menu is hidden again -->
    <middle>no</middle>
    <!-- center submenus vertically about the parent entry -->
    <submenuShowDelay>100</submenuShowDelay>
    <!-- this one is easy, time to delay before showing a submenu after hovering
    over the parent entry -->
    <applicationIcons>yes</applicationIcons>
    <!-- controls if icons appear in the client-list-(combined-)menu -->
    <manageDesktops>yes</manageDesktops>
    <!-- show the manage desktops section in the client-list-(combined-)menu -->
    </menu>
    <applications>
    <!--
    # this is an example with comments through out. use these to make your
    # own rules, but without the comments of course.
    <application name="first element of window's WM_CLASS property (see xprop)"
    class="second element of window's WM_CLASS property (see xprop)"
    role="the window's WM_WINDOW_ROLE property (see xprop)"
    type="the window's _NET_WM_WINDOW_TYPE (if unspecified, then
    it is dialog for child windows)">
    # the name or the class can be set, or both. this is used to match
    # windows when they appear. role can optionally be set as well, to
    # further restrict your matches.
    # the name, class, and role use simple wildcard matching such as those
    # used by a shell. you can use * to match any characters and ? to match
    # any single character.
    # the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
    # or desktop
    # when multiple rules match a window, they will all be applied, in the
    # order that they appear in this list
    # each element can be left out or set to 'default' to specify to not
    # change that attribute of the window
    <decor>yes</decor>
    # enable or disable window decorations
    <shade>no</shade>
    # make the window shaded when it appears, or not
    <position force="no">
    # the position is only used if both an x and y coordinate are provided
    # (and not set to 'default')
    # when force is "yes", then the window will be placed here even if it
    # says you want it placed elsewhere. this is to override buggy
    # applications who refuse to behave
    <x>center</x>
    # a number like 50, or 'center' to center on screen. use a negative number
    # to start from the right (or bottom for <y>), ie -50 is 50 pixels from the
    # right edge (or bottom).
    <y>200</y>
    <monitor>1</monitor>
    # specifies the monitor in a xinerama setup.
    # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>
    <focus>yes</focus>
    # if the window should try be given focus when it appears. if this is set
    # to yes it doesn't guarantee the window will be given focus. some
    # restrictions may apply, but Openbox will try to
    <desktop>1</desktop>
    # 1 is the first desktop, 'all' for all desktops
    <layer>normal</layer>
    # 'above', 'normal', or 'below'
    <iconic>no</iconic>
    # make the window iconified when it appears, or not
    <skip_pager>no</skip_pager>
    # asks to not be shown in pagers
    <skip_taskbar>no</skip_taskbar>
    # asks to not be shown in taskbars. window cycling actions will also
    # skip past such windows
    <fullscreen>yes</fullscreen>
    # make the window in fullscreen mode when it appears
    <maximized>true</maximized>
    # 'Horizontal', 'Vertical' or boolean (yes/no)
    </application>
    # end of the example
    -->
    </applications>
    </openbox_config>
    menu.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <openbox_menu xmlns="http://openbox.org/3.4/menu">
    <menu id="apps-accessories-menu" label="Accessories">
    <item label="Calculator">
    <action name="Execute">
    <command>gnome-calculator</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Character Map">
    <action name="Execute">
    <command>gnome-character-map</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Ark File Archiver">
    <action name="Execute">
    <command>ark</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="apps-editors-menu" label="Editors">
    <item label="GVim">
    <action name="Execute">
    <command>gvim</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>GVim</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="Emacs">
    <action name="Execute">
    <command>emacs</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>Emacs</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="GEdit">
    <action name="Execute">
    <command>gedit</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Kate">
    <action name="Execute">
    <command>kate</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Kwrite">
    <action name="Execute">
    <command>kwrite</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="apps-term-menu" label="Terminals">
    <item label="Rxvt Unicode">
    <action name="Execute">
    <command>urxvt</command>
    </action>
    </item>
    <item label="Gnome Terminal">
    <action name="Execute">
    <command>gnome-terminal</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Xfce Terminal">
    <action name="Execute">
    <command>xfce4-terminal</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Konsole">
    <action name="Execute">
    <command>konsole</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Xterm">
    <action name="Execute"><command>xterm</command></action>
    </item>
    </menu>
    <menu id="apps-net-menu" label="Internet">
    <item label="Firefox">
    <action name="Execute">
    <command>firefox</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>Firefox</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="Opera">
    <action name="Execute">
    <command>opera</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>Opera</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="Konqueror">
    <action name="Execute">
    <command>konqueror</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Epiphany">
    <action name="Execute">
    <command>epiphany</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Pidgin Instant Messenger">
    <action name="Execute">
    <command>pidgin</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Kopete Instant Messenger">
    <action name="Execute">
    <command>kopete</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="XChat">
    <action name="Execute">
    <command>xchat</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="apps-office-menu" label="Office">
    <item label="OpenOffice Base">
    <action name="Execute">
    <command>ooffice -base</command>
    </action>
    </item>
    <item label="OpenOffice Calc">
    <action name="Execute">
    <command>ooffice -calc</command>
    </action>
    </item>
    <item label="OpenOffice Draw">
    <action name="Execute">
    <command>ooffice -draw</command>
    </action>
    </item>
    <item label="OpenOffice Impress">
    <action name="Execute">
    <command>ooffice -impress</command>
    </action>
    </item>
    <item label="OpenOffice Math">
    <action name="Execute">
    <command>ooffice -math</command>
    </action>
    </item>
    <item label="OpenOffice Printer Administration">
    <action name="Execute">
    <command>ooffice-printeradmin</command>
    </action>
    </item>
    <item label="OpenOffice Writer">
    <action name="Execute">
    <command>ooffice -writer</command>
    </action>
    </item>
    </menu>
    <menu id="apps-multimedia-menu" label="Multimedia">
    <item label="Amarok">
    <action name="Execute">
    <command>amarok</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Rhythmbox">
    <action name="Execute">
    <command>rhythmbox</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="K3b">
    <action name="Execute">
    <command>k3b</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="MPlayer">
    <action name="Execute">
    <command>gmplayer</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>MPlayer</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="Totem">
    <action name="Execute">
    <command>totem</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="apps-fileman-menu" label="File Managers">
    <item label="Nautilus">
    <action name="Execute">
    <command>nautilus --no-desktop --browser</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Thunar">
    <action name="Execute">
    <command>Thunar</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="KDE File Manager">
    <action name="Execute">
    <command>kfmclient openURL ~</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Rox">
    <action name="Execute">
    <command>rox</command>
    <startupnotify>
    <enabled>yes</enabled>
    <wmclass>ROX-Filer</wmclass>
    </startupnotify>
    </action>
    </item>
    <item label="PCMan File Manager">
    <action name="Execute">
    <command>pcmanfm</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="apps-graphics-menu" label="Graphics">
    <item label="Gimp">
    <action name="Execute">
    <command>gimp</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Gwenview">
    <action name="Execute">
    <command>gwenview</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Dia Diagram Editor">
    <action name="Execute">
    <command>dia</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    <item label="Inkscape">
    <action name="Execute">
    <command>inkscape</command>
    <startupnotify>
    <enabled>yes</enabled>
    </startupnotify>
    </action>
    </item>
    </menu>
    <menu id="system-menu" label="System">
    <item label="Openbox Configuration Manager">
    <action name="Execute">
    <command>obconf</command>
    <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
    </item>
    <item label="Gnome Control Center">
    <action name="Execute">
    <command>gnome-control-center</command>
    <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
    </item>
    <item label="KDE Control Center">
    <action name="Execute">
    <command>kcontrol</command>
    <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
    </item>
    <item label="Xfce Settings">
    <action name="Execute">
    <command>xfce-setting-show</command>
    <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
    </item>
    <item label="Manage Cups Printers">
    <action name="Execute">
    <command>xdg-open http://localhost:631/</command>
    <startupnotify>
    <enabled>no</enabled>
    <icon>cups</icon>
    </startupnotify>
    </action>
    </item>
    <separator />
    <item label="Reconfigure Openbox">
    <action name="Reconfigure" />
    </item>
    <item label="Exit Openbox">
    <action name="Exit">
    <prompt>yes</prompt>
    </action>
    </item>
    </menu>
    <menu id="root-menu" label="Openbox 3">
    <separator label="Applications" />
    <menu id="apps-accessories-menu"/>
    <menu id="apps-editors-menu"/>
    <menu id="apps-graphics-menu"/>
    <menu id="apps-net-menu"/>
    <menu id="apps-office-menu"/>
    <menu id="apps-multimedia-menu"/>
    <menu id="apps-term-menu"/>
    <menu id="apps-fileman-menu"/>
    <separator label="System" />
    <menu id="system-menu"/>
    <separator />
    <item label="Log Out">
    <action name="SessionLogout">
    <prompt>yes</prompt>
    </action>
    </item>
    </menu>
    </openbox_menu>
    autostart.sh
    # This shell script is run before Openbox launches.
    # Environment variables set here are passed to the Openbox session.
    # Set a background color
    BG=""
    if which hsetroot >/dev/null; then
    BG=hsetroot
    else
    if which esetroot >/dev/null; then
    BG=esetroot
    else
    if which xsetroot >/dev/null; then
    BG=xsetroot
    fi
    fi
    fi
    test -z $BG || $BG -solid "#303030"
    # D-bus
    if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
    eval `dbus-launch --sh-syntax --exit-with-session`
    fi
    # Make GTK apps look and behave how they were set up in the gnome config tools
    if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
    /usr/libexec/gnome-settings-daemon &
    elif which gnome-settings-daemon >/dev/null; then
    gnome-settings-daemon &
    # Make GTK apps look and behave how they were set up in the XFCE config tools
    elif which xfce-mcs-manager >/dev/null; then
    xfce-mcs-manager n &
    fi
    # Preload stuff for KDE apps
    if which start_kdeinit >/dev/null; then
    LD_BIND_NOW=true start_kdeinit --new-startup +kcminit_startup &
    fi
    # Run XDG autostart things. By default don't run anything desktop-specific
    # See xdg-autostart --help more info
    DESKTOP_ENV=""
    if which /usr/lib/openbox/xdg-autostart >/dev/null; then
    /usr/lib/openbox/xdg-autostart $DESKTOP_ENV
    fi
    pypanel &
    eval `cat $HOME/.fehbg` &
    setxkbmap se
    conky
    I don´t know really what info you need to help me but please let me know what you need and I will get it for you.
    I want my Openbox back
    /Neuwerld
    Last edited by neuwerld (2009-03-25 17:35:59)

    neuwerld wrote:
    Ohh thanks guys!
    It worked as a charm, and thanks Brisbin33 for the autostart.sh tip.
    So the thing that caused my whole system not to work as it should was that I forgot to put a "&" after conky?
    haha that´s kinda anoying I have been sitting and looking through like a milllion files looking for the answer
    But again, really thanks!
    /Neuwerld
    that little "&" sends the conky process to the background freeing up the current process (your autostart.sh script) to finish doing what it's doing so you can move on to running openbox itself.  with this in mind, it should be obvious why keeping conky in the foreground would cause problems.
    also, replacing it with (sleep 1 && conky) & means... wait a second, when that's done successfully (&&) run conky, and put all of that () to the background.  that way openbox comes up immediatly and only a second later you've got your panel and monitor.
    all this after .xinitrc and before openbox

Maybe you are looking for

  • Is this even possible...if so advice??

    Hi Everyone, So I need to tap into the great knowledge of others on here and see if anyone has either some advice or maybe recommended resources to check on this question. I am setting up a small business with a Mac Mini Server and my client asked me

  • Zathura can't render pdf with mupdf backend

    After the update to zathura 0.2.4-1 I can't longer view pdf with zathura and mupdf backend, I get the following error error: could not load plugin /usr/lib/zathura/pdf.so (/usr/lib/zathura/pdf.so: undefined symbol: opj_stream_destroy) error: unknown

  • SS7 to 8i on NT (Text to Long)

    When I map the SQL Server Text columns to and Oracle CLOB or Varchar2 type everything works like a charm. When I map from SS7 Text to Oracle Long the migration workbench constantly crashes! Half of the time with an 6fbf6ener7cx error :] the other hal

  • 111 Failed to connect to SBOCommon Login - DI server

    Hi, I have developed a website that uses DI Server. I am able to successfully execute the B1 logic in my development machine. After hosting it on a server, i am getting "111 Failed to connect to SBOCommon Login" error. Any clues? Thanks & Regards Amu

  • T-cube request id blank

    Hello Friends, Please could you share with me , under what circumstances can a plan cube request id be blank? thanks!! regards YHogan