├── README.md └── obsidianQuickNoteEntry.py /README.md: -------------------------------------------------------------------------------- 1 | # Quick-note-entry-for-Obsidian 2 | A simple one-line quick entry GUI for your Obsidian daily notes in markdown format. 3 | 4 | ![](https://i.imgur.com/332Bqbc.png) 5 | 6 | Log your day quickly with this simple GUI that writes remotely to your Obsidian Daily note vault (in outliner format). 7 | 8 | # Getting Started 9 | 10 | ## Dependancies 11 | 12 | You must have PyQt5 installed. If not already installed, `python -m pip install PyQt5` 13 | 14 | 1. Open the obsidianQuickNoteEntry.py file in a text editor or IDE. 15 | 2. **Pick which date format you use for your daily notes**. Keep `DateFormat = 1` unchanged if your daily notes are in the format: **MMMM Do, YYYY (November 22, 2021)**. If your daily notes are in the format **YYYY-MM-DD (2021-11-22)**, change the value to 2. 16 | 3. Copy your Obsidian folder path and paste it between the quotation marks in `ObsidianVaultFolder = "" ` 17 | 4. Do the same with your Daily notes folder. If you keep your daily notes in the same folder as your main folder, just use the same path. 18 | 5. Depending on your OS, you can make a keyboard shortcut to run the program. I use Ctrl Alt N. 19 | 20 | -------------------------------------------------------------------------------- /obsidianQuickNoteEntry.py: -------------------------------------------------------------------------------- 1 | #-------------Obsidian: Quick daily note writer------------# 2 | # Author: Adrian Papineau 3 | # Date created: February 14th, 2022 4 | 5 | # A simple one-line quick entry GUI for your Obsidian daily notes in markdown format. 6 | 7 | 8 | from PyQt5.QtWidgets import * 9 | import sys 10 | from datetime import date 11 | import time 12 | import glob, os 13 | 14 | ###------------------------------------------### 15 | 16 | 17 | ObsidianVaultFolder = "" # Example :"C:/Users/User/Documents/ObsidianVault/VaultName" 18 | DailyNotesFolder = "" # Example :"C:/Users/User/Documents/ObsidianVault/VaultName/DailyNotes" 19 | DateFormat = 1 20 | 21 | ''' 22 | DateFormat 1 = MMMM Do, YYYY (November 22,2021) 23 | DateFormat 2 = YYYY-MM-DD (2021-11-22) 24 | ''' 25 | 26 | #return current daily note file path 27 | def RoamFormatDate(): 28 | today = date.today() 29 | dateExtractMonth = today.strftime('%B') 30 | dateExtractDay = today.strftime('%d') 31 | dateExtractYear = today.strftime('%Y') 32 | # Get rid of the beginning 0 in day of the month. 33 | if dateExtractDay[0] == "0": 34 | dateExtractDay = dateExtractDay[-1] 35 | # Add the "th" or similar 36 | if ((int(dateExtractDay) >= 10) and (int(dateExtractDay) <20)) or (dateExtractDay[-1] == "0") or ((int(dateExtractDay[-1]) >=4) and (int(dateExtractDay[-1]) <10)): 37 | dateExtractNUM = str(dateExtractDay + "th") 38 | elif dateExtractDay[-1] == "1": 39 | dateExtractNUM = str(dateExtractDay + "st") 40 | elif dateExtractDay[-1] == "2": 41 | dateExtractNUM = str(dateExtractDay + "nd") 42 | elif dateExtractDay[-1] == "3": 43 | dateExtractNUM = str(dateExtractDay + "rd") 44 | RoamFormat = str(dateExtractMonth + " " + dateExtractNUM + ", " + dateExtractYear) 45 | return RoamFormat 46 | #print("Roam format date is: " + RoamFormatDate()) 47 | def SecondFormatDate(): 48 | dateFormat = str(date.today()) 49 | return dateFormat 50 | #print("Second format date is: " + SecondFormatDate()) 51 | 52 | def CurrentDate(): 53 | if DateFormat == 1: 54 | return RoamFormatDate() 55 | if DateFormat == 2: 56 | return SecondFormatDate() 57 | else: 58 | print("Invalid number selection for DateFormat") 59 | 60 | def CurrentDailyNote(): 61 | DailyNoteName = (CurrentDate() + ".md") 62 | DailyNotePath = DailyNotesFolder + "/" + DailyNoteName 63 | return DailyNotePath 64 | print("Currently monitoring the daily note: " + "\n" + CurrentDailyNote()) 65 | 66 | ###------------------------------------------### 67 | 68 | def getTime(): 69 | currentTime = time.strftime("%H:%M") 70 | return(str(currentTime)) 71 | 72 | 73 | class Window(QDialog): 74 | 75 | def __init__(self): 76 | super(Window, self).__init__() 77 | self.setWindowTitle("Quick daily note entry") 78 | self.setGeometry(100, 100, 500, 100)# setting geometry to the window 79 | self.formGroupBox = QGroupBox("Daily note entry") 80 | self.nameLineEdit = QLineEdit() 81 | self.createForm() 82 | self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) 83 | self.buttonBox.accepted.connect(self.getInfo) 84 | self.buttonBox.rejected.connect(self.reject) 85 | mainLayout = QVBoxLayout() 86 | mainLayout.addWidget(self.formGroupBox) 87 | mainLayout.addWidget(self.buttonBox) 88 | self.setLayout(mainLayout) 89 | 90 | def getInfo(self): 91 | currentEntry = (self.nameLineEdit.text()) 92 | AppendToNote(getTime() + " " + str(currentEntry)) 93 | self.close() 94 | 95 | def createForm(self): 96 | layout = QFormLayout() 97 | layout.addRow(QLabel("-"), self.nameLineEdit) 98 | self.formGroupBox.setLayout(layout) 99 | 100 | ###-----### 101 | 102 | def NotePath(): 103 | LinkName = (RemoveAlias() + ".md") 104 | LinkNotePath = ObsidianVaultFolder + "/" + LinkName 105 | return(LinkNotePath) 106 | 107 | def AppendToNote(desiredBlock): 108 | Notefile = open(CurrentDailyNote(), encoding="utf8") 109 | NoteContent = Notefile.read() 110 | Notefile.seek(0) 111 | Notefile = open(CurrentDailyNote(), "w", encoding="utf8") 112 | Notefile.write(NoteContent + "\n" + "- " + desiredBlock) 113 | print("Sucessfully wrote to desired note") 114 | Notefile.seek(0) 115 | Notefile.close() 116 | 117 | if __name__ == '__main__': 118 | app = QApplication(sys.argv) 119 | window = Window() 120 | window.show() 121 | sys.exit(app.exec()) --------------------------------------------------------------------------------