Wayland, GNOME Shell and arbtt

Tomasz Miąsko tomasz.miasko at gmail.com
Wed Dec 20 22:28:01 CET 2017


I am quite fond of arbtt, but have moved on to Wayland, where much stronger
emphasis on security prevents arbtt-capture from gathering necessary window
information. Not all is lost as GNOME Shell supports writing custom extensions
which do have direct access to window manager. That is how an idea for
extension was born, one that records window information in arbtt data format.

If any of you happen to use GNOME Shell (with Wayland) and would like to
continue using arbtt, you can find the extension here:
https://github.com/tmiasko/arbtt-capture


Furthermore, after working with arbtt data format, I have some comments and
suggestion, in case you were to release a new version at some point:

While working with current format, from within Haskell library environment, is
relatively convenient, from the outside it is like reading hieroglyphs on a
spacecraft from the outer space. Dates potentially arbitrary far in the future
(or in the past), stored as the number of days since 1858-11-17. Time stored
with an arbitrary precision. Instead, a single integer representing UNIX time
would be more than welcomed (potentially 64-bit number with higher millisecond
resolution if so desired).

Strings are serialized as 32-bit integer describing the number of Unicode code
points (Haskell list length), followed by those code points, each encoded in
UTF-8. Given that code point encoding in UTF-8 is variable in length, you can't
read back the whole string at once. Writing the total number of bytes instead
of the number of code points would be more convenient.

Instance of StringReferencingBinary for Text leaves two indexes unused,
i.e., 254 and 255. Though, it does look quite intentional:

instance StringReferencingBinary Text where
        ls_put strs s = case elemIndex s strs of
                Just i | 0 <= i && i  < 255 - 2 ->
                        put (fromIntegral (succ i) :: Word8)
                _ ->    put (0 :: Word8) >> put s

ListOfStringable instance for CaptureData includes window titles and program
names, but excludes desktop name (thus, it is not referenced back).

Thanks for arbtt. Cheers,
Tomasz




More information about the arbtt mailing list