Emacs into focus
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
Emacs into focus         


Author: Richard G Riley
Date: Aug 6, 2008 22:36

Can someone recommend the best way to have emacs come to the foreground
on a Linux desktop? I'm trying to get emacsclient wired up properly so I
can handle mailto URLS from iceweasel (firefox) properly. I have tried:

,----
| /usr/bin/emacsclient -e "(progn (raise-frame)(message-mail (substring \"$1\" 7) \"Subject\" '((\"from\" \"Richard Rileygmail.com>\"))))"
`----

But raise-frame does not seem to work on my Gnome desktop.

Replacing raise-frame with (bring-on-top)

where

,----
| (defun bring-on-top()
| (interactive)
| (x-send-client-message
| nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_FULLSCREEN" 1))
| )
`----

Does work but removes the WM border from the emacs frame.

Does anyone have a cleaner solution?

regards
Show full article (0.78Kb)
11 Comments
Re: Emacs into focus         


Author: Tim X
Date: Aug 7, 2008 02:16

Richard G Riley gmail.com> writes:
Show full article (1.12Kb)
no comments
Re: Emacs into focus         


Author: Joost Kremers
Date: Aug 7, 2008 02:41

Richard G Riley wrote:
> But raise-frame does not seem to work on my Gnome desktop.

IIUC an app can only request to be raised, it's up to the window manager to
decide wether to honour that request or not. so you'll need to find where
in gnome this can be configured. (i run xfce, so i can't help you there...)

--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
no comments
Re: Emacs into focus         


Author: Andrea Vettorello
Date: Aug 7, 2008 04:01

On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley gmail.com> wrote:
>
> Can someone recommend the best way to have emacs come to the foreground
> on a Linux desktop? I'm trying to get emacsclient wired up properly so I
> can handle mailto URLS from iceweasel (firefox) properly. I have tried:
>
> ,----
> | /usr/bin/emacsclient -e "(progn (raise-frame)(message-mail (substring \"$1\" 7) \"Subject\" '((\"from\" \"Richard Rileygmail.com>\"))))"
> `----
>
> But raise-frame does not seem to work on my Gnome desktop.
>
> Replacing raise-frame with (bring-on-top)
>
> where
>
> ,----
> | (defun bring-on-top()
> | (interactive)
> | (x-send-client-message ...
Show full article (1.34Kb)
no comments
Re: Emacs into focus         


Author: Richard G Riley
Date: Aug 7, 2008 07:33

"Andrea Vettorello" gmail.com> writes:
> On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley gmail.com> wrote:
>>
>> Can someone recommend the best way to have emacs come to the foreground
>> on a Linux desktop? I'm trying to get emacsclient...
Show full article (1.58Kb)
no comments
Re: Emacs into focus         


Author: Chris Giroir
Date: Aug 7, 2008 04:52

> Does anyone have a cleaner solution?
>
> regards
>
> r.

http://burtonini.com/blog/computers/devilspie
http://ubuntu-tutorials.com/2007/07/25/how-to-set-default-workspace-size-and-window.../

Devilspie is a util that a lot of gnome users use to do things with
windows on creation. I bet you can make sure the title (or some other
feature) of the emacs client windows are unique and have devilspie
tell it to raise on creation.

Chris G
no comments
Re: Emacs into focus         


Author: Richard G Riley
Date: Aug 7, 2008 07:53

"Chris Giroir" valefor.com> writes:
>> Does anyone have a cleaner solution?
>>
>> regards
>>
>> r.
>
> http://burtonini.com/blog/computers/devilspie
> http://ubuntu-tutorials.com/2007/07/25/how-to-set-default-workspace-size-and-window.../
>
> Devilspie is a util that a lot of gnome users use to do things with
> windows on creation. I bet you can make sure the title (or some other
> feature) of the emacs client windows are unique and have devilspie
> tell it to raise on creation.
>
> Chris G
>

I use emacsclient here : there are no new windows created afaik.
no comments
Re: Emacs into focus         


Author: Andrea Vettorello
Date: Aug 7, 2008 10:33

On Thu, Aug 7, 2008 at 4:33 PM, Richard G Riley gmail.com> wrote:
> "Andrea Vettorello" gmail.com> writes:
>
>> On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley gmail.com> wrote:

[...]
.
>>
>> Metacity, the default Gnome window manager, tries to "avoid focus
>> stealing" (I think this blog post explains its behaviour:
>> http://blogs.gnome.org/metacity/2007/12/24/stacking/ ), IIRC there
>> should be a gconf setting to tweak it but I'm not completely sure as I
>> don't use it...
>
> The thing is that other email clients come to the fg just
> fine via the mailto click. I'll dig around some more and maybe ask in
> the gtk+ irc channel.
>
Show full article (1.00Kb)
no comments
Re: Emacs into focus         


Date: Aug 7, 2008 14:47

Richard G Riley gmail.com> writes:

[...]
> I use emacsclient here : there are no new windows created afaik.

That depends on configuration. (I have emacs configured so that
emacsclient always creates a new frame.)
no comments
Re: Emacs into focus         


Author: Ian Swainson
Date: Aug 7, 2008 18:31

On Thursday 07 August 2008 at 05:36 PM, Richard G Riley gmail.com> wrote:
> Can someone recommend the best way to have emacs come to the foreground
> on a Linux desktop?

I use wmctrl with a little script that I bind to a key combination which
either brings the app to the foreground or starts it if it is not running:

#!/bin/sh

###

# Switch to a screen or do something

###

if ! wmctrl -a $1; then $2; fi

I save this as switchto and then:

switchto "Mozilla Firefox" "firefox"

Perhaps wmctrl could be used in the same way for emacs?

Cheers,
ian

--
Ian Swainson
Show full article (0.76Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: .emacs in the Windows version of Emacsgnu.emacs.help ·
1 2