To have a list of all the so called ThemedIcons for your GTK app, download https://flathub.org/apps/details/org.gnome.design.IconLibrary
I have just spent 30 minutes for this. Thank you Gnome developers
| #!/usr/bin/python3 | |
| # both megacmd and bw-cli need to be installed and configured before running this script | |
| # bw-cli from snap needs to be configured in order to write in the /tmp folder | |
| # files will be uploaded in the /bw folder on MEGA | |
| import sys | |
| import os | |
| import subprocess | |
| from getpass import getpass |
| # Credit: https://stackoverflow.com/questions/39818733/create-dictionary-where-keys-are-variable-names | |
| def create_dict(*args: str): | |
| return dict({i:eval(i) for i in args}) |
| def qq(condition, is_true, is_false): | |
| return is_true if condition else is_false |
| import requests | |
| from gi.repository import Gtk, Adw, GdkPixbuf, GLib | |
| def gtk_image_from_url(url: str, image: Gtk.Image): | |
| """Using the requests module we load an image from a http endpoint, then we can create a Pixbuf loader to load our image""" | |
| response = requests.get(url) | |
| response.raise_for_status() | |
| loader = GdkPixbuf.PixbufLoader() | |
| loader.write_bytes(GLib.Bytes.new(response.content)) |
| def ask(message: str, options: set) -> str: | |
| _input = None | |
| while not _input in options: | |
| _input = input(message) | |
| return _input |
| def key_in_dict(_dict: dict, key_lookup: str, separator='.'): | |
| """ | |
| Searches for a nested key in a dictionary and returns its value, or None if nothing was found. | |
| key_lookup must be a string where each key is deparated by a given "separator" character, which by default is a dot | |
| """ | |
| if not isinstance(_dict, dict): | |
| raise TypeError('First argument must be type Dict') | |
| keys = key_lookup.split(separator) | |
| subdict = _dict |
| { | |
| // Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and | |
| // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
| // same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "prefix": "log", | |
| // "body": [ | |
| // "console.log('$1');", |
| /** | |
| The first time I wanted to create an extension for Gnome, I spent two hours trying to understand how to do this, due to bad documentation. | |
| So now I am sharing this once for all. | |
| */ | |
| const ByteArray = imports.byteArray; | |
| function exec(command) { | |
| const output = GLib.spawn_command_line_sync(command); | |
| return { | |
| ok: output[0], | |
| standard_output: ByteArray.toString(output[1]), |
To have a list of all the so called ThemedIcons for your GTK app, download https://flathub.org/apps/details/org.gnome.design.IconLibrary
I have just spent 30 minutes for this. Thank you Gnome developers
I'm writing this because I found it harder than expected, but actually is super easy.
Shift + c, you can select more than oneShift + v, will ask for confirmation.NOTE
On older versions, you simply had to press c and v without Shift