Sawfish + xdg-open

View: New views
5 Messages — Rating Filter:   Alert me  

Sawfish + xdg-open

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I've been spending some time on the issue that xdg-open can't be used
properly when not using KDE/GNOME/XFCE. And I've found the issue:

xdg-open doesn't find one of the above three and tries to use an
internal function which does not work for me, as it for example gets
the mimetype application/octet-stream, though it is x-directory/normal
or inode/directory.

So I've thought about letting sawfish add a WINDOW_MANAGER property to
the root window. If gnome-int is loaded it would be set to
sawfish-gnome, if kde-int is loaded to sawfish-kde else to sawfish.

(a similar thing is done by XFCE)

Next setup xdg-open to use gnome-open when sawfish is beeing run
standalone. (if you want to use xfce-open or kfmclient, simply the DE=
value)

Patches attached.

/me now happily using FolderView Screenlet which now opens
GNOME-Commander instead of nothing :)

Regards,
Chris

diff --git a/lisp/sawfish/wm/integration/gnome.jl b/lisp/sawfish/wm/integration/gnome.jl
index 606e557..4140bc3 100644
--- a/lisp/sawfish/wm/integration/gnome.jl
+++ b/lisp/sawfish/wm/integration/gnome.jl
@@ -30,6 +30,9 @@
 
   (define-structure-alias gnome-int sawfish.wm.integration.gnome)
 
+  ;; set root windows WINDOW_MANAGER property to sawfish-gnome
+  (set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish-gnome"))
+
   ;; invoke the GNOME terminal instead of xterm
   (unless (variable-customized-p 'xterm-program)
     (setq xterm-program "gnome-terminal.wrapper"))
diff --git a/lisp/sawfish/wm/integration/kde.jl b/lisp/sawfish/wm/integration/kde.jl
index 1af6bb6..a0b391c 100644
--- a/lisp/sawfish/wm/integration/kde.jl
+++ b/lisp/sawfish/wm/integration/kde.jl
@@ -30,6 +30,9 @@
 
   (define-structure-alias kde-int sawfish.wm.integration.kde)
 
+  ;; set root windows WINDOW_MANAGER property to sawfish-kde
+  (set-x-text-property 'root 'WINDOW_MANAGER (vector sawfish-kde))
+
   ;; invoke the KDE terminal instead of xterm
   (unless (variable-customized-p 'xterm-program)
     (setq xterm-program "konsole"))
diff --git a/lisp/sawfish/wm/session/init.jl b/lisp/sawfish/wm/session/init.jl
index 4d124ae..c04624e 100644
--- a/lisp/sawfish/wm/session/init.jl
+++ b/lisp/sawfish/wm/session/init.jl
@@ -191,6 +191,9 @@ that feature off, allowing some broken clients to be session managed.")
       ;; we need to start before gmc, otherwise it won't hint its icons
       (sm-set-property "_GSM_Priority" sm-gsm-priority)
 
+      ;; set WINDOW_MANAGER to sawfish (...)
+      (set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish"))
+
       ;; 2. load the session if it exists
       (let ((file (sm-find-file sm-client-id sm-prefix)))
  (when (file-exists-p file)



--- a/usr/bin/xdg-open 2009-11-01 13:44:18.968439032 +0100
+++ b/usr/bin/xdg-open 2009-11-01 13:43:59.698682789 +0100
@@ -304,6 +304,7 @@
     if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
     elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
+    elif xprop -root WINDOW_MANAGER | grep ' = \"sawfish\"' >/dev/null 2>&1; then DE=gnome;
     fi
 }


Re: Sawfish + xdg-open

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ouch! Previous patch for sawfish didn't work, the following one does:

diff --git a/lisp/sawfish/wm.jl b/lisp/sawfish/wm.jl
index fb7c47b..c127ad0 100644
--- a/lisp/sawfish/wm.jl
+++ b/lisp/sawfish/wm.jl
@@ -34,6 +34,21 @@
 ;; set $DISPLAY so that any subprocesses inherit it
 (setenv "DISPLAY" display-name)
 
+(unless batch-mode
+
+(require 'sawfish.wm.misc)
+
+;; GNOME
+(if (getenv "GNOME_DESKTOP_SESSION_ID")
+  (set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish-gnome"))
+
+;; KDE
+(if (getenv "KDE_SESSION_VERSION")
+  (set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish-kde"))
+
+;; STANDALONE
+(set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish")))))
+
 ;; load i18n support when necessary
 
 (unless batch-mode

I guess it should not be a problem to commit it.

How do I use eq properly here:

(if (eq (get-x-text-property 'root 'WINDOW_MANAGER) 'sawfish) (<whatever>))

I thought that should work.

Chris

Re: Sawfish + xdg-open

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

seems that setting it via wm.jl, user.jl and defaults.jl doesn't work,
while it does when setting it via sawfish[/]rc so I guess it's the
easiest to just put

;; Kludge for xdg-open
(set-x-text-property 'root 'WINDOW_MANAGER (vector "sawfish"))

into you rc file.

Chris

Re: Sawfish + xdg-open

by Teika Kazura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

On Sun, 1 Nov 2009 18:27:16 +0100, Christopher Roy Bratusek wrote:
> How do I use eq properly here:
>
> (if (eq (get-x-text-property 'root 'WINDOW_MANAGER) 'sawfish) (<whatever>))

You may already know it, but the correct one is:
(if (equal (get-x-text-property 'root 'WINDOW_MANAGER)
           (vector "sawfish")) ...)

Regards,
Teika (Teika kazura)


Re: Sawfish + xdg-open

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Tue, 03 Nov 2009 16:13:06 +0900 (JST)
schrieb Teika Kazura <teika@...>:

> Hi.
>
> On Sun, 1 Nov 2009 18:27:16 +0100, Christopher Roy Bratusek wrote:
> > How do I use eq properly here:
> >
> > (if (eq (get-x-text-property 'root 'WINDOW_MANAGER) 'sawfish)
> > (<whatever>))
>
> You may already know it, but the correct one is:
> (if (equal (get-x-text-property 'root 'WINDOW_MANAGER)
>            (vector "sawfish")) ...)
>
> Regards,
> Teika (Teika kazura)
>

hmm yeah, but the thing that's more interessting: why does that work
from sawfish[/]rc but not from either wm.jl, user.jl, wm-spec.jl or
defaults.jl?

Chris