Skip to content

Commit 3dbe34f

Browse files
committed
Adds MacOS and improved history support
- Automatic browser history detection is much better - Improve tests - MacOS menu bar support, looks like hackerbar
1 parent e35fdef commit 3dbe34f

25 files changed

Lines changed: 2113 additions & 498 deletions

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
1211
strategy:
1312
matrix:
13+
os: [ubuntu-latest, macos-latest]
1414
python-version: ["3.11", "3.12", "3.13", "3.14"]
15+
runs-on: ${{ matrix.os }}
16+
env:
17+
CI: "true"
1518
steps:
1619
- uses: actions/checkout@v6
17-
- uses: astral-sh/setup-uv@v7
20+
- uses: astral-sh/setup-uv@v8
1821
- run: uv run --python ${{ matrix.python-version }} --with pytest python -m pytest

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

CHANGELOG.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ This file will only list released and supported versions, usually skipping over
33
5.0.0
44
=====
55

6-
* Migrated from setup.py to pyproject.toml
6+
* Upgrades for modern python (3.11+), using uv and pyproject.toml.
77
* Switched from requests to urllib (zero external dependencies)
8-
* Switched from custom appindicator shim to native AppIndicator3 via GObject introspection
9-
* Migrated icon loading to importlib.resources
10-
* Modernized version detection using importlib.metadata
11-
* Requires Python 3.11+
8+
* Switched to AppIndicator3 on Linux
9+
* Adds MacOS support
10+
* Improved history scanning, works for dozens of browsers
1211

1312
4.0.2
1413
=====

README.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
[![Coverage Status](https://coveralls.io/repos/github/captn3m0/hackertray/badge.svg?branch=master)](https://coveralls.io/github/captn3m0/hackertray?branch=master)
55
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/captn3m0/hackertray/test.yml)
66

7-
HackerTray is a simple [Hacker News](https://news.ycombinator.com/) Linux application
8-
that lets you view top HN stories in your System Tray. It uses appindicator where available,
9-
but provides a Gtk StatusIcon fallback in case AppIndicator is not available.
7+
HackerTray is a simple [Hacker News](https://news.ycombinator.com/) application
8+
that lets you view top HN stories in your System Tray. On Linux it uses appindicator where available
9+
(with a Gtk StatusIcon fallback). On macOS it uses a native status bar menu via pyobjc.
1010

1111
The inspiration for this came from [Hacker Bar](https://web.archive.org/web/20131126173924/http://hackerbarapp.com/) (now dead), which was Mac-only.
1212

@@ -47,34 +47,19 @@ HackerTray will automatically check the latest version on startup, and inform yo
4747
HackerTray accepts its various options via the command line. Run `hackertray -h` to see all options. Currently the following switches are supported:
4848

4949
1. `-c`: Enables comments support. Clicking on links will also open the comments page on HN. Can be switched off via the UI, but the setting is not remembered.
50-
2. `--chrome PROFILE-PATH`: Specifying a profile path to a chrome directory will make HackerTray read the Chrome History file to mark links as read. Links are checked once every 5 minutes, which is when the History file is copied (to override the lock in case Chrome is open), searched using sqlite and deleted. This feature is still experimental.
51-
3. `--firefox PROFILE-PATH`: Specify path to a firefox profile directory. HackerTray will read your firefox history from this profile, and use it to mark links as read. Pass `auto` as PROFILE-PATH to automatically read the default profile and use that.
52-
4. `--reverse` (or `-r`). Switches the order for the elements in the menu, so Quit is at top. Use this if your system bar is at the bottom of the screen.
50+
2. `--reverse` (or `-r`): Switches the order for the elements in the menu, so Quit is at top. Use this if your system bar is at the bottom of the screen.
51+
3. `--verbose`: Enable debug logging.
5352

54-
Note that the `--chrome` and `--firefox` options are independent, and can be used together. However, they cannot be specified multiple times (so reading from 2 chrome profiles is not possible).
53+
Browser history is automatically discovered from all installed browsers (Chrome, Firefox, Safari, Brave, Edge, Arc, and many more). All profiles are searched.
5554

56-
### Google Chrome Profile Path
57-
58-
Where your Profile is stored depends on [which version of chrome you are using](https://chromium.googlesource.com/chromium/src.git/+/62.0.3202.58/docs/user_data_dir.md#linux):
59-
60-
- [Chrome Stable] `~/.config/google-chrome/Default`
61-
- [Chrome Beta] `~/.config/google-chrome-beta/Default`
62-
- [Chrome Dev] `~/.config/google-chrome-unstable/Default`
63-
- [Chromium] `~/.config/chromium/Default`
64-
65-
Replace `Default` with `Profile 1`, `Profile 2` or so on if you use multiple profiles on Chrome. Note that the `--chrome` option accepts a `PROFILE-PATH`, not the History file itself. Also note that sometimes `~` might not be set, so you might need to use the complete path (such as `/home/nemo/.config/google-chrome/Default/`).
66-
67-
### Firefox Profile Path
68-
69-
The default firefox profile path is `~/.mozilla/firefox/*.default`, where `*` denotes a random 8 digit string. You can also read `~/.mozilla/firefox/profiles.ini` to get a list of profiles. Alternatively, just pass `auto` and HackerTray will pick the default profile automatically.
55+
Options can also be set in `~/.config/hackertray/hackertray.ini` (or `~/.config/hackertray.ini`):
7056

7157
## Features
7258

7359
1. Minimalist Approach to HN
7460
2. Opens links in your default browser
75-
3. Remembers which links you opened, even if you opened them outside of HackerTray
76-
4. Shows Points/Comment count in a simple format
77-
5. Reads your Google Chrome/Firefox History file to determine which links you've already read (even if you may not have opened them via HackerTray)
61+
3. Shows Points/Comment count in a simple format
62+
4. Reads your browser history to mark which links you've already visited
7863

7964
### Troubleshooting
8065

@@ -101,7 +86,8 @@ On every launch, a request is made to `https://pypi.python.org/pypi/hackertray/j
10186

10287
## Credits
10388

104-
- Mark Rickert for [Hacker Bar](http://hackerbarapp.com/) (No longer active)
89+
- Mark Rickert for [Hacker Bar](https://github.com/MohawkApps/Hacker-Bar) (No longer active, MIT License). The macOS port references Hacker Bar's original design.
90+
- [browser-history](https://github.com/browser-history/browser-history) (Apache 2.0) — browser history discovery patterns were informed by this project.
10591
- [Giridaran Manivannan](https://github.com/ace03uec) for troubleshooting instructions.
10692
- [@cheeaun](https://github.com/cheeaun) for the [Unofficial Hacker News API](https://github.com/cheeaun/node-hnapi/)
10793

0 commit comments

Comments
 (0)