Cant spawn urxvt in python

As an exercise in learning python, i am trying to write an application launcher like dmenu. Only difference is that it will write everything directly on to screen (no window) using osdcat/pyosd. The problem is that it can launch other programs but launching urxvt fails.
os.spawnlp(os.P_NOWAIT,"urxvt")
launches urxvt but it is launched as a defunct process and no window appears
4812 0.0 0.0 0 0 pts/1 Z+ 20:52 0:00 [urxvt] <defunct>
when called with P_WAIT it returns with -11 which seems to be sigsegv
when called with os.system it works fine, but i guess its not the proper way to do this.
Any help will be appreciated.
PS: The partly baked code is below... It works with basic functionality ie you can launch programs other than urxvt. No editing of typed text, backspace,arrow keys etc currently. And it uses dmenu_path to get the list of programs
#!/usr/bin/python
from Xlib.display import Display
from Xlib import X
from Xlib import XK
import pyosd
import re
import commands
import os
a = commands.getoutput("dmenu_path").split("\n")
matches = []
def matchpattern(pattern,lst):
return filter(lambda x: re.match(pattern.lower(),x) , lst)
def printmatches(matches,myosd):
map(lambda x: myosd.display(x,line= matches.index(x)) , matches)
def clearlines(myosd):
map(lambda x: myosd.display("",line=x),range(0,9))
def run_pgm(program):
print "running"
print program
pid = os.fork()
if not pid:
os.execlp(program)
def handle_event(aEvent,disp,myosd,input):
keycode = aEvent.detail
if aEvent.type == X.KeyPress:
keysym = disp.keycode_to_keysym(keycode,0)
if keysym == XK.XK_Escape:
disp.ungrab_keyboard(X.CurrentTime)
return None
elif keysym == XK.XK_Return:
disp.ungrab_keyboard(X.CurrentTime)
matches = matchpattern(input,a)
print matches
if len(matches) == 0:
run_pgm(input)
else:
run_pgm(matches[0])
return None
else:
input += disp.lookup_string(keysym)
clearlines(myosd)
myosd.display(input)
printmatches(matchpattern(input,a)[0:9],myosd)
return input
else:
return input
def main():
disp = Display()
root = disp.screen().root
input = ""
myosd=pyosd.osd("-*-courier-bold-r-*-*-24-*-75-*-*-*-*-*",colour="#00FF00",timeout=0,pos=0,align=1,lines=10)
myosd.display("Run: ")
root.change_attributes(event_mask = X.KeyPressMask)
root.grab_keyboard(1,X.GrabModeAsync, X.GrabModeAsync,X.CurrentTime)
while input != None:
event = root.display.next_event()
input = handle_event(event,disp,myosd,input)
print
if __name__ == '__main__':
main()

What I mentioned above is working for me, except that mplayer is still giving me trouble. If you close stdin and stdout the mplayer window won't show up at all. Even with -noconsolecontrols.
I just tried the following, reading and writing to /dev/null instead:
pid=os.fork()
if pid == 0:
os.setsid()
readnull=open("/dev/null",'r')
writenull=open("/dev/null",'w')
p=Popen(cmd,shell=True,stdin=readnull,stdout=writenull,stderr=writenull)
p.wait()
readnull.close()
writenull.close()
os._exit(0)
I wonder what better practice is generally, closing stdin or piping /dev/null to stdin.
EDIT:
Actually, this seems to create zombie processes too.
EDIT2:
OK. Time to read up on Unix stuff: http://en.wikipedia.org/wiki/SIGCHLD
So add
import signal
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
to the start of your program, the zombies will go away.
BTW using exec* is nicer than Popen because the spawned program won't have a python parent. That makes it look a lot better in htop etc.
Last edited by Procyon (2009-02-14 14:59:09)

Similar Messages

  • Cant install or setup python!!

    A few weeks ago i downloaded and tried to install the latest python from their website. Somehow I  finally managed to "install" it but not sure how i did.
    Last night i did a complete sys update (pacman -Syu) and downloaded and installed everything listed, including the latest python. I went back to my old folder python folder on my desktop and ran python setup.py install and it looked like it went through the steps to install. But when i try to open a python script file it does not do anything, does not open, give an error, etc. When i try to open it using open with and search for the python file it says "bad address".
    Any ideas?

    Actually i think its 2.6 and yes it was listed in there. I think my problem is that when i open a python script file it does not open ?:|
    Can i test this somehow?
    ** Edit: when i try to open some sample python script files, they just open in Mousepad !!
    Last edited by banshee28 (2008-11-08 18:52:13)

  • Awesome systray is not showing all icons, perhaps overlapping widgets?

    I have a problem with my Awesome configuration that results in some of the icons being missing or partially missing from my systray. I suspect this is because of some overlapping, since they are partially hidden. You can see the problem in the top right corner.
    rc.lua:
    -- Standard awesome library
    require("awful")
    require("awful.autofocus")
    require("awful.rules")
    -- Theme handling library
    require("beautiful")
    -- Notification library
    require("naughty")
    --Wiget Library
    require("vicious")
    -- awesoMPD Widget
    --require("awesompd/awesompd")
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    beautiful.init("/usr/share/awesome/themes/blind-alien/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "urxvt"
    editor = os.getenv("EDITOR") or "vim"
    editor_cmd = terminal .. " -e " .. editor
    -- Enable or disable widgets:
    -- You also have to edit the wiboxes!
    useSysInfo = true
    usePacman = true
    useMpd = true
    useWifi = false
    useNet = true
    useBat = false
    useCpu = true
    useMem = true
    useTemp = false
    -- Widget Settings
    cpuCores = 2 --Number of CPU Cores
    thermalZone = "coretemp.0" --Thermal Zone to read cpu temperature from (check vicious docu)
    thermalData = "core" --Data Source: "proc", "core" or "sys"
    netAdapter = "eth0" --Network adapter to monitor
    wifiAdapter = "wlan0" --Wifi adapter for wifi widget
    pacUpdate = "yaourt -Sy" --Command to update pacman cache
    pacUpgrade = "yaourt -Su" --Command to upgrade system
    networkManager = terminal .. " -e wicd-curses"
    battery = "BAT1" --Battery to monitor
    widthMpd = 420 --Width of MPD widget
    -- Widget update intervals in seconds
    updateCpu = 1
    updatePac = 1801
    updateMpd = 1
    updateWifi = 7
    updateNet = 1
    updateBat = 31
    updateMem = 7
    -- For Dual-Screen setups:
    -- Set "dualScreen" to "2" if you want a different, optimized widget layout for every screen.
    -- If you set it to "-1" it will copy the same widget layout to both screens. (default Awesome behavior)
    dualScreen = -1
    screencount = screen.count()
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    layouts =
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.magnifier,
    awful.layout.suit.floating,
    awful.layout.suit.max
    -- {{{ Tags
    -- Define a tag table which will hold all screen tags.
    tags = {
    --names = { "1", "2", "3", "4", "5", "6"},
    --names = { "⌘", "♐", "⌥", "ℵ"},
    --names = { "⠪", "⠫", "⠬", "⠭", "⠮", "⠳"},
    names = { "⠐", "⠡", "⠪", "⠵", "⠻", "⠿" },
    --names = { " ∙", "⠡", "⠲", "⠵", "⠻", "⠿"},
    --names = { " ⠐ ", " ⠡ ", " ⠲ ", " ⠵ ", " ⠾ ", " ⠿ "},
    --names = { "⢷", "⣨", "⡪", "⣌", "⣪", "⡝"},
    layout = {
    layouts[8], layouts[8], layouts[8], layouts[5], layouts[8], layouts[8]
    for s = 1, screencount do
    tags[s] = awful.tag(tags.names, s, tags.layout)
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
    { "restart WM", awesome.restart },
    { "logout", awesome.quit },
    { "shutdown" , "sudo /sbin/halt -p" },
    { "reboot" , "sudo /sbin/reboot" }
    myinternet = {
    { "Chromium", "chromium" },
    { "Firefox" , "firefox" },
    { "IM" , "pidgin" },
    { "IRC" , "xchat"}
    mymedia = {
    { "Spotify", "spotify" },
    { "Rhythmbox", "rhythmbox" },
    { "ncmpcpp", "urxvt -e ncmpcpp" },
    { "Gnome Mplayer", "gnome-mplayer" },
    { "VLC" , "vlc" }
    mygraphics = {
    { "GIMP" , "gimp" },
    { "Inkscape" , "inkscape" },
    { "Image viewer" , "eog" }
    myoffice = {
    { "Base" , "lobase" },
    { "Calc" , "localc" },
    { "Impress" , "loimpress" },
    { "LibreOffice" , "loffice" },
    { "Writer" , "lowriter" },
    { "Lyx" , "lyx" },
    { "Document viewer" , "evince" }
    mysystem = {
    { "htop" , "urxvt -e htop" },
    { "Partition" , "gksudo gparted" },
    { "Sys mon" , "gnome-system-monitor" }
    myutilities = {
    { "Gedit" , "gedit" },
    { "Virtualbox" , "VirtualBox" },
    { "File Manager" , "nautilus --no-desktop" }
    myplaces = {
    { "Home" , "nautilus --no-desktop /home/johan/" },
    { "Documents" , "nautilus --no-desktop /home/johan/Documents/" },
    { "Downloads" , "nautilus --no-desktop /home/johan/Downloads/" },
    { "Music" , "nautilus --no-desktop /home/johan/Music/" },
    { "Pictures" , "nautilus --no-desktop /home/johan/Pictures/" }
    myserverplaces = {
    { "Server root" , "nautilus --no-desktop /srv/" },
    { "Downloads" , "nautilus --no-desktop /srv/download/" },
    { "Movies" , "nautilus --no-desktop /srv/movies/" },
    { "Tv-Series" , "nautilus --no-desktop /srv/tv-series/" },
    { "Misc" , "nautilus --no-desktop /srv/misc/" }
    mymainmenu = awful.menu({ items = {
    { "Terminal", terminal },
    { "Places" , myplaces },
    { "Server" , myserverplaces },
    { "Internet" , myinternet },
    { "Media" , mymedia },
    { "Graphics" , mygraphics },
    { "Office" , myoffice },
    { "Utilities" , myutilities },
    { "Systools" , mysystem },
    { "Awesome", myawesomemenu }
    mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
    menu = mymainmenu })
    -- Separators
    bubble = widget({ type = "textbox" })
    spacer = widget({ type = "textbox" })
    space = widget({ type = "textbox" })
    separator = widget({ type = "textbox" })
    bracketl = widget({ type = "textbox" })
    bracketr = widget({ type = "textbox" })
    vertline = widget({ type = "textbox" })
    dash = widget({ type = "textbox" })
    bubble.text = " ∘ "
    spacer.text = " "
    space.text = " "
    --separator.text = "<span font_desc='ClearlyU'> ⡾ </span>"
    separator.text = "] ["
    vertline.text = "|"
    dash.text = "-"
    bracketl.text = "["
    bracketr.text = "]"
    -- Status Labels
    cpuLabel = {}
    for s = 1, cpuCores do
    cpuLabel[s] = widget({ type = "textbox" })
    cpuLabel[s].text = "Core " .. s
    end
    rlabel = widget({ type = "textbox" })
    rlabel.text = "Root:"
    hlabel = widget({ type = "textbox" })
    hlabel.text = "Home:"
    -- WIDGETS --
    -- OS info
    if useSysInfo == true then
    sys = widget({ type = "textbox" })
    vicious.register(sys, vicious.widgets.os, "$1 $2")
    end
    -- Pacman updates
    if usePacman == true then
    -- Widget
    pnoghosticon = widget({ type = "imagebox" })
    pnoghosticon.image = image(beautiful.widget_pacnoghost)
    pnoghosticon.visible = true
    pghosticon = awful.widget.launcher({
    image = beautiful.widget_pacghost,
    command = terminal .. " -e " .. pacUpgrade .. " && echo -e 'vicious.force({ pacup, })' | awesome-client"
    pghosticon.visible = false
    -- Icon
    -- picon = widget({ type = "imagebox" })
    -- picon.image = image(beautiful.widget_pacnew)
    -- Use the Pacman icon as launcher to update the package list (change to fit your package-management system)
    picon = awful.widget.launcher({
    image = beautiful.widget_pacnew,
    command = pacUpdate .. " && echo -e 'vicious.force({ pacup, })' | awesome-client"
    runpicon = awful.widget.launcher({
    image = beautiful.widget_pacman_run,
    command = pacUpdate .. " && echo -e 'vicious.force({ pacup, })' | awesome-client"
    runpicon.visible = false
    pacup = widget({ type = "textbox" })
    vicious.register(pacup, vicious.widgets.pkg,
    function(widget, args)
    local nr = tonumber(args[1])
    if nr ~= 0 then
    pnoghosticon.visible = false
    pghosticon.visible = true
    picon.visible = false
    runpicon.visible = true
    else
    pghosticon.visible = false
    pnoghosticon.visible = true
    runpicon.visible = false
    picon.visible = true
    end
    end, updatePac, "Arch")
    end
    -- MPD Widget
    if useMpd == true then
    -- PLAY, STOP, PREV/NEXT Buttons
    -- requires modification of /usr/share/awesome/lib/awful/widget/launcher.lua
    -- b = util.table.join(w:buttons(), button({}, 1, nil, function () util.spawn(args.command) end))
    -- to:
    -- b = util.table.join(w:buttons(), button({}, 1, nil, function () util.spawn_with_shell(args.command) end))
    music_play = awful.widget.launcher({
    image = beautiful.widget_play,
    command = "mpc toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
    music_pause = awful.widget.launcher({
    image = beautiful.widget_pause,
    command = "mpc toggle && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
    music_pause.visible = false
    music_stop = awful.widget.launcher({
    image = beautiful.widget_stop,
    command = "mpc stop && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
    music_prev = awful.widget.launcher({
    image = beautiful.widget_prev,
    command = "mpc prev && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
    music_next = awful.widget.launcher({
    image = beautiful.widget_next,
    command = "mpc next && echo -e 'vicious.force({ mpdwidget, })' | awesome-client"
    mpdicon = widget({ type = "imagebox" })
    mpdicon.image = image(beautiful.widget_mpd)
    -- Initialize widget
    mpdwidget = widget({ type = "textbox" })
    --mpdwidget.wrap = "none"
    mpdwidget.width = widthMpd
    --mpdwidget.wrap = "word_char"
    -- Register Widget
    --vicious.register(mpdwidget, vicious.widgets.mpd, "(${state}) : ${Artist} - ${Title} ]", 13)
    -- Set the maximum width of the MPD widget inside the string.format function as "%.<length>s"
    vicious.register(mpdwidget, vicious.widgets.mpd,
    function(widget, args)
    --local maxlength = 85
    local font = beautiful.font
    local string = args["{Artist}"] .. " - " .. args["{Title}"]
    --local string = "[" .. args["{state}"] .. "]" .. " : " .. args["{Artist}"] .. " - " .. args["{Title}"]
    --[[ if maxlength < string.len(string) then
    return "<span font_desc='" .. font .. "'>" .. string.sub(string, 0, maxlength-6) .. "</span> ..."
    else
    return "<span font_desc='" .. font .. "'>" .. string .. "</span>"
    end]]
    if args["{state}"] == "Play" then
    music_play.visible = false
    music_pause.visible = true
    else
    music_play.visible = true
    music_pause.visible = false
    end
    return string
    end, updateMpd)
    end
    ---- WIFI Widget
    --if useWifi == true then
    -- wifiwidget = widget({ type = "textbox" })
    -- wifiwidget.width = 22
    -- wifiwidget.align = "right"
    -- --wifiimage = widget({ type = "imagebox" })
    -- wifiimage0 = awful.widget.launcher({
    -- image = beautiful.widget_wifi0,
    -- command = networkManager
    -- wifiimage0.image.visible = true
    -- wifiimage1 = awful.widget.launcher({
    -- image = beautiful.widget_wifi1,
    -- command = networkManager
    -- wifiimage1.image.visible = false
    -- wifiimage2 = awful.widget.launcher({
    -- image = beautiful.widget_wifi2,
    -- command = networkManager
    -- wifiimage2.image.visible = false
    -- wifiimage3 = awful.widget.launcher({
    -- image = beautiful.widget_wifi3,
    -- command = networkManager
    -- wifiimage3.image.visible = false
    -- wifiimage4 = awful.widget.launcher({
    -- image = beautiful.widget_wifi4,
    -- command = networkManager
    -- wifiimage4.image.visible = false
    -- -- Register Widget
    -- -- change to the desired network adapter if needed
    -- --vicious.register(wifiwidget, vicious.widgets.wifi, "~ ${link}%", 5, "wlan0")
    -- vicious.register(wifiwidget, vicious.widgets.wifi,
    -- function(widget, args)
    -- if tonumber(args["{link}"]) > 75 then
    -- wifiimage0.visible = false
    -- wifiimage1.visible = false
    -- wifiimage2.visible = false
    -- wifiimage3.visible = false
    -- wifiimage4.visible = true
    -- elseif tonumber(args["{link}"]) > 50 then
    -- wifiimage0.visible = false
    -- wifiimage1.visible = false
    -- wifiimage2.visible = false
    -- wifiimage3.visible = true
    -- wifiimage4.visible = false
    -- elseif tonumber(args["{link}"]) > 25 then
    -- wifiimage0.visible = false
    -- wifiimage1.visible = false
    -- wifiimage2.visible = true
    -- wifiimage3.visible = false
    -- wifiimage4.visible = false
    -- elseif tonumber(args["{link}"]) > 0 then
    -- wifiimage0.visible = false
    -- wifiimage1.visible = true
    -- wifiimage2.visible = false
    -- wifiimage3.visible = false
    -- wifiimage4.visible = false
    -- else
    -- wifiimage0.visible = true
    -- wifiimage1.visible = false
    -- wifiimage2.visible = false
    -- wifiimage3.visible = false
    -- wifiimage4.visible = false
    -- end
    -- return string.format("%02d%%", tonumber(args["{link}"]))
    -- end, updateWifi, wifiAdapter)
    --end
    -- NETWORK Widget
    if useNet == true then
    dnicon = widget({ type = "imagebox" })
    upicon = widget({ type = "imagebox" })
    dnicon.image = image(beautiful.widget_down)
    upicon.image = image(beautiful.widget_up)
    -- Initialize widget
    netdnwidget = widget({ type = "textbox" })
    netdnwidget.width = 55
    --netdnwidget.align = "right"
    netupwidget = widget({ type = "textbox" })
    netupwidget.width = 55
    --netupwidget.align = "right"
    -- Register widget
    -- change to the desired network adapter if needed
    --vicious.register(netdnwidget, vicious.widgets.net, "${eth0 down_kb} kB/s", 1)
    --vicious.register(netupwidget, vicious.widgets.net, "${eth0 up_kb} kB/s", 1)
    -- The following code formats the output to fill with zeroes at the beginning i.e. 013 kB/s instead of 13 kB/s.
    -- It also automatically switches to MB/s if there is more than 999 kB/s
    vicious.register(netdnwidget, vicious.widgets.net,
    function(widget, args)
    if tonumber(args["{" .. netAdapter .. " down_kb}"]) > 999 then
    return string.format("%04.1f MB/s", tonumber(args["{" .. netAdapter .. " down_mb}"]))
    else
    return string.format("%03d kB/s", tonumber(args["{" .. netAdapter .. " down_kb}"]))
    end
    end, updateNet)
    vicious.register(netupwidget, vicious.widgets.net,
    function(widget, args)
    if tonumber(args["{" .. netAdapter .. " up_kb}"]) > 999 then
    return string.format("%04.1f MB/s", tonumber(args["{" .. netAdapter .. " up_mb}"]))
    else
    return string.format("%03d kB/s", tonumber(args["{" .. netAdapter .. " up_kb}"]))
    end
    end, updateNet)
    end
    ---- BATTERY widget
    --if useBat == true then
    -- baticon = widget({ type = "imagebox" })
    -- --baticon.image = image(beautiful.widget_batfull)
    -- --Initialize widget
    -- batwidget = widget({ type = "textbox" })
    -- batwidget.width = 22
    -- batwidget.align = "right"
    -- --Register widget
    -- --vicious.register(batwidget, vicious.widgets.bat, "$1$2", 31, "BAT1")
    -- vicious.register(batwidget, vicious.widgets.bat,
    -- function(widget, args)
    -- if string.match(args[1], "[+↯]") then
    -- baticon.image = image(beautiful.widget_ac)
    -- elseif tonumber(args[2]) > 40 then
    -- baticon.image = image(beautiful.widget_batfull)
    -- elseif tonumber(args[2]) > 20 then
    -- baticon.image = image(beautiful.widget_batlow)
    -- else
    -- baticon.image = image(beautiful.widget_batempty)
    -- end
    -- if tonumber(args[2]) == 100 then
    -- return "Full"
    -- end
    -- return args[2] .. "%"
    -- end, updateBat, battery)
    --end
    -- {{{ CPU
    --if useTemp == true then
    -- -- Core Temp
    -- tempwidget = widget({ type = "textbox" })
    -- tempwidget.width = 26
    -- tempwidget.align = "right"
    -- vicious.register(tempwidget, vicious.widgets.thermal, "$1 C", updateCpu, { thermalZone, thermalData })
    -- --vicious.register(tempwidget, vicious.widgets.thermal, "$1°C", 5, { "thermal_zone0", "sys" })
    -- -- Icon
    -- tempicon = widget({ type = "imagebox" })
    -- tempicon.image = image(beautiful.widget_temp)
    --end
    -- Readout
    if useCpu == true then
    -- Icon
    cpuicon = widget({ type = "imagebox" })
    cpuicon.image = image(beautiful.widget_cpu)
    -- Core 1 Meter
    cpubar = {}
    freq = {}
    displayCores = {}
    displayCpu = {}
    for s = 1, cpuCores do
    cpubar[s] = awful.widget.progressbar()
    cpubar[s]:set_width(50)
    cpubar[s]:set_height(6)
    cpubar[s]:set_vertical(false)
    cpubar[s]:set_background_color("#434343")
    --cpubar:set_color(beautiful.fg_normal)
    cpubar[s]:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
    --Delete the following line if you want to put the widget on the left side of the wibox
    cpubar[s].layout = awful.widget.layout.horizontal.rightleft
    vicious.register(cpubar[s], vicious.widgets.cpu, "$" .. s, updateCpu)
    awful.widget.layout.margins[cpubar[s].widget] = { top = 6 }
    -- Frequency
    freq[s] = widget({ type = "textbox" })
    freq[s].width = 44
    freq[s].align = "right"
    --vicious.register(freq1, vicious.widgets.cpufreq, "$2 GHz", 9, "cpu0")
    vicious.register(freq[s], vicious.widgets.cpufreq,
    function(widget, args)
    return string.format("%03.1f GHz", args[2])
    end, updateCpu, "cpu" .. s - 1)
    -- Cache that shit
    vicious.cache(vicious.widgets.cpu)
    end
    end
    -- }}} CPU
    -- {{{ MEM
    if useMem == true then
    -- Icon
    memicon = widget({ type = "imagebox" })
    memicon.image = image(beautiful.widget_mem)
    -- Percentage
    --mem = widget({ type = "textbox" })
    --vicious.register(mem, vicious.widgets.mem, "$1%")
    -- Meter
    membar = awful.widget.progressbar()
    membar:set_width(50)
    membar:set_height(6)
    membar:set_vertical(false)
    membar:set_background_color("#434343")
    --membar:set_color(beautiful.fg_normal )
    membar:set_gradient_colors({ beautiful.fg_normal, beautiful.fg_normal, beautiful.fg_normal, beautiful.bar })
    --This bar should be placed on the right side of the wibox unless
    --it's a dual-screen config in which case the default (leftright)
    --layout is used... change that if you need!
    if screencount ~= dualScreen then
    membar.layout = awful.widget.layout.horizontal.rightleft
    end
    --Register the widget
    vicious.register(membar, vicious.widgets.mem, "$1", updateMem)
    -- Align progressbars
    awful.widget.layout.margins[membar.widget] = { top = 6 }
    -- MEM Usage
    --mem_total = widget({ type = "textbox" })
    --vicious.register(mem_total, vicious.widgets.mem, "$3 MB", 9)
    --mem_used = widget({ type = "textbox" })
    --vicious.register(mem_total, vicious.widgets.mem, "$2 MB", 9,)
    -- Cache that shit
    vicious.cache(vicious.widgets.mem)
    end
    -- }}} MEM
    -- Create a textclock widget
    mytextclock = awful.widget.textclock({ align = "right" }, "%H:%M")
    awful.widget.layout.margins[mytextclock] = { top = -1 }
    -- Create a systray
    mysystray = widget({ type = "systray"})
    -- Create a wibox for each screen and add it
    mywibox = {}
    mybottomwibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(awful.button({}, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({}, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({}, 4, awful.tag.viewnext),
    awful.button({}, 5, awful.tag.viewprev))
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(awful.button({}, 1, function(c)
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    client.focus = c
    c:raise()
    end),
    awful.button({}, 3, function()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width = 250 })
    end
    end),
    awful.button({}, 4, function()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({}, 5, function()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screencount do
    -- Set a screen margin for borders
    awful.screen.padding(screen[s], { top = 0 })
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(awful.button({}, 1, function() awful.layout.inc(layouts, 1) end),
    awful.button({}, 3, function() awful.layout.inc(layouts, -1) end),
    awful.button({}, 4, function() awful.layout.inc(layouts, 1) end),
    awful.button({}, 5, function() awful.layout.inc(layouts, -1) end)))
    mylayoutbox[s].resize = false
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
    awful.widget.layout.margins[mytaglist[s]] = { top = -2 }
    -- WARNING: In order to properly view the tasklist some lua files have been modified. For the
    -- tasklist_floating_icon icon to be placed on the left side of the task name instead of the
    -- right alignment, /usr/share/awesome/lib/awful/widget/tasklist.lua in function new(label, buttons) the
    -- variable widgets.textbox has to be modified like this:
    -- remove bg_align = "right" and
    -- modify the left margin from 2 to icon width + 2 (i.e.: 18).
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(function(c)
    return awful.widget.tasklist.label.currenttags(c, s,
    -- WARNING: Requires modified /usr/share/awesome/lib/awful/widget/tasklist.lua !!!
    -- This basically hides the application icons on the tasklist. If you don't want this or
    -- prefer not to change your tasklist.lua remove the following line!
    { hide_icon = true })
    end, mytasklist.buttons)
    awful.widget.layout.margins[mytasklist[s]] = { top = 2 }
    -- WIBOXES --
    -- Here we create the wiboxes if it's not a dual-screen layout
    if screencount ~= dualScreen then
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s, border_width = 0, height = 18 })
    -- Add widgets to the wibox - order matters
    mywibox[s].widgets = {
    mytaglist[s],
    mypromptbox[s],
    displaySysInfo,
    layout = awful.widget.layout.horizontal.leftright
    mytextclock,
    mylayoutbox[s],
    s == 1 and mysystray or nil,
    mytasklist[s],
    layout = awful.widget.layout.horizontal.rightleft
    mybottomwibox[s] = awful.wibox({ position = "bottom", screen = s, border_width = 0, height = 18 })
    mybottomwibox[s].widgets = {
    space, music_play, music_pause, music_stop, music_prev, music_next, space, mpdwidget,
    layout = awful.widget.layout.horizontal.leftright
    spacer,
    bracketr,
    -- spacer, batwidget, spacer, baticon, spacer,
    -- separator,
    -- spacer, wifiwidget, spacer, wifiimage0, wifiimage1, wifiimage2, wifiimage3, wifiimage4, spacer,
    -- separator,
    -- spacer, tempwidget, spacer, tempicon, spacer,
    -- separator,
    spacer, freq[1], spacer, cpubar[1], spacer,
    --cpuLabel[1], spacer,
    cpuicon, spacer,
    separator,
    spacer, membar, spacer, memicon, spacer,
    separator,
    spacer, netupwidget, spacer, upicon, spacer, separator, spacer, netdnwidget, spacer, dnicon, spacer,
    separator,
    space, pghosticon, pnoghosticon, runpicon, picon, space,
    bracketl,
    layout = awful.widget.layout.horizontal.rightleft
    end
    end
    if screencount == dualScreen then
    -- Here we create the wiboxes if it is a dual screen configuration:
    mywibox[1] = awful.wibox({ position = "top", screen = 1, border_width = 0, height = 18 })
    -- Add widgets to the wibox - order matters
    mywibox[1].widgets = {
    mytaglist[1],
    spacer,
    mypromptbox[1],
    mytasklist[1],
    layout = awful.widget.layout.horizontal.leftright
    spacer,
    mytextclock,
    -- spacer,
    mylayoutbox[1],
    -- spacer,
    -- mytasklist[1],
    layout = awful.widget.layout.horizontal.rightleft
    mybottomwibox[1] = awful.wibox({ position = "bottom", screen = 1, border_width = 0, height = 18 })
    mybottomwibox[1].widgets = {
    space, music_play, music_pause, music_stop, music_prev, music_next, space, mpdwidget,
    layout = awful.widget.layout.horizontal.leftright
    space,
    s == 1 and mysystray or nil,
    layout = awful.widget.layout.horizontal.rightleft
    mywibox[2] = awful.wibox({ position = "top", screen = 2, border_width = 0, height = 18 })
    mywibox[2].widgets = {
    space,
    mytaglist[2],
    spacer,
    mypromptbox[2],
    layout = awful.widget.layout.horizontal.leftright
    spacer,
    mytextclock,
    space,
    mylayoutbox[2],
    spacer,
    mytasklist[2],
    layout = awful.widget.layout.horizontal.rightleft
    mybottomwibox[2] = awful.wibox({ position = "bottom", screen = 2, border_width = 0, height = 18 })
    mybottomwibox[2].widgets = {
    spacer,
    bracketl,
    spacer, sys, spacer,
    separator,
    space, runpicon, picon, pghosticon, pnoghosticon, space,
    separator,
    spacer, dnicon, spacer, netdnwidget, spacer, separator, spacer, upicon, spacer, netupwidget, spacer,
    separator,
    spacer, memicon, spacer, membar, spacer,
    bracketr,
    layout = awful.widget.layout.horizontal.leftright
    spacer,
    bracketr,
    spacer, tempwidget, spacer, tempicon, spacer,
    separator,
    spacer, freq[2], spacer, cpubar[2], spacer,
    cpuLabel[2], spacer,
    cpuicon, spacer,
    separator,
    spacer, freq[1], spacer, cpubar[1], spacer,
    cpuLabel[1], spacer,
    cpuicon, spacer,
    bracketl,
    layout = awful.widget.layout.horizontal.rightleft
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(awful.button({}, 3, function() mymainmenu:toggle() end),
    awful.button({}, 4, awful.tag.viewnext),
    awful.button({}, 5, awful.tag.viewprev)))
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(awful.key({ modkey, }, "Left", awful.tag.viewprev),
    awful.key({ }, "Print", function () awful.util.spawn("gnome-screenshot") end),
    awful.key({ modkey, }, "Right", awful.tag.viewnext),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "j",
    function()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function() mymainmenu:show({ keygrabber = true }) end),
    --Volume manipulation
    -- awful.key({}, "XF86AudioRaiseVolume", function() awful.util.spawn("amixer set Master 5+") end),
    -- awful.key({}, "XF86AudioLowerVolume", function() awful.util.spawn("amixer set Master 5-") end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end),
    awful.key({ modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end),
    awful.key({ modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end),
    awful.key({ modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function() awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function() awful.tag.incmwfact(0.05) end),
    awful.key({ modkey, }, "h", function() awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function() awful.tag.incnmaster(1) end),
    awful.key({ modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function() awful.tag.incncol(1) end),
    awful.key({ modkey, "Control" }, "l", function() awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function() awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function() awful.layout.inc(layouts, -1) end),
    -- Prompt
    awful.key({ modkey }, "r", function() mypromptbox[mouse.screen]:run() end),
    awful.key({ modkey }, "x",
    function()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end))
    clientkeys = awful.util.table.join(awful.key({ modkey, }, "f", function(c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, }, "q", function(c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle),
    awful.key({ modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen),
    awful.key({ modkey, "Shift" }, "m", function () awful.util.spawn("urxvt -T ncmpcpp -e 'ncmpcpp'") end),
    awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("chromium") end),
    awful.key({ modkey, }, "b", function () awful.util.spawn("nautilus --no-desktop") end),
    awful.key({ modkey, "Shift" }, "r", function(c) c:redraw() end),
    awful.key({ modkey, }, "t", function(c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n", function(c) c.minimized = not c.minimized end),
    awful.key({ modkey, }, "m",
    function(c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end))
    -- Compute the maximum number of digit we need, limited to 9
    keynumber = 0
    for s = 1, screencount do
    keynumber = math.min(9, math.max(#tags[s], keynumber));
    end
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewonly(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewtoggle(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.movetotag(tags[client.focus.screen][i])
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.toggletag(tags[client.focus.screen][i])
    end
    end))
    end
    clientbuttons = awful.util.table.join(awful.button({}, 1, function(c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- {{{ Rules
    awful.rules.rules = {
    -- All clients will match this rule.
    rule = {},
    properties = {
    border_width = beautiful.border_width,
    border_color = beautiful.border_normal,
    size_hints_honor = false,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons
    rule = { class = "MPlayer" },
    properties = { floating = true }
    rule = { class = "pinentry" },
    properties = { floating = true }
    rule = { class = "gimp" },
    properties = { floating = true }
    { rule = { class = "firefox" },
    properties = { tag = tags[1][2] } },
    { rule = { class = "Chromium" },
    properties = { tag = tags[1][2] } },
    { rule = { class = "Pidgin" },
    properties = { tag = tags[1][3] } },
    { rule = { class = "Xchat" },
    properties = {tag = tags[1][4] } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    -- properties = { tag = tags[1][2] } },
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.add_signal("manage", function(c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })
    -- Enable sloppy focus
    c:add_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    end)
    client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    -- {{{ Tag signal handler - selection
    -- - ASCII tags 1 [2] 3 4...
    -- - start with tag 1 named [1] in tag setup
    for s = 1, screencount do
    for t = 1, #tags[s] do
    tags[s][t]:add_signal("property::selected", function ()
    if tags[s][t].selected then
    tags[s][t].name = "[" .. tags[s][t].name .. "]"
    else--]]
    --tags[s][t].name = tags[s][t].name:gsub("[%[%]]", "")
    --[[ end
    end)
    end
    end
    I have tried to search around for a solution to this, but I am coming up short. Any idea on how to solve this?
    Last edited by kveras (2011-11-21 09:01:47)

    First of all, did you check the wiki and forums? We'll help you, but you have to try to fix it yourself first.
    You will need to provide more info if you want help.
    Did you set up Gnome to force fallback mode?
    Did you look at the Gnome wiki article? There's a few sections that sound like what your looking to do, but the examples are USING OTHER WM's. They still might be able to point you in the right direction.

  • SOLVED:Dmenu not launching correctly in Xmonad

    I am running xmonad and I am having issues getting the dmenu_run to execute properly. It was working fine before but now it just launches with a white bar and nothing autocompletes. I am running Xmonad 0.9.2-2.1 and dmenu 4.4-1. Here is my entry in xmonad.hs:
    , ((modMask, xK_p ), spawn "dmenu_run | dmenu -b")
    Also, here is my entire xmonad.hs:
    import XMonad hiding (Tall)
    import XMonad.Hooks.DynamicLog
    import XMonad.Hooks.ManageDocks
    import XMonad.Hooks.ManageHelpers
    import XMonad.Layout.HintedTile
    import XMonad.Layout.LayoutHints (layoutHints)
    import XMonad.Prompt
    import XMonad.Prompt.Shell
    import XMonad.Util.Run(spawnPipe)
    import System.Exit
    import System.IO
    import Data.Monoid
    import qualified XMonad.StackSet as W
    import qualified Data.Map as M
    myBorderWidth = 1
    main = do
    xmproc <- spawnPipe "/usr/bin/xmobar /home/comhack/.xmobarcc"
    xmonad $ defaultConfig {
    terminal = "urxvt",
    modMask = mod1Mask,
    workspaces = ["Net", "Chat", "Work", "4", "5", "6", "7", "8", "9"],
    normalBorderColor = "#000000",
    focusedBorderColor = "#838B8B",
    manageHook = composeOne [isFullscreen -?> doFullFloat],
    borderWidth = myBorderWidth,
    keys = myKeys,
    focusFollowsMouse = True,
    layoutHook = myLayout,
    logHook = dynamicLogWithPP $ xmobarPP
    { ppOutput = hPutStrLn xmproc,
    ppTitle = xmobarColor "green" "" . shorten 60,
    ppHiddenNoWindows = xmobarColor "grey" ""
    myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask , xK_Return ), spawn $ XMonad.terminal conf)
    , ((modm , xK_backslash ), spawn “amixer -q set Master toggle”)
    , ((modm , xK_minus ), spawn “amixer -q set Master 3- unmute”)
    , ((modm , xK_equal ), spawn “amixer -q set Master 3+ unmute”)
    , ((modMask .|. shiftMask, xK_c ), kill)
    , ((modMask , xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask , xK_n ), refresh)
    , ((modMask, xK_p ), spawn "dmenu_run | dmenu -b")
    , ((modMask , xK_Tab ), windows W.focusDown)
    , ((modMask , xK_j ), windows W.focusDown)
    , ((modMask , xK_k ), windows W.focusUp)
    , ((modMask , xK_m ), windows W.focusMaster)
    , ((modMask .|. shiftMask, xK_Return ), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j ), windows W.swapDown)
    , ((modMask .|. shiftMask, xK_k ), windows W.swapUp)
    , ((modMask , xK_h ), sendMessage Shrink)
    , ((modMask , xK_l ), sendMessage Expand)
    , ((modMask , xK_t ), withFocused $ windows . W.sink)
    , ((modMask , xK_comma ), sendMessage (IncMasterN 1))
    , ((modMask , xK_period ), sendMessage (IncMasterN (-1)))
    , ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
    , ((modMask , xK_q ), spawn "xmonad --recompile")
    , ((modMask , xK_F2 ), shellPrompt defaultXPConfig)
    , ((0 , 0x1008ff30 ), shellPrompt defaultXPConfig)
    , ((0 , 0x1008ff13 ), spawn "amixer -q set Master 2dB+")
    , ((0 , 0x1008ff11 ), spawn "amixer -q set Master 2dB-")
    , ((0 , 0x1008ff12 ), spawn "amixer -q set Master toggle")
    , ((0 , 0x1008ff16 ), spawn "cmus-remote --prev")
    , ((0 , 0x1008ff17 ), spawn "cmus-remote --next")
    , ((0 , 0x1008ff14 ), spawn "cmus-remote --pause")
    , ((0 , 0x1008ff5b ), spawn "urxvt -e screen -rd cmus")
    , ((modMask , xK_Print ), spawn "scrot -e 'mv $f ~/Screenshots'")
    ++
    [((m .|. modMask, k), windows $ f i)
    | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
    , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
    | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
    , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
    myLayout = avoidStruts $ tiled ||| wideTiled ||| Full
    where
    tiled = HintedTile nmaster delta ratio Center Tall
    wideTiled = HintedTile nmaster delta ratio Center Wide
    nmaster = 1
    ratio = 1/2
    delta = 3/100
    It was working fine before so I am thinking that it must of been an update or something. If I run the command in a terminal, it works just fine. So it has to be the syntax or something. This works perfectly:
    dmenu_run | dmenu -b
    Any ideas?
    Last edited by securitybreach (2011-08-08 03:07:25)

    Obscaenvs wrote:
    I don't think it's an actual bug; it's just updated syntax. For me, this solved the issue:
    In my xmonad.hs, I _had_ the line
    , ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
    I changed this to use dmenu_run instead and not piping to dmenu:
    , ((modm, xK_p ), spawn "exe=`dmenu_run` && eval \"exec $exe\"")
    A recompile is necessary for this to take effect. One of you did not have to recompile, but that was most likely because the downgraded dmenu understood the old syntax.
    Now it works...YMMV.
    EDIT: I see now that user "securitybreach" uses "dmenu_run" already... Try not piping the command; when I did this, I got two instances of Dmenu running: one with all the executables in path as usual, and one blank.
    There are people having issues with dmenu using other window managers besides XMonad, so that is not the same issue.  Not to mention, that my spawn of dmenu is WAY less complicated than that, and I am still getting the issue (before downgrade).

  • The great xmonad.hs thread

    For several reasons, I wanted to start the great xmonad.hs thread.
    Idea is simple: just post the xmonad.hs file you're using, and/or discuss yours/someone else's.
    To start off, this is my (small) xmonad.hs file:
    [cpf@galactica .xmonad]% cat xmonad.hs
    -- module Main where
    import XMonad
    import XMonad.Config.Xfce
    -- import XMonad.Config.Gnome
    import qualified Data.Map as M
    main = xmonad $ xfceConfig
    terminal = "urxvt",
    modMask = mod4Mask,
    keys = \c -> myKeys c `M.union` keys xfceConfig c
    myKeys (XConfig {modMask = modm}) = M.fromList $
    [ ((modm, xK_p), spawn "hayaku"),
    ((modm .|. shiftMask, xK_p), spawn "xfrun4"),
    ((modm .|. shiftMask, xK_q), spawn "xfce4-session-logout")

    Nice idea, xmonad has a nice config style.
    mine:
    import XMonad
    import System.Exit
    import XMonad.Hooks.SetWMName
    --dzen nessesesity's
    import IO
    import XMonad.Hooks.DynamicLog
    import XMonad.Util.Run
    import XMonad.Util.Dzen
    import XMonad.Hooks.ManageDocks
    --For the Keybindings
    import XMonad.Actions.CycleWS
    import XMonad.Util.EZConfig
    import XMonad.Actions.SinkAll
    --Layouts
    import XMonad.Layout.Grid
    --Java issues
    import XMonad.Hooks.SetWMName
    import qualified XMonad.StackSet as W
    import qualified Data.Map as M
    modm = mod1Mask
    main :: IO ()
    main = do
    h <- spawnPipe "dzen2 -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -bg black -fg grey -h 14 -w 300 -ta l "
    xmonad $ defaultConfig
    -- simple stuff
    terminal = "urxvt"
    ,focusFollowsMouse = True
    ,borderWidth = 1
    ,modMask = mod1Mask
    ,workspaces = ["opera","ftd","three","four","five","six"]
    ,normalBorderColor = "#555b2f"
    ,focusedBorderColor = "#b22222"
    -- ,defaultGaps = [(14,0,0,0)]
    -- hooks, layouts
    ,layoutHook = avoidStruts $ tiled ||| Grid ||| Mirror tiled ||| Full
    ,manageHook = composeAll [ className =? "Opera" --> doF(W.shift "opera")
    , className =? "Openftd_gui" --> doF(W.shift "ftd") ]
    <+> manageDocks
    ,logHook = dynamicLogWithPP defaultPP
    { ppCurrent = dzenColor "red" "" . wrap "[" "]"
    , ppVisible = wrap "[" "]"
    , ppHidden = dzenColor "grey" ""
    , ppHiddenNoWindows = dzenColor "grey" ""
    , ppSep = " ^fg(grey)^r(2x17) "
    , ppUrgent = dzenColor "red" "" . wrap "^" ""
    , ppLayout = dzenColor "grey" ""
    , ppTitle = const ""
    , ppOutput = hPutStrLn h }
    ,startupHook = setWMName "LG3D"
    `additionalKeys`
    -- Move focus in workspace
    ((modm, xK_Right ), windows W.focusDown)
    ,((modm, xK_Left ), windows W.focusUp )
    -- Moce windows in workspace
    ,((modm .|. shiftMask, xK_Right ), windows W.swapDown )
    ,((modm .|. shiftMask, xK_Left ), windows W.swapUp )
    -- Move screenfocus
    ,((controlMask, xK_Right), nextScreen)
    ,((controlMask, xK_Left ), prevScreen)
    -- Move windows across screens
    ,((controlMask .|. shiftMask, xK_Right), shiftNextScreen)
    ,((controlMask .|. shiftMask, xK_Left), shiftPrevScreen)
    -- Switch workspace
    ,((controlMask .|. modm, xK_Right), nextWS)
    ,((controlMask .|. modm, xK_Left), prevWS)
    -- Move windows across workspaces
    ,((controlMask .|. modm .|. shiftMask, xK_Right), shiftToNext)
    ,((controlMask .|. modm .|. shiftMask, xK_Left), shiftToPrev)
    -- Sink all windows into tiling
    ,((modm, xK_t), sinkAll)
    -- Java hack
    ,((modm, xK_F12), setWMName "LG3D")
    --Hide dzen
    ,((modm, xK_b), sendMessage ToggleStruts)
    --Commands
    ,((modm, xK_a), spawn "urxvt")
    where
    tiled = Tall 1 (3/100) (1/2)

  • [SOLVED] Need help with dzen2, conky and xmonad.

    Hey all. I've recently been using XMonad and have found it to be a really useful tool, especially when it comes to keeping me on task and dealing with screen real-estate. However, I've been having difficulty setting up a dzen2 status bar that displays what conky pipes into it.
    Here is my xmonad.hs file :
    import XMonad
    import IO
    import XMonad.Util.Run
    import XMonad.Hooks.ManageDocks
    import XMonad.Hooks.DynamicLog
    import XMonad.Layout.NoBorders
    import XMonad.Util.EZConfig
    main = do
    bar <- spawn myConkyBar
    xmonad $ defaultConfig
    borderWidth = 2
    , terminal = "urxvt"
    , normalBorderColor = "#343434"
    , focusedBorderColor = "cyan"
    , workspaces = ["www","lp","letter","else"]
    , manageHook = manageDocks <+> manageHook defaultConfig
    , layoutHook = avoidStruts $ layoutHook defaultConfig
    } `additionalKeys`
    [ ((0, xK_F12), spawn "urxvt")
    , ((mod4Mask.|. 0, xK_w), spawn "firefox")
    , ((mod4Mask .|. shiftMask, xK_w), spawn "scrot -s")
    , ((0, xK_Print), spawn "scrot -d 2")
    myConkyBar = "conky -c .conkyrc | dzen2 -fn 'Clean' -bg #343434 -x 0 -y 768"
    And the relevant .conkyrc file:
    out_to_console yes
    text_buffer_size 512
    mpd_host localhost
    mpd_port 6600
    update_interval 1.0
    cpu_avg_samples 2
    net_avg_samples 2
    TEXT
    ^fg(cyan)^i(/home/greg/.icons/mpd.xbm) ^fg(#E0EEEE)$mpd_smart ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/cpu.xbm) ^fg(#FF69B4)${cpu cpu1}% ^fg(cyan)^i(/home/greg/.icons/cpu.xbm) ^fg(#FF69B4)${cpu cpu2}% ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/mem.xbm) ^fg()$mem ^fg(#343434)| ^fg(cyan)^i(/home/greg/.icons/down.xbm) ^fg(#FF69B4)${downspeed wlan0} ^fg(cyan)^i(/home/greg/.icons/up.xbm) ^fg(#FF69B4)${upspeed wlan0} ^fg(#343434)| ^fg(red)${battery_percent BAT0}% ^fg(#343434)| ^fg(red)$acpitemp C ^fg(#343434)| ^fg(#CD5555)$kernel ^fg(#343434)| ^fg(cyan)${time %m-%d-%y %l:%M%p}
    The main problem I'm having is that Xmonad will make the space for dzen, but conky will write to the root window, and not dzen. So the long string of text is written on the root window without any formatting, and dzen is (usually) just a black bar. I'm not the best with Haskell, but I am im
    proving, so any help would be appreciated.
    Also, I've noticed that dzen2 only updates when switching workspaces. Was I supposed to define an update interval somewhere?
    Last edited by camphor (2009-12-23 04:53:35)

    i think you have to use the logHook,
    this is part of my configuration, although i'm not using Xmonad anymore (haven't found the time to really configure it)
    -- XMonad:
    main = do
    xmobar <- spawnPipe myStatusBar
    dynHooksRef <- initDynamicHooks
    xmonad $ myUrgencyHook $ defaultConfig
    { terminal = myTerminal
    , focusFollowsMouse = myFocusFollowsMouse
    , borderWidth = myBorderWidth
    , modMask = myModMask
    --, numlockMask = myNumlockMask
    , workspaces = myWorkspaces
    , normalBorderColor = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
    , layoutHook = myLayout
    , manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
    , handleEventHook = myEventHook
    , logHook = dynamicLogWithPP $ myXmobarPP xmobar
    , startupHook = myStartupHook
    is using Xmobar, but the config from where i took this was using dzen, maybe you can use that:
    http://haskell.org/haskellwiki/Xmonad/C … _xmonad.hs
    ps: sorry for the awful english.

  • Why doesn't my xmonad.hs do anything?

    I am just starting to try and learn xmonad. It seems to be the only tiling window manager that has simplicity (i.e. not awesomewm) and some complexity to it (not dwm). The only problem I am running into is the fact that my xmonad.hs (mostly copied from other working configs) either gives me errors, or doesn't do anything. I can't even start a terminal with Mod+shift+enter.
    Can someone take a look at my config and see what is going wrong?
    -------------------- imports --------------------
    --necessary
    import XMonad
    import qualified XMonad.StackSet as W
    import qualified Data.Map as M
    import System.Exit
    import Graphics.X11.Xlib
    import IO (Handle, hPutStrLn)
    --utilities
    import XMonad.Util.Run (spawnPipe)
    import XMonad.Actions.NoBorders
    --hooks
    import XMonad.Hooks.ManageDocks
    import XMonad.Hooks.DynamicLog
    import XMonad.Hooks.XPropManage
    --MO' HOOKS
    import Graphics.X11.Xlib.Extras
    import Foreign.C.Types (CLong)
    --layouts
    --import XMonad.Layout.NoBorders
    --import XMonad.Layout.ResizableTile
    --import XMonad.Layout.Gaps
    --import XMonad.Layout.Named
    --import XMonad.Layout.PerWorkspace
    --import XMonad.Layout.Spacing
    import Data.Ratio((%))
    main = xmonad $ defaultConfig
    -- h <- spawnPipe "xmobar ~/.xmobarrc"
    { workspaces = ["term", "www", "chat", "code", "else"]
    , borderWidth = 3
    , terminal = "urxvt"
    , normalBorderColor = "#333333"
    , focusedBorderColor = "#1793d1"
    , modMask = mod4Mask
    , keys = keys'
    -- Make space for a systray app.
    --, layoutHook = avoidStruts $ Tall ||| Wide ||| Full
    --, manageHook = manageHook defaultConfig <+> manageDocks
    where
    tiled = Tall nmaster ratio
    -- Default number of windows in the master pane
    nmaster = 1
    -- Default proportion of screen occupied by master pane
    ratio = 2/(1+(toRational(sqrt(5)::Double))) -- golden
    -- Percent of screen to increment by when resizing panes
    delta = 5%100
    -------------------- managehooks --------------------
    myManageHook = composeAll . concat $
    [ [className =? c --> doFloat | c <- myFloats]
    , [title =? t --> doFloat | t <- myOtherFloats]
    , [className =? r --> doIgnore | r <- myIgnores]
    --, [className =? mp --> doF (W.shift "mp") | mp <- mediaPlayers]
    --, [className =? im --> doF (W.shift "irc") | im <- imMessenger]
    --, [className =? bw --> doF (W.shift "www") | bw <- browsers]
    --, [className =? e --> doF (W.shift "else") | e <- elseApps]
    where
    myFloats = ["Gimp", "vlc", "Nitrogen", "Thunar", "Leafpad", "gmrun"]
    myOtherFloats = ["Downloads", "Firefox Preferences", "Save As...", "Send file", "Open", "File Transfers"]
    myIgnores = ["trayer", "stalonetray"]
    mediaPlayers = ["Quodlibet"]
    imMessenger = ["Pidgin"]
    browsers = ["Shiretoko", "Firefox"]
    elseApps = ["Mirage", "Gimp"]
    ----------------------- Key Bindings ------------------------------
    keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
    keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    -- ((modMask x, xK_b), sendMessage ToggleStruts)
    -- Application hotkeys
    ((modMask, xK_f ), spawn "firefox")
    , ((modMask .|. shiftMask, xK_m ), spawn "urxvt -e ncmpcpp")
    None of my keybindings work. I was attempting to use the
    main = do
    xmonad $ defaultConfig
    But that always complains about a parsing error with "{".
    Any advice?

    I am having alot of difficulty with keybindings though. If I define my keybinds, it erases all others. It seems like I have to explicitly define every single key combo I need.
    Here is xmonad.hs:
    import XMonad
    import XMonad.Hooks.DynamicLog
    import XMonad.Hooks.FadeInactive
    import XMonad.Hooks.UrgencyHook
    import XMonad.Hooks.ManageHelpers
    import XMonad.Hooks.ManageDocks
    import XMonad.Hooks.XPropManage
    import XMonad.Layout
    --import XMonad.Layout.LayoutHints
    --import XMonad.Layout.Reflect
    --import XMonad.Layout.PerWorkspace
    --import XMonad.Layout.NoBorders
    --import XMonad.Layout.Tabbed
    --import XMonad.Layout.DecorationMadness
    --import XMonad.Layout.ThreeColumns
    --import XMonad.Layout.TwoPane
    import XMonad.Layout.Grid
    import XMonad.Layout.Magnifier
    import XMonad.Layout.MagicFocus
    --import XMonad.Layout.IM
    import XMonad.Layout.Circle
    --import XMonad.Actions.WindowGo
    import XMonad.Actions.UpdatePointer
    --import XMonad.Util.Run
    --import XMonad.Util.Loggers
    import XMonad.Util.Run(spawnPipe)
    import XMonad.Util.EZConfig(additionalKeys)
    import qualified Data.Map as M
    import qualified XMonad.StackSet as W
    import Data.Ratio
    import System.IO
    import System.Exit
    import Graphics.X11.Xlib
    import Graphics.X11.Xlib.Extras
    import Foreign.C.Types (CLong)
    main = do
    dzpipe <- spawnPipe statusBarCmd
    xmonad $ defaultConfig { workspaces = myWorkspaces
    , borderWidth = myBorderWidth
    , normalBorderColor = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
    , terminal = myTerminal
    , modMask = myModMask
    --, keys = myKeys
    , layoutHook = myLayout
    , manageHook = manageHook'
    , logHook = dynamicLogWithPP $ mPP dzpipe
    ------------------Status bar stuff -------------------------
    -------- Theming Stuff --------------
    -- Color names are easier to remember:
    orange = "#ff7701"
    colorDarkGray = "#171717"
    colorGray = "#777777"
    purple = "#e3008d"
    colorGreen = "#17d193"
    colorBlue = "#1793d1"
    colorRed = "#d19090"
    yellow = "#fee100"
    colorWhite = "#ffffff"
    colorBlack = "#000000"
    barFont = "terminus"
    barXFont = "Bauhaus Md BT:size=14"
    xftFont = "xft: Bauhaus Md BT-14"
    statusBarCmd = "dzen2 -fn 'nu' -bg '#000000' -fg '#f0f0f0' -h 16 -w 280 -ta l"
    -------- Pretty printer ----------
    mPP dzenSbar = defaultPP
    { ppCurrent = dzenColor colorWhite colorBlue . pad
    , ppUrgent = dzenColor colorWhite colorRed . pad
    , ppVisible = dzenColor colorGreen colorWhite . pad
    , ppHidden = dzenColor colorWhite colorBlack . pad
    , ppHiddenNoWindows = dzenColor colorGray colorBlack . pad
    , ppTitle = const ""
    , ppSep = ""
    , ppWsSep = ""
    , ppLayout = dzenColor "#ffffff" "#000000" .
    (\x -> case x of
    "Tall" -> "^i(" ++ myBitmapsDir ++ "/tall.xbm)"
    "Mirror Tall" -> "^i(" ++ myBitmapsDir ++ "/mtall.xbm)"
    "Circle" -> "^i(" ++ myBitmapsDir ++ "/circle.xbm)"
    "magnify Grid" -> "^i(" ++ myBitmapsDir ++ "/magnifier grid.xbm)"
    "Full" -> "^i(" ++ myBitmapsDir ++ "/full.xbm)"
    _ -> x
    , ppOutput = hPutStrLn dzenSbar
    where
    ------------------------- Define some Variables -----------------------------
    myWorkspaces = ["alpha", "beta" ,"gamma", "delta", "epsilon", "zeta", "eta"]
    myBorderWidth = 2
    myNormalBorderColor = "#222222"
    myFocusedBorderColor = "#1793d1"
    myTerminal = "urxvt"
    myModMask = mod4Mask
    myBitmapsDir = "/home/semperfiguy/.xmonad/xbms"
    ------------------------------ Manage Hook ---------------------------
    myManageHook :: ManageHook
    myManageHook = composeAll . concat $
    [ [ className =? c --> doFloat | c <- myFloats ]
    , [ title =? t --> doFloat | t <- myOtherFloats ]
    , [ resource =? r --> doIgnore | r <- myIgnores ]
    , [ className =? "Firefox" --> doF (W.shift "beta") ]
    , [ className =? "Shiretoko" --> doF (W.shift "beta") ]
    , [ className =? "Xiphos" --> doF (W.shift "gamma") ]
    , [ className =? "Thunar" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
    , [ className =? "ncmpcpp" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
    , [ className =? "Sonata" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
    , [ className =? "Gimp" --> doF (W.shift "zeta") <+> doF (W.swapUp) ]
    , [ className =? "OpenOffice.org 3.0" --> doF (W.shift "gamma") ]
    where
    myIgnores = ["panel", "trayer"]
    myFloats = ["feh", "Gimp", "Nvidia-settings", "Gtk-chtheme"]
    myOtherFloats = ["alsamixer", "Firefox Preferences", "Session Manager - Mozilla Firefox", "Firefox Add-on Updates", "Clear Private Data", "Dialog"
    manageHook' :: ManageHook
    manageHook' = manageDocks <+> manageHook defaultConfig <+> myManageHook
    ---------------------- Layout Hook ---------------------------------------
    myLayout = avoidStruts (tiled ||| Mirror tiled ||| circle ||| magnify Grid ||| Full)
    where
    --standardLayouts = hintedTile Tall ||| hintedTile Wide ||| tabLayout ||| noBorders Full
    --webLayouts = tabLayout ||| twoPane ||| threeCol ||| noBorders Full
    --imLayout = reflectHoriz $ withIM (1%10) (Role "roster") (standardLayouts)
    --termLayouts = circle ||| magnified ||| grid ||| tabLayout ||| noBorders Full
    --hintedTile = HintedTile nmaster delta ratio TopLeft
    --tabLayout = tabbedBottom shrinkText myTabConfig
    --twoPane = TwoPane delta (1/2)
    --threeCol = ThreeCol nmaster delta (1%3)
    circle = magicFocus (Circle)
    magnify = magnifiercz (15%10)
    --grid = (GridRatio (15/10))
    tiled = Tall nmaster delta ratio
    nmaster = 1
    delta = 5 % 100
    ratio = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
    ------------------------------- Key Bindings ----------------------------------
    --myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
    myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask .|. shiftMask, xK_b), sendMessage ToggleStruts)
    -- Application key bindings
    , ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
    , ((modMask .|. shiftMask, xK_m), spawn "urxvt -e alsmixer")
    , ((modMask .|. shiftMask, xK_P), spawn "gmrun")
    , ((modMask, xK_f), spawn "firefox")

  • [Solved] Awesome 3.5: gmail vicious widget does not work

    I updated my awesome from 3.4 to 3.5. I noticed that vicious.widgets.gmail does not work anymore. When I move my cursor on mailicon, I can only see N/A. Obviously in my home there is  ~/.netrc file:
    machine mail.google.com login MYMAIL password MYPASSWORD
    This is how I configured the widget: Solved someone this or has someone any idea about how to solve?
    -- Gmail
    mailicon = wibox.widget.imagebox(beautiful.widget_gmail)
    mailwidget = wibox.widget.textbox()
    gmail_t = awful.tooltip({ objects = { mailwidget },})
    vicious.register(mailwidget, vicious.widgets.gmail,
    function (widget, args)
    gmail_t:set_text(args["{subject}"])
    gmail_t:add_to_object(mailicon)
    return args["{count}"]
    end, 120)
    --the '120' here means check every 2 minutes.
    mailicon:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.util.spawn("urxvt -e mutt", false) end)
    Bye! ^^
    Last edited by ninquitassar (2013-02-17 20:22:28)

    nostalgix wrote:
    I don't know for sure, but maybe it's
    mailicon = wibox.widget.imagebox(beautiful.widget_gmail)
    instead of
    mailicon = wibox.widget.imagebox()
    mailicon.set_image(beautiful.widget_gmail)
    That's what he has.
    Last edited by nomorewindows (2013-02-12 21:16:51)

  • Help with using xmonad configuration

    http://haskell.org/haskellwiki/Xmonad/C … _xmonad.hs
    ok when I did ghci <filename> after I downloaded the configuration, I got an error saying parse error on input `<!' Failed modules loaded: none.
    how would I go about solving this problem?
    PS I'm a noob when it comes to this stuff but I'm learning
    Last edited by unregistered (2009-06-08 10:15:41)

    Here is Assorato's config:
    {-# OPTIONS_GHC -fglasgow-exts -fno-warn-missing-signatures #-}
    -- |
    -- Module : XMonad.Config.Arossato
    -- Copyright : (c) Andrea Rossato 2007
    -- License : BSD3-style (see LICENSE)
    -- Maintainer : [email protected]
    -- Stability : stable
    -- Portability : portable
    -- This module specifies my xmonad defaults.
    module XMonad.Config.Arossato
    ( -- * Usage
    -- $usage
    arossatoConfig
    ) where
    import qualified Data.Map as M
    import XMonad hiding ( (|||) )
    import qualified XMonad.StackSet as W
    import XMonad.Actions.CycleWS
    import XMonad.Hooks.DynamicLog hiding (xmobar)
    import XMonad.Hooks.ManageDocks
    import XMonad.Hooks.ServerMode
    import XMonad.Layout.Accordion
    import XMonad.Layout.LayoutCombinators
    import XMonad.Layout.Magnifier
    import XMonad.Layout.NoBorders
    import XMonad.Layout.SimpleFloat
    import XMonad.Layout.Tabbed
    import XMonad.Layout.WindowArranger
    import XMonad.Prompt
    import XMonad.Prompt.Shell
    import XMonad.Prompt.Ssh
    import XMonad.Prompt.Theme
    import XMonad.Prompt.Window
    import XMonad.Prompt.XMonad
    import XMonad.Util.Run
    import XMonad.Util.Themes
    -- $usage
    -- The simplest way to use this configuration module is to use an
    -- @~\/.xmonad\/xmonad.hs@ like this:
    -- > module Main (main) where
    -- >
    -- > import XMonad
    -- > import XMonad.Config.Arossato (arossatoConfig)
    -- >
    -- > main :: IO ()
    -- > main = xmonad =<< arossatoConfig
    -- NOTE: that I'm using xmobar and, if you don't have xmobar in your
    -- PATH, this configuration will produce an error and xmonad will not
    -- start. If you don't want to install xmobar get rid of this line at
    -- the beginning of 'arossatoConfig'.
    -- You can use this module also as a starting point for writing your
    -- own configuration module from scratch. Save it as your
    -- @~\/.xmonad\/xmonad.hs@ and:
    -- 1. Change the module name from
    -- > module XMonad.Config.Arossato
    -- > ( -- * Usage
    -- > -- $usage
    -- > arossatoConfig
    -- > ) where
    -- to
    -- > module Main where
    -- 2. Add a line like:
    -- > main = xmonad =<< arossatoConfig
    -- 3. Start playing with the configuration options...;)
    arossatoConfig = do
    xmobar <- spawnPipe "xmobar" -- REMOVE this line if you do not have xmobar installed!
    return $ defaultConfig
    { workspaces = ["home","var","dev","mail","web","doc"] ++
    map show [7 .. 9 :: Int]
    , logHook = myDynLog xmobar -- REMOVE this line if you do not have xmobar installed!
    , manageHook = newManageHook
    , layoutHook = avoidStruts $
    decorated |||
    noBorders mytabs |||
    otherLays
    , terminal = "urxvt +sb"
    , normalBorderColor = "white"
    , focusedBorderColor = "black"
    , keys = newKeys
    , handleEventHook = serverModeEventHook
    , focusFollowsMouse = False
    where
    -- layouts
    mytabs = tabbed shrinkText (theme smallClean)
    decorated = simpleFloat' shrinkText (theme smallClean)
    tiled = Tall 1 (3/100) (1/2)
    otherLays = windowArrange $
    magnifier tiled |||
    noBorders Full |||
    Mirror tiled |||
    Accordion
    -- manageHook
    myManageHook = composeAll [ resource =? "win" --> doF (W.shift "doc") -- xpdf
    , resource =? "firefox-bin" --> doF (W.shift "web")
    newManageHook = myManageHook
    -- xmobar
    myDynLog h = dynamicLogWithPP defaultPP
    { ppCurrent = xmobarColor "yellow" "" . wrap "[" "]"
    , ppTitle = xmobarColor "green" "" . shorten 40
    , ppVisible = wrap "(" ")"
    , ppOutput = hPutStrLn h
    -- key bindings stuff
    defKeys = keys defaultConfig
    delKeys x = foldr M.delete (defKeys x) (toRemove x)
    newKeys x = foldr (uncurry M.insert) (delKeys x) (toAdd x)
    -- remove some of the default key bindings
    toRemove x =
    [ (modMask x , xK_j)
    , (modMask x , xK_k)
    , (modMask x , xK_p)
    , (modMask x .|. shiftMask, xK_p)
    , (modMask x .|. shiftMask, xK_q)
    , (modMask x , xK_q)
    ] ++
    -- I want modMask .|. shiftMask 1-9 to be free!
    [(shiftMask .|. modMask x, k) | k <- [xK_1 .. xK_9]]
    -- These are my personal key bindings
    toAdd x =
    [ ((modMask x , xK_F12 ), xmonadPrompt defaultXPConfig )
    , ((modMask x , xK_F3 ), shellPrompt defaultXPConfig )
    , ((modMask x , xK_F4 ), sshPrompt defaultXPConfig )
    , ((modMask x , xK_F5 ), themePrompt defaultXPConfig )
    , ((modMask x , xK_F6 ), windowPromptGoto defaultXPConfig )
    , ((modMask x , xK_F7 ), windowPromptBring defaultXPConfig )
    , ((modMask x , xK_comma ), prevWS )
    , ((modMask x , xK_period), nextWS )
    , ((modMask x , xK_Right ), windows W.focusDown )
    , ((modMask x , xK_Left ), windows W.focusUp )
    -- other stuff: launch some useful utilities
    , ((modMask x , xK_F2 ), spawn "urxvt -fg white -bg black +sb" )
    , ((modMask x .|. shiftMask, xK_F4 ), spawn "~/bin/dict.sh" )
    , ((modMask x .|. shiftMask, xK_F5 ), spawn "~/bin/urlOpen.sh" )
    , ((modMask x .|. shiftMask, xK_t ), spawn "~/bin/teaTime.sh" )
    , ((modMask x , xK_c ), kill )
    , ((modMask x .|. shiftMask, xK_comma ), sendMessage (IncMasterN 1 ) )
    , ((modMask x .|. shiftMask, xK_period), sendMessage (IncMasterN (-1)) )
    -- commands fo the Magnifier layout
    , ((modMask x .|. controlMask , xK_plus ), sendMessage MagnifyMore)
    , ((modMask x .|. controlMask , xK_minus), sendMessage MagnifyLess)
    , ((modMask x .|. controlMask , xK_o ), sendMessage ToggleOff )
    , ((modMask x .|. controlMask .|. shiftMask, xK_o ), sendMessage ToggleOn )
    -- windowArranger
    , ((modMask x .|. controlMask , xK_a ), sendMessage Arrange )
    , ((modMask x .|. controlMask .|. shiftMask, xK_a ), sendMessage DeArrange )
    , ((modMask x .|. controlMask , xK_Left ), sendMessage (DecreaseLeft 10))
    , ((modMask x .|. controlMask , xK_Up ), sendMessage (DecreaseUp 10))
    , ((modMask x .|. controlMask , xK_Right), sendMessage (IncreaseRight 10))
    , ((modMask x .|. controlMask , xK_Down ), sendMessage (IncreaseDown 10))
    , ((modMask x .|. shiftMask , xK_Left ), sendMessage (MoveLeft 10))
    , ((modMask x .|. shiftMask , xK_Right), sendMessage (MoveRight 10))
    , ((modMask x .|. shiftMask , xK_Down ), sendMessage (MoveDown 10))
    , ((modMask x .|. shiftMask , xK_Up ), sendMessage (MoveUp 10))
    -- gaps
    , ((modMask x , xK_b ), sendMessage ToggleStruts )
    ] ++
    -- Use modMask .|. shiftMask .|. controlMask 1-9 instead
    [( (m .|. modMask x, k), windows $ f i)
    | (i, k) <- zip (workspaces x) [xK_1 .. xK_9]
    , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask .|. controlMask)]
    As you can see Assorato uses other keybindings than the default ones.

  • _calendar user spawning repeated Python instances crippling machine

    I have a Mac Mini Server running 10.8.4 that shortly after a recent update the machine is repeatedly spawning a Python instance, spiking it to ~100% CPU and then dropping, then a new Python PID comes to the top of top/, spikes to ~100% then drops.  It appears that the user _calendar is running these Python processes.  When I rename /System/Library/Frameworks/Python.framework/Versions/current/Resources/Python.a pp the CPU load drops immediately.  Note that I'm not running the Calendar service on this server.
    Is anyone else having this problem?
    TIA.
    Tim

    I just had this similar problem too.
    I tried to turn off my Address Book server and they're all gone

  • Cant install python modules.

    Hi, i have just started using berkeley db xml, and i'd like to use the python bindings ('im more cumfortable with python rather than java or c++).
    But, when i follow the procedure (as in README in dbxml-2.5.13/dbxml/src/python/bsddb3-4.8.0/README)
    i get the error:
    python setup.dbxml.py build
    running build
    running build_py
    running build_ext
    building 'bsddb3._pybsddb' extension
    gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPYBSDDB_STANDALONE=1 -I../../../../install/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c Modules/_bsddb.c -o build/temp.macosx-10.3-fat-2.6/Modules/_bsddb.o
    In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
    from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
    from Modules/_bsddb.c:92:
    /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
    In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
    from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
    from Modules/_bsddb.c:92:
    /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
    lipo: can't figure out the architecture type of: /var/folders/ny/nydPeoc+Ghy00a8WqC3IU++++TI/-Tmp-//ccJWWHQZ.out
    error: command 'gcc' failed with exit status 1
    thanks.

    I see you are on a mac - building these packages with the default install can be a major PIA. I recommend starting with a fresh python install instead of the system one just to make sure std packages don't get messed up. Also, make sure you have mac dev tools/env installed so you get the right gcc version.
    hth,
    eleddy

  • Cant type anything in urxvt

    Hi guys...
    Iḿ trying to get a nice urxvt, but probably there is some configuration which is messing up th urxvt, making it impossible to type anything, like if the input it disabled and the only way to close it is killing the process
    the scrrenshothttp://img37.imageshack.us/img37/7642/snapshot1y.png
    there's my .Xresources
    *background: #333333
    *foreground: #efefcf
    !Colors
    ! Black
    *color0: #5A5A5A
    *color8: #3e3e3e
    ! Red
    *color1: #FF4747
    *color9: #FF6767
    ! Green
    *color2: #AFC81C
    *color10: #bFC81C
    ! Yellow
    *color3: #FDD338
    *color11: #F4D461
    ! Blue
    *color4: #619AF4
    *color12: #5496FF
    ! Purple
    *color5: #5F5A90
    *color13: #826AB1
    ! Cyan
    *color6: #47E0FF
    *color14: #2ED9FB
    ! White
    *color7: #FFFFFF
    *color15: #DEDEDE
    ! Orange
    *color16: #FFB000
    !Xft settings
    Xft.dpi: 96
    Xft.hinting: 1
    Xft.hintstyle: hintfull
    Xft.antialias: 1
    Xft.rgba: rgb
    URxvt.imLocale: pt_BR.utf8
    !URxvt settings
    URxvt.urlLauncher: firefox
    URxvt*scrollBar: false
    URxvt*internalBorder: 6
    URxvt*font: xft:Monaco:pixelsize=12:antialias=false
    URxvt*boldFont : xft:Monaco: pixelsize=12:weight=bold
    URxvt.background: #010101
    !URxvt.foreground: #ffffff
    !URxvt.termName: string
    !URxvt.geometry: 128x64
    !URxvt.reverseVideo: boolean
    !URxvt.loginShell: boolean
    !URxvt.jumpScroll: boolean
    !URxvt.skipScroll: boolean
    !URxvt.pastableTabs: boolean
    !URxvt.scrollstyle: mode
    !URxvt.scrollBar_right: boolean
    !URxvt.scrollBar_floating: boolean
    !URxvt.scrollBar_align: mode
    !URxvt.thickness: number
    !URxvt.scrollTtyOutput: boolean
    !URxvt.scrollTtyKeypress: boolean
    !URxvt.scrollWithBuffer: boolean
    URxvt.inheritPixmap: true
    URxvt.transparent: false
    URxvt.tintColor: #333333
    URxvt.shading: 0
    URxvt.fading: 0
    URxvt.fadeColor: #222222
    !URxvt.utmpInhibit: boolean
    URxvt.urgentOnBell: true
    !URxvt.visualBell: boolean
    !URxvt.mapAlert: boolean
    !URxvt.meta8: boolean
    URxvt.mouseWheelScrollPage: True
    !URxvt.tripleclickwords: boolean
    !URxvt.insecure: boolean
    !URxvt.cursorUnderline: boolean
    URxvt.cursorBlink: true
    !URxvt.pointerBlank: boolean
    !URxvt.colorBD: color
    !URxvt.colorIT: color
    !URxvt.colorUL: color
    !URxvt.colorRV: color
    !URxvt.underlineColor: color
    !URxvt.scrollColor: color
    !URxvt.troughColor: color
    !URxvt.highlightColor: color
    URxvt.cursorColor: #afc81c
    !URxvt.cursorColor2: color
    URxvt.pointerColor: #afc81c
    !URxvt.pointerColor2: color
    !URxvt.borderColor: color
    !URxvt.intensityStyles: boolean
    !URxvt.inputMethod: name
    !URxvt.preeditType: style
    !URxvt.imLocale: string
    !URxvt.imFont: fontname
    !URxvt.title: URxvt
    !URxvt.iconName: string
    !URxvt.saveLines: number
    !URxvt.depth: number
    !URxvt.transient-for: windowid
    !URxvt.override-redirect: boolean
    !URxvt.hold: boolean
    !URxvt.externalBorder: number
    !URxvt.internalBorder: number
    URxvt.borderLess: true
    !URxvt.skipBuiltinGlyphs: boolean
    !URxvt.lineSpace: number
    !URxvt.pointerBlankDelay: number
    !URxvt.backspacekey: string
    !URxvt.deletekey: string
    !URxvt.selectstyle: mode
    !URxvt.print-pipe: string
    !URxvt.modifier: modifier
    !URxvt.cutchars: string
    !URxvt.answerbackString: string
    !URxvt.secondaryScreen: boolean
    !URxvt.secondaryScroll: boolean
    !URxvt.perl-lib: string
    !URxvt.perl-eval: perl-eval
    !URxvt.perl-ext-common: string
    !URxvt.perl-ext: string
    !URxvt.iso14755_52: boolean
    !URxvt*keysym.sym: keysym
    !xterm settings
    xterm*dynamicColors: true
    !xterm*utf8: 2
    xterm*eightBitInput: true
    xterm*saveLines: 32767
    xterm*scrollTtyKeypress:true
    xterm*scrollTtyOutput: false
    xterm*scrollBar: false
    xterm*loginShell: true
    xterm*faceName: Bitstream Vera Sans Mono:pixelsize=10
    xterm*jumpScroll: true
    xterm*multiScroll: true
    xterm*toolBar: false
    Thanks in advance fellas

    I gave them a try, it appears to be an issue with:
    URxvt*borderLess: true
    Setting either true or false in .Xdefaults results in the same unusable terminal.
    However, launching urxvt via `urxvt +borderLess` gives a normal, usable terminal (I can't tell if the option actually did anything as XMonad puts borders on all my windows anyway), and `urxvt -borderLess` results in a broken terminal also.
    So not really sure whats going on, but I'd say avoid using that option.

  • [SOLVED] awesome & urxvt results in some screen flickering

    Hi,
    i've been using awesome since a few weeks and i noticed a flickering problem when starting urxvt (via mod4+enter).
    urxvt starts, disappears, comes back again, disappears and so on.
    starting up urxvt (time until i get a usable promt) takes about 1-2 seconds.
    However, i don't know how to track the problem down. Maybe it is urxvt's (i think it is), maybe it is awesome's or even ati's fault (using 2.6.32 with open source ati driver).
    when i switch between multiple windows (using mod4+n) only urxvt windows are flickering. Switching between gui-apps (ff, dolphin, …) works as expected.
    maybe someone has an idea about this …
    Here are the configs:
    .Xdefaults:
    !URxvt settings
    !--[Title]--!
    URxvt*title: urxvtc
    URxvt*termName: rxvt-unicode
    URxvt*cursorBlink: true
    URxvt*urgentOnBell: true
    !--[Url's /launching/marking/yanking]--!
    URxvt.perl-ext: default,matcher
    URxvt.urlLauncher: /usr/bin/firefox
    URxvt.matcher.button: 1
    !--[Fonts]--!
    URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=14:antialias=false
    URxvt.italicFont: xft:Bitstream Vera Sans Mono:italic:autohint=true:antialias=false
    URxvt.boldItalicFont: xft:Bitstream Vera Sans Mono:bold:italic:autohint=true:antialias=false
    URxvt.underlineColor: yellow
    URxvt.scrollBar: false
    !--[Urxvt Options]--!
    URxvt.boldMode: false
    URxvt.imLocale: de_AT.UTF-8
    URxvt.loginShell: true
    URxvt.saveLines: 512
    URxvt.inheritPixmap: true
    URxvt.borderless: true
    URxvt.jumpScroll: true
    URxvt.tintColor: white
    URxvt.internalBorder: 0
    URxvt.cursorBlink: false
    URxvt.cursorColor: #dd9900
    URxvt.cursorColor2: #000000
    URxvt.background: #222222
    URxvt.foreground: #ddccbb
    URxvt.colorBD: #ffffff
    URxvt.colorIT: #bbbbbb
    URxvt.colorUL: #999999
    URxvt.underlineColor: #999999
    URxvt*saveLines: 512
    !URxvt*depth: 32
    !URxvt*background: rgba:02f0/04f0/04f0/cccc
    URxvt*transparent: true
    URxvt*shading: 10
    !--[Colours]--!
    !Theme One from
    !http://phraktured.net/terminal-colors/terminal%20theme.tags.html
    *background: rgb:00/00/00
    *foreground: rgb:a8/a8/a8
    *color0: rgb:00/00/00
    *color1: rgb:a8/00/00
    *color2: rgb:00/a8/00
    *color3: rgb:a8/54/00
    *color4: rgb:00/00/a8
    *color5: rgb:a8/00/a8
    *color6: rgb:00/a8/a8
    *color7: rgb:a8/a8/a8
    *color8: rgb:54/50/54
    *color9: rgb:f8/54/50
    *color10: rgb:50/fc/50
    *color11: rgb:f8/fc/50
    *color12: rgb:50/54/f8
    *color13: rgb:f8/54/f8
    *color14: rgb:50/fc/f8
    *color15: rgb:f8/fc/f8
    http://github.com/nblock/config/blob/master/.Xdefaults
    rc.lua:
    -- {{{ Load libraries
    -- Standard awesome library
    require("awful")
    require("awful.autofocus")
    require("awful.rules")
    -- Theme handling library
    require("beautiful")
    -- Notification library
    require("naughty")
    require("vicious")
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "urxvtc"
    editor = "vim"
    editor_cmd = terminal .. " -e " .. editor
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    layouts =
    awful.layout.suit.tile, --1
    awful.layout.suit.tile.left, --2
    awful.layout.suit.tile.bottom, --3
    awful.layout.suit.tile.top, --4
    awful.layout.suit.fair, --5
    awful.layout.suit.fair.horizontal, --6
    awful.layout.suit.spiral, --7
    awful.layout.suit.spiral.dwindle, --8
    awful.layout.suit.max, --9
    awful.layout.suit.max.fullscreen, --10
    awful.layout.suit.magnifier, --11
    awful.layout.suit.floating --12
    -- some commands
    local commands = {}
    commands.suspend = "sudo pm-suspend"
    commands.help = "touch ~/seppal"
    commands.lock = "xscreensaver-command --lock"
    commands.screenshot = "scrot -e 'mv $f ~/bilder/screenshots'"
    --audio stuff
    commands.raisevol = "amixer set PCM 2%+"
    commands.lowervol = "amixer set PCM 2%-"
    commands.mute = "amixer sset PCM toggle"
    commands.cmusnext = "cmus-remote --next"
    commands.cmusprev = "cmus-remote --prev"
    commands.cmuspause = "cmus-remote --pause"
    commands.cmusplay = "cmus-remote --play"
    commands.calc = "krunner"
    --todo
    commands.fileman = "pcmanfm"
    commands.calc = "xcalc"
    commands.browser = "firefox"
    -- {{{ Tags
    -- Define a tag table which hold all screen tags.
    tags = {}
    for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({
    "1 download", "2 mail", "3 chat",
    "4 music", "5 news", "6 fm",
    7, 8, 9 }, s,
    {layouts[3], layouts[1], layouts[1], -- Tags: 1, 2, 3
    layouts[1], layouts[1], layouts[1], -- 4, 5 ,6
    layouts[1], layouts[1], layouts[1] -- 7, 8, 9
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
    { "restart", awesome.restart },
    { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
    { "open terminal", terminal }
    mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
    menu = mymainmenu })
    -- {{{ Wibox
    -- {{{ Widgets configuration
    -- {{{ Reusable separators
    local spacer = widget({ type = "textbox", name = "spacer" })
    local separator = widget({ type = "textbox", name = "separator" })
    spacer.text = " "
    separator.text = " <span foreground='red'>•</span> "
    -- {{{ CPU load
    local cpuwidget = widget({ type = "textbox" })
    vicious.register(cpuwidget, vicious.widgets.cpu, "<span foreground='orange'>load: </span><span foreground='green'>$2%</span><span foreground='orange'> - </span><span foreground='green'>$3%</span>")
    -- {{{ CPU temperature
    local thermalwidget = widget({ type = "textbox" })
    vicious.register(thermalwidget, vicious.widgets.thermal, "<span foreground='orange'>temp: </span><span foreground='green'>$1°C</span>", 20, "thermal_zone1")
    -- {{{ Battery state
    -- Widget icon
    -- baticon = widget({ type = "imagebox", name = "baticon" })
    -- baticon.image = image(beautiful.widget_bat)
    local batwidget = widget({ type = "textbox" })
    vicious.register(batwidget, vicious.widgets.bat, "<span foreground='orange'>bat: </span><span foreground='green'>$1$2%</span>", 60, "C1C5")
    -- {{{ Date and time
    local datewidget = widget({ type = "textbox" })
    vicious.register(datewidget, vicious.widgets.date, "<span foreground='green'>%a, %d.%m.%y - %H:%M</span>", 5)
    -- {{{ Volume widget
    local volwidget = widget({ type = "textbox" })
    vicious.register(volwidget, vicious.widgets.volume, "<span foreground='orange'>vol: </span><span foreground='green'>$1%</span>", 1, 'PCM')
    -- {{{ System tray
    systray = widget({ type = "systray" })
    -- {{{ Wibox initialisation
    local wibox = {}
    local promptbox = {}
    local layoutbox = {}
    local taglist = {}
    taglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev))
    for s = 1, screen.count() do
    -- Create a promptbox
    promptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
    -- Create a layoutbox
    layoutbox[s] = awful.widget.layoutbox(s)
    layoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
    -- Create a taglist widget
    taglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, taglist.buttons)
    -- Create the wibox
    wibox[s] = awful.wibox({
    position = "top", screen = s,
    fg = beautiful.fg_normal, bg = beautiful.bg_normal
    -- Add widgets to the wibox
    wibox[s].widgets = {{
    launcher, taglist[s], layoutbox[s], promptbox[s],
    layout = awful.widget.layout.horizontal.leftright
    s == screen.count() and systray or nil,
    spacer, datewidget,
    separator, volwidget,
    separator, batwidget,
    separator, cpuwidget,
    separator, thermalwidget,
    layout = awful.widget.layout.horizontal.rightleft
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    --user defined
    awful.key({}, "XF86PowerOff", function() awful.util.spawn_with_shell(commands.suspend) end ),
    awful.key({}, "Help", function() awful.util.spawn_with_shell(commands.help) end ),
    awful.key({ modkey, }, "F12", function () awful.util.spawn_with_shell(commands.lock) end),
    --audio stuff
    awful.key({}, "XF86AudioMute", function() awful.util.spawn_with_shell(commands.mute) end ),
    awful.key({}, "XF86AudioRaiseVolume", function() awful.util.spawn_with_shell(commands.raisevol) end ),
    awful.key({}, "XF86AudioLowerVolume", function() awful.util.spawn_with_shell(commands.lowervol) end ),
    awful.key({}, "XF86AudioNext", function() awful.util.spawn_with_shell(commands.cmusnext) end ),
    awful.key({}, "XF86AudioPrev", function() awful.util.spawn_with_shell(commands.cmusprev) end ),
    awful.key({}, "XF86AudioPlay", function() awful.util.spawn_with_shell(commands.cmuspause) end ),
    awful.key({}, "XF86Tools", function() awful.util.spawn_with_shell(commands.cmusplay) end ),
    awful.key({}, "XF86Calculator", function() awful.util.spawn_with_shell(commands.calc) end ),
    awful.key({}, "Print", function() awful.util.spawn_with_shell(commands.screenshot) end ),
    -- awful.key({}, "XF86MyComputer", function() awful.util.spawn_with_shell(commands.fileman) end ),
    -- awful.key({}, "XF86Mail", function() awful.util.spawn_with_shell(commands.mail) end ),
    -- awful.key({}, "XF86HomePage", function() awful.util.spawn_with_shell(commands.browser) end ),
    -- awful.key({}, "XF86Sleep", function() awful.util.spawn_with_shell(commands.lock) end ),
    -- awful.key({"Control", "Mod1"}, "l", function() awful.util.spawn_with_shell(commands.lock) end ),
    --default bindings
    awful.key({ modkey, }, "Left", awful.tag.viewprev ),
    awful.key({ modkey, }, "Right", awful.tag.viewnext ),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "n",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "n", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "n", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    -- Prompt
    awful.key({ modkey }, "r", function () promptbox[mouse.screen]:run() end),
    -- Run stuff in a Terminal
    awful.key({ modkey }, "x", function ()
    awful.prompt.run({ prompt = "Run in Terminal: " }, promptbox[mouse.screen].widget,
    function (prog)
    awful.util.spawn_with_shell(terminal .. " -name " .. prog .. " -e /bin/bash -c " .. prog)
    end)
    end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
    awful.key({ modkey, }, "j", function (c) c.minimized = not c.minimized end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end)
    -- Compute the maximum number of digit we need, limited to 9
    keynumber = 0
    for s = 1, screen.count() do
    keynumber = math.min(9, math.max(#tags[s], keynumber));
    end
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewonly(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewtoggle(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.movetotag(tags[client.focus.screen][i])
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.toggletag(tags[client.focus.screen][i])
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- {{{ Rules
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    border_color = beautiful.border_normal,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons } },
    --floating apps
    { rule = { class = "pinentry-qt4" },
    properties = { floating = true } },
    { rule = { class = "Gimp" },
    properties = { floating = true } },
    --apptags
    --downloading stuff
    { rule = { class = "JDownloader" },
    properties = { tag = tags[1][1],switchtotag = true } },
    { rule = { instance = "rtorrent" },
    properties = { tag = tags[1][1],switchtotag = false } },
    -- mail
    { rule = { class = "Kmail" },
    properties = { tag = tags[1][2],switchtotag = true } },
    --chat and stuff like that
    { rule = { class = "Choqok" },
    properties = { tag = tags[1][3],switchtotag = false } },
    { rule = { class = "Kopete" },
    properties = { tag = tags[1][3],switchtotag = false } },
    -- cmus
    { rule = { instance = "cmus" },
    properties = { tag = tags[1][4],switchtotag = true } },
    -- news
    { rule = { instance = "newsbeuter" },
    properties = { tag = tags[1][5],switchtotag = true } },
    --file manager
    { rule = { class = "Dolphin" },
    properties = { tag = tags[1][6],switchtotag = true } },
    --misc stuff
    { rule = { class = "Konqueror" },
    properties = { tag = tags[1][9],switchtotag = true } },
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.add_signal("manage", function (c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })
    -- remove gaps
    c.size_hints_honor = false
    -- Enable sloppy focus
    c:add_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    end)
    client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    -- {{{ Autostart
    os.execute("krandrtray &")
    -- vim: fdm=marker fdl=0 sts=4 ai
    http://github.com/nblock/config/blob/ma … ome/rc.lua
    Thanks.
    Last edited by nblock (2010-01-02 09:59:24)

    Try this .Xdefaults which works with awesome/urxvt.
    *utf8: 1
    *faceSize: 10
    *jumpScroll: true
    *multiScroll: true
    *boldMode: false
    *scrollBar: false
    *cutNewline: false
    *scrollTtyOutput: false
    *scrollKey: true
    *cursorBlink: true
    *dynamicColors: true
    *saveLines: 5000
    *geometry: 125x45
    ! URxvt
    URxvt*termName: xterm
    URxvt.font: xft:Bitstream Vera Sans Mono:antialias=true:pixelsize=12
    !urxvt.font: xft:Bitstream Vera Sans Mono-12:antialias=true
    URxvt*transparent: false
    URxvt*tintColor: #666666
    URxvt*shading: 50
    URxvt*scrollBar: false
    URxvt*internalBorder: 5
    URxvt*urgentOnBell: true
    URxvt*scrollTtyKeypress: true
    URxvt*underlineColor: yellow
    URxvt*perl-ext-common: default,matcher
    URxvt*urlLauncher: firefox
    URxvt*matcher.button: 1
    URxvt*matcher.pattern.1: \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]
    ! Colours
    *background: #303030
    *foreground: #f2f2f2
    *cursorColor: #999
    *highlightColor: #333
    *color0: #101010
    *color1: #f13a21
    *color2: #93f91d
    *color3: #ffd00a
    *color4: #404f9e
    *color5: #ec0048
    *color6: #2aa7e7
    *color7: #f2f2f2
    *color8: #1d202f
    *color9: #ff361e
    *color10: #ffc005
    *color11: #93ff00
    *color12: #3071ff
    *color13: #ef0051
    *color14: #4bb8fd
    *color15: #a020f0
    Last edited by r6 (2010-01-02 05:05:11)

  • How can I use automator to open terminal change directory run a python script?

    Hi all,
    I dont really ever use automator - which may be my big problem - and I am trying to make an apllication that seems fairly simple in theroy. I want something that will lunch terminal, cd to the place where my python script lives and then run it. I have tried a number of suggested ways and can get the terminal to open and the directory to change but cant figure out how to run the script. This is my workflow if i did it manually each time
    - open terminal
    - type cd "the place where my file lives"
    - type python uploadr.py -d
    I can get terminal to open then cd to the right place but cant get the "python uploadr.py -d" to run without an error.
    any help would be very appricated
    thanks!!!
    J

    this is the script I got closest with - I know its something to do with breaking those two commands up but i just dont know how to do it
    on run {input, parameters}
              tell application "Terminal"
      activate
                        if (the (count of the window) = 0) or ¬
                                  (the busy of window 1 = true) then
                                  tell application "System Events"
      keystroke "n" using command down
                                  end tell
                        end if
                        do script "cd /Users/behole/Desktop/FlickrUpload/" & "python uploadr.py -d" in window 1
              end tell
              return input
    end run
    this is the error I get in terminal after I run it
    Last login: Mon Jul 23 15:37:17 on ttys000
    be-holes-MacBook-Pro:~ behole$ cd /Users/behole/Desktop/FlickrUpload/python uploadr.py -d
    -bash: cd: /Users/behole/Desktop/FlickrUpload/python: No such file or directory
    be-holes-MacBook-Pro:~ behole$

  • Error using python multiprocessing in Azure Machine Learning

    I want to do some parallel data manipulation in Azure ML but I can't seem to get multiprocessing to work. 
    So when I try this simple example in Azure ML Python Script Module
    import multiprocessing
    def azureml_main(dataframe1 = None, dataframe2 = None):
    process_pool = multiprocessing.Pool(10)
    l = []
    for i in range(10):
    l.append((0, 1000))
    r = process_pool.map(do, l)
    process_pool.close()
    foo = 0
    for a in r:
    foo = foo + a
    print(foo)
    return dataframe1
    def do(arg):
    foo = 0
    for i in range(arg[0], arg[1]):
    foo = foo + 1
    return foo
    I get this error:
        Error 0085: The following error occurred during script evaluation, please view the output log for more information:
         ---------- Start of error message from Python interpreter ----------
         data:text/plain,Caught exception while executing function: Traceback (most recent call last):
        File "C:\server\invokepy.py", line 167, in batch
         odfs = mod.azureml_main(*idfs)
        File "C:\temp\azuremod.py", line 19, in azureml_main
         process_pool = multiprocessing.Pool(10)
        File "C:\pyhome\lib\multiprocessing\__init__.py", line 232, in Pool
         return Pool(processes, initializer, initargs, maxtasksperchild)
        File "C:\pyhome\lib\multiprocessing\pool.py", line 159, in __init__
         self._repopulate_pool()
        File "C:\pyhome\lib\multiprocessing\pool.py", line 223, in _repopulate_pool
         w.start()
        File "C:\pyhome\lib\multiprocessing\process.py", line 130, in start
         self._popen = Popen(self)
        File "C:\pyhome\lib\multiprocessing\forking.py", line 280, in __init__
         to_child.close()
        IOError: [Errno 22] Invalid argument
         ---------- End of error message from Python  interpreter  ----------
    When I try the same code in a local regular python file it works just fine
    Any ideas? Or is there another way?
     

    Hello Grahamaaa,
    (a) Regarding map: Yes, vanilla map, list comprehensions, generators, etc. are all sequential.
    (b) NumPy: You can call into multi-threaded native code (via OpenMP/TBB/etc.) as long as they follow the usual GIL locking/unlocking protocol. There are some calls such as SetCpuAffinity that are not supported.
    There are essentially two ways to around the GIL in CPython: write C extensions that use threads or spawn multiple Python interpreters. The first approach should work modulo calls like SetCpuAffinity.
    We are looking into why the fork call in Python is not working.
    Regards,
    Sudarshan (AzureML)

Maybe you are looking for