Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughmacOS menu bar -- The Drupal way
Pre-requisites
Problem/Motivation
Can't get (real-time) notifications without checking mailbox or logging into drupal.org when
- An issue having a new comment,
- A documentation page gets updated
- A new post is published to Planet Drupal
- A new Change Record is published
The 4 cases can be classified into two types:
- Login required: 1.2, 3 is available on user's dashboard page, logging in drupal.org is required
- Login optional: 4 do not have to login drupal.org, anonymous ussers is able to access Change Record list pages.
Proposed resolution
Using Bitbar, which can put anything in the menu bar by using any programming language. and put Drupalicon in your macOS's menu bar! And the code which outputs the menu items can be executed by a certain interval. Just like a cron job. The executable file's name indicates that. For example.
foo.1m.php
, executes per 1 minbar.2h.sh
, executes at every 2 hours
So that the menu items are generated dynamically. To get update notifications is possible.
See the demo: https://github.com/jungleran/macos-menu-bar-the-drupal-way/blob/master/macos-menu-bar-the-drupal-way.gif or https://github.com/jungleran/macos-menu-bar-the-drupal-way/blob/master/macos-menu-bar-the-drupal-way.mp4
Login required
Using a HTTP client to visit the target page which contains information we care, further more, the HTTP client handles over the page content to a DOM parser to extract information we want, The last stop is to output them to a proper format following Bitbar's documentation. and display icon(s) in the menu bar.
An example: https://github.com/jungleran/macos-menu-bar-the-drupal-way/blob/master/do.5m.py
By changing your drupal.org credentials in the code, you should be able to see issue/documentation links of "My posts" and posts of "Planet Drupal" from your drupal.org dashboard page as menu items on your macOs menu bar.
# Change your drupal.org credentials here
username = 'YOUR_DRUAP.ORG_ACCOUNT'
password = "YOUR_PASSWORD"
Read the documentation https://github.com/matryer/bitbar to get the example working for you.
Login optional
The process is similar to the above, just do not have to handle logging in.
See example: https://github.com/jungleran/macos-menu-bar-the-drupal-way/blob/master/do.cr.15m.py
This example pulls Change Records(CR) from https://www.drupal.org/list-changes/drupal, all three types of CR are pulled and display each item as menu item. The three types of CR are:
- Published
- Reviews
- Draft
Also see the README.md in the repo of the examples. https://github.com/jungleran/macos-menu-bar-the-drupal-way
Enhancement
As more menus are putting into the menu bar, it's going to get crowded soon. So Here comes Dozer to hide some of them when necessary.
Dozer is a free and open-source project, an alternative of Bartender which is a payware.
PS: Python3 is used to write the examples.
Remaining tasks
Get ready your own Drupal menu bar.
User interface changes
Drupalicon conquers your menu bar.
Release notes snippet
- Target OS: macOS
- Target readers : Drupal contributors/Core contributors.
- Target goal: Happy Drupaling!
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web