This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require("lgi") | |
local Gio = lgi.require("Gio", "2.0") | |
--[[ Arguments: | |
1 (table): The first element is the commandline process name, the rest are commandline arguments | |
2 (table): A list of Gio.SubprocessFlags | |
]] | |
local sub = Gio.Subprocess.new( | |
{ "echo", "Hello", "world!" }, | |
{ Gio.SubprocessFlags.NONE, Gio.SubprocessFlags.STDOUT_PIPE } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require("lgi") | |
local GLib = lgi.require("GLib", "2.0") | |
--[[ Explanation | |
Some multimedia apps (music players, for example) that uses GLib and related libraries (Gtk, | |
GObject, GStreamer, etc...) commonly auto-detects user directories that contains specific | |
things like music, videos, pictures and documents. That's nice, but... How is it done? | |
Well... Here's the answer: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- From my other Gist: https://gist.github.com/M1que4s/9f1eec873f87cb02238bd6de2d435705 | |
local lgi = require("lgi") | |
local GObject = lgi.require("GObject", "2.0") | |
local Canonical = GObject.Object:derive("Canonical") | |
function Canonical:_class_init(Class) | |
function Class:set_property(id, val, pspec) | |
if id == 1 then self.priv["prop-a"] = val:get_string() | |
elseif id == 2 then self.priv["prop-b"] = val:get_string() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require("lgi") | |
local Gio = lgi.require("Gio", "2.0") | |
local Content = {} | |
local Dir = "" | |
function ReadDir(Path, Tab, Indent) | |
local file = Gio.File.new_for_path(Path) | |
local enum = file:enumerate_children("standard::name", Gio.FileQueryInfoFlags.NONE) | |
local path = file:get_path() .. "/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require("lgi") | |
local GObject = lgi.require("GObject", "2.0") | |
-- Our new class inherits directly from GObject | |
local Person = GObject.Object:derive("Person") | |
-- Class constructor, used by GObject. This function | |
-- is called one time and is for register our class. | |
-- Inside this function we can do some things like | |
-- create some properties, signals and override some |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require("lgi") | |
local Gtk = lgi.Gtk | |
local GObject = lgi.GObject | |
local Example = lgi.package("Example") | |
Example:class("App", Gtk.Application) | |
Example:class("Header", Gtk.HeaderBar) | |
Example:class("Window", Gtk.ApplicationWindow) | |
function Example.App:_init( ... ) |
NewerOlder