New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libinput-gestures: init at 2.32 #34687
Conversation
@@ -0,0 +1,35 @@ | |||
{lib, stdenv, fetchFromGitHub, bash, fakeroot, libinput, xdotool, makeWrapper}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You don't need
bash
as you can usestdenv.shell
- Please add space after
{
and before}
.
sha256 = "1by6sabx0s8sd9w5675gc26q7yccxnxxsjg4dqlb6nbs0vcg81s7"; | ||
}; | ||
|
||
buildInputs = [ bash fakeroot makeWrapper ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be nativeBuildInputs
(and bash
should go ref the comment above)
installPhase = | ||
'' | ||
mkdir -p $out | ||
fakeroot -- bash libinput-gestures-setup -d "$out" install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need fakeroot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, libinput-gestures-setup bails if it's not executed as root, see https://github.com/bulletmark/libinput-gestures/blob/f3c0e61f5b85073eee3ddfe0216f8dd040ddf64d/libinput-gestures-setup#L145-L148
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably just patch that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I was a moron and it's not required. Removing it now.
'' | ||
mkdir -p $out | ||
fakeroot -- bash libinput-gestures-setup -d "$out" install | ||
mv $out/usr/bin $out/bin-unwrapped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you call makeWrapper
/wrapProgram
later, it will take care of renaming instead you having to define your own scheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used that at first, but the config files are discovered depending on argv[0]. Using wrapProgram means it will look for {/etc,~/.config}/.libinput-gestures-wrapped.conf
, rather than {/etc,~/.config}/libinput-gestures.conf
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapProgram
takes an --argv SOME_NAME
argument that should deal with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like wrapProgram
already sets --argv0
. I tried setting it manually, but that still didn't work.
mkdir -p $out | ||
fakeroot -- bash libinput-gestures-setup -d "$out" install | ||
mv $out/usr/bin $out/bin-unwrapped | ||
mv $out/usr/share $out/share |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixupPhase
will handle this for you, you don't need to do it manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't seem to happen for me, unless I'm missing something.
rmdir $out/usr | ||
mkdir $out/bin | ||
sed -i "s,/usr/bin/,,g" $out/share/applications/*.desktop | ||
makeWrapper $out/bin-unwrapped/libinput-gestures $out/bin/libinput-gestures --prefix PATH : ${lib.makeBinPath [ libinput xdotool ]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use wrapProgram
instead of makeWrapper
it will handle the renaming for you.
mkdir $out/bin | ||
sed -i "s,/usr/bin/,,g" $out/share/applications/*.desktop | ||
makeWrapper $out/bin-unwrapped/libinput-gestures $out/bin/libinput-gestures --prefix PATH : ${lib.makeBinPath [ libinput xdotool ]} | ||
makeWrapper $out/bin-unwrapped/libinput-gestures-setup $out/bin/libinput-gestures-setup --prefix PATH : ${lib.makeBinPath [ ]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of prefixing with an empty list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None, I forgot to remove this after finding out that -setup is pretty much useless in NixOS anyway.
makeWrapper $out/bin-unwrapped/libinput-gestures-setup $out/bin/libinput-gestures-setup --prefix PATH : ${lib.makeBinPath [ ]} | ||
''; | ||
|
||
meta = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change this to meta = with stdenv.lib; {
...
meta = { | ||
homepage = https://github.com/bulletmark/libinput-gestures; | ||
description = "Gesture mapper for libinput"; | ||
license = stdenv.lib.licenses.gpl3Plus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... you can get rid of the stdenv.lib.
part here
homepage = https://github.com/bulletmark/libinput-gestures; | ||
description = "Gesture mapper for libinput"; | ||
license = stdenv.lib.licenses.gpl3Plus; | ||
platforms = stdenv.lib.platforms.linux; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
c55bed5
to
66cffda
Compare
66cffda
to
8b54d1c
Compare
@peterhoeg I believe I've dealt with all your feedback now. |
Super, for the last item, just patch this line: https://github.com/bulletmark/libinput-gestures/blob/master/libinput-gestures#L13 instead of using |
rmdir "$out/usr" | ||
mkdir "$out/bin" | ||
substituteInPlace "$out/share/applications/libinput-gestures.desktop" --replace "/usr" "$out" | ||
chmod +x "$out/share/applications/libinput-gestures.desktop" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.desktop files without a shebang shouldn't be executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but KDE doesn't seem to. If it's not there then running kioclient5 exec result/share/applications/libinput-gestures.desktop
gives the following confirmation prompt:
Clicking Continue fails with the following message:
Since /nix/store is read-only. If libinput-gestures.desktop
is executable then everything works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, Firefox seems to install
its .desktop file, which also causes it to become marked executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know that. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.. I was surprised too when I found out.
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
installPhase = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming you don't have to install manually, move the clean-up to the postInstall
phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything after invoking libinput-gestures-setup
?
8b54d1c
to
d545773
Compare
@peterhoeg Done. |
Have a look at this: peterhoeg@c2d6711 I made some changes: a) This is a python program so use b) Patch the paths to the various programs c) Patch the installation path to avoid the shuffling from /usr d) Add a reference to wmctrl e) Make it look for the default config file in the correct place f) Drop the reference to xdotool which isn't used |
a) Fair enough. I didn't know buildPython{Package,Application} was compatible with packages that didn't use distutils/setuptools. Good to know! b,c) Fair enough. Personally I prefer wrapping over patching since it doesn't need to be maintained when the underlying package changes. d) Good catch. Didn't think about that since I don't use libinput-gestures to manage my workspaces. e) Nice, though we probably want to add a way to override the default config file. Maybe an argument? f) xdotool is used for the default backwards/forwards gestures, and is the primary way that I use libinput-gestures. I guess d and f mean that it makes more sense to let the user add more tools to the path themselves (another argument?), than to hardcode a few blessed utilities into the package. |
a) Fair enough. I didn't know buildPython{Package,Application} was
compatible with packages that didn't use distutils/setuptools.
That's what ```format = "other";``` does.
b,c) Fair enough. Personally I prefer wrapping over patching since it
doesn't need to be maintained when the underlying package changes.
Patching allows us to use absolute paths to the dependencies instead of accidentally picking up something from the user's path. There is a bit of a maintenance burden, but it makes things more predictable.
d) Good catch. Didn't think about that since I don't use libinput-gestures
to manage my workspaces.
I just looked through the code for references to ```run```.
e) Nice, though we probably want to add a way to override the default
config file. Maybe an argument?
The application already takes that as an argument.
f) xdotool is used for the default backwards/forwards gestures
I don't see any mentioning of it in the code.
I guess d and f mean that it makes more sense to let the user add more
tools to the path themselves (another argument?), than to hardcode a few
blessed utilities into the package.
We should include the ones that are necessary for the operation. Which ones are optional?
|
The config file allows you to map gestures to arbitrary commands. The default configuration (https://github.com/bulletmark/libinput-gestures/blob/master/libinput-gestures.conf) uses xdotool for three-finger swipes to the left and right, as well as for pinches. |
The way I read the config file, it uses If somebody wants to do more, they can always wrap it accordingly. |
I just realized that |
I wasn't sure since I'm not in maintainers.nix, but I suppose I can add myself to there. |
Sure, just add a separate commit for that. |
@teozkr, any chance you can get the last bits in within the next couple of days so this can make it into 18.03 ? |
Yeah sure, sorry.
…On 26 February 2018 at 09:32, Peter Hoeg ***@***.***> wrote:
@teozkr <https://github.com/teozkr>, any chance you can get the last bits
in within the next couple of days so this can make it into 18.03 ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34687 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAnqaIAWRmXUnAdPRU4TjRWr1-uiFa2Jks5tYmw5gaJpZM4R76tv>
.
|
d545773
to
946f395
Compare
xf86-input-synaptics is unmaintained, and touchegg doesn't work with the latest synaptics driver or libinput. Ideally DEs would implement this themselves, but at least KDE/Plasma doesn't (yet) 0002-paths.patch was contributed by @peterhoeg.
946f395
to
cf5a17e
Compare
Set myself as maintainer and merged most of your suggestions. I'm still leaving in Seems to build fine for me, going to try it out on my laptop in a moment and report back with the results. |
Can confirm that it works fine on my laptop. |
Thanks for your patience @teozkr! Looking forward to the next PR. ;-) |
Thanks! |
Motivation for this change
xf86-input-synaptics is unmaintained, and touchegg doesn't work with
the latest synaptics driver or libinput. Ideally DEs would implement this
themselves, but at least KDE/Plasma doesn't (yet)
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)