26 January 2025

Configuring Multimedia Keys in LXDE for use in Firefox Add-ons

# Configuring Multimedia Keys in LXDE for use in Firefox Add-ons

## Problem Definition and Environment

In my quest to use multimedia keys on my "Microsoft Curve Keyboard "within the LXDE environment on Debian, I encountered a frustrating challenge. Specifically, I wanted to configure the multimedia keys to work with the "Text Aloud" add-on in Firefox. Firefox only accepts shortcuts using **Alt** or **Control**, so I needed to remap the buttons to other key combinations.

## Extracting Key Codes

To address this issue, I first needed to determine how my multimedia keys were being recognized by the system. I utilized the `xev` command, which allows you to monitor key events in X11. By running the command `xev | grep keycode`, I was able to see the keycodes associated with my multimedia buttons. The output showed that the keys were detected as follows:

```
state 0x10, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
state 0x10, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
state 0x10, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
state 0x10, keycode 172 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
```

This output confirmed that the multimedia keys were indeed recognized by the system, and I could proceed to map them to the desired actions.



Another way to extract the codes is



```

$ xbindkeys -mk
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.

--- Press "q" to stop. ---
"(Scheme function)"
    m:0x10 + c:172
    Mod2 + XF86AudioPlay
"(Scheme function)"
    m:0x10 + c:122
    Mod2 + XF86AudioLowerVolume
"(Scheme function)"
    m:0x10 + c:121
    Mod2 + XF86AudioMute
"(Scheme function)"
    m:0x10 + c:123
    Mod2 + XF86AudioRaiseVolume
"(Scheme function)"
    m:0x10 + c:24
    Mod2 + q

```



## Initial Attempts and Failures

My first approach involved using `xbindkeys`, a utility that allows you to bind keys to specific commands. I created a configuration file to map the multimedia keys to shortcuts that would invoke the appropriate actions in Firefox. Here's a snippet of my initial configuration:

```bash
"xdotool key Alt+p"
    XF86AudioPlay
"xdotool key Alt+o"
    XF86AudioMute
"xdotool key Alt+comma"
    XF86AudioLowerVolume
"xdotool key Alt+period"
    XF86AudioRaiseVolume
```

To reload I do

`pkill xbindkeys; xbindkeys`





However, despite `xbindkeys` running successfully and detecting the keys, pressing the multimedia buttons did not trigger the expected actions in Firefox or any other application. I tested various combinations and configurations, but nothing seemed to work.



I must say that the `xdotool key Alt+period` command was working well, even within Firefox.


I tested that by doing 

`sleep 2; xdotool key Alt+period` 

on a terminal and then quickly moving the focus to Firefox.




## An Alternative Approach: Using `lxde-rc.xml`

After some troubleshooting, I decided to take a different approach by directly modifying the `lxde-rc.xml` configuration file, which is used by the LXDE desktop environment to manage keyboard shortcuts among other things.

To implement this, I edited the `lxde-rc.xml` file and added keybindings for the multimedia keys. Here's how I initially set it up:

```xml
<keyboard>
    <keybind key="XF86AudioLowerVolume">
        <action name="Execute">
            <command>xdotool key Alt+comma</command>
        </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
        <action name="Execute">
            <command>xdotool key Alt+period</command>
        </action>
    </keybind>
</keyboard>
```

To test if this approach was working correctly, I replaced the `xdotool` command with a simpler command that opens a terminal (`lxterminal`). This way, I could easily observe whether the keybindings were functioning. The modified keybinding looked like this:

```xml
<keybind key="XF86AudioLowerVolume">
    <action name="Execute">
        <command>lxterminal</command>  <!-- For testing -->
    </action>
</keybind>
```

After saving the changes, I reloaded the Openbox configuration by running `openbox --reconfigure`. When I pressed the multimedia key for lowering the volume, a terminal opened, confirming that the keybinding was now functional.

## Conclusion

Mapping multimedia keys in Linux environments often requires persistence and a methodical approach. By extracting keycodes, experimenting with tools like `xbindkeys`, and utilizing the `lxde-rc.xml` file, multimedia keys can be successfully configured for specific applications, such as Firefox add-ons. These steps demonstrate the flexibility and customization options available within Linux desktop environments, making it possible to tailor functionality to individual requirements.


05 January 2025

Problem: "Toshiba Satellite A300" shuts-down hard during boot-up.

Problem with "Toshiba Satellite A300". Shuts down hard during bootup.

  • Some extra details:
Bios  1.70 of 11/24/2008
Ram 3GB
Satellite A300 PSAGCE-0c500wce

  • Problem:
As of 2025, the battery completely died more than a year ago.
With or without it inserted, the computer boots up, but right after the Windows logo appears, it shuts-down, consistently.


  • Some troubleshooting:
If I enter in the BIOS, I can stay there, change settings, and the computer runs fine.

I tried to boot up from some linux-live-usb distributions. I was surprised to see that with some it would work, with others the same problem would appear.

This would happen with and without the HD attached to the computer. I thought the HD could be causing the failure.

I narrowed it down to the boot parameter  "acpi=off". With it in the kernel parameters of the boot process, the linux would boot up without problems.


  • My guess:
When Windows/Linux tried to communicate with the BIOS to get ACPI information, whatever the 'dead-or-missing-battery' was responding/not-responding was causing the computer to shut-down.

Maybe it was not designed-and-tested to work with no battery.

Maybe this problem is fixed with a BIOS update (it has never been updated on that laptop), however there is a problem... Toshiba website and support for this model is gone. There are BIOS updates out there, but not from Toshiba. So you either play the cards or not.

  • Workaround
Knowing how to successfully boot Linux I looked for a similar way on Windows. It is the "Rescue Mode". Just press F8 repeatedly right after pressing the power-button. It will instruct Windows (W7 I believe it was) to give you a menu and choose what to load.

I returned the laptop to my friend with instructions on how to boot in that way.

  • Misc
Luckily it didn't have any of the many other problems that Model can have (I researched a lot).

I also learnt about about  https://www.hirensbootcd.org

It is like a Linux-live-usb but with Windows. Unfortunately I didn't find the way to prevent it from talking to the ACPI so within seconds/minutes of booting it would cause the shutdown. But it is good to know it is there if you need to update the BIOS and you require a Windows for that (because the vendor gives you a .exe ) and you don't have a Windows around.

Hope it helps others.

Too Cool for Internet Explorer