Skip to main content

Ridiculously Uncomplicated MacOS Python Statusbar apps.

Project description

rumps

Ridiculously Uncomplicated macOS Python Statusbar apps.

https://raw.github.com/jaredks/rumps/master/examples/rumps_example.png
import rumps

class AwesomeStatusBarApp(rumps.App):
    @rumps.clicked("Preferences")
    def prefs(self, _):
        rumps.alert("jk! no preferences available!")

    @rumps.clicked("Silly button")
    def onoff(self, sender):
        sender.state = not sender.state

    @rumps.clicked("Say hi")
    def sayhi(self, _):
        rumps.notification("Awesome title", "amazing subtitle", "hi!!1")

if __name__ == "__main__":
    AwesomeStatusBarApp("Awesome App").run()

How fun!?

rumps can greatly shorten the code required to generate a working app. No PyObjC underscore syntax required!

Use case

rumps is for any console-based program that would benefit from a simple configuration toolbar or launch menu.

Good for:

  • Notification-center-based app

  • Controlling daemons / launching separate programs

  • Updating simple info from web APIs on a timer

Not good for:

  • Any app that is first and foremost a GUI application

Required

  • PyObjC

  • Python 2.6+

Mac OS X 10.6 was shipped with Python 2.6 as the default version and PyObjC has been included in the default Python since Mac OS X 10.5. If you’re using Mac OS X 10.6+ and the default Python that came with it, then rumps should be good to go!

Installation

Using pip,

pip install rumps

Or from source,

python setup.py install

Both of which will require sudo if installing in a system-wide location.

Virtual Environments

There are issues with using virtualenv because of the way the Python executable is copied. Although rumps attempts to apply a fix (hack) during the install process, it is not suggested to use virtualenv.

To ensure proper functionality, either use venv (packaged with Python 3) or create a standalone app using py2app.

python3 -m venv env

Documentation

Documentation is available at http://rumps.readthedocs.org

License

“Modified BSD License”. See LICENSE for details. Copyright Jared Suttles, 2020.

Works Made With rumps

20twenty20 - eohomegrownapps

42-CanITakeCoffee - avallete

air-quality-app - grtfou

Airplane - C-Codes

allbar - raphaelhuefner

allofthelights - kenkeiter

attendee-tool-mlh - Bucknalla

Auroratain - Matt-McConway

AutoSSP - viktyz

AutoVPN - shadyabhi

BackgroundsForReddit - karlaugsten

bink - e40

bitracker - JZChen

BluetoothEvent - lostman-github

break-timer - jjmojojjmojo

breaker - amloewi

bundle-checker - jeffgodwyll

c1t1 - e9t

CamAlert - MrBananaPants

camsketch - pdubroy

casita - david-kuehn

ChargeMon - RhetTbull

ComicStreamer - beville

commitwatch - chrisfosterelli

ComMute - cwverhey

computer-time - rbrich

crypto-ticker-macOS - mqulateen

cryptocoin-quotes - Sayan98

cuco - jjuanda

currency-converter - ahmedelgohary

dns.app - damln

Dokky - rogierkn

dolar_bitcoin - celis

duplicati - duplicati

dysonMacOS - fhenwood

earth - nickrobson

ForceNapClone - hroftgit

freelan-bar - privacee

g-assistant-mac - agucova

gapa - ozlerhakan

GitSyncApp - jachin

Gumpy - RobGraham

Habitus - kmundnic

HalfCaff - dougn

happymac - laffra

harmenubar - vekkt0r

hatarake - kfdm-archive

HipStatus - jamfit

hp-lorem - jamesrampton

hs100-status-bar - craig-davis

iBatteryStats - saket13

iBrew - Tristan79

idiot - snare

interlocking - jrauch

istat - Lingdu0

keynote_snap - sasn0

Keypad - jelmer04

keyringo - tokenizecx

kizkiz - TkTech

koinex-status-ticker - kirantambe

leaguefriend - pandarison

LifxController - mitchmcdee

lil_ip_toolbar - mchlrtkwski

mac-shrew - mejmo

MacFaceID - vkalia602

majo-v - r4lv

MBatteryApp - Elliot-Potts

McBing - bagabont

Memcode - aroraenterprise

memdam - joshalbrecht

MenuBarGmail - rcmdnk

MenuPing - Julien Bordet

midi2dmx - davidbistolas

monero-ticker - Cisplatin

MoodLight - kretash

MoonTicker - skxu

musicbar - russelg

narcissist - helmholtz

Noise-Line - Dnncha

nowplaying_statusbar - MataiulS

obmenka - vlakin

OnAir - henrik242

org-clock-dashboard - srid

osx-bamboo-plan-status - spalter

osx-myair - CameronEx

PennAppsX - yousufmsoliman

phd - ChrisCummins

pokemon-go-status - pboardman

polly - interrogator

pompy - camilopayan

project_screen_to_lifx - emiraga

PSPEWC-mac - jacquesCedric

py-Timey - asakasinsky

pymodoro - volflow

pySplash - Egregors

quick-grayscale - shubhamjain

quiet - hiroshi

Radio-Crowd - EliMendelson

RadioBar - wass3r

RadioBar (fork) - mdbraber

rescuetime_statusbar - MauriceZ

rideindegochecker - josepvalls

RitsWifi - fang2hou

safety-bar - pyupio

SAT-Vocab-Quizzer - Legoben

sb-translate - leandroltavares

sharfoo - furqan-shakoor

ShortyURLShortener - Naktrem

shotput - amussey

SingMenuData - ponyfleisch

slack-status-bar - ericwb

slackify - nikodraca

Snapgrid - VladUsatii

snippets - quillford

sonostus - sarkkine

Spaceapi-Desktop - UrLab

SpaceSwitcher - SankaitLaroiya

SpotifyLyrics - yask123

steemticker-osx - ZachC16

Timebar - devonkong

Timebox - visini

Telkom-ADSL-Data-Usage - parautenbach

Telton - Yywww

Textinator - RhetTbull

these-days - hahayes

time-tracking - willsgrigg

timerbar - uberalex

tracker - jtxx000

TrojanA - chrisxiao

umma - mankoff

upbrew - stchris

uptimeIndicator - paulaborde

urstatus - kysely

uStatus - kdungs

VagrantBar - kingsdigitallab

voiceplay - tb0hdan

volsbb - akigugale

Volumio_bar - volderette

votingpowerbar - therealwolf42

VPN Handler - tsarenkotxt

WakeTime App - dleicht

WallpDesk - L3rchal

webcronic - josselinauguste

Whale - amka

WhyFi - OzTamir

WordTime - Demonstrandum

work_time_percent_applet - Benhgift

WorkWise - 8ern4ard

xCodea - lowne

yaca - drproteus

Zero - beejhuff

Submit a pull request to add your own!

Contributing

If you’ve submitted a pull request and need it reviewed, please request a review from @daredoes (contributing in free time, so please be patient)

Changes

0.4.0 (2022-10-14)

  • Automatically display windows in light or dark mode #162

  • Allow copy, paste, etc #150

  • Allow notifications to be displayed in DND #179

  • Add event hooks, enable multiple event handlers #140

  • Allow menu items to be hidden #138

  • Fix dark mode alert style #137

  • Notifications: fixes, cleanup, and tests #131

  • Fix slider for some older macOS versions (10.11 and before?)

  • Keyboard interrupts now stop a running application

0.3.0 (2019-02-01)

  • Fix passing data in notifications

  • Add other and icon_path options to alert

  • Add secure option to Window

  • Add action_button, other_button, and reply_button options to notification

  • Add slider

0.2.2 (2017-04-26)

  • Add template icon support for dark menubar theme.

  • Fix inability to create notification center by creating Info.plist file at executable directory with CFBundleIdentifier on installation. If that failed, provide more information at runtime in the exception about how to fix the problem.

  • Add Python 3 support

0.2.1 (2014-12-13)

  • No longer have to set menu explicitly
    • rumps will create the menu as it parses paths in clicked decorators

  • Reverted change to timers that produced a list of weak references rather than objects

  • New keyword arguments
    • key for clicked

    • debug for App.run

0.2.0 (2014-08-09)

Improvements and compatibility fixes

  • Added a large number of docstrings

  • Merged pull request allowing unicode text

  • Compatibility fixes for Python 2.6
    • Included OrderedDict recipe

    • _TIMERS not using weakref.WeakSet

  • Compatibility fixes for Mac OS X versions prior to 10.8 (Notification Center)
    • Attempting to send a notification on <10.8 will raise RuntimeError

  • Added quit_application function to allow for both custom quit buttons and running clean up code before quitting

API changes

  • Most api changes dealt with accepting None as a parameter to use or restore a default setting

  • Raise TypeError before less obvious exceptions occur in PyObjC

  • alert and Window
    • No required parameters

    • Passing a string as cancel parameter will change the button text to that string

    • Window.add_button now requires a string

  • App
    • name parameter must be a string and title must be either a string or None

    • Added quit_button parameter allowing custom text or disabling completely by passing None

  • MenuItem
    • Passing None as callback parameter to MenuItem.set_callback method will disable the callback function and grey out the menu item

    • passing an invalid sequence for dimensions parameter to MenuItem.set_icon will no longer silently error

0.1.5 (2014-08-03)

  • Fix implemented for NSInvalidArgumentException issue on 10.9.x

0.1.4 (2013-08-21)

  • Menu class subclassing ListDict, a subclass of OrderedDict with additional insertion operations

  • update method of Menu works like old App.menu parsing - consumes various nested Python containers and creates menus

0.1.3 (2013-08-19)

  • separator global for marking menu separators (in addition to None in context of a menu)

  • Can now have separators in sub menus using either separator or None

  • Key and menu title not matching doesn’t raise an exception since the situation would occur if the title is changed dynamically
    • Instead, a warning in the log

  • Refactored MenuItem such that it subclasses new Menu class

  • Menu class created
    • Wraps NSMenu using __setitem__, __delitem__, etc.

    • Allows for main menu to be easily changed during runtime as it now uses Menu class instead of vanilla OrderedDict

    • clear method for MenuItem + other irrelevant methods inherited from OrderedDict raise NotImplementedError

  • As result of refactoring, could simplify menu parsing for App

0.1.2 (2013-08-11)

  • Interval access and modification added to Timer objects

  • timers function for iterating over timers

  • Timer class now directly in module namespace

  • More specfic case for trying callback with instance of App subclass as first argument
    • Point is to avoid catching a completely different TypeError, then sending 2 variables to a function consuming 1

0.1.1 (2013-08-07)

  • Parsing data structures for creating menus is now more robust

  • Fixed MenuItem __repr__ for printing instances where no callback function has been given

  • Added example_menu.py to examples serving also as a test for new MenuItem changes

  • Can now del MenuItems of submenus and it will be reflected in the actual menu

  • add method for more convenient addition of MenuItems to a MenuItem’s submenu

  • Created module docstring

0.1.0 (2013-07-31)

  • world, hello! meet rumps.

Project details


Download files

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

Source Distribution

rumps-0.4.0.tar.gz (39.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page