Skip to content

MacOS menu bar app that pops up at user-specified intervals. These pop-ups contain user-specified texts, such as inspirational quotes or idioms. Useful for language learners. Written in SwiftUI.

License

Notifications You must be signed in to change notification settings

liweiyap/text-popover-macOS

Repository files navigation

Text-Popover is a MacOS menu bar app that pops up at user-specified intervals. These pop-ups contain user-specified texts, such as inspirational quotes or idioms, which are stored in SQLite databases in the text-popover-macOSDatabaseFiles/ directory. Language learners could use these pop-ups as virtual placards. The app is written in the SwiftUI framework.

Light mode Dark mode

Contents

Usage

Main page of popover

  1. This button closes the app.
  2. This button takes you to the next page of the popover, which shows any additional text that you might want to display.
  3. This is the amount of time remaining in hours and minutes before the text changes to the next available one in the current database. If the Mac goes to sleep whilst the app is still running, the time will be updated accordingly when the Mac wakes up.
  4. This button opens the settings window.
  5. This is the user-defined main text for display. In the image above, the main text (Expression) is a German idiom.
  6. This is a user-defined sub-text for display. It can be blank. In the image, the sub-text (Explanation) is the meaning of the German idiom.

Back to top

Next page of popover

  1. This button takes you back to the main page of the popover.
  2. This is a user-defined sub-text (Elaboration) for display. It can be blank. In the image, the sub-text is the history behind the German idiom.

Back to top

Adjusting the settings

  1. This segment sets the interval between changes in the text displayed in the popover. When the interval is up, the text is updated to the next available one in the current database, and the time is reset. The default interval is 24 hours.
  2. This segment sets the sound played when the text in the popover is updated. By default, no sound is played. Drag on the slider to adjust the volume of the sound. By default, the sound is played at a maximal volume. In addition, by default, the popover appears automatically on the screen when the text gets updated. However, you have the option to turn off this pop-up behaviour, such that when the current interval is up, the text in the popover will still get updated but the popover will not appear on the screen.
  3. This segment allows you to decide whether or not to display the sub-texts (Explanation and Elaboration). After all, they could sometimes be blank. By default, the Explanation is displayed but the Elaboration (together with the blue button in the popover) is not.
  4. This segment allows you to set the appearance of the popover to either light or dark mode. The default appearance is dark mode.

Back to top

Default database "Redewendungen"

The default database contains German idioms (Redewendungen). Every time the app is restarted, the default database is automatically built from scratch. This is done by using the Python library Beautiful Soup to scrape the idioms, as well as their meaning and history, from Wikipedia. Python is not required for any further databases that you may wish to add.

Back to top

Adding a new database

  1. Click this button if you wish to add a new database.

  1. Input the name of your new database and click 'Create'.

  1. The list of databases on the left will automatically be updated. Click on the name of your new database.
  2. Input as many entries as you like. The Explanation and Elaboration are optional but the Expression cannot be left blank.
  3. If you no longer want an entry, you can remove it from your database.

The popover will display entries from the new database as long as it is selected in the settings window.

  1. Click on this button if you no longer want a database, and then click 'Yes' to confirm deletion.

Back to top

Note on databases

All databases are added to the text-popover-macOSDatabaseFiles/ directory. From within the app, you cannot delete the default database "Redewendungen". Neither can you add any new entries to the default database nor remove any entries from it. For more information, please refer to the README of that directory.

Back to top

More samples

Languages that do not use the Latin alphabet

Back to top

Inspirational quotes

Back to top

Demotivational pop-ups (just for fun)

Back to top

Installation

Requirements

Back to top

Instructions

  1. Download the source code by clicking on the green 'Code' button on this website. Alternatively, clone the repository by first navigating to the path where you want to store the local copy and then running the following command in the Terminal:
    git clone https://github.com/liweiyap/text-popover-macOS.git
  2. Install the SQLite.swift dependency using Carthage.
    • Navigate to the root directory of the repository and run the following command in the Terminal:
      carthage update --platform macOS
      This will produce a 'Carthage' folder in the root directory of the repository.
    • Navigate to 'Carthage > Checkouts > SQLite.swift' and open the file 'SQLite.xcodeproj' in Xcode.
    • Set Build Libraries for Distribution to Yes and close the file 'SQLite.xcodeproj'.
    • Return to the root directory of the repository and run the following command in the Terminal:
      carthage build --platform macOS
    • Now, open the main file 'text-popover-macOS.xcodeproj' in Xcode.
    • In the 'General' settings tab of the 'text-popover-macOS' target, scroll down to the section 'Frameworks, Libraries, and Embedded Content'. Drag and drop the entire 'Carthage/Build/Mac/SQLite.framework' folder into this section.
  3. Build and run the app in Xcode by clicking on the triangular icon at the top left corner of the screen.
    • If the following message box appears, click OK.

    • You might also need to open 'System Preferences > Security & Privacy > Privacy > Accessibility' and tick the check-box next to the 'Text-Popover' program.

Back to top

TODO

  • Check if we really need the SQLite.swift dependency. After all, it is just a wrapper, and it has not really been properly maintained since at least July 2020. Follow this tutorial. This might help us to resolve this issue.
  • NSUserDefaults to store user preferences across different launches of app (see here).
  • Consider replacing print statements and exceptions with Alerts.
  • When database is selected in DatabaseList, perhaps we should show a scrollable list of available Expressions first, instead of DatabaseAdderAndRemover.
  • Make certain texts selectable.

Back to top

Licence

MIT © 2021 Li-Wei Yap

Back to top

About

MacOS menu bar app that pops up at user-specified intervals. These pop-ups contain user-specified texts, such as inspirational quotes or idioms. Useful for language learners. Written in SwiftUI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published