maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Just leaving this here - Keyboard Shortcuts - FXTEC (https://talk.maemo.org/showthread.php?t=101036)

MadDev 2020-05-29 14:36

Just leaving this here - Keyboard Shortcuts - FXTEC
 
UPDATE

New instructions and code here https://github.com/Logic-gate/Keymapper

END UPDATE

DO NOT FOLLOW INSTRUCTIONS HEREIN

Just leaving this here because I forgot both my TJC and my TJC-linked email passwords. :mad:

Keyboard Shortcuts...the wrong way.

Download this (https://gist.github.com/Logic-gate/1...le-keymapper-c)

this (https://gist.github.com/Logic-gate/1...le-keymapper-h)

...into your home dir. Something like /home/nemo/scripts/keymapper/ or whatever...

Install make, gcc, and libconfig
Code:

pkcon install gcc make libconfig
run
Code:

make
no errors should be returned.

in the terminal do...
Code:

./keymapper listen
start typing...you should get an output like
Code:

CODE --> 125
CODE --> 100
..etc

memorize the codes...yes, using your memory.

create a file called keymap.config

Code:

touch keymap.config
copy the following to it.

Code:

// Not recommended to run keymapper as root,

name = "Fxtec Pro 1 Keymap shortcuts";
keymap =
{
  testing = { holder =  125;
                          trigger = 14;
                          cmd = "echo this works";
                                          };
};

now run
Code:

./keymapper start
use fx key + backspace

the output should be
Code:

this works
...

This works kind of like the sym(I think it's called that) button on the n900, where you have an instigator and then a trigger. The holder is the instigator. Once you click it(press the physical button) it registers to a file called key.log, the next button you use is the command trigger, as in what actually runs whatever you give it.

the config format is as follows:

Code:

// Not recommended to run keymapper as root,
name = "Fxtec Pro 1 Keymap shortcuts";
keymap =
{
  something_to_remeber = { holder =  the first button you press;
                          trigger = the second button you press;
                          cmd = a command;
                                          };

 another_thing = { holder = the first button you press;
                            trigger = the second button you press;
                            cmd = a command; };
};

You can add as many as you like...just keep in mind the following
  • This is not the best approach to shortcuts
  • when you run ./keymapper start, it need to run indefinitely
  • The shortcuts will be active even if the device is locked.

If you're going to run it as root...even though I do not recommend it, yet still do so personally. Don't run any command you dont fully know its outcome.

To run applications, you'll need to export the runtime dir

Code:

export XDG_RUNTIME_DIR=/run/user/100000
you can then use
Code:

#under root
su nemo bash -c 'harbour-piepmatz &

or
Code:

#and under nemo
harbour-piepmatz &

Final thoughts

This is not the best way of doing shortcuts...it's hacky, sloppy, and buggy. It is however a way nonetheless. So it is what it is until someone else makes a better and safer alternative...

demo(https://twitter.com/m4d_d3v/status/1...227333120?s=20)

here's the config from the demo--without screenshots. Also disregard the first entry orientationLock...iit's for something else.

Code:

// Not recommended to run keymapper as root,

name = "Fxtec Pro 1 Keymap shortcuts";
keymap =
{
  orientationLock = { holder =  125;
                                  trigger = 14;
                                  cmd = "cat /home/nemo/.dynamic-state | grep 1 ; echo $? > /home/nemo/.dynamic-state";
                                          };
  twitter = { holder = 125;
                            trigger = 100;
                            cmd = " su nemo bash -c 'harbour-piepmatz &'"; };
  browser = { holder = 125;
                            trigger = 57;
                            cmd = "su nemo bash -c '/usr/bin/sailfish-browser &'"; };
  wifi_off = { holder = 125;
                            trigger = 16;
                            cmd = "dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:false"; };
  wifi_on = { holder = 125;
                            trigger = 17;
                            cmd = "dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:true"; };
};



All times are GMT. The time now is 00:32.

vBulletin® Version 3.8.8