• How to map specific actions to keys?


    Hi all, I’ve got a list of actions that I wish I could map onto specific key combinations on my laptop. I understand the basic principal of doing this is:

    Prepare executable script => Map said script onto key combination

    This is the idea that I got from reading Arch Wiki. Unfortunately as a Linux newbie, I have no idea on how to put this into action.

    My first issue is that I have no idea how to prepare the scripts, and how to make them executable. The following list are the actions that I want

    1. Laptop screen brightness UP
    2. Laptop screen brightness DOWN
    3. Laptop volume UP
    4. Laptop volume DOWN
    5. Laptop volume MUTE/UNMUTE

    Any place that I can get these scripts already prepared? Also, what are the tools that I need to download as a prerequisite for these scripts to work?

    After the scripts for said actions above are ready, how do I map them?

    Help is greatly appreciated, thanks.

  • WEhat is your Desktop Environment?

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @joekamprad, it’s Xfce

  • @bitglass said in How to map specific actions to keys?:

    Xfce

    Settings -> Settings Manager -> Keyboard -> Application

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @joekamprad, thanks, found it

    Now the only problem are the scripts

  • @bitglass said in How to map specific actions to keys?:

    Laptop screen brightness UP
    Laptop screen brightness DOWN
    Laptop volume UP
    Laptop volume DOWN
    Laptop volume MUTE/UNMUTE

    for this you do not need to make some scripts there should be already an option for that…

    i use this commands inside my i3-wm setup:

    Pulse Audio controls

    pactl set-sink-volume 0 +5%
    pactl set-sink-volume 0 -5%
    pactl set-sink-mute 0 toggle

    Sreen brightness controls

    xbacklight -inc 20
    xbacklight -dec 20

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • “Handle display brightness keys” in Xfce Power Manager is checked?

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @joekamprad

    Just checked, “Handle display brightness keys” is checked, never knew this was built into Xfce. Thanks for pointing out.

    As for the other commands such as pulse audio, do you mean they are already handled like the screen brightness commands (pre-mapped to laptop keys by software)?

  • yes should be as xfce is a complete Desktop Environment, it only can happen that your hardware is kinda exotic and you need to tweak…

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @joekamprad

    Sorry for dumb questions and thanks for helping out!

    Is the audio pre-mapped function handled by Pulse Audio, or another program? Had a look in Pulse Audio settings and can’t seem to find it.

    I’ve found a similar post for volume control here:
    https://bbs.archlinux.org/viewtopic.php?id=124513

    However this one requires the use of scripts, and I think that’s not what you’re referring to?

  • you can put any script you want to a keaybinding by adding a new one, put in the command and press the button you want to bind it…

    this should work also for you:

    pactl set-sink-volume 0 +5% : for raise volume
    pactl set-sink-volume 0 -5% : for lower volume
    pactl set-sink-mute 0 toggle : for mute and unmute

    [updates once a week] = [90% less problems]
    [Li{u}n//u//{i}x] since 1988 - overcoming failure means success
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @joekamprad

    Noted, thanks for the help, appreciate it

map1 specific6 keys7 actions1 Posts 12Views 283
Log in to reply