It turns out however that in NixOS wmctrl didn't work well. I had 3 windows opened, and wmctrl -l only showed one. Since gnome3 is still young in nixos, the first thought was that mutter did something wrong when returning the list of clients, due to some possible packaging mistake.
However, xprop -root correctly listed 3 window ids for the _NET_CLIENT_LIST atom, so mutter did its job.
Therefore it might be a problem of wmctrl. I'm always sure in these cases Debian has a patch, however I wanted to find out by myself.
Let's prepare an environment for hacking wmctrl:
$ nix-shell ~/nixpkgs -A wmctrl
$ unpackPhase
$ cd $sourceRoot
$ configurePhase
$ buildPhase
$ ./wmctrl -l
Ok it runs. Now let's dive into the code.
- Open main.c
- Search for _NET_CLIENT_LIST
- Note the for loop in list_windows function right below, it uses client_list_size / sizeof(Window) in the condition. That may be the culprit.
- We make use of the most advanced debugging technique: before the for loop add a printf("%lu\n%lu\n", client_list_size, sizeof(Window));
$ buildPhase
$ ./wmctrl -l
Bingo! client_list_size is 12 (3 windows x 4 byte) while sizeof(Window) is 8 instead of 4. Definitely a bug for 64-bit systems.
Of course Debian has the patch: http://ftp.de.debian.org/debian/pool/main/w/wmctrl/wmctrl_1.07-7.debian.tar.gz
- Exit the nix-shell and delete the wmctrl source directory.
- Copy debian/patches/01_64-bit-data.patch under ~/nixpkgs/pkgs/tools/X11/wmctrl/64-bit-data.patch.
- Edit ~/nixpkgs/pkgs/tools/X11/wmctrl/default and add patches = [ ./64-bit-data.patch ]; in the derivation.
- Finally install the patched wmctrl with nix-env ~/nixpkgs -iA wmctrl and see that wmctrl -l now works.
- Commit, push to nixpkgs master, profit.
8 comments:
omg this saved me like two days of work. I would have had to refactor an ass of code if not for seeing this. THANK YOU!
Good post!
SRI ANNAPOORNESHAWARI ASTROLOGY CENTER.Best Astrologer In Oklahoma
Amazing...!
SRIKRISHANA ASTROLOGY.Vashikaran Astrologer in Bagalkot
This is a good article. Thanks for sharing
SRICHAKRAM ASTROLOGY.Best Astrologer In Indiranagar
Nice post. Keep sharing. Thanks for sharing.
SRI ANNAPOORNESHAWARI ASTROLOGY CENTER.Best Astrologer In Akola
Good post!
SRIKRISHANA ASTROLOGY.Vashikaran Astrologer in Shivamogga
Good post thanks for share information.
ABHIRAM ASTROLOGY CENTER.Best Astrologer In electronic-city
Nice pick. it's very Useful Article.
ABHIRAM ASTROLOGY CENTER.Best Astrologer In electronic-city
Post a Comment