Skip to content

Commit a1536cb

Browse files
authored
Merge pull request #6 from visini/remove-desk-handler
Remove desk handler
2 parents 43a7446 + be85e66 commit a1536cb

File tree

6 files changed

+44
-292
lines changed

6 files changed

+44
-292
lines changed

Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ VERSION_SET := 1
55
endif
66

77
install:
8-
@echo "If pip error, export the below flags (NOT via Makefile, since every line has separate shell! run directly)"
9-
#export SYSTEM_VERSION_COMPAT=1
10-
#export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
11-
#export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"
12-
#export LDFLAGS="${LDFLAGS} -L/usr/local/opt/sqlite/lib"
13-
#export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/sqlite/include"
14-
#export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"
15-
#export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/sqlite/lib/pkgconfig"
168
poetry install
179
dev:
1810
poetry run python main.py
@@ -26,9 +18,9 @@ ifeq ($(VERSION_SET),1)
2618
poetry version $(VERSION)
2719
git add pyproject.toml
2820
git commit -m "Release $(VERSION)"
29-
git push
21+
git push
3022
cd dist && zip -r "$(APP_NAME).app.zip" "$(APP_NAME).app"
3123
gh release create $(VERSION) 'dist/$(APP_NAME).app.zip#$(APP_NAME).app.zip'
3224
else
3325
$(error VERSION not defined - use like this: make release VERSION=...)
34-
endif
26+
endif

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Menu bar utility app (macOS) for adding [Timeboxing](https://en.wikipedia.org/wi
66

77
![Screenshot](screenshot.png)
88

9-
Integrated with a _Raspberry Pi-/Arduino-powered standing desk_ for setting a new desk height after the current task has been completed. See implementation details in [visini/desk](https://github.com/visini/desk) and [visini/stand](https://github.com/visini/stand).
10-
119
See `Makefile` for how to install, debug, build, and release. Or download the [latest release](https://github.com/visini/timebox/releases).
1210

11+
Note: Since April 14, 2023, Things 3 stores data in a unique location - you will have to build the app after setting the proper path in `main.py` via `THINGS_SQLITE_PATH`.
12+
1313
Download using GitHub CLI:
1414

1515
```shell

main.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,13 @@
55
import sqlite3
66
import os
77

8-
from ssh_desk_handler import SSHDeskHandler
9-
10-
SEC_TO_MIN = 60
8+
THINGS_SQLITE_PATH = "~/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/ThingsData-4R6L5/Things Database.thingsdatabase/main.sqlite"
119

1210
def timez():
1311
return time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime())
1412

15-
1613
def get_things_today_tasks(index=0, complete_task=False):
17-
conn = sqlite3.connect(
18-
os.path.expanduser(
19-
"~/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/Things Database.thingsdatabase/main.sqlite"
20-
)
21-
)
14+
conn = sqlite3.connect(os.path.expanduser(THINGS_SQLITE_PATH))
2215
sql = (
2316
"SELECT\n"
2417
" TAG.title,\n"
@@ -29,7 +22,6 @@ def get_things_today_tasks(index=0, complete_task=False):
2922
" LEFT JOIN TMTag TAG ON TAGS.tags = TAG.uuid\n"
3023
" LEFT OUTER JOIN TMTask PROJECT ON TASK.project = PROJECT.uuid\n"
3124
" LEFT OUTER JOIN TMArea AREA ON TASK.area = AREA.uuid\n"
32-
" LEFT OUTER JOIN TMTask HEADING ON TASK.actionGroup = HEADING.uuid\n"
3325
" WHERE TASK.trashed = 0 AND TASK.status = 0 AND TASK.type = 0 AND TAG.title IS NOT NULL\n"
3426
" AND TASK.start = 1\n"
3527
" AND TASK.startdate is NOT NULL\n"
@@ -78,20 +70,13 @@ def __init__(self, timer_interval=1):
7870
self.timer.stop() # timer running when initialized
7971
self.timer.count = 0
8072
self.app = rumps.App("Timebox", "🥊")
81-
self.desk_handler = SSHDeskHandler()
82-
self.interval = SEC_TO_MIN
73+
self.interval = 60
8374
self.current_things_task_url = None
8475
self.start_pause_button = rumps.MenuItem(
8576
title="Start Timer",
8677
callback=lambda _: self.start_timer(_, self.interval),
8778
key="s",
8879
)
89-
self.toggle_sit_stand_button = rumps.MenuItem(
90-
title="Toggle Sit/Stand",
91-
callback=lambda sender: self.toggle_button(sender),
92-
key="t",
93-
)
94-
self.toggle_sit_stand_button.state = True
9580
self.stop_button = rumps.MenuItem(title="Stop Timer", callback=None)
9681
self.buttons = {}
9782
self.buttons_callback = {}
@@ -114,7 +99,6 @@ def __init__(self, timer_interval=1):
11499
self.app.menu = [
115100
self.start_pause_button,
116101
self.sync_button,
117-
self.toggle_sit_stand_button,
118102
None,
119103
self.sum_menu_item,
120104
# *self.things_buttons.values(),
@@ -168,7 +152,7 @@ def run(self):
168152
def set_mins(self, sender, interval, task_url):
169153
for btn in [*self.things_buttons.values(), *self.buttons.values()]:
170154
if sender.title == btn.title:
171-
self.interval = interval * SEC_TO_MIN
155+
self.interval = interval * 60
172156
cleaned_title = " ".join(sender.title.split()[:-2])
173157
if task_url is not None:
174158
self.menu_title = " → " + cleaned_title
@@ -215,8 +199,6 @@ def on_tick(self, sender):
215199
shlex.split("open '" + self.current_things_task_url + "'")
216200
)
217201
self.current_things_task_url = None
218-
if self.toggle_sit_stand_button.state == True:
219-
self.desk_handler.toggle()
220202
self.stop_timer(sender)
221203
self.stop_button.set_callback(None)
222204
self.sync_data()

0 commit comments

Comments
 (0)