Newsboat: How to escape spaces in browser path

Created on 4 Jun 2019  路  4Comments  路  Source: newsboat/newsboat

Newsboat version:

newsboat 2.15.0 - https://newsboat.org/
Copyright (C) 2006-2015 Andreas Krennmair
Copyright (C) 2015-2019 Alexander Batischev
Copyright (C) 2006-2017 Newsbeuter contributors
Copyright (C) 2017-2019 Newsboat contributors

Newsboat is free software licensed under the MIT License. (Type `newsboat -vv' to see the full text.)
It bundles JSON for Modern C++ library, licensed under the MIT License: https://github.com/nlohmann/json
It bundles an alphanum algorithm implementation licensed under the MIT license: http://www.davekoelle.com/alphanum.html

newsboat 2.15.0
System: Darwin 18.2.0 (x86_64)
Compiler: g++ 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)
ncurses: ncurses 5.7.20081102 (compiled with 5.7)
libcurl: libcurl/7.54.0 LibreSSL/2.6.4 zlib/1.2.11 nghttp2/1.24.1 (compiled with 7.54.0)
SQLite: 3.24.0 (compiled with 3.24.0)
libxml2: compiled with 2.9.4

I want to set the browser command to /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app %u. The --app parameter opens Chrome in app mode on that page, meaning no bookmarks, tabs or address bar. Here are the config lines that I have tried and the errors they give:

  • browser /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app %u:

    sh: /Applications/Google https://news.ycombinator.com/item?id=20077421: No such file or directory

  • browser '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --app %u:

    sh: -c: line 0: unexpected EOF while looking for matching'' sh: -c: line 1: syntax error: unexpected end of file`

  • browser /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --app %u:

    sh: /Applications/Google\: No such file or directory

The OP in #172 relied instead on using /usr/bin/open, but I am unable to get that to work correctly with the --app argument.

How do I escape the spaces in the browser executable path?

bug

All 4 comments

Hi! This is embarrassing; apparently the code that splits lines into "words" is totally broken. I'm still figuring it out; meanwhile your best bet is to create a script that calls the browser, and use that as your Newsboat browser:

/home/garfieldnate/script.sh

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app $1

/home/garfieldnate/.newsboat/config

...
browser /home/garfieldnate/script.sh
...

For the next googler, here is my browser startup script:

#/usr/bin/env sh
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="$1"

For whatever reason the --app <website> syntax doesn't work.

This might be what folks on Linux want to use: browser xdg-open

I appreciate the work you put in on this! Thank you for fixing this.

Was this page helpful?
0 / 5 - 0 ratings