Git Product home page Git Product logo

update-browser-desktop-files's Introduction

update-browser-desktop-files

Simple script to restore browser command line parameters after software update

I use Ubuntu 23.10 with VAAPI for hardware video decoding on my browsers. To enable hardware decoding in Chromium based browsers on Linux, you need to add command line parameters ("--enable-features=VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL). To make these permanent, you can put them at the end of lines starting with "Exec" in their .desktop files

This is straightforward enough, but the problem is, whenever there is a software update to any of these browsers, its .desktop file is overwritten so you have to do it again. After getting fed up with this, I decided to write this script.

Run it and it will ensure that any Exec lines in the listed desktop files that don't end in the required parameters will have them appended, Any that still do have them will be left alone. The updated file will be copied to ~/.local/share/applications where it will override the originally installed .desktop file. As it will be unaffected by subsequent updates, the VAAPI parameters will survive them, but sometimes icon paths etc are changed in updates, which would require this script to be re-run to take account of that.

Setting up

The desktopFiles array should contain the full paths of all the browser desktop files you want to be able to keep the command line parameters on. Mine is :-

declare -a desktopFiles=("/var/lib/snapd/desktop/applications/brave_brave.desktop"
                         "/var/lib/snapd/desktop/applications/chromium_chromium.desktop"
                         "/usr/share/applications/google-chrome-beta.desktop"
                         "/usr/share/applications/google-chrome.desktop"
                         "/usr/share/applications/microsoft-edge.desktop")

The params variable should be set to the parameters you want to ensure are appended to the Exec lines in the files. For VAAPI video decoding and encoding this is :-

params="--enable-features=VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL"

Running

Run the script using your user account :-

./update-desktop-files.sh

Thats it!

update-browser-desktop-files's People

Contributors

richard-austin avatar

Watchers

 avatar

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.