Giter Club home page Giter Club logo

lphk's People

Contributors

dependabot[bot] avatar dmac31415 avatar duncte123 avatar erikskinnari avatar lyiriyah avatar nimaid avatar nullmember avatar silencx avatar snags avatar still34 avatar thetimewalker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lphk's Issues

Looping while pressing

Hello

Is there a way to loop something while I press it? I want a volume up button that keeps going up untill I release the button.

Thanks in advance

Characters which require escaping in Python scripts cannot be used for TAP or PRESS.

I'm unable to use , /, or ' as valid targets for a TAP or PRESS command. I believe this is because these characters are considered "special" and require escaping in order to use them as plain characters.

Upon checking in pynput using a short script you can see what pynput sees when you type a backslash:

from pynput import keyboard

def on_press(key):
... try:
... print('alphanumeric key {0} pressed'.format(
... key.char))
... except AttributeError:
... print('special key {0} pressed'.format(
... key))
...
def on_release(key):
... print('{0} released'.format(
... key))
... if key == keyboard.Key.esc:
... # Stop listener
... return False
...

Collect events until released

... with keyboard.Listener(
... on_press=on_press,
... on_release=on_release) as listener:
... listener.join()
...
Key.enter released
alphanumeric key \ pressed
'\' released
alphanumeric key \ pressed
'\' released

Note the escaped version of the backslash: '\'.

Autostart

Is there any option to autostart LPHK on PC boot load a config/layout and run it in the Background
Is there anything planed for the future?

LPHK Crash when redetecting Launchpad

OS: Ubuntu 18.04
Launchpad: MK2
Python versions (python --version)
System: Python 2.7.15+
Conda: Python 3.7.5

When pressing connect to launchpad the following error occurs, when switching usb ports and pressing redetect the program crashes
image

Program output (full output):

duncte123@duncte123 ~> bash
duncte123@duncte123:~$ conda activate LPHK
(LPHK) duncte123@duncte123:~$ python --version
Python 3.7.5
(LPHK) duncte123@duncte123:~/Desktop/LPHK$ git pull
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 53 (delta 37), reused 35 (delta 19), pack-reused 0
Unpacking objects: 100% (53/53), done.
From github.com:nimaid/LPHK
   d52345a..cc4d1ca  master     -> origin/master
Updating d52345a..cc4d1ca
Fast-forward
 README.md                        | 304 +++++++++++++++++++++------------------
 install_beta/install_windows.bat |  57 ++++----
 window.py                        |  15 +-
 3 files changed, 210 insertions(+), 166 deletions(-)
(LPHK) duncte123@duncte123:~/Desktop/LPHK$ python LPHK.py 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib conf.c:3558:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/usr/lib/alsa-lib/libasound_module_conf_pulse.so: libasound_module_conf_pulse.so: cannot open shared object file: No such file or directory)
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fa47d9ed740 (most recent call first):
Aborted (core dumped)
(LPHK) duncte123@duncte123:~/Desktop/LPHK$ 

LSUSB output:

duncte123@duncte123 ~> lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2b Intel Corp. 
Bus 001 Device 002: ID 0bda:58d2 Realtek Semiconductor Corp. 
Bus 001 Device 004: ID 1235:0069 Focusrite-Novation 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
duncte123@duncte123 ~> 

LPHK.py not opening, at all

It opens a command line for a split second, and then closes, with no output

I tried python LPHK.py, and got:
python LPHK.py
File "", line 1
python LPHK.py
^
SyntaxError: invalid syntax

With python3 LPHK.py:
python3 LPHK.py
File "", line 1
python3 LPHK.py
^
SyntaxError: invalid syntax

For some reason it won't allow spaces at the starts of lines, thanks GitHub

_tkinter.TclError: couldn't recognize data in image file "resources/info.png"

I cloned this on my mac. Python 3.6 in a virtual environment. Installed the dependencies, and then ran the script as in the instructions and get this error trace.

Traceback (most recent call last):
File "LPHK.py", line 56, in
main()
File "LPHK.py", line 52, in main
window.init(lp)
File "/Users/jandrews/Projects/innovation-cmd/LPHK/window.py", line 26, in init
make()
File "/Users/jandrews/Projects/innovation-cmd/LPHK/window.py", line 335, in make
app = Main_Window(root)
File "/Users/jandrews/Projects/innovation-cmd/LPHK/window.py", line 33, in init
self.info_image = tk.PhotoImage(file="resources/info.png").subsample(2, 2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/init.py", line 3539, in init
Image.init(self, 'photo', name, cnf, master, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/init.py", line 3495, in init
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "resources/info.png"

Simply assigned keys are not accepted in the game

Hi!
I assigned simple buttons to the launchpad.
I want to use it with the game Elite: Dangerous.

If I press the assigned keyboard shortcuts on the Launchpad in a note, then I get the result directly. This means that the inputs via the launchpad actually work like a keyboard.

However, this does not work in the game.
The game does not accept any buttons from the launchpad.

Am I missing something here?

Not able to detect my launchpad

I have my novation launchpad MK2 plugged into my galliumos linux laptop, and for some reason, it can't be detected. here is the log:

chrx@chrx:~/Desktop/LPHK-master$ python3 LPHK.py
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib conf.c:3523:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib conf.c:3523:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
Traceback (most recent call last):
File "LPHK.py", line 58, in
main()
File "LPHK.py", line 56, in main
shutdown()
File "LPHK.py", line 49, in shutdown
os.execv(sys.executable, [""" + sys.executable + """] + sys.argv)
FileNotFoundError: [Errno 2] No such file or directory

Here is what it looks like when I type lsusb

chrx@chrx:~/Desktop/LPHK-master$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2a Intel Corp.
Bus 001 Device 002: ID 04f2:b567 Chicony Electronics Co., Ltd
Bus 001 Device 015: ID 1235:0069 Focusrite-Novation
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Any help is appreciated. Thank you.

You must be root to use this library on linux when using the default layout's volume function on Arch

The basic steps to the error where:

  1. Installing using the beta installer
  2. Changing the env to the LPHK env
  3. Running LPHK.py (with plugged in launchpad)
  4. Loading the default example layout

The following error occurs when i press the left, light up and down keys:

[scripts] (2, 0) Starting asynchronous script in background...
[scripts] (2, 0) Now running script...
[scripts] (2, 0)    Simple keybind: prev_track
Exception in thread Thread-67637:
Traceback (most recent call last):
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/tmp/LPHK-master/scripts.py", line 523, in run_script
    idx = main_logic(idx)
  File "/tmp/LPHK-master/scripts.py", line 492, in main_logic
    kb.press(key)
  File "/tmp/LPHK-master/kb.py", line 23, in press
    keyboard.press(key)
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/__init__.py", line 396, in press
    send(hotkey, True, False)
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/__init__.py", line 383, in send
    _os_keyboard.press(scan_codes[0])
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 158, in press
    write_event(scan_code, True)
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 144, in write_event
    build_device()
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/MYUSER/.conda/envs/LPHK/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.

Trying to start LPHK with sudo brings a whole other problem along (tried it as suggested by @nimaid ):

(LPHK) [MYUSER@HOSTNAME LPHK-master]$ sudo /home/MYUSER/.conda/envs/LPHK/bin/python /tmp/LPHK-master/LPHK.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Traceback (most recent call last):
  File "/tmp/LPHK-master/LPHK.py", line 58, in <module>
    main()
  File "/tmp/LPHK-master/LPHK.py", line 53, in main
    init()
  File "/tmp/LPHK-master/LPHK.py", line 33, in init
    sound.init(PATH)
  File "/tmp/LPHK-master/sound.py", line 16, in init
    m.init()
pygame.error: No available audio device

My setup is:

  • Laptop running Arch Linux
    • I use i3 as my window-manager
    • I have alsamixer and pulseaudio installed for everything related to audio i/o
  • Launchpad MK2
  • The LPHK installation is located in /tmp/LPHK-master
  • I have sudo rights

Please comment if additional information is needed - I'll try to respond asap.

LP Mini not working.

Hooked up my LP Mini and tried to connect but connection failed after many redetects.

Problem in SOUND/How to toggle keys

If I use SOUND, the sound file's pitch is lowered when it is played. And plus how can i toggle keys by commands? I want to toggle Q key(i'll use autohotkey as ctrl+F23 as there isn't q in LPHK) for voice chat in games, but I don't know how. By the way is toggling keys is supported?

+) plz make toggling lights

Install hell on Linux

@nimaid
OS: Ubuntu 18.04, fresh install. (Remember this)
PC: Thinkpad T430, i5 3320m, 16GB RAM, Samsung 256GB SSD
LP: LP MKII
Issue: I run the installer, it installs Conda fine. But when it tries to install LPHK, it doesn't create directories in ~/.conda and bitches to me that I don't have write permissions. I run as root, same issue. I run chown lyiriyah .conda. Still bitches. So I create the directories, change the ownership to me and run it again. It completes successfully. I run RUN.bash and it loads and doesn't detect my Launchpad. Happy fun. I am installing Conda myself as I write this, maybe that will change something.

PRESS and TAP are not global on windows

While testing the program out on windows I noticed that the key commands like TAP, PRESS and @SIMPLE are only executed for the window that is currently focussed, this breaks using LPHK for stuff like controlling obs while you are streaming

Suggestion (Sorry for issue area)

Add the function to have a button to switch to another profile, or have the ability to open the profile with open file ability and load it up that way. I would love to have my right circular keys as buttons for 8 different profiles.

shift_r doesn't exist

So currently I'm trying to bind vrchat gestures to my launchpad, these keybinds are:
shift+f1 through 8 for left hand
right shift+f1 through 8 for right hand

left hand works like a dream with the code:

PRESS shift
PRESS f1
WAIT_UNPRESSED
RELEASE shift
RELEASE f1

right hand however cannot be bound since when i replace shift with shift_r it comes up with an error message saying the key does not exist.

Typo in LPHK.py

The is a typo in the shutting down function.
Wanted to commit a branch for it but that doesn't seem possible so here's the typo

Line 50 :
sys.exit("[LPHK] Sutting down...") -> sys.exit("[LPHK] Shutting down...")

Shift key automatic keyup when another key is tapped

Script:

PRESS win
PRESS shift
TAP right
RELEASE shift
RELEASE win

Expected behavior from JS Key tracker (https://unixpapa.com/js/testkey.html):

keydown  keyCode=91  ([)   which=91  ([)   charCode=0        
keydown  keyCode=16        which=16        charCode=0        
keyup    keyCode=39  (')   which=39  (')   charCode=0        
keyup    keyCode=16        which=16        charCode=0        
keyup    keyCode=91  ([)   which=91  ([)   charCode=0        

91 is win, 16 is shift and 39 is right arrow

Actual behavior:

keydown  keyCode=91  ([)   which=91  ([)   charCode=0        
keydown  keyCode=16        which=16        charCode=0        
keyup    keyCode=16        which=16        charCode=0        
keyup    keyCode=39  (')   which=39  (')   charCode=0        
keydown  keyCode=16        which=16        charCode=0        
keyup    keyCode=16        which=16        charCode=0        
keyup    keyCode=91  ([)   which=91  ([)   charCode=0  

Notice the 2 extra lines at line 3 and 5. I've tried variants of PRESS, TAP, ASYNC to no avail.

Edit: I'm using the Launchpad Pro (but other shortcuts seem to work fine, for example this script works fine:

PRESS ctrl
PRESS shift
TAP n
RELEASE shift
RELEASE ctrl

DELAY 0.5

PRESS ctrl
TAP k
TAP o
RELEASE ctrl

Auto-Importing Functions

Hello everyone,
The idea is to have a main script that at a fixed point (startup) wuold read all files in a sub-folder (/commands) and if the file has the right format (normal .py script + a specific header) it would import it as an available command/function in the LPHK language.

The script will check for the libs that it needs to run that specific script and install it via pip.

In the header, there will be a way to rename functions.
When using an importend function you need to use the name of the file "x" and the name of the function "y".
In the LPHK script, you will need to write x.y as a command.
When importing a file, the script will create a dictionary and associate a specific command with a custom name.
Something like function['WEB_NEW']=Web.open_ new.
Thanks to this, you'll be able to use the custon name and make the LPHK script look "nicer".

Find mouse position

I'm having issues to get the mouse coordinates of where I want it to click.

This issue could be solved by adding a command to LPHK Script, that displays the current mouse coordinates somewhere.

As an example:
M_COORD would show the current coordinates of the mouse in a pop-up window

If you could add this command, it would really help me programming my macro keys.

LPHK on Mini?

I absolutely love the concept of LPHK, but I only own a Launchpad Mini. Is it possible you can work towards a solution for Launchpad Mini? And if so, could I request a rough estimate on when I could use LPHK with Mini?
Thanks in advance.

Edit: I apologise, I had not read the readme thoroughly.

Windows + L doesn't work

I tried to set up a button to lock my computer using the key combination Windows + L.
The Code I used looks like this:
PRESS windows
TAP l
RELEASE windows
However it didn't do anything, but when I used a combination like Win + E (for opening a file explorer) it worked just fine...

How to bind numeric keys?

Hi @nimaid

I was wondering if there is a way to map numeric keys.
If i do a @simple 4, the 4 on the normal keyboard will be pressed, but I can find the way to press 4 on the numeric block of the keyboard.

Best regards
Rasti

Add function for layout

Hi,
I have an idea :
Make a function to change layout when you click on a button.
They can be good to have multiple board and easy to change layout.

(sorry for my english, i'm french)
great project

Possible to load new layouts?

Any way to make it so i can key in to load certain layouts on button press so i can switch between layouts faster?

STRING accents problem

Hey !
When i use the "STRING" argument, i can't use accents like:
"STRING รฉ". The "รฉ" simply not appear :/

(sorry for my english, i'm french)

Thanks,
Mathitux

Volume Controls Not Working on Mac

The volume controls are not working on Mac.

System Version: macOS 10.15.5
Script: TAP vol_up
Log:
---------------- BEGIN LOG 15/07/2020 14:23:12 ----------------
LPHK - LaunchPad HotKey - A Novation Launchpad Macro Scripting System
Version: 0.3.0
Platform: Macintosh
Is compiled executable: False
Is portable: True
Operating path: /Users//downloads/LPHK-0.3.0
User path: /Users//downloads/LPHK-0.3.0
Program file path: /Users//downloads/LPHK-0.3.0
Program file: /Users//downloads/LPHK-0.3.0/LPHK.py
Log file (this file): /Users//downloads/LPHK-0.3.0/LPHK.log

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

[scripts] (0, 7) No script running, starting script in background...
[scripts] (0, 7) Now running script...
[scripts] (0, 7) Tap key vol_up
[scripts] (0, 7) Script done running.

Repeat command while button is pressed

Hi!
Firtst of all, thank you ever so much for this project! I really appreciate this ๐Ÿ‘

Is there a function which allows for the command to repeat while the button is pressed?
For instance with vol_down.

While button is pushed down, repeat @simple vol_down until button is released.

Makes sense?

Using mp3 sounds

I am putting a mp3 sound into the examples file and using this code:
SOUND examples\meme.mp3
Keep getting a error message saying that it can not be found.
I have the default wav files in there and they work fine with the:
SOUND examples\airhorn.wav
And it is in the exact same file location.

pip.exe not opening?

Okay, I get this isn't about your software but it still baffles me. When I open pip.exe, it opens, and closes immediately.

Sending SOUND to specific output

Hi it would be nice if you could make it so that the sound could be played out of multiple outputs. so for example one through my headphones and one thorugh my mic (so that it would be an actual soundboard)
ty

Wrong keybinds?

Today i made a layout to play fortnite with my launchpad mini and i had two problems:

I assigned "TAP d" to a key and when i ran it... it muted the sound of the computer;
I assigned "TAP g" to another key and it started playing music in spotify.

I once tested this and i had no problems.

My OS: Windows 10

Allow parameter for OPEN

Can you allow parameters for OPEN? I like to start serialsend.exe and give lots of info to the program. At the moment I get error, file not found.

Loading a layout on startup

I've been using the application for a month now. And everytime I boot up, I need to launch the app, press the Live Mode pop-up for Launchpad Pro and then proceed to load my layout. I was thinking maybe there is a way to automate this, or even just load the last opened layout on the next boot.

Custom Launchpad Pro firmware isn't recognized properly

Hi Ella,

I wanted to try out LPHK with my Launchpad Pro, with a custom firmware installed on it (https://github.com/mat1jaczyyy/lpp-performance-cfw) and when I try to launch LPHK, it recognizes my LP as a Launchpad Classic/Mini/S and first of all, the layout is all messed up and the buttons don't do anything. I'm also encountering this error when first starting LPHK.
Exception in thread Thread-2: Traceback (most recent call last): File "D:\Programmi\Miniconda3\envs\LPHK\lib\threading.py", line 926, in _bootstrap_inner self.run() File "D:\Programmi\Miniconda3\envs\LPHK\lib\threading.py", line 1177, in run self.function(*self.args, **self.kwargs) File "D:\Git Repositories\LPHK-master\lp_events.py", line 28, in run pressed[x][y] = False IndexError: list index out of range

I don't know what to do about it.

TheLifeGamingYT

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.