Skip to content

SwiftDialog 2.4.0

Compare
Choose a tag to compare
@bartreardon bartreardon released this 06 Feb 01:28
· 69 commits to main since this release
a9280e5

New features

Notifications

  • --notification can now accept --button1action to set a default action to take when a user clicks a notification. can be a URL or command:

    image

    e.g.

    --notification --title "<text>" --message "<text>" --button1action "open -a Safari.app"

    --notification --title "<text>" --message "<text>" --button1action "https://swiftdialog.app/"

  • Additionally, You can specify an additional action and define button labels :

    --notification --title "<text>" --message "<text>" --button1text "Do Something" --button1action "/do/something" --button2text "Do Something Else" --button2action "/do/something/else/"

    • --button1action will remain the default action if either the notification or button1 is actioned. button2action will only trigger if button2 is actioned.

List Items

  • Added "subtitle" option to listitems.

    Listitems can now have a subtitle. This expands the space used by all listitems and allows for up to 2 lines of additional descriptive text.

    --listitem "Some Item Title",subtitle="Some Item subtitle with additional details"

    image

    Advanced example courtesy of @dan-snelson and Setup Your Mac

    image

Window Controls

  • New --windowbuttons argument - shows the close, minimize and maximise/fullscreen buttons on the window

    image
    • This enables all buttons by default (the maximise/zoom button is only enabled if the window is also resizable).
    • Individual buttons can be selectively enabled by passing in one or more of close min or max as an argument, e.g, --windowbuttons min will only enable the minimise button
  • New --resizable option which enables the window to be resizable by clicking and dragging the window corners.

    • Using this option implies --moveable
    • NOTE: macOS will initiate new rezizable windows with the same window dimentions as the last run swiftdialog window. i.e. if a dialog has dimentions 800x600 when it is closed and a new resizable dialog is launched, it will also have dimentions 800x600 regardless of what --width or --height options are specified. Take this behaviour into account when using this option.

Other New Features

  • computer is a valid option wherever icon can be used (e.g. --icon computer). shows the visual representation of the device

    image
  • New text= for image sources. useful for using emoji as icons for example --icon text=🙂

  • New color= for --background and --bannerimage so you can use solid colours instead of images for those commands --background color=red --bannerimage colour=#12a4b1

  • New --bannerheight to specify an exact height for the banner

  • Add Missing System Font Weights and Colors - pr #321

  • Added --hidedefaultkeyboardaction argument. Changes the default "Return" or "Escape" keys to require cmd+shift. This helps mitigate against non-intentional dismissal of dialogs. #125

  • Added a property to non switch style checkboxes that allows them to affect button1. This is useful for terms and conditions style checkboxes where you want to disable the button until the user has agreed to the terms.

    • Example: dialog --checkbox "I Agree",enableButton1 --button1disabled
      image image
  • Added basic support for a date picker #224

    • Example: --textfield "Choose a date",isdate=true
    image
    • NOTE: There is no date validation at this point in time. This capability simply puts the selected date into the textfield.
  • Added an option to have live validation of textfields that have a format requirement using regex.

    • Enabled with the --textfieldlivevalidation argument

    dialog --textfield "Enter in 4 numbers",regex="^\d{4}$" --textfieldlivevalidation

    image

Fixes

  • json processing properly accepts numbers now so {"width" : 450} is acceptable (as is the current method where everything needs to be treated as a string)

  • Icons used in listitems are now width limited in addition to height - this is important for sf symbol rendering so they are all the same size

  • fixed an issue where float to string to float conversion (if/when it happens) would fail if the number format for the users locale was 1.234.567,80 (this may be an issue in swift with how CGFloat is represented as a string as regardless of locale the float is converted to a string with a period instead of a locale specific decimal point - e.g. 123 becomes 123.0