Skip to main content

A spacemacs menu inspired gtk module

Project description

SpaceMenu

Description

SpaceMenu is a python module inspired by the spacemacs "space menu". Designed to be used as a laucher for i3wm

Dependencies

gtk-3.0

Installation

pip install spacemenu

Usage

Window

The class Window represents the menu window itself

from spacemenu import Window
window = Window(root, options)
Parameters

root -> A dictionary with the desired display information in the following schema:

{
  "label": 'title of the window',
  "branches": [
    {
      "label": "label for the first branch",
      "branches": [],
      "leaves": []
    }
  ],
  "leaves": [
    { "label": "label for leaf 1", "command": "shell command to be executed""}
  ]
}

so, a branch can contain other branches or leaves, and each leaf executes a command.

options -> Options can either be a dictonary or an Options object

{
  "margin": 10,
  "column_spacing": 1,
  "row_spacing": 1,
  "max_columns": 5,
  "row_height": 35,
  "margin_left": 0,
  "margin_right": 0,
  "margin_bottom": 0,
  "font": "italic bold 12px Georgia, serif",
  "background_color": "#ffffff"
  "button_background_color": "#ffffff"
  "button_text_color": "#000000"
  "branch_background_color": "#ffffff",
  "branch_text_color": "#ffffff",
  "branch_text_shortcut_color": "#ff0000",
  "branch_text_separator_color": "#00ff00",
  "branch_text_label_color": "#0000ff",
  "leaf_background_color": "#ffffff",
  "leaf_text_color": "#000000",
  "leaf_text_shortcut_color": "#ff0000",
  "leaf_text_separator_color': "#00ff00",
  "leaf_text_label_color": "#0000ff"
}

note: any undefined values will be set to the Gtk theme default

Methods

draw() -> draw the window

Options

Outer Shape

  • margin_left: Sets outer left margin (in px)
  • margin_right: Sets outer right margin (in px)
  • margin_bottom: Sets outer bottom margin (in px)

Inner Shap

  • inner_margin: Inner margin for the window
  • column_spacing: Spacing between each column
  • row_spacing: Spacing between each row
  • max_columns: Maximum number of columns to display
  • row_height: The height of the buttons in each row
  • font: Font to be used by the labels

Colors

  • background_color: The color for the window background (#rrggbb)
  • button_background_color: The color for the button background (#rrggbb)
  • button_text_color: The color for the text of the buttons(#rrggbb)

TODO

  • allow externally defined shortcuts

License

GPL-3.0-or-later

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spacemenu, version 0.4
Filename, size File type Python version Upload date Hashes
Filename, size spacemenu-0.4-py3-none-any.whl (20.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size spacemenu-0.4.tar.gz (7.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page