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

You are viewing a single thread.
View all comments View context
1 point

Could you please share the script?

permalink
report
parent
reply
6 points
*

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.

permalink
report
parent
reply
3 points

Thanks!

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

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

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

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

Community stats

  • 8.4K

    Monthly active users

  • 3.4K

    Posts

  • 40K

    Comments