* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
@ 2008-08-07 9:16 ` Tim X
2008-08-07 9:41 ` Joost Kremers
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Tim X @ 2008-08-07 9:16 UTC (permalink / raw)
To: help-gnu-emacs
Richard G Riley <rileyrgdev@gmail.com> writes:
> 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 Riley<rileyrgdev@gmail.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?
>
I'm not that familiar with gnome, but focus and raising/lowering of
frames is usually managed by the window manager. Maybe tehre is
something you can set at that level which will make things work more the
way you want?
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
2008-08-07 9:16 ` Tim X
@ 2008-08-07 9:41 ` Joost Kremers
2008-08-07 11:01 ` Andrea Vettorello
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Joost Kremers @ 2008-08-07 9:41 UTC (permalink / raw)
To: help-gnu-emacs
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)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
2008-08-07 9:16 ` Tim X
2008-08-07 9:41 ` Joost Kremers
@ 2008-08-07 11:01 ` Andrea Vettorello
2008-08-07 11:52 ` Chris Giroir
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Andrea Vettorello @ 2008-08-07 11:01 UTC (permalink / raw)
To: help-gnu-emacs
On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley <rileyrgdev@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 Riley<rileyrgdev@gmail.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.
This won't help you a lot, but removing window decorations (and fill
screen) is the expected behaviour of _NET_WM_STATE_FULLSCREEN (
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2551694
).
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...
--
Andrea
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
` (2 preceding siblings ...)
2008-08-07 11:01 ` Andrea Vettorello
@ 2008-08-07 11:52 ` Chris Giroir
[not found] ` <mailman.15986.1218106891.18990.help-gnu-emacs@gnu.org>
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Chris Giroir @ 2008-08-07 11:52 UTC (permalink / raw)
To: help-gnu-emacs
> 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-effects-in-gnome/
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
^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <mailman.15986.1218106891.18990.help-gnu-emacs@gnu.org>]
* Re: Emacs into focus
[not found] ` <mailman.15986.1218106891.18990.help-gnu-emacs@gnu.org>
@ 2008-08-07 14:33 ` Richard G Riley
2008-08-07 17:33 ` Andrea Vettorello
0 siblings, 1 reply; 12+ messages in thread
From: Richard G Riley @ 2008-08-07 14:33 UTC (permalink / raw)
To: help-gnu-emacs
"Andrea Vettorello" <andrea.vettorello@gmail.com> writes:
> On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley <rileyrgdev@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 Riley<rileyrgdev@gmail.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.
>
> This won't help you a lot, but removing window decorations (and fill
> screen) is the expected behaviour of _NET_WM_STATE_FULLSCREEN (
> http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2551694
> ).
>
> 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs into focus
2008-08-07 14:33 ` Richard G Riley
@ 2008-08-07 17:33 ` Andrea Vettorello
0 siblings, 0 replies; 12+ messages in thread
From: Andrea Vettorello @ 2008-08-07 17:33 UTC (permalink / raw)
To: help-gnu-emacs
On Thu, Aug 7, 2008 at 4:33 PM, Richard G Riley <rileyrgdev@gmail.com> wrote:
> "Andrea Vettorello" <andrea.vettorello@gmail.com> writes:
>
>> On Thu, Aug 7, 2008 at 7:36 AM, Richard G Riley <rileyrgdev@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.
>
In one of comments of the post I linked it's suggested to set
_NET_WM_USER_TIME and use _NET_ACTIVE_WINDOW to raise and give focus
to a window from a different application (Client).
I think it could be done using x-send-client-message or maybe
implemented directly on emacs-client itself.
--
Andrea
^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <mailman.15993.1218120233.18990.help-gnu-emacs@gnu.org>]
* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
` (5 preceding siblings ...)
[not found] ` <mailman.15993.1218120233.18990.help-gnu-emacs@gnu.org>
@ 2008-08-08 1:31 ` Ian Swainson
2008-08-09 22:08 ` Richard G Riley
7 siblings, 0 replies; 12+ messages in thread
From: Ian Swainson @ 2008-08-08 1:31 UTC (permalink / raw)
To: Richard G Riley; +Cc: help-gnu-emacs
On Thursday 07 August 2008 at 05:36 PM, Richard G Riley <rileyrgdev@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
fortune says:
In every hierarchy the cream rises until it sours.
-- Dr. Laurence J. Peter
Created using Free Software on GNU/Linux http://www.getgnulinux.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs into focus
2008-08-07 5:36 Emacs into focus Richard G Riley
` (6 preceding siblings ...)
2008-08-08 1:31 ` Ian Swainson
@ 2008-08-09 22:08 ` Richard G Riley
7 siblings, 0 replies; 12+ messages in thread
From: Richard G Riley @ 2008-08-09 22:08 UTC (permalink / raw)
To: help-gnu-emacs
Richard G Riley <rileyrgdev@gmail.com> writes:
> 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 Riley<rileyrgdev@gmail.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
>
> r.
In case this helps anyone else:
After digging around this was the best I came up with where (on Debian)
emacs.bash is a symbolic link to /usr/share/emacs/22.2/etc/emacs.bash
,---- gnus-mailto.sh ----
| #!/bin/sh
| wmctrl -a emacs22
| source ~/bin/emacs.bash
| edit --eval "(progn (johnsu01/mailto \"$1\"))"
`----
and the necessary function to bring up posting styles I borrowed from
John Sullivans tips and added the gnus-alive-p check:
http://journal.wjsullivan.net/185095.html
,----
| (require 'gnus-util)
|
| (defun johnsu01/mailto (url)
| "Follow a mailto URL as passed from Iceweasel, prompting for a posting style."
| (unless(gnus-alive-p)
| (gnus))
|
| (message "Url is : %s" url)
|
| (let ((gnus-newsgroup-name
| (completing-read "Use posting style of group: "
| gnus-active-hashtb nil
| (gnus-read-active-file-p))))
| (setq url (url-unhex-string url))
| (browse-url-mail url))
| ;; message-mail does not do anything with the body argument, so we have to.
| (if (string-match (regexp-quote "?") url)
| (let* ((start (match-end 0))
| (args (url-parse-query-string
| (substring url start nil)))
| (body (cadr (assoc-string "body" args t))))
| (when body
| (switch-to-buffer (car (message-buffers)))
| (save-excursion
| (message-goto-body)
| (insert body)))))
| )
`----
On my debian system edit() does not actually start emacs if its not
already running but I think that might be a bug on my system at the
moment.
^ permalink raw reply [flat|nested] 12+ messages in thread