Giter Club home page Giter Club logo

Comments (7)

sfsam avatar sfsam commented on July 3, 2024 1

I don't know why Monterey is different from Ventura and Sonoma (which both work fine). There is a defaults read-type <domain> <key> command which gives the type (e.g. BOOL) of each <key> in <domain>. I guess you could do defaults read... to get everything and then iterate over the keys, calling defaults read-type on each and using the output to generate a fully qualified defaults write... command for each key.

from itsycal.

sfsam avatar sfsam commented on July 3, 2024

Thanks for reporting.
What happens if you delete it and then download it from the website instead of Homebrew?

from itsycal.

clanktron avatar clanktron commented on July 3, 2024

That didn't do anything for me but the following script I threw together fixed the issue.

#!/bin/sh
pkill Itsycal && 
    defaults delete com.mowglii.ItsycalApp && 
    open -a Itsycal

It looks like it only happens when the defaults utility is used to write to the ShowLocation key. All the other keys are fine to modify it seems.

Running the test script below works perfectly fine to set my defaults. However if I uncomment the line setting ShowLocation it'll render the app in the aforementioned unusable state. This happens whether its set to 0 or 1, regardless of whether the defaults write command is even changing the value set by the gui.

#!/bin/sh

if pgrep Itsycal > /dev/null; then
    pkill Itsycal
fi
if defaults domains | grep com.mowglii.ItsycalApp > /dev/null; then
    defaults delete com.mowglii.ItsycalApp
fi

defaults write com.mowglii.ItsycalApp ClockFormat "E MMM d" &&
defaults write com.mowglii.ItsycalApp HideIcon 1 &&
defaults write com.mowglii.ItsycalApp SUEnableAutomaticChecks 0 &&
defaults write com.mowglii.ItsycalApp ShowEventDays 7 &&
defaults write com.mowglii.ItsycalApp SizePreference 2 &&
defaults write com.mowglii.ItsycalApp "NSStatusItem Preferred Position ItsycalStatusItem" 110 &&
# defaults write com.mowglii.ItsycalApp ShowLocation 1 &&
open -a Itsycal

I took it from previously closed issues that defaults was the way to "export/backup" my config. Is this not supported?

from itsycal.

sfsam avatar sfsam commented on July 3, 2024

I tried your script with the ShowLocation line both commented and uncommented (and also with both 0 and 1), but I could not reproduce the behavior you're experiencing. I am wondering what other differences there may be between our systems. I ran it on Ventura as well as Sonoma.

from itsycal.

clanktron avatar clanktron commented on July 3, 2024

Both systems I've tried it on are running monterey 12.7

uname -a
# Darwin clayton-mbp 21.6.0 Darwin Kernel Version 21.6.0: Fri Sep 15 16:17:23 PDT 2023; root:xnu-8020.240.18.703.5~1/RELEASE_X86_64 x86_64 i386 Darwin

from itsycal.

sfsam avatar sfsam commented on July 3, 2024

Can you trying changing that line to this:

defaults write com.mowglii.ItsycalApp ShowLocation -bool YES &&

I was able to reproduce the behavior on Monterey and making the above change worked for me. I will have to investigate the reason why.

from itsycal.

clanktron avatar clanktron commented on July 3, 2024

Cool that works for me too.
Looks like it works anytime you enter it as a boolean through defaults:

defaults write com.mowglii.ItsycalApp ShowLocation -bool true
defaults write com.mowglii.ItsycalApp ShowLocation -bool false
defaults write com.mowglii.ItsycalApp ShowLocation -bool YES
defaults write com.mowglii.ItsycalApp ShowLocation -bool NO

I still have the problem though of importing my config 😅

I generally save any relevant bits from defaults read to a file and then apply them with default import for all my preferred apps.
Running read gives me the following:

defaults read com.mowglii.ItsycalApp
# {
#     ClockFormat = "E MMM d";
#     HideIcon = 1;
#     "NSStatusItem Preferred Position ItsycalStatusItem" = 90;
#     "NSWindow Frame SUUpdateAlert" = "968 14 938 518 0 0 1920 1080 ";
#     SUEnableAutomaticChecks = 0;
#     SUHasLaunchedBefore = 1;
#     SULastCheckTime = "2023-10-11 01:47:04 +0000";
#     SUSkippedVersion = 2260;
#     SelectedCalendars =     (
#         "F3E57387-3448-427D-ADD9-7C682C52778D",
#         "E595BDF8-E722-4A11-AE67-6D01C8B4E353",
#         "69FAB19A-D295-4804-BCF9-7D39F318C9EE",
#         "A7DD60A0-BAA2-4F96-A41A-520E1C9A6693",
#         "EF6A98AC-0449-4501-B7DC-4DB436EBA0AC",
#         "71FCE555-7B32-4963-BD1A-40BA9557692D",
#         "238CCD93-0198-47A4-BDA6-9896DA1A0C28",
#         "ED57D1DC-54EC-4A4F-82FC-BA1274CE6AB0",
#         "C649B892-45A1-4EB4-993E-400A8A5F83DF",
#         "15FB96F8-BC99-4FC8-90BF-7FD8DD5459AB"
#     );
#     ShowEventDays = 7;
#     ShowLocation = 0;
#     SizePreference = 2;
# }

of which I save the following to a file:

cat Itsycal.plist
# {
#     ClockFormat = "E MMM d";
#     HideIcon = 1;
#     SUEnableAutomaticChecks = 0;
#     "NSStatusItem Preferred Position ItsycalStatusItem" = 90;
#     ShowEventDays = 7;
#     SizePreference = 2;
# }

Running defaults import com.mowglii.ItsycalApp Itsycal.plist imports these just fine.
That being said the equivalent of writing a bool in this file would be a 0 or 1, and importing the config when it contains either of those for ShowLocation reproduces the bug.
I've tried changing it to YES/NO/true/false and it seems that regardless of the value that's written the bug is reproduced.

from itsycal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.