Skip to content

Commit

Permalink
xkeysnail: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
bb2020 committed Feb 26, 2025
1 parent 661dddb commit 9e7a0f6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
from xkeysnail.transform import *

aa = False
def aa_setvar(v):
def _aa_setvar():
def aaset(v):
def _aaset():
transform._mark_set = False
global aa; aa = v
return _aa_setvar
def aa_ifvar():
def _aa_ifvar():
transform._mark_set = False
global aa
return _aaset
def aaif():
def _aaif():
global aa; transform._mark_set = False
if aa: aa = False; return K("esc")
return K("enter")
return _aa_ifvar
def aa_flipmark():
def _aa_flipmark():
return _aaif
def aaflip():
def _aaflip():
transform._mark_set = not transform._mark_set;
return _aa_flipmark
return _aaflip

define_keymap(re.compile("Google-chrome|Chromium-browser|firefox"), {
K("C-b"): with_mark(K("left")),
Expand All @@ -37,17 +36,17 @@ def _aa_flipmark():
K("C-d"): [K("delete"), set_mark(False)],
K("M-d"): [K("C-delete"), set_mark(False)],
K("M-backspace"): [K("C-backspace"), set_mark(False)],

K("C-slash"): [K("C-z"), set_mark(False)],
K("C-space"): aa_flipmark(),

K("C-space"): aaflip(),
# K("C-space"): set_mark(True),
K("C-M-space"): with_or_set_mark(K("C-right")),

K("enter"): aaif(),
K("C-s"): [K("F3"), aaset(True)],
K("C-r"): [K("Shift-F3"), aaset(True)],
K("C-g"): [K("esc"), aaset(False)]
# K("C-s"): K("F3"),
# K("C-r"): K("Shift-F3"),
# K("C-g"): [K("esc"), set_mark(False)]

K("C-s"): [K("F3"), aa_setvar(True)],
K("C-r"): [K("Shift-F3"), aa_setvar(True)],
K("C-g"): [K("esc"), aa_setvar(False)],
K("enter"): aa_ifvar()
})
22 changes: 11 additions & 11 deletions pkgs/by-name/xk/xkeysnail/package.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
lib,
fetchFromGitHub,
makeWrapper,
python3Packages,
fetchpatch,
}:

python3Packages.buildPythonApplication rec {
pname = "xkeysnail";
version = "0.4.0";
version = "0.4";

src = fetchFromGitHub {
owner = "mooz";
repo = pname;
rev = "bf3c93b4fe6efd42893db4e6588e5ef1c4909cfb";
sha256 = "0plcpb4ndzfsd5hj32m0g32swnhyph9sd759cdhhzmjvlq3j8q6p";
hash = "sha256-12AkB6Zb1g9hY6mcphO8HlquxXigiiFhadr9Zsm6jF4=";
};

nativeBuildInputs = [ makeWrapper ];
patches = [
(fetchpatch {
url = "https://github.com/mooz/xkeysnail/pull/181.patch";
hash = "sha256-yqsAfn3SibRW2clbtVwVZi1dJ8pAiXoYpittpz7S/wU=";
})
];

propagatedBuildInputs = with python3Packages; [
evdev
xlib
inotify-simple
appdirs
];

doCheck = false;

postInstall = ''
mkdir -p $out/share
cp ./example/config.py $out/share/example.py
cp ${./browser-emacs-bindings.py} $out/share/browser.py
install -D ${./emacs.py} $out/share/browser.py
makeWrapper $out/bin/xkeysnail $out/bin/xkeysnail-example \
--add-flags "-q" --add-flags "$out/share/example.py"
makeWrapper $out/bin/xkeysnail $out/bin/xkeysnail-browser \
--add-flags "-q" --add-flags "$out/share/browser.py"
'';
Expand Down

0 comments on commit 9e7a0f6

Please sign in to comment.