While mowing the lawn this afternoon I rescued this little fella that flew straight into a cobweb.

Red and black moth on my finger

Notes on getting autostart working for a classic confined snap

Last night I finally managed to get a working build of the Snippet Pixie snap that pretty much works as hoped, but there were a couple of things I had to change in order to get autostart working that I thought it might help others to mention here.

There's a couple of wrinkles due to naming.

The snap is called snippetpixie and uses that in the snapcraft.yaml apps: entry, but the binary and canonical name for the app (as used in meson build etc.) is com.github.bytepixie.snippetpixie, and that's the app's "ID" too. It's a GTK app built with Vala, initially for elementary OS.

This means the .desktop file is usually called com.github.bytepixie.snippetpixie.desktop. So in the app it uses this as the desktop file name when trying to copy and fix it up to create an autostart version, but the DesktopAppInfo class failed to find the file by that name.

Turns out snapd/snapcraft takes that com.github.bytepixie.snippetpixie.desktop file and renames it to snippetpixie_snippetpixie.desktop at some point (I think install time by snapd), making some changes to the Exec line along the way.

This means the DesktopAppInfo class doesn't recognise com.github.bytepixie.snippetpixie.desktop as valid.

In the end I had to add specific code for running as a snap to change the desktop file name to look for, and also be careful about the way the Exec line is changed for the new autostart version to carefully insert the required --start param in the altered command line instead of blindly changing it to com.github.bytepixie.snippetpixie --start.

You can see some of the altered (not very clever, but it works) code in snippetpixie's update_autostart function.

Hope this helps someone else having troubles getting autostart to work for a snap.

One More Thing...

I guess I'm also officially announcing that there's candidate availability of a snap for Snippet Pixie!

It can be installed from the candidate channel with…

sudo snap install snippetpixie --classic --candidate

Any feedback on the snap is warmly welcomed via either the Snapcraft forum's "Call for testing" post, or Snippet Pixie's GitHub Issues.

Get It!!!

Get

Get

Almost Back In The Saddle

Almost Back In The Saddle
RustyElm

 
 
00:00 /
 
1X
 

Hello, my name is Ian Jones, and this is the RustyElm microcast, a short, very ad-hoc journal of my attempt to learn Rust and Elm in order to build a side project.

I had a draft podcast way back in mid September 2018, but never finished it as I was just too damn busy.

Things have been kinda crazy, starting with working on multiple huge releases of WP Offload Media, and helping out with WP Offload SES. Giving my best 8 hours or more of mental energy a day to my work for Delicious Brains doesn't leave much in the tank for late night hacking. I very much enjoy working on WP Offload Media, it's an awesome plugin, and I enjoy having primary responsibility for it's development, so I naturally put a lot of my energy into it and am always thinking about it.

Having said that, I did get an itch for something I needed to build that also took my eye off of RustyElm and learning Rust and Elm, that being: Snippet Pixie.

Snippet Pixie is "Your little expandable text snippet helper", for Linux. I couldn't find a good Linux application alternative to the likes of Text Expander or Dash (which I currently use on macOS). So, in the end, I kinda just had to build it, otherwise known as scratching my itch. My primary desktop Linux distribution is elementary OS, so that's what I built it for, in Vala.

Turns out that may have helped me get my shrivelled little brain around the Rust concept of Ownership, as Vala also doesn't let you throw objects around without taking into consideration ownership. It caught me out a few times when the complier complained about not being able to assign an unowned reference etc, and reminded me a lot of how Rust handles ownership. Even though things aren't exactly the same, I'm going to chalk that one up as some progress in my learning of Rust, alright?!

Anyhow, Snippet Pixie recently had a momentous release that included date/time, clipboard, embedded snippets and cursor placeholders, adding a whole new level of functionality. And even though I'm in the middle of trying to get a snap sorted so it'll be usable on many more Linux distributions, and still have plans for more improvements to Snippet Pixie, I feel like I no longer have a huge pressure to keep adding functionality and can relax a little bit on it.

As such, I'm starting to look at getting started with my Rust and Elm based project for my evening recreational programming. Stay tuned.

Micro.blog: @ianmjones

Twitter: @ianmjones

Snippet Pixie 1.2 released with support for placeholders 🎉️

I'm very proud to announce that Snippet Pixie now includes support for placeholders! 🎉️

This release took an immense amount of work, with lots of thought taken in the design of the placeholders feature, hopefully you find these new super powers useful!

  • Date/Time: Insert the current or calculated date/time with configurable format.
  • Clipboard: Insert the text contents of the clipboard.
  • Snippets: Insert snippets in your snippets!
  • Cursor: Set where the cursor should end up after the snippet has expanded.

Read on for a summary of the placeholders feature and how to use the different types of placeholder.

Placeholders

All placeholders are delimited (wrapped) by $$, with the placeholder name starting with an @ symbol.

For example, today's date can be inserted with $$@date$$.

Some placeholders allow for extra arguments when : follows their name and that is followed by the argument. For example a format for a date, or the abbreviation for a snippet. Check the following descriptions for each placeholder for more details.

To use $$ in your snippet body, escape the second $ with a backslash like so: $\$.

@date

Quick Examples:

  • Today's date with system format: $$@date$$
  • Today's date with custom format: $$@date:%Y-%m-%d %H:%M:%S$$
  • Tomorrow's date with system format: $$@date@+1D$$
  • Date 2 weeks from today with custom format: $$@date@+2W:%x$$
  • Time 3 hours from now: $$@time@+3H$$

@time is an alias for @date, with one important difference, the default output if no format specified is the default time format (%X) rather than default date format (%x).

The optional format specified after : can take a format string as detailed in the GLib.DateTime.format function's docs.

The optional date calculation starts with an @ after the placeholder name, followed by a signed integer and unit. The unit types are as follows:

  • Y: Years
  • M: Months
  • W: Weeks
  • D: Days
  • h: Hours
  • m: Minutes
  • s: Seconds

You can apply more than one date calculation, for example +2h+30m adds 2 hours and 30 minutes to the current time.

You can use both positive (+) and negative calculations, for example -3D takes 3 days from the current date.

@clipboard

When $$@clipboard$$ is part of a snippet's body, when its abbreviation is expanded the current text contents of the clipboard will replace the placeholder.

@snippet

You can have up to three levels of embedded snippets with the @snippet placeholder.

The abbreviation for the snippet to be embedded is entered after :, for example $$@snippet:sigg;$$ expands the snippet with abbreviation sigg; in place of the placeholder.

@cursor

Adding $$@cursor$$ to a snippet's body will put the cursor in its place after expansion instead of at the end of the expanded text.

If $$@cursor$$ is entered more than once in a snippet's body or via snippet embedding, then the last occurrence of the cursor placeholder wins.

Get It!!!

Get