this post was submitted on 01 Oct 2024
22 points (95.8% liked)

Linux

47949 readers
1713 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

is there a way to prevent all the other apps on the system from opening up new tabs/windows in firefox?

top 6 comments
sorted by: hot top controversial new old
[–] Sonotsugipaa@lemmy.dbzer0.com 10 points 1 month ago (1 children)

You can set some browser-unrelated program or script as your desktop environment's default browser, for example I wrote a Zsh script that creates a KDE dialog and asks me to copy the URL to the clipboard.

I'm not currently at my PC, but if you want it I can paste it in a comment here when I get to it - it shouldn't be too hard to translate it to Bash, either.

Other than that? /usr/bin/true is a pretty nice default browser for applications to start without your consent, very minimal and lightweight.

[–] vort3@lemmy.ml 1 points 1 month ago (1 children)

Could you please share the script?

[–] Sonotsugipaa@lemmy.dbzer0.com 6 points 1 month ago* (last edited 1 month ago) (1 children)

Here it is:

#!/usr/bin/zsh

nl=$'\n'
dnl=$'\n\n'

url=$1
msgcontent=$url; shift
argi=1
for arg ($@); do
    argi=$(($argi + 1))
    msgcontent=${msgcontent}${nl}Argument\ ${argi}': '${arg}
done

title="${0:A}"
msg="An application attempted to open a web page:${dnl}\"${msgcontent}\"${dnl}Copy the URL to clipboard?"

kdialog --title $title --yesno $msg
answer=$?

if [[ $answer = 0 ]]; then wl-copy $url; fi

If you want to translate it to Bash, keep in mind that arrays behave differently between the two shells, and syntax like for arg ($@); do would likely misbehave or not work at all.

Also, there's an issue where some applications do something weird, and the URL seems to be a zero-length argument. I have absolutely no idea what's up with that.

[–] vort3@lemmy.ml 3 points 4 weeks ago
[–] wildbus8979@sh.itjust.works 5 points 1 month ago (1 children)

Other apps than what?

You can start Firefox without the --no-remote flag. And it would allow external processes to open links.

[–] ngn@lemy.lol 1 points 1 month ago

that was what i was looking for, thank you