Coder Social home page Coder Social logo

Comments (5)

PredragBoksic avatar PredragBoksic commented on September 27, 2024

This system declares the following variable:
declare -x DESKTOP_SESSION="plasma"

Hence, a possible workaround is:

set +u
if [[ "${DESKTOP_SESSION}" =~ ^plasma? ]]; then
is_kde=1
fi
set -u

I tested it, and the Firefox is closing automatically at the end of the download now. However, I started to save a very long webpage and there were two follow-up questions: Do you want to replace the existing file? and Do you really want to close the window while the download is in progress?

It would be convenient to answer Yes in order to overwrite the saved file (webpage) automatically.

from automate-save-page-as.

abiyani avatar abiyani commented on September 27, 2024

You can add new keystrokes (depending on your requirement) after line 225 per your requirements (see example on line 228:

xdotool windowactivate "${browser_wid}" key --clearmodifiers "ctrl+w"
)

Also, I would suggest using Chrome headless (https://developers.google.com/web/updates/2017/04/headless-chrome) mode now for automating these tasks. When I wrote this hacky tool, there wasn't any easy way to automate them, but now the landscape has changed since then.

from automate-save-page-as.

PredragBoksic avatar PredragBoksic commented on September 27, 2024

Thank you for your knowledgeable answer. I will try the Chrome headless in the future. Initially, I saw that Chrome did not save complete pages as Firefox did.

The save_page_as works mostly well, except that the first run may not close the window for some reason. It is best to complete a single trial first and then allow the script to execute other page save tasks automatically with window closing.

from automate-save-page-as.

Ashark avatar Ashark commented on September 27, 2024

I am using Firefox 89.0 (Arch Linux) and KDE.
Yes, the problem is that it defines is_kde wrong, so tries to klose =) with ctrl + f4 instead of ctrl + w.
Changing

if [[ "${DESKTOP_SESSION}" =~ ^kde-? ]]; then

to

if [[ "${DESKTOP_SESSION}" == plasma ]]; then

fixed it.

from automate-save-page-as.

Ashark avatar Ashark commented on September 27, 2024

@PredragBoksic

I started to save a very long webpage and there were two follow-up questions: Do you want to replace the existing file? and Do you really want to close the window while the download is in progress?

It would be convenient to answer Yes in order to overwrite the saved file (webpage) automatically.

See #32

from automate-save-page-as.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.