SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-11-30 02:18:14

chaanakya
#! Die Hard
Registered: 2010-12-30
Posts: 940

ELisp or XMonad help?

Hey guys!

I use Emacs and Jabber.el and I have notifications through xfce4-notifyd or whatever it's called.  It's all good and fine.  However, every time a notification pops up, it takes focus.  I'm trying to figure out how to do either of the following:

1) Stop Emacs from notifying me when I'm typing IN the Emacs window (i.e. how to check if Emacs has focus)

2) Stop xfce4-notifyd from taking focus.  This is an Xmonad issue.

Here are my config files:

Relevant part of my .emacs:

(defvar libnotify-program "/usr/bin/notify-send")

(defun notify-send (title message)
  (start-process "notify" " notify"
         libnotify-program "--expire-time=0" title message))

(defun libnotify-jabber-notify (from buf text proposed-alert)
  "(jabber.el hook) Notify of new Jabber chat messages via libnotify"
  (when (or jabber-message-alert-same-buffer
            (not (memq (selected-window) (get-buffer-window-list buf))))
    (if (jabber-muc-sender-p from)
        (notify-send (format "(PM) %s"
                       (jabber-jid-displayname (jabber-jid-user from)))
               (format "%s: %s" (jabber-jid-resource from) text)))
      (notify-send (format "%s" (jabber-jid-displayname from))
             text)))

(add-hook 'jabber-alert-message-hooks 'libnotify-jabber-notify)

and here's my .xmonad/xmonad.hs:

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Actions.CycleWS
import XMonad.Layout.DecorationMadness
import Control.Monad (liftM2)
import XMonad.Prompt
import XMonad.Prompt.Workspace
import XMonad.Util.Themes
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.FadeInactive
import System.IO

myManageHook = composeAll . concat $
         [ [title =? t --> doShift "e-mail" | t <- a]
         , [title =? u --> doShift "files" | u <- b]
         , [className =? v --> doShift "media" | v <- c]
         , [title =? w --> doShift "terminal" | w <- d]
         , [className =? x --> doShift "emacs" | x <- e]
         , [className =? y --> doShift "emacs" | y <- f]
         , [className =? z --> doShift "web" | z <- g]
         , [ composeOne [isFullscreen -?> doFullFloat ] ]
         , [className =? aa --> doShift "eclipse" | aa <- h]
         ]
         where 
                viewShift = doF . liftM2 (.) W.greedyView W.shift
           a = ["Mutt"]
           b = ["Ranger"]
           c = ["vlc", "Vlc"]
           d = ["Terminal"]
           e = ["emacs","Emacs"]
           f = ["win", "Xpdf"]
           g = ["Navigator", "Conkeror"]
           h = ["Eclipse"]


main = do
     xmproc <- spawnPipe "/usr/bin/xmobar ~/.xmobarrc"
     xmonad $ defaultConfig
             { manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
        , layoutHook = avoidStruts $ layoutHook defaultConfig
        , logHook = dynamicLogWithPP $ xmobarPP
                        { ppOutput = hPutStrLn xmproc
                        , ppTitle = xmobarColor "white" "" . shorten 200
                        }
        , modMask = mod4Mask
        , workspaces = ["web", "e-mail", "files", "media", "terminal", "emacs", "skype", "eclipse"]
        , focusFollowsMouse = False
        } `additionalKeys`
            [ ((mod1Mask, xK_l), spawn "xscreensaver-command -lock")
            , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
            , ((0, xK_Print), spawn "scrot")
        , ((mod1Mask, xK_h), spawn "~/scripts/hibernate.sh")
        , ((mod1Mask, xK_m), spawn "urxvt.real -title 'Mutt' -e ~/scripts/mutt.home")
        , ((mod1Mask, xK_n), spawn "urxvt.real -title 'Mutt' -e ~/scripts/mutt.caltech")
        , ((mod1Mask, xK_e), spawn "emacsclient -c")
        , ((mod4Mask, xK_f), spawn "urxvt.real -title 'Ranger' -e python2.6 /usr/bin/ranger")
        , ((mod1Mask, xK_c), spawn "conkeror")
        , ((mod1Mask, xK_t), spawn "thunar")
        , ((mod1Mask, xK_u), spawn "~/scripts/sync.sh")
        , ((mod1Mask, xK_i), spawn "~/scripts/xcalib -i -a")
        , ((shiftMask, xK_Return), spawn "urxvt.real")
        , ((shiftMask, xK_Num_Lock), spawn"~/scripts/xcalib -i -a")
        , ((mod4Mask, xK_Right), nextWS)
        , ((mod4Mask, xK_Left), prevWS)
        , ((mod4Mask .|. mod1Mask, xK_Left), spawn "urxvt.real -e ~/scripts/rotate-left.sh")
        , ((mod4Mask .|. mod1Mask, xK_Right), spawn "urxvt.real -e ~/scripts/rotate-right.sh")
        , ((mod4Mask .|. mod1Mask, xK_Down), spawn "urxvt.real -e ~/scripts/rotate-inverted.sh")
        , ((mod4Mask .|. mod1Mask, xK_Up), spawn "urxvt.real -e ~/scripts/rotate-normal.sh")
        , ((mod4Mask, xK_slash), spawn "~/scripts/keyboard_layout")
        , ((0, 0x1008ff11), spawn "~/scripts/volume.sh decrease")
        , ((0, 0x1008ff13), spawn "~/scripts/volume.sh increase")
        , ((mod4Mask, xK_s), spawn "~/scripts/shutdown.sh")
        , ((0, 0x1008ff12), spawn "~/scripts/mute.sh")
        , ((0, 0x1008ff14), spawn "mpc toggle")
        , ((0, 0x1008ff15), spawn "mpc stop")
        , ((0, 0x1008ff16), spawn "mpc prev")
        , ((0, 0x1008ff17), spawn "mpc next")
        , ((controlMask, xK_backslash), workspacePrompt defaultXPConfig (windows . W.view))
            ]

Thanks in advance!

- Chaanakya


Check out Musik - an easy-to-use text-to-music converter!
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral … 660e787ff1

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo