Gabriele Musco's Dev Log

Making a D-Bus Daemon with Python and Flatpak

2021-01-02 | #gtk #gnome #dbus #python #hydrapaper #meson #flatpak #tutorial

Credit where credit is due, I learned most of this stuff from this awesome series of articles by Larry Price. Give it a read, it’s worth it. Why D-Bus daemons are quite useful tools. What would you need them for? Well, I decided to add one to HydraPaper to do two jobs: change the wallpaper periodically listen for monitor configuration changes and adapt to it, so that when you plug or unplug a monitor, the wallpaper doesn’t get all messed up There could be other reasons, like provide an always active “server” component to your application, or if you need to send notifications to the user even when your main app isn’t running. Continue reading 

Giara is a reddit app for Linux

2020-10-30 | #giara #reddit #linux #gtk #gnome #world

I am a quite avid reddit user. Like it or not, reddit is a very central place where communities for stuff that I care about tend to aggregate. For the longest time, I have felt the need for a reddit app on my Linux desktop, and I waited and kept waiting for one that would finally allow me to break free of using the web version. Some honorable mentions are due to projects like the now seemingly abandoned Something for reddit and the terminal app Tuir. Continue reading 

Map Mouse Back and Forward Buttons in Your GTK App

2020-10-08 | #gtk #gtk3 #python #mouse #button #eventhandler

The back and forward buttons on your mouse are incredibly useful, at least for me. I use them all the time! I couldn’t find a proper way to map it on my app until I asked on the GTK Matrix chatroom, there baedert sent me a couple of links to how he did it in his app corebird. I translated the code to Python and decided to make a blog post to archive the procedure. Continue reading 

Create an auto resizing image widget with GTK3 and Python

2020-10-03 | #python #gtk #gtk3 #cairo #drawing #area #gtkdrawingarea #pixbuf

One of the most common things you might wanna do with images, that is making them automatically resize to adapt to the available space they have, is not possible with Gtk.Image. So after some hacking, I seem to have found a solution that works: from gi.repository import Gtk, GdkPixbuf, Gdk class PictureView(Gtk.DrawingArea): def __init__(self, path, *args, **kwargs): super().__init__(*args, **kwargs) self.path = path self.pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.path) self.img_surface = Gdk.cairo_surface_create_from_pixbuf( self.pixbuf, 1, None ) def get_useful_height(self): aw = self. Continue reading 

Man pages with Markdown and Pandoc

2020-08-31 | #markdown #pandoc #man #documentation #manual #groff

Man pages are awesome. They genuinely are. In any *nix system you can just get documentation on your programs or even some programming things (namely a lot of C stuff, this was very useful in University) offline by just using a tiny simple command. Of course writing man pages is a different thing. They are written in groff. I am not a fan of it, although I know people who do enjoy using it. Continue reading 