lol

ahk_x11: init at 1.0.4 (#298173)

authored by

Arne Keller and committed by
GitHub
785c70e4 d07057a9

+232
+58
pkgs/by-name/ah/ahk_x11/adjust.patch
··· 1 + diff --git a/Makefile b/Makefile 2 + index 8b54a8b..6522293 100644 3 + --- a/Makefile 4 + +++ b/Makefile 5 + @@ -60,7 +60,6 @@ xdotool/libxdo.a: xdotool/.git 6 + $(MAKE) -C xdotool libxdo.a 7 + 8 + lib/configured: 9 + - shards install --frozen 10 + ./bin/gi-crystal 11 + # TODO: can be fixed in application code? 12 + sed -i -E 's/private getter xdo_p/getter xdo_p/' lib/x_do/src/x_do.cr 13 + @@ -71,7 +70,7 @@ lib/configured: 14 + test-appimage: ahk_x11.AppImage 15 + ./ahk_x11.AppImage tests.ahk 16 + test-dev: bin/ahk_x11 17 + - ./bin/ahk_x11 tests.ahk 18 + + XDG_CACHE_HOME=${TMPDIR} HOME=${TMPDIR} xvfb-run --auto-display openbox --startup "./bin/ahk_x11 tests.ahk" 19 + 20 + clean: 21 + rm -rf ahk_x11.AppImage bin/ahk_x11 bin/ahk_x11.dev linuxdeploy-plugin-gtk.sh linuxdeploy-x86_64.AppImage lib 22 + diff --git a/src/ahk_x11.cr b/src/ahk_x11.cr 23 + index 16777d8..b4d96e1 100644 24 + --- a/src/ahk_x11.cr 25 + +++ b/src/ahk_x11.cr 26 + @@ -67,14 +67,12 @@ version = {{ read_file("./shard.yml").split("\n")[1][9..] }} 27 + lines = Compiler.new.extract.try &.split('\n') 28 + is_compiled = !! lines 29 + if ! lines 30 + - # Only needed for installer script, this can't (yet) really be part of ahk code. TODO: rm on exit 31 + - File.write("/tmp/tmp_ahk_x11_logo.png", logo_blob) 32 + if ARGV[0]? 33 + if ARGV[0] == "-v" || ARGV[0] == "--version" 34 + puts "AHK_X11 version: #{version}\nTargets to partially implement Classic Windows AutoHotkey specification: v1.0.24 (2004). AutoHotkey is a scripting language." 35 + ::exit 36 + elsif ARGV[0] == "-h" || ARGV[0] == "--help" 37 + - puts "AHK_X11 is a Linux implementation for AutoHotkey classic version 1.0.24 (2004). Internal version: #{version}. Full up to date documentation can be found at https://phil294.github.io/AHK_X11/.\n\nPossible methods of invocation:\n\nahk_x11.AppImage \"path to script.ahk\"\nahk_x11.AppImage <<< $'MsgBox, 1\\nMsgBox, 2'\nahk_x11.AppImage --repl\nahk_x11.AppImage --windowspy\nahk_x11.AppImage --compile \"path to script.ahk\" \"optional: output executable file path\"\n\nAlternatively, just run the program without arguments to open the graphical installer. Once installed, you should be able to run and/or compile any .ahk file in your file manager by selecting it from the right click context menu." 38 + + puts "AHK_X11 is a Linux implementation for AutoHotkey classic version 1.0.24 (2004). Internal version: #{version}. Full up to date documentation can be found at https://phil294.github.io/AHK_X11/.\n\nPossible methods of invocation:\n\nahk_x11 \"path to script.ahk\"\nahk_x11 <<< $'MsgBox, 1\\nMsgBox, 2'\nahk_x11 --repl\nahk_x11 --windowspy\nahk_x11 --compile \"path to script.ahk\" \"optional: output executable file path\"\n\nAlternatively, you should be able to run and/or compile any .ahk file in your file manager by selecting it from the right click context menu." 39 + ::exit 40 + elsif ARGV[0] == "--repl" 41 + lines = ["#Persistent"] 42 + @@ -101,7 +99,8 @@ if ! lines 43 + if stdin 44 + lines = stdin.split('\n') 45 + else 46 + - lines = {{ read_file("./src/installer.ahk").split("\n") }} 47 + + puts "Use -h for help." 48 + + ::exit 1 49 + end 50 + end 51 + end 52 + @@ -120,4 +119,4 @@ rescue e : Run::RuntimeException 53 + build_error e 54 + end 55 + 56 + -sleep # exiting is completely handled in runner 57 + \ No newline at end of file 58 + +sleep # exiting is completely handled in runner
+112
pkgs/by-name/ah/ahk_x11/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + crystal, 6 + copyDesktopItems, 7 + linkFarm, 8 + fetchgit, 9 + 10 + gtk3, 11 + libxkbcommon, 12 + xorg, 13 + libnotify, 14 + gobject-introspection, # needed to build gi-crystal 15 + openbox, 16 + xvfb-run, 17 + xdotool, 18 + 19 + buildDevTarget ? false, # the dev version prints debug info 20 + }: 21 + 22 + # NOTICE: AHK_X11 from this package does not support compiling scripts into portable executables. 23 + let 24 + pname = "ahk_x11"; 25 + version = "1.0.4"; 26 + 27 + inherit (xorg) 28 + libXinerama 29 + libXtst 30 + libXext 31 + libXi 32 + ; 33 + 34 + in 35 + crystal.buildCrystalPackage { 36 + inherit pname version; 37 + 38 + src = fetchFromGitHub { 39 + owner = "phil294"; 40 + repo = "AHK_X11"; 41 + rev = version; 42 + hash = "sha256-Kxe0tLbER1XFnnfUUIiy9CgCgz2qK21AIk4DfHymKlI="; 43 + fetchSubmodules = true; 44 + }; 45 + 46 + # Fix build problems and the following UX problem: 47 + # Without this patch, the binary launches a graphical installer GUI that is useless with system-wide installation. 48 + # With this patch, it prompts to use -h for help. 49 + patches = [ ./adjust.patch ]; 50 + 51 + shardsFile = ./shards.nix; 52 + copyShardDeps = true; 53 + 54 + preBuild = '' 55 + mkdir bin 56 + cd lib/gi-crystal 57 + shards build -Dpreview_mt --release --no-debug 58 + cd ../.. 59 + cp lib/gi-crystal/bin/gi-crystal bin 60 + ''; 61 + 62 + postBuild = lib.optionalString buildDevTarget '' 63 + mv bin/ahk_x11.dev bin/ahk_x11 64 + ''; 65 + 66 + preInstall = '' 67 + mkdir -p $out/bin 68 + ''; 69 + 70 + postInstall = '' 71 + install -Dm644 -t $out/share/licenses/ahk_x11/ LICENSE 72 + install -Dm644 -t $out/share/pixmaps/ assets/ahk_x11.png 73 + install -Dm644 -t $out/share/applications/ assets/*.desktop 74 + install -Dm644 assets/ahk_x11-mime.xml $out/share/mime/packages/ahk_x11.xml 75 + ''; 76 + 77 + buildInputs = [ 78 + gtk3 79 + libxkbcommon 80 + libXinerama 81 + libXtst 82 + libXext 83 + libXi 84 + libnotify 85 + ]; 86 + nativeBuildInputs = [ 87 + copyDesktopItems 88 + gobject-introspection 89 + ]; 90 + nativeCheckInputs = [ 91 + xvfb-run 92 + openbox 93 + xdotool 94 + ]; 95 + 96 + buildTargets = if buildDevTarget then "bin/ahk_x11.dev" else "bin/ahk_x11"; 97 + checkTarget = "test-dev"; 98 + 99 + # The tests fail with AtSpi failure. This means it lacks assistive technologies: 100 + # https://github.com/phil294/AHK_X11?tab=readme-ov-file#accessibility 101 + # I don't know how to fix it for xvfb and openbox. 102 + doCheck = false; 103 + 104 + meta = { 105 + description = "AutoHotkey for X11"; 106 + homepage = "https://phil294.github.io/AHK_X11"; 107 + license = lib.licenses.gpl2Plus; 108 + maintainers = with lib.maintainers; [ ulysseszhan ]; 109 + platforms = lib.platforms.linux; 110 + mainProgram = "ahk_x11"; 111 + }; 112 + }
+62
pkgs/by-name/ah/ahk_x11/shards.nix
··· 1 + { 2 + atspi = { 3 + url = "https://github.com/phil294/atspi.cr.git"; 4 + rev = "7aec8d3604313da415e54e654c1dc6b33ae05d8d"; 5 + sha256 = "1r6k9f00a2y406hqsgq0r58zlfmg3xbzqjmfh93nwqs4m6h0shml"; 6 + }; 7 + cron_parser = { 8 + url = "https://github.com/kostya/cron_parser.git"; 9 + rev = "v0.4.0"; 10 + sha256 = "17fgg2nvyx99v05l10h6cnxfr7swz8yaxhmnk4l47kg2spi8w90a"; 11 + }; 12 + future = { 13 + url = "https://github.com/crystal-community/future.cr.git"; 14 + rev = "v1.0.0"; 15 + sha256 = "1mji2djkrf4vxgs432kgkzxx54ybzk636789k2vsws3sf14l74i8"; 16 + }; 17 + gi-crystal = { 18 + url = "https://github.com/hugopl/gi-crystal.git"; 19 + rev = "v0.22.1"; 20 + sha256 = "1bwsr5i6cmvnc72qdnmq4v6grif1hahrc7s6js2ivdrfix72flyg"; 21 + }; 22 + gtk3 = { 23 + url = "https://github.com/phil294/gtk3.cr.git"; 24 + rev = "3105fc24ef5e841791f8c30002db998b9c20a677"; 25 + sha256 = "16sjiyyfprnfmqw8pf58d12sv2x8rnv7kb72k5rmvd67sr6gv8pq"; 26 + }; 27 + harfbuzz = { 28 + url = "https://github.com/hugopl/harfbuzz.cr.git"; 29 + rev = "v0.2.0"; 30 + sha256 = "06wgqxwyib5416yp53j2iwcbr3bl4jjxb1flm7z103l365par694"; 31 + }; 32 + notify = { 33 + url = "https://github.com/phil294/notify.cr.git"; 34 + rev = "0c9880e6169e09f0db1cb40432e0b76651d15ad3"; 35 + sha256 = "1waasvhx4n817d8gqk3fza4ac4a9d71f80cfii5dbh2aqzhqf070"; 36 + }; 37 + pango = { 38 + url = "https://github.com/hugopl/pango.cr.git"; 39 + rev = "v0.3.1"; 40 + sha256 = "0xlf127flimnll875mcq92q7xsi975rrgdpcpmnrwllhdhfx9qmv"; 41 + }; 42 + tasker = { 43 + url = "https://github.com/spider-gazelle/tasker.git"; 44 + rev = "v2.1.4"; 45 + sha256 = "0254sl279nrw5nz43dz5gm89ah1zrw5bvxfma81navpx5gfg9pyb"; 46 + }; 47 + x11 = { 48 + url = "https://github.com/phil294/x11-cr.git"; 49 + rev = "5a937d647d8eac29106602fcdeb161a78eb3d59d"; 50 + sha256 = "11rflkxrg1dl5c80llwan4qs47ir7w7lgqdmhy2z907kxbrfkznr"; 51 + }; 52 + x_do = { 53 + url = "https://github.com/phil294/x_do.cr.git"; 54 + rev = "94f755a4f18a9a9820e9738b371cbe6b49731926"; 55 + sha256 = "099mrhyb8kly6isk7xr1mzxbxfm4xizmyyw2ylmlx4ywynz9iyl6"; 56 + }; 57 + xtst = { 58 + url = "https://github.com/phil294/xtst-cr.git"; 59 + rev = "f731b708e1789d039258ecd62f7b0d1107a00b78"; 60 + sha256 = "1vhzn1ck7ifkvhw5f9kpljsa278va039wa6f3hhd8w6gr2zqvzk8"; 61 + }; 62 + }