Skip to content

Instantly share code, notes, and snippets.

@infirit
infirit / gdbus_async_init.py
Last active February 8, 2023 09:34
gdbus_connection_proxy
from gi.repository import Gio, GLib, GObject
import logging
import random
class Base(Gio.DBusProxy):
connect_signal = GObject.GObject.connect
disconnect_signal = GObject.GObject.disconnect
__name = 'org.bluez'
@infirit
infirit / bluez-alsa-9999.ebuild
Created October 27, 2018 14:33
bluez-alsa ebuild for meson
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit meson multilib-minimal
DESCRIPTION="Bluetooth Audio ALSA Backend"
HOMEPAGE="https://github.com/Arkq/bluez-alsa"
if [[ ${PV} == "9999" ]] ; then
@infirit
infirit / icon_scale.py
Created October 3, 2017 17:13
Silly icon scaling experiment
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
import cairo
class IconWindow(Gtk.Window):
def __init__(self, *args, **kwargs):
super().__init__(default_width=150, default_height=150, **kwargs)
self.icon_name = "thunderbird"
@infirit
infirit / joke_appindicator.py
Created September 9, 2017 12:19
AppIndicator experiment
# This code is an example for a tutorial on Ubuntu Unity/Gnome AppIndicators:
# http://candidtim.github.io/appindicator/2014/09/13/ubuntu-appindicator-step-by-step.html
import os
import signal
import json
import gi
from urllib.request import Request, urlopen
from urllib.error import URLError
@infirit
infirit / gtk_treeview_cell_data_functin.py
Created August 20, 2017 12:51
Simple CellDataFunction example
from gi.repository import Gtk, Gdk, GLib, GObject
from gi.repository import GdkPixbuf
from datetime import datetime
import cairo
import time
class TreeViewWindow(Gtk.Window):
def __init__(self):
super().__init__(title="Cell Data Func Example")
@infirit
infirit / cairo_surface_scaling.py
Created July 2, 2017 22:24
silly cairo surface scaling example (dd 2017-07-03 requires patched pycairo)
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
import cairo
class IconWindow(Gtk.Window):
def __init__(self, *args, **kwargs):
super().__init__(default_width=150, default_height=150, **kwargs)
self.icon_name = "thunderbird-icon"
@infirit
infirit / drop_python2.diff
Last active May 20, 2017 12:17
drop_python2.diff
diff --git a/apps/blueman-assistant.in b/apps/blueman-assistant.in
index fa02f6ea..dd460bb1 100755
--- a/apps/blueman-assistant.in
+++ b/apps/blueman-assistant.in
@@ -265,7 +265,7 @@ class Assistant:
self.assistant.set_page_header_image(pages[PAGE_FINISH], get_icon("dialog-warning", 32))
self.assistant.set_current_page(PAGE_FINISH)
- self.applet.connect_service(str("(os)"), self.service.device.get_object_path(), self.service.uuid,
+ self.applet.connect_service("(os)", self.service.device.get_object_path(), self.service.uuid,
@infirit
infirit / gtktogglebutton_styled.py
Created April 19, 2017 18:03
GtkToggleButton styled
#!/usr/local/cpython-3.6/bin/python3
# pylint: disable=wrong-import-position
"""Give a toggle button, see what it looks like."""
import sys
import gi
gi.require_version('Gtk', '3.0')
@infirit
infirit / spawn_async_wrapper.py
Last active January 12, 2017 19:28
wrapper script for GLib.spawn_async
from gi.repository import GLib
from gi import PyGIDeprecationWarning
import collections
import warnings
def spawn_async(argv=None, envp=None, working_directory=None,
flags=0, child_setup=None, user_data=None,
standard_input=None, standard_output=None,
standard_error=None):
warnings.warn("Deprecated, old usage of static binding which will be removed.",
@infirit
infirit / bluez-alsa-9999.ebuilld
Last active December 20, 2016 14:55
bluez-alsa gentoo multilib ebuild
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=6
inherit autotools eutils multilib-minimal
DESCRIPTION="Bluetooth Audio ALSA Backend"
HOMEPAGE="https://github.com/Arkq/bluez-alsa"