You are not logged in.

#26 2010-09-03 15:52:03

quigybo
Member
Registered: 2009-01-15
Posts: 223

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

These problems you are experiencing are specific to xml and openbox. As mentioned above & is escaped as &amp in xml. Openbox (wrt keybindings anyway) does not source your .bashrc by default, you need to source it in your autostart.sh. I keep my functions and aliases as separate files, sourced by my .bashrc and also autostart.sh, as the bash specific stuff doesn't need to be sourced. I also add ~/bin to PATH in my autostart.sh.

Offline

#27 2010-09-04 10:04:46

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

For some reason replacing & with &amp or & in home/username/.config/openbox/rc.xml seems to make no difference at all - the error message is still displayed when I hit reconfigure and firefox loads with the URL broken at the ampersand.

How do I source .bashrc in autostart.sh?

Offline

#28 2010-09-04 12:14:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

Do you have a file autostart.sh? If so, put

. /home/username/.bashrc

in that file and (I guess()reboot.

If that doesn't work, we can try the script approach.

Offline

#29 2010-09-04 13:44:49

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

ok I'm trying this, just reconfigured X and got booted out of X with the most strange error message from xkbcomp:

"How are you gentlemen? All your base are belong to us. (Openbox received signal 11)"

hehe wtf?!

Offline

#30 2010-09-04 14:11:49

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

This code should work fine for you

<keybind key="W-XF86Mail">
    <action name="Execute">
     <execute>firefox 'https://spreadsheets.google.com/ccc?key=0AjuCrdYnTCyacGNfX0FuRzBFUnBOalNxS0VXYjJhVUE&amp;hl=en#gid=3'</execute>
    </action>
  </keybind>

tested and working fine for my document. You just need to  sign in.
if you make any changes to rc.xml just reconfigure openbox or logout/login.

Last edited by kgas (2010-09-04 14:15:54)

Offline

#31 2010-09-04 14:14:02

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

I've tried the following in autostart.sh:

. /home/username/.bashrc &
/home/username/.bashrc &
source ~/.bashrc &

I log in to X and press the keys but still get nothing. The autostart.sh is relevant because I control other programs from the same file, and if I type any of the above incorrectly I get a 'file not found' error message on quitting X. So autostart must be doing something with .bashrc, but for some reason it's not applied to the keybinding. Is there anything wrong with this code in .config/openbox/rc.xml?

<keybind key="W-XF86Mail">
    <action name="Execute">
    <execute>urxvt -e gdocspread</execute>
    </action>
</keybind>

Offline

#32 2010-09-04 14:18:43

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

dameunmate, check the code in my  previous post and let us know its working. tongue

Offline

#33 2010-09-04 14:24:27

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

kgas that works! the solution was so simple!

so my understanding is that simple URL's like http://www.bbc.co.uk work fine in ~/.config/openbox/rc.xml but more complex URL's including ampersand & or a hash # should be enclosed in single quotes, and the ampersand must be written as &amp; .

Thanks everyone.

Last edited by dameunmate (2010-09-04 14:28:39)

Offline

#34 2010-09-04 14:27:29

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

for future reference, could anyone enlighten me as to why the function I defined in ~/.bashrc is not working when called from the openbox xml file, even when I source .bashrc from the relevant autostart.sh?

Offline

#35 2010-09-04 14:32:39

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

Offline

#36 2010-09-04 14:49:18

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

~/.bashrc

# Check for an interactive session
[ -z "$PS1" ] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

gdocspread() {

firefox https://spreadsheets.google.com/ccc?key=0AjuCrdYnTCyacGNfX0FuRzBFUnBOalNxS0VXYjJhVUE#gid=3

}
Ramses de Norre wrote:

The way you've put the thing in bashrc, the # is interpreted as the beginning of a comment, which should have been obvious by the syntax highlighting.

Strangely enough, on my system that's not the case. With the above .bashrc file, if I open urxvt and type 'gdocspread' the correct URL opens, including the last bit #gid=3. I'm new to Linux and have just started using urxvt so I don't have syntax highlighting, but I would like to have it. I've no idea why I can't call this function from the Openbox keybindings:

<keybind key="W-XF86Mail">
    <action name="Execute">
    <execute>urxvt -e gdocspread</execute>
    </action>
</keybind>

autostart.sh:

# This shell script is run before Openbox launches.
# Environment variables set here are passed to the Openbox session.

# Set a background color
BG=""
if which hsetroot >/dev/null 2>&1; then
    BG=hsetroot
else
    if which esetroot >/dev/null 2>&1; then
        BG=esetroot
    else
        if which xsetroot >/dev/null 2>&1; then
            BG=xsetroot
        fi
    fi
fi
test -z $BG || $BG -solid "#303030"


# D-bus
if which dbus-launch >/dev/null 2>&1 && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
       eval `dbus-launch --sh-syntax --exit-with-session`
fi

# Make GTK apps look and behave how they were set up in the gnome config tools
if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
  /usr/libexec/gnome-settings-daemon &
elif which gnome-settings-daemon >/dev/null 2>&1; then
  gnome-settings-daemon &
# Make GTK apps look and behave how they were set up in the XFCE config tools
elif which xfce-mcs-manager >/dev/null 2>&1; then
  xfce-mcs-manager n &
fi

# Preload stuff for KDE apps
if which start_kdeinit >/dev/null 2>&1; then
  LD_BIND_NOW=true start_kdeinit --new-startup +kcminit_startup &
fi

# Run XDG autostart things.  By default don't run anything desktop-specific
# See xdg-autostart --help more info
DESKTOP_ENV=""
if which /usr/lib/openbox/xdg-autostart >/dev/null 2>&1; then
  /usr/lib/openbox/xdg-autostart $DESKTOP_ENV
fi

#background image
sh ../../../home/rich/.fehbg &

source /home/rich/.bashrc &

(sleep 1 && numlockx) &

Offline

#37 2010-09-04 15:03:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

Syntax highlighting is usually a part of e.g. vim or other editors, not terminal emulators like urxvt (but you can have e.g. underlined and clickable urls in urxvt if you like).

On my system the url works fine, the '#' is *not* interpreted as a comment. <- I forgot to add that when I posted the url to Ramses de Norre's post, sorry about that.

.bashrc is not an xml file, and rc.xml is, maybe that's the reason you need more / different escaping mechanisms.

Offline

#38 2010-09-04 15:43:11

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

Thank you for the clarification.

Do you know how I can call a function defined in ~/.bashrc from ~/.config/openbox/rc.xml? (see my autostart.sh above which currently doesn't do the job...)

Offline

#39 2010-09-04 15:48:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

dameunmate wrote:

Thank you for the clarification.

Do you know how I can call a function defined in ~/.bashrc from ~/.config/openbox/rc.xml? (see my autostart.sh above which currently doesn't do the job...)

No I don't know that - that's why I didn't reply to it ;P
I always use my functions and aliases in the shell - I just type them in.

Offline

#40 2010-09-04 18:08:39

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: [SOLVED] rc.xml: & ampersand and # hash break Openbox keybinding URL's

ah..well anyway thanks for your help here and on previous topics big_smile

Offline

Board footer

Powered by FluxBB