Skip to content

Commit

Permalink
set target day
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r4m committed Feb 14, 2024
1 parent f2af923 commit f4b5e5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# macOS-D-day
<img width="961" alt="image" src="https://github.com/v1r4m/macOS-D-day/assets/26866063/55e9d050-48b1-4474-9675-f549d2dc83d3">

* `2024년 1월 30일` 기준으로 상단 Dock Bar에 디데이를 표시해줍니다.
* 특정 날짜를 기준으로 상단 Dock Bar에 디데이를 표시해줍니다.
* tested only on MacOS Monterey `12.5.1`, Apple M1 Pro

## stack
Expand All @@ -19,8 +19,3 @@ python3 main.py
python3 setup.py py2app -A
```


### 추가해야 하는 기능
* 날짜 커스텀 기능
* 생긴게 심심하니까 이모지 정도 넣고 싶다

7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
class DateApp(rumps.App):
def __init__(self):
super(DateApp, self).__init__("Date App")
self.target_date_file = os.path.join(os.path.expanduser("~"), 'target_date.txt')
self.target_date = self.load_target_date()
self.update_date()

def load_target_date(self):
if os.path.exists('target_date.txt'):
with open('target_date.txt', 'r') as f:
if os.path.exists(self.target_date_file):
with open(self.target_date_file, 'r') as f:
return datetime.strptime(f.read().strip(), '%Y-%m-%d').date()
else:
return date.today()
Expand All @@ -27,7 +28,7 @@ def set_target_date(self, _):
if response.clicked:
self.target_date = datetime.strptime(response.text, '%Y-%m-%d').date()
self.update_date()
with open('target_date.txt', 'w') as f:
with open(self.target_date_file, 'w') as f:
f.write(str(self.target_date))

def update_date(self):
Expand Down

0 comments on commit f4b5e5f

Please sign in to comment.