daisyUniverse / Keebie

Easy Second Keyboard support in Linux (With layers!)
84 stars 17 forks source link

Create a buildscript and add to the AUR / look into adding to other linux package managers #13

Open daisyUniverse opened 3 years ago

daisyUniverse commented 3 years ago

Pretty self explanatory, I don't yet know how to do this so I'm leaving this here so I don't forget to learn how

Data-007 commented 3 years ago

@robinuniverse steamdeck-ui is already in/on aur

Michael-E-B commented 3 years ago

@robinuniverse steamdeck-ui is already in/on aur

I fail to see how streamdeck-ui is relevant to keebie, maybe I'm just missing something.

parasbhanot commented 3 years ago

Creating Aur for Keebie does not look that difficult as we do not need to compile anything but before doing that we should create standard configuration directory as well as installation directory for keebie.py . Generally configuration files for programs like vim/neovim , dunst,fish,dxhd etc resides in /home/$USER/.config folder . In this case layer directory should reside in .config folder of user but i am not sure about installation directory of keebie.py as there are so many options.

if we standardise the layer directory and installation directory of keebie.py and layers we can write systemd service file which will run on any system and end user does not have to modify the path of keebie.py and change the name of user in keebie.service

Environment=XAUTHORITY=/home/$USER/.Xauthority # set it to your user name
ExecStart=/usr/bin/python3 <locaion of keebie.py>

what do you think ?

Michael-E-B commented 3 years ago

For the last week or so I've been working on digging through the Debian policy manual to try to figure out how to make a .deb package for Keebie. I just pushed a branch pkg with my results, none of it is ready for installation as keebie.py still doesn't know where to look for the other files, or that the other files need to be copied to the users home if they aren't present etc but I have been able to build an instalable package in a few ways.

There are three commits of interest:

9404dd2a has a very complex way to build a package that adds only one new folder to the project root and will require extra work for each format added.

c5a5432a have a simpler way that puts a debian/ folder to the project root and will require extra work for each format added.

4435869c uses a neat program called FPM to build many package formats very easily with next to no extra work required for each one, this method puts one folder in the project root. This is in my opinion the best of these options. FPM supports building for Arch, Debian, Red Hat, Snap and others.

parasbhanot commented 3 years ago

i have also been working on AUR packaging . it is working just fine on my Arch machine but the only problem is that udev rules are not installing for some reason .

Following are the contents of my PKGBUILD file :

# Maintainer: Paras Bhanot <paras.bhanot@gmail.com>
pkgname=keebie
pkgver=1.0.r.
pkgrel=1
epoch=
pkgdesc="A python script which mimics the functionally of autohotkeys in Linux"
arch=(x86_64 i686)
url="https://github.com/parasbhanot/Keebie.git"
license=('MIT')
groups=()
depends=(python-evdev xdotool)
makedepends=(git)
checkdepends=()
optdepends=()
provides=(keebie)
conflicts=(keebie)
replaces=()
backup=()
options=()
install=
changelog=
source=("git+$url")        
noextract=()
md5sums=('SKIP')
validpgpkeys=()

package() {
    cd Keebie
    mkdir -p ${pkgdir}/opt/${pkgname}
        mkdir -p ${pkgdir}/etc/systemd/system/
        mkdir -p ${pkgdir}/etc/udev/rules.d
    install -Dm644 keebie.py  ${pkgdir}/opt/${pkgname}
    install -Dm644 settings.json  ${pkgdir}/opt/${pkgname}
        install -Dm644 config  ${pkgdir}/opt/${pkgname}
    install -Dm644 setup_tools/keebie.service ${pkgdir}/etc/systemd/system/
        install -Dm644 setup_tools/85-keebie-keyboard.rules ${pkgdir}/etc/udev/rules.d
}

i am getting permission denied error due to "85-keebie-keyboard.rules" file.

The problem with this approach is that we need sudo to edit layers file . i think it would be be better if keebie.py could check for layers in .config folder. This will make installation way easier using package manager.

Michael-E-B commented 3 years ago

My take on config and layers/ is that they should be in /usr/share/keebie/ and when a user runs Keebie for the first time these files should be copied to /home/user/.config/keebie/ and then read from there. I don't know if systemd distinguishes between users or what user it runs commands as so this might not be workable.

daisyUniverse commented 3 years ago

I like this solution, you should be able to do it in bash by using the $HOME variable, which should just point to whatever user that invoked the scripts home folder

Michael-E-B commented 3 years ago

Thoughts on using fpm instead of having to deal with each package formats complexities?

daisyUniverse commented 3 years ago

Wow this is an interesting project, I mean ideally, yeah, it is definitely a really good looking option to look into, we just need to get the layer files saved to config and then it looks like it would be pretty easy to move forward from there, That's a really cool find

Michael-E-B commented 3 years ago

I'm going to keep using fpm as I work on this then.