• Running Browser?

    From Andy Burns@21:1/5 to Folderol on Thu Aug 5 11:50:12 2021
    Folderol wrote:

    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    if you know a full list of potential browsers you're interested in, you
    could do

    ps -a | grep -E 'firefox|chromium|kmeleon|vivaldi|palemoon'

    etc, but winkywankybrowser could be running and you won't notice.

    Or you could look for things connecting to port 443 or port 80

    netstat -nt | awk '{print $5}' | grep -E ':80|:443'

    but that could include things other than a browser (such as update
    processes) or miss browsers connecting to non-standard ports, or do
    partial matches on e.g. port 44321

    in short there's no good way ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Folderol@21:1/5 to All on Thu Aug 5 11:23:30 2021
    Does anyone know of a way to find out if *any* browser is already running, and if so, which one?

    --
    W J G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrzej Adam Filip@21:1/5 to Andy Burns on Thu Aug 5 12:24:40 2021
    Andy Burns <usenet@andyburns.uk> wrote:
    Folderol wrote:

    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    if you know a full list of potential browsers you're interested in,
    you could do

    ps -a | grep -E 'firefox|chromium|kmeleon|vivaldi|palemoon'

    etc, but winkywankybrowser could be running and you won't notice.
    […]

    On Debian you may get list of web browsers programs installed from packages.

    # list of X-windows browsers
    update-alternatives --list x-www-browser
    # list of text mode browsers
    update-alternatives --list www-browser

    --
    [Andrew] Andrzej A. Filip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Folderol@21:1/5 to Andrzej Adam Filip on Thu Aug 5 15:14:06 2021
    On Thu, 05 Aug 2021 12:24:40 +0100 (BST)
    Andrzej Adam Filip <anfi@onet.eu> wrote:

    update-alternatives --list x-www-browser

    Thanks both of you for the answers. However, I need this to work in any distro. Otherwise it might have been usable - sort of, but that command reveals that a couple of lightweight ones don't appear in the list.

    I'll just have to think of something else. Maybe just point the users to the index file and have them load it into a browser manually.

    --
    W J G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Unruh@21:1/5 to Folderol on Thu Aug 5 14:25:39 2021
    On 2021-08-05, Folderol <general@musically.me.uk> wrote:
    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    ps auxww|grep <nameofbrowser>|grep -v grep
    and cycle through all the browsers on your system.




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Gregorie@21:1/5 to Folderol on Thu Aug 5 17:56:13 2021
    On Thu, 05 Aug 2021 15:14:06 +0200, Folderol wrote:


    I'll just have to think of something else. Maybe just point the users to
    the index file and have them load it into a browser manually.

    Does this program/project have a configuration file?
    If so, define the browser to be used in it?.

    Thats my usual approach for anything that may change from one
    installation to another.

    I usually assume that the configuration file will be manually edited and
    so validate it fairly carefully and treat config items that don't match
    the environment/runtime conditions as a fatal errors. However, depending
    on what your intended users can be expected to deal with, you may want to
    add an interactive configuration editor which pops up if the
    configuration doesn't match the environment.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Unruh@21:1/5 to Folderol on Thu Aug 5 15:25:39 2021
    On 2021-08-05, Folderol <general@musically.me.uk> wrote:
    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    ps auxww|grep <nameofbrowser>|grep -v grep
    and cycle through all the browsers on your system.




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Gregorie@21:1/5 to Folderol on Thu Aug 5 18:56:13 2021
    On Thu, 05 Aug 2021 15:14:06 +0200, Folderol wrote:


    I'll just have to think of something else. Maybe just point the users to
    the index file and have them load it into a browser manually.

    Does this program/project have a configuration file?
    If so, define the browser to be used in it?.

    Thats my usual approach for anything that may change from one
    installation to another.

    I usually assume that the configuration file will be manually edited and
    so validate it fairly carefully and treat config items that don't match
    the environment/runtime conditions as a fatal errors. However, depending
    on what your intended users can be expected to deal with, you may want to
    add an interactive configuration editor which pops up if the
    configuration doesn't match the environment.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gordon@21:1/5 to Folderol on Fri Aug 6 01:39:52 2021
    On 2021-08-05, Folderol <Folderol@f1.n221.z2.fidonet.fi> wrote:
    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    Is top of any use for you? top | grep firefox

    Or ps -ax | grep firefox

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gordon@21:1/5 to Folderol on Fri Aug 6 02:39:52 2021
    On 2021-08-05, Folderol <Folderol@f1.n221.z2.fidonet.fi> wrote:
    Does anyone know of a way to find out if *any* browser is already running, and
    if so, which one?

    Is top of any use for you? top | grep firefox

    Or ps -ax | grep firefox

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Folderol@21:1/5 to Martin Gregorie on Fri Aug 6 07:23:37 2021
    On Thu, 05 Aug 2021 18:56:13 +0200
    Martin Gregorie <Martin.Gregorie@f1.n221.z2.fidonet.fi> wrote:

    On Thu, 05 Aug 2021 15:14:06 +0200, Folderol wrote:


    I'll just have to think of something else. Maybe just point the users to
    the index file and have them load it into a browser manually.

    Does this program/project have a configuration file?
    If so, define the browser to be used in it?.

    Thats my usual approach for anything that may change from one
    installation to another.

    I usually assume that the configuration file will be manually edited and
    so validate it fairly carefully and treat config items that don't match
    the environment/runtime conditions as a fatal errors. However, depending
    on what your intended users can be expected to deal with, you may want to
    add an interactive configuration editor which pops up if the
    configuration doesn't match the environment.


    Thanks again for the suggestions (and Gordon too).

    The problem is that this will be used by people with no understanding of what is going on, don't know what browser they have installed - just know they have 'the Internet' - and wouldn't know how to do any configuration. They do know how to plug in a USB stick though :)

    I think the best bet is to just use XDG which will open the default browser. Thinking about it I doubt they'll have more than one browser.

    P.S. In their own fields some of them are brilliant.

    --
    W J G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to Folderol on Fri Aug 6 15:29:16 2021
    Folderol <general@musically.me.uk> wrote:
    Thanks both of you for the answers. However, I need this to work in any distro. Otherwise it might have been usable - sort of, but that command reveals that a couple of lightweight ones don't appear in the list.

    I'll just have to think of something else. Maybe just point the users to the index file and have them load it into a browser manually.

    $ xdg-open example.html

    will open the file in the user's default browser, however that may be configured.

    You can find out the default via:

    $ xdg-settings --list
    Known properties:
    default-url-scheme-handler Default handler for URL scheme
    default-web-browser Default web browser
    $ xdg-settings get default-web-browser
    firefox.desktop

    xdg-* should work on any Linux distro or desktop environment, but not for
    other desktop stacks. If they're on a Mac the equivalent is:

    $ open example.html

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Folderol@21:1/5 to Theo on Fri Aug 6 17:54:46 2021
    On 06 Aug 2021 15:29:16 +0100 (BST)
    Theo <theom+news@chiark.greenend.org.uk> wrote:

    Folderol <general@musically.me.uk> wrote:
    Thanks both of you for the answers. However, I need this to work in any
    distro. Otherwise it might have been usable - sort of, but that command
    reveals that a couple of lightweight ones don't appear in the list.

    I'll just have to think of something else. Maybe just point the users to the >> index file and have them load it into a browser manually.

    $ xdg-open example.html

    will open the file in the user's default browser, however that may be >configured.

    I was aware of this, but some browsers don't set the tags that XDG uses. However, I've had a 'DOH' moment ::

    The program is run from a USB stick and needs a browser only to view its on-board HTML user guide. So it's trivially easy to use a lightweight browser that doesn't need to be installed but can run from the same stick, then call it directly.

    I shall now go and sit in the corner wearing a dunce hat!

    --
    W J G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)