20250506.1746536761
This commit is contained in:
parent
1194ba127d
commit
3c5f3155eb
3 changed files with 77 additions and 17 deletions
|
@ -357,21 +357,33 @@ PRIORITY may be one of the characters ?A, ?B, or ?C."
|
||||||
;; View 7 days in the calendar view
|
;; View 7 days in the calendar view
|
||||||
((agenda "" ((org-agenda-span 7)))
|
((agenda "" ((org-agenda-span 7)))
|
||||||
|
|
||||||
;; Display items with priority A
|
|
||||||
|
(tags-todo "+TODO=\"STRT\""
|
||||||
|
((org-agenda-overriding-header "All started tasks (STRT)")))
|
||||||
|
|
||||||
|
;; ------------------ Priority A ------------------
|
||||||
(tags "PRIORITY=\"A\""
|
(tags "PRIORITY=\"A\""
|
||||||
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
((org-agenda-skip-function
|
||||||
(org-agenda-overriding-header "High-priority unfinished tasks:")))
|
'(or (org-agenda-skip-entry-if 'todo 'done)
|
||||||
|
(org-agenda-skip-entry-if 'todo '("STRT" "HOLD"))))
|
||||||
|
(org-agenda-overriding-header "High‑priority unfinished tasks:")))
|
||||||
|
|
||||||
|
;; ------------------ Priority B ------------------
|
||||||
;; Display items with priority B (really it is view all items minus A & C)
|
|
||||||
(tags "PRIORITY=\"B\""
|
(tags "PRIORITY=\"B\""
|
||||||
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
((org-agenda-skip-function
|
||||||
(org-agenda-overriding-header "ALL normal priority tasks:")))
|
'(or (org-agenda-skip-entry-if 'todo 'done)
|
||||||
|
(org-agenda-skip-entry-if 'todo '("STRT" "HOLD"))))
|
||||||
|
(org-agenda-overriding-header "ALL normal‑priority tasks:")))
|
||||||
|
|
||||||
;; Display items with pirority C
|
;; ------------------ Priority C ------------------
|
||||||
(tags "PRIORITY=\"C\""
|
(tags "PRIORITY=\"C\""
|
||||||
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
((org-agenda-skip-function
|
||||||
(org-agenda-overriding-header "Low-priority Unfinished tasks:")))
|
'(or (org-agenda-skip-entry-if 'todo 'done)
|
||||||
|
(org-agenda-skip-entry-if 'todo '("STRT" "HOLD"))))
|
||||||
|
(org-agenda-overriding-header "Low‑priority unfinished tasks:")))
|
||||||
|
|
||||||
|
(tags-todo "+TODO=\"HOLD\""
|
||||||
|
((org-agenda-overriding-header "All holded tasks (HOLD)")))
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Don't compress things (change to suite your tastes)
|
;; Don't compress things (change to suite your tastes)
|
||||||
|
|
|
@ -129,6 +129,8 @@ alias dib="diary.py insert ${DIARY:?} bulk"
|
||||||
alias dis=" diary_string"
|
alias dis=" diary_string"
|
||||||
alias dit="diary.py doctor ${DIARY:?}"
|
alias dit="diary.py doctor ${DIARY:?}"
|
||||||
alias jrnlc="jrnl --encrypt"
|
alias jrnlc="jrnl --encrypt"
|
||||||
|
# vifm
|
||||||
|
alias fm="vifmrun"
|
||||||
|
|
||||||
# bindkeys
|
# bindkeys
|
||||||
## autosuggest
|
## autosuggest
|
||||||
|
|
|
@ -62,6 +62,22 @@ class Config:
|
||||||
Config.validate()
|
Config.validate()
|
||||||
|
|
||||||
|
|
||||||
|
def daytime(dt: datetime):
|
||||||
|
hour = int(dt.strftime("%I"))
|
||||||
|
|
||||||
|
am_pm = dt.strftime("%p") # "AM"/"PM"
|
||||||
|
|
||||||
|
part_of_day = "none"
|
||||||
|
|
||||||
|
if am_pm == "AM":
|
||||||
|
if 5 <= hour < 12:
|
||||||
|
part_of_day = "morning"
|
||||||
|
elif 12 <= hour < 5:
|
||||||
|
part_of_day = "night"
|
||||||
|
|
||||||
|
return part_of_day
|
||||||
|
|
||||||
|
|
||||||
def make_logger():
|
def make_logger():
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
|
@ -104,13 +120,16 @@ def find_closest_entry(data, target_timestamp: int):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def convert_diary_date(date_str):
|
def convert_diary_date(date_str, to_str: bool = True):
|
||||||
try:
|
try:
|
||||||
return (
|
dt = (
|
||||||
datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ")
|
datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
.replace(tzinfo=ZoneInfo("UTC"))
|
.replace(tzinfo=ZoneInfo("UTC"))
|
||||||
.astimezone(TZ)
|
.astimezone(TZ)
|
||||||
).strftime("%d %b %Y at %H:%M:%S:")
|
)
|
||||||
|
if to_str:
|
||||||
|
return dt.strftime("%d %b %Y at %H:%M:%S:")
|
||||||
|
return dt
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -569,9 +588,15 @@ def export():
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
diary_datetime = convert_diary_date(create_time)
|
||||||
|
daytime_tag = daytime(convert_diary_date(create_time, False))
|
||||||
|
|
||||||
|
if daytime_tag != "none":
|
||||||
|
content += f"\n@{daytime_tag}"
|
||||||
|
|
||||||
content = shlex.quote(content)
|
content = shlex.quote(content)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f'printf "%s %b" "{convert_diary_date(create_time)}" {content} | jrnl {diary_name}',
|
f'printf "%s %b" "{diary_datetime}" {content} | jrnl {diary_name}',
|
||||||
shell=True,
|
shell=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
@ -629,13 +654,24 @@ def insert():
|
||||||
"""
|
"""
|
||||||
Inserting a string from the terminal
|
Inserting a string from the terminal
|
||||||
"""
|
"""
|
||||||
content = shlex.quote(sys.argv[4])
|
|
||||||
|
diary_datetime = convert_diary_date(datenow_timestamp)
|
||||||
|
daytime_tag = daytime(convert_diary_date(datenow_timestamp, False))
|
||||||
|
|
||||||
|
content = sys.argv[4]
|
||||||
|
|
||||||
|
# inserting daytime tag
|
||||||
|
if daytime_tag != "none":
|
||||||
|
content += f"\n@{daytime_tag}"
|
||||||
|
|
||||||
|
content = shlex.quote(content)
|
||||||
|
|
||||||
if not content:
|
if not content:
|
||||||
print("There is no text")
|
print("There is no text")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f'printf "%s %s" "{convert_diary_date(datenow_timestamp)}" {content} | jrnl {diary_name}',
|
f'printf "%s %s" "{diary_datetime}" {content} | jrnl {diary_name}',
|
||||||
shell=True,
|
shell=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
@ -658,11 +694,21 @@ def insert():
|
||||||
|
|
||||||
subprocess.run(["nvim", temp_file_path], text=True, check=True)
|
subprocess.run(["nvim", temp_file_path], text=True, check=True)
|
||||||
with open(temp_file_path, "r") as file:
|
with open(temp_file_path, "r") as file:
|
||||||
|
diary_datetime = convert_diary_date(datenow_timestamp)
|
||||||
|
daytime_tag = daytime(diary_datetime)
|
||||||
|
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
# inserting daytime tag
|
||||||
|
if daytime_tag != "none":
|
||||||
|
content += f"\n@{daytime_tag}"
|
||||||
|
|
||||||
content = shlex.quote(file.read())
|
content = shlex.quote(file.read())
|
||||||
|
|
||||||
if hash != make_hash(temp_file_path):
|
if hash != make_hash(temp_file_path):
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
f'printf "%s %s" "{convert_diary_date(datenow_timestamp)}" {content} | jrnl {diary_name}',
|
f'printf "%s %s" "{diary_datetime}" {content} | jrnl {diary_name}',
|
||||||
shell=True,
|
shell=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
|
Loading…
Add table
Reference in a new issue