• Fedora 44 and Firefox 154 crashing: “the specified toplevel id is already used”

    It does not happen often but today after rebooting Fedora Kinoite since the previous OS update Firefox crashed and would no longer load. This is a big issue since we all rely on the browser for everything plus the fact that my session includes tons of open windows and tabs which I would rather not lose.

    Luckily I already had a Flatpak version of Firefox installed from previously which I rarely use. It was installed for some codec issues with Ubiquiti Unifi Protect as well as for certain Youtube videos. This version does not contain all my user profile data or session but at least I could start digging around.

    A couple of weeks ago the Firefox Fedora package maintainer enabled KDE’s session restore feature (not the same as Firefox’s own session restore). However this broke the compatibility with Wayland crashing with “the specified toplevel id is already used“. To be fair I am not too much into the inner workings of XDG, so I tried to just get a work-around.

    The obvious one of starting in X11 actually worked. It launched Firefox and even restored my session. But it was utterly laggy compared to the smoothness of Wayland. If you want to try simply run this in the console:

    MOZ_ENABLE_WAYLAND=0 firefox

    Fortunately I am not the only user affected so there were a few bugs about the issue of which #2059617 has become the principal. Comment 10 mentioned the option to disable the Wayland session and it worked flawlessly. Find your Firefox profile in your home directory (e.g. $HOME/.mozilla/firefox/xxxxx.default-release) and add this line to the end of prefs.js:

    user_pref("widget.wayland.session-management.enabled", false);

    Now restart Firefox and all should be back to normal, Wayland working and your browser session restored.

    I left a comment in the same bug in case anyone needs to get up and running quickly. Hopefully a fix will be out soon so people that are not aware of these work-arounds can launch Firefox again.

  • Procrastination, tasks, notes, and brain overload

    I am fan of simple post-it sized notes that I can have in front of me in areas which I can quickly visualise and remember tasks and appointments.

    Despite being a technologist there is nothing quicker, simpler and easier than taking a pencil and writing a few words, a time/date and any additional information in an ultra summarised manner on a piece of paper.

    No matter how many applications I have come across, either on the mobile or the computer, they have never hit me with ease of use or a quick overview of upcoming or pending tasks. Especially when a lot of tasks are added it becomes a task in itself to manage the task list.

    My main reason for jotting down tasks is that I can feel my brain having the extra overview after delegating my memory to a piece of paper. That I no longer have to keep this task tracked and I can use the freed resource for other things conveys a feeling of relaxation and inner peace. This may ring a bell for some or completely opposite seem ridiculously for others, to each his own.

    Since I get a lot of ideas, thoughts and tasks popping up at random hours, and I am not always near a notepad, and even if I was, the amount of notes needed would rapidly defeat the purpose of having the most important tasks floating around to quickly see.

    It is a bit like people that prioritise everything as critical, meaning that at the end there will be no priorisation. Therefore my notes are mainly for important appointments or urgent deadlines that I must not forget. All my other nice to have tasks are usually written down on an A4 as bullet-points which at the end gets messed up or saved and found months later, or if not jotted down simply forgotten to be remembered a few weeks down the line again.

    The result is frustration that I cannot have my urgent tasks at hand, while still having space to just keep adding more mundane or no time limit tasks to my list, while still only having my critical tasks highly visible.

    For people fighting against procrastination I would mention that having many tasks of equal priority in front of you, makes it incredible hard to select one and just start it. The priorisation chain of thought will most of the times end up consuming more than the time any of the tasks would take to accomplish, but that is analysis paralysis in a nutshell.

    So I built my concept of what such tool should be:

    • Easily accessible everywhere
    • Quick to add a new thought, task or idea
    • No to-do lists to manage
    • Only a single task is ever visible
    • Just a few words per task
    • Priorisation, but not levels, either do now or later
    • Working across one’s devices (sync)
    • Overview to see done tasks, a pat on the back
    • Zero gimmicks

    The result is doit.ninja which I have been dogfooding over the last months and must say has done wonders to speed up task completion, offload brain resources, remember important events, and simply feel more accomplished.

    Liberating old tasks from one’s mind that had been lingering around but never got done is a great sensation. I have this oddity that as soon as I sit down at the computer, I forget what I sat for, only remembering again once I turn off the screen. I assume this is due to the sheer amount of new inputs and duties on the computer to act upon taking my focus away.

    To use the application simply install it and add the widget to your front home screen. The widget needs to be visible as soon as you open your device to have an effect. Everything is really self-explanatory but the concept is:

    • Add a task
    • Define priority if any
    • Do it!

    The tasks will show up in a priority defined by the application’s logic, with more weight to urgent and upcoming tasks. The principle is that once you see a task you do it and hit “Done“. If you cannot, you hit “Later” and will see the next task.

    Now, go get something done… doit.ninja!

  • Running Android Studio Flatpak in Wayland

    Wayland has been tested in Android Studio for quite some time. Despite officially not being stable yet it works very well and removed the mouse stuttering or lag I personally was experiencing on XWayland (X11).

    I created an issue and added a PR to the Android Studio Flatpak repository, however I had to close it as Wayland is not considered stable yet.

    Instead I added some instructions to the documentation on how to use Wayland instead of running Android Studio in XWayland (X11).

    By simply enabling the Wayland permission in the Flatpak advanced settings for Android Studio it will work on next launch. The same can also be achieved in the console:

    $ flatpak override --user --socket=wayland com.google.AndroidStudio

    Please note that the AVD Emulator will still continue to run on XWayland (X11) as it does not yet include Wayland Qt libraries so do not remove the default X11 permission just yet.

    Once launched you can go to Help > About and click the blue “Copy and Close” button. When pasted into the text editor you will see near the top either of these two lines:

    Toolkit: sun.awt.wl.WLToolkit (Wayland)

    Toolkit: sun.awt.X11.XToolkit (X11)

  • Android Studio Emulator (AVD) is already running

    Sometimes in Android Studio the AVD or Android Emulator does not terminate properly.

    Upon next launch this annoying “device is already running” and a process ID warning will pop up.

    This warning happens because there is a lock file (hardware-qemu.ini.lock) which once deleted will let you run the emulator again.

    The path is the following:

    $HOME/.var/app/com.google.AndroidStudio/config/.android/avd/Pixel_9.avd/hardware-qemu.ini.lock

    Obviously replace the example’s device name in the path (Pixel_9.avd) with your own device’s name.

  • Android Studio Flatpak light/dark theme automatic change bug fix

    It is nice to have the desktop automatically change its theme from light to dark at sunset. Most applications work by default without further action in Fedora Kinoite. However Android Studio despite supporting light & dark themes for ages did not offer the option to automatically change the theme in Linux until very recently.

    After enabling the “Sync with OS” setting unfortunately nothing happened. Not even a restart of the application changed the theme. Guess Linux is still Linux where everything needs a bit of dedication to properly work.

    So digging into the topic it is (what else!) a Flatpak permissions issue. The dbus communication is not going through between the system and the application. After enabling the permissions I managed to get Android Studio to read the current theme on launch. But this was just a dead end as the automatic switching was still not working, I had to restart Android Studio to pick the switched theme which was not great for the workflow.

    After some time scouting sources of both Android Studio (really IntelliJ IDEA by JetBrains) and the application’s Flathub repo, the culprit was found. Android Studio itself is working fine as on a non-atomic system not using the Flatpak version there is no problem. The issue was in the Flatpak’s environment that missed a specific component, namely dbus-tools. Inside this module the command dbus-monitor is found and this is missing from the current Flathub build.

    The dbus-monitor is used to do exactly as its name states, it monitors the dbus for changes (signals) and this is what Android Studio uses to get the “color-scheme” parameter from the system. If this command cannot be executed it just dies silently and automatic theme change will not work. In a non-atomic system dbus-tools is part of the core system but Flatpaks run in a bare-bones environment and in this case the module is not included.

    To confirm this hypothesis I created my own Flatpak including dbus-tools:

    {
      "name": "dbus-tools",
      "buildsystem": "meson",
      "config-opts": [
        "-Dtools=true",
        "-Dmessage_bus=false",
        "-Dsystemd=disabled",
        "-Dx11_autolaunch=disabled"
      ],
      "sources": [
        {
          "type": "archive",
          "url": "https://dbus.freedesktop.org/releases/dbus/dbus-1.16.2.tar.xz",
          "sha256": "0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6beb7e2"
        }
      ]
    },
    ...

    There are a few more tweaks that are not relevant for the case in question but are just to get the Flatpak built with less overhead:

    $ cat com.google.AndroidStudio.Test.json 
    {
      "id": "com.google.AndroidStudio.Test",
      "runtime": "org.freedesktop.Sdk",
      "runtime-version": "25.08",
      "sdk": "org.freedesktop.Sdk",
      "command": "android-studio-wrapper",
      "finish-args": [
        "--socket=x11",
        "--socket=pulseaudio",
        "--socket=ssh-auth",
        "--socket=gpg-agent",
        "--share=ipc",
        "--share=network",
        "--device=all",
        "--filesystem=home",
        "--allow=multiarch",
        "--env=JAVA_HOME=/app/extra/jbr",
        "--talk-name=org.freedesktop.Notifications",
        "--talk-name=org.freedesktop.secrets"
      ],
      "modules": [
        {
          "name": "dbus-tools",
          "buildsystem": "meson",
          "config-opts": [
            "-Dtools=true",
            "-Dmessage_bus=false",
    	"-Dsystemd=disabled",
            "-Dx11_autolaunch=disabled"
          ],
          "sources": [
            {
              "type": "archive",
              "url": "https://dbus.freedesktop.org/releases/dbus/dbus-1.16.2.tar.xz",
              "sha256": "0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6beb7e2"
            }
          ]
        },
        {
          "name": "android-studio",
          "buildsystem": "simple",
          "build-commands": [
            "install -D -t ${FLATPAK_DEST}/bin/ apply_extra android-studio-wrapper",
            "echo '[Desktop Entry]' > test.desktop",
            "echo 'Type=Application' >> test.desktop",
            "echo 'Name=Android Studio Test' >> test.desktop",
            "echo 'Exec=android-studio-wrapper' >> test.desktop",
            "echo 'Icon=com.google.AndroidStudio.Test' >> test.desktop",
            "echo 'Categories=Development;IDE;' >> test.desktop",
            "install -Dm644 test.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop",
            "echo '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' > test.metainfo.xml",
            "echo '<component type=\"desktop-application\">' >> test.metainfo.xml",
            "echo '  <id>com.google.AndroidStudio.Test</id>' >> test.metainfo.xml",
            "echo '  <metadata_license>CC0-1.0</metadata_license>' >> test.metainfo.xml",
            "echo '  <project_license>Apache-2.0</project_license>' >> test.metainfo.xml",
            "echo '  <name>Android Studio Test</name>' >> test.metainfo.xml",
            "echo '  <summary>Test Build</summary>' >> test.metainfo.xml",
            "echo '  <description><p>Testing theme switching configuration.</p></description>' >> test.metainfo.xml",
            "echo '  <launchable type=\"desktop-id\">com.google.AndroidStudio.Test.desktop</launchable>' >> test.metainfo.xml",
            "echo '</component>' >> test.metainfo.xml",
            "install -Dm644 test.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml",
            "echo \"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'><rect width='10' height='10' fill='purple'/></svg>\" > test.svg",
            "install -Dm644 test.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg"
          ],
          "sources": [
            {
              "type": "extra-data",
              "filename": "android-studio.tar.gz",
              "size": 1541218005,
              "only-arches": [
                "x86_64"
              ],
              "url": "https://dl.google.com/dl/android/studio/ide-zips/2026.1.2.10/android-studio-quail2-linux.tar.gz",
              "sha256": "64445a54092e7056c6eb7f1a89ad116d0feec2ef5f965b8e594d62abdb58590f"
            },
            {
              "type": "script",
              "dest-filename": "apply_extra",
              "commands": [
                "tar xzf android-studio.tar.gz --strip-components=1",
                "rm -f android-studio.tar.gz"
              ]
            },
            {
              "type": "script",
              "dest-filename": "android-studio-wrapper",
              "commands": [
                "/app/extra/bin/studio $@"
              ]
            }
          ]
        }
      ]
    }
    

    Then you install flatpak-builder, build your custom Flatpak and when finalised you can test it out:

    $ sudo dnf -y install flatpak-builder git
    $ flatpak-builder --user --install --force-clean --disable-rofiles-fuse build-dir com.google.AndroidStudio.Test.json
    $ flatpak run --command=dbus-monitor com.google.AndroidStudio.Test
    

    If the last command displays content it means dbus-monitor is now part of your Flatpak’s environment and you can safely launch the full appplication:

    $ flatpak run com.google.AndroidStudio.Test

    I ran all inside a toolbx so that I can get rid of it again easily. Also it should not affect your existing Flathub Android Studio installation, it is a completely parallel Flatpak (com.google.AndroidStudio.Test).

    Now the best moment comes, going into Settings>Appearance and enabling “Sync with OS“. Immediately Android Studio should change its theme to the system one. An easy way to change your theme if you have sunrise & sunset as triggers, is to simply change your location in the KDE Plasma settings e.g. to the other side of the planet, then you can quickly revert back and forth.

    As this is only a personal solution I have also created an issue at the Flathub repo so hopefully we will soon see this Android Studio Flatpak correctly switching light to dark themes and viceversa automatically for everyone.