ref: rename pref options

This commit is contained in:
relikd
2025-12-11 18:33:35 +01:00
parent d03840757a
commit bd03059247
5 changed files with 37 additions and 60 deletions

View File

@@ -101,34 +101,14 @@ This number can be changed with the following Terminal command (default: 10):
defaults write de.relikd.baRSS openFewLinksLimit -int 10 defaults write de.relikd.baRSS openFewLinksLimit -int 10
``` ```
2. In preferences you can choose to show 'Short article names'. 2. You can change the appearance of colors throughout the application.
This will limit the number of displayed characters to 60 (default).
With this Terminal command you can customize this limit:
```
defaults write de.relikd.baRSS shortArticleNamesLimit -int 50
```
3. Each article menu item shows a summary tooltip (if the server provides one).
By default, the tooltip is limited to 2000 characters.
You can change the limit with this command:
```
defaults write de.relikd.baRSS articleTooltipLimit -int 500
```
3. Limit the number of displayed articles per feed menu.
**Note:** displayed unread count may be different than the unread items inside. 'Open all unread' will open hidden items too.
```
defaults write de.relikd.baRSS articlesInMenuLimit -int 40
```
4. You can change the appearance of colors throughout the application.
E.g., The tint color of the menu bar icon and the color of the blue unread articles dot. E.g., The tint color of the menu bar icon and the color of the blue unread articles dot.
``` ```
defaults write de.relikd.baRSS colorStatusIconTint -string "#37F" defaults write de.relikd.baRSS colorStatusIconTint -string "#37F"
defaults write de.relikd.baRSS colorUnreadIndicator -string "#FBA33A" defaults write de.relikd.baRSS colorUnreadIndicator -string "#FBA33A"
``` ```
5. To backup your list of subscribed feeds, here is a one-liner: 3. To backup your list of subscribed feeds, here is a one-liner:
``` ```
open barss:backup && cp "$HOME/Library/Containers/de.relikd.baRSS/Data/Library/Application Support/baRSS/backup/feeds_latest.opml" "$HOME/Desktop/baRSS_backup_$(date "+%Y-%m-%d").opml" open barss:backup && cp "$HOME/Library/Containers/de.relikd.baRSS/Data/Library/Application Support/baRSS/backup/feeds_latest.opml" "$HOME/Desktop/baRSS_backup_$(date "+%Y-%m-%d").opml"
``` ```

View File

@@ -47,10 +47,9 @@
NSString *title = self.title; NSString *title = self.title;
if (!title) return @""; if (!title) return @"";
// TODO: It should be enough to get user prefs once per menu build // TODO: It should be enough to get user prefs once per menu build
if (UserPrefsBool(Pref_feedTruncateTitle)) { NSUInteger limit = UserPrefsUInt(Pref_articleTitleLimit); // -1 will become MAX_INT
NSUInteger limit = UserPrefsUInt(Pref_shortArticleNamesLimit); if (limit > 0 && title.length > limit) {
if (title.length > limit) title = [[title substringToIndex:limit] stringByAppendingString:@"…"];
title = [[title substringToIndex:limit] stringByAppendingString:@"…"];
} }
return title; return title;
} }
@@ -64,7 +63,7 @@
item.onStateImage = [NSImage imageNamed:RSSImageMenuItemUnread]; item.onStateImage = [NSImage imageNamed:RSSImageMenuItemUnread];
item.accessibilityLabel = (self.unread ? NSLocalizedString(@"article: unread", @"accessibility label, feed menu item") : NSLocalizedString(@"article: read", @"accessibility label, feed menu item")); item.accessibilityLabel = (self.unread ? NSLocalizedString(@"article: unread", @"accessibility label, feed menu item") : NSLocalizedString(@"article: read", @"accessibility label, feed menu item"));
// truncate tooltip // truncate tooltip
NSUInteger limit = UserPrefsUInt(Pref_articleTooltipLimit); NSUInteger limit = UserPrefsUInt(Pref_articleTooltipLimit); // -1 will become MAX_INT
if (limit > 0) { if (limit > 0) {
NSString *tooltip = (self.abstract ? self.abstract : self.body); // fall back to body (html) NSString *tooltip = (self.abstract ? self.abstract : self.body); // fall back to body (html)
if (tooltip.length > limit) if (tooltip.length > limit)

View File

@@ -15,34 +15,35 @@
/** default: @c nil */ static NSString* const Pref_defaultHttpApplication = @"defaultHttpApplication"; /** default: @c nil */ static NSString* const Pref_defaultHttpApplication = @"defaultHttpApplication";
/** default: @c nil */ static NSString* const Pref_notificationType = @"notificationType"; /** default: @c nil */ static NSString* const Pref_notificationType = @"notificationType";
// ------ Appearance matrix ------ (Preferences > Appearance Tab) ------ // ------ Appearance matrix ------ (Preferences > Appearance Tab) ------
/** default: @c YES */ static NSString* const Pref_globalTintMenuIcon = @"globalTintMenuBarIcon"; // menu buttons
/** default: @c YES */ static NSString* const Pref_globalUpdateAll = @"globalUpdateAll"; /** default: @c NO */ static NSString* const Pref_globalToggleHidden = @"globalToggleHidden";
/** default: @c NO */ static NSString* const Pref_globalToggleHidden = @"globalToggleHidden"; /** default: @c YES */ static NSString* const Pref_globalUpdateAll = @"globalUpdateAll";
/** default: @c YES */ static NSString* const Pref_globalOpenUnread = @"globalOpenUnread"; /** default: @c YES */ static NSString* const Pref_globalOpenUnread = @"globalOpenUnread";
/** default: @c YES */ static NSString* const Pref_globalMarkRead = @"globalMarkRead"; /** default: @c YES */ static NSString* const Pref_groupOpenUnread = @"groupOpenUnread";
/** default: @c YES */ static NSString* const Pref_globalMarkUnread = @"globalMarkUnread"; /** default: @c YES */ static NSString* const Pref_feedOpenUnread = @"feedOpenUnread";
/** default: @c YES */ static NSString* const Pref_globalUnreadCount = @"globalUnreadCount"; /** default: @c YES */ static NSString* const Pref_globalMarkRead = @"globalMarkRead";
/** default: @c YES */ static NSString* const Pref_groupOpenUnread = @"groupOpenUnread"; /** default: @c YES */ static NSString* const Pref_groupMarkRead = @"groupMarkRead";
/** default: @c YES */ static NSString* const Pref_groupMarkRead = @"groupMarkRead"; /** default: @c YES */ static NSString* const Pref_feedMarkRead = @"feedMarkRead";
/** default: @c YES */ static NSString* const Pref_groupMarkUnread = @"groupMarkUnread"; /** default: @c YES */ static NSString* const Pref_globalMarkUnread = @"globalMarkUnread";
/** default: @c NO */ static NSString* const Pref_groupUnreadOnly = @"groupUnreadOnly"; /** default: @c YES */ static NSString* const Pref_groupMarkUnread = @"groupMarkUnread";
/** default: @c YES */ static NSString* const Pref_groupUnreadCount = @"groupUnreadCount"; /** default: @c YES */ static NSString* const Pref_feedMarkUnread = @"feedMarkUnread";
/** default: @c NO */ static NSString* const Pref_groupUnreadIndicator = @"groupUnreadIndicator"; // display options
/** default: @c YES */ static NSString* const Pref_feedOpenUnread = @"feedOpenUnread"; /** default: @c YES */ static NSString* const Pref_globalUnreadCount = @"globalUnreadCount";
/** default: @c YES */ static NSString* const Pref_feedMarkRead = @"feedMarkRead"; /** default: @c YES */ static NSString* const Pref_groupUnreadCount = @"groupUnreadCount";
/** default: @c YES */ static NSString* const Pref_feedMarkUnread = @"feedMarkUnread"; /** default: @c YES */ static NSString* const Pref_feedUnreadCount = @"feedUnreadCount";
/** default: @c NO */ static NSString* const Pref_feedUnreadOnly = @"feedUnreadOnly"; /** default: @c YES */ static NSString* const Pref_globalTintMenuIcon = @"globalTintMenuBarIcon";
/** default: @c YES */ static NSString* const Pref_feedUnreadCount = @"feedUnreadCount"; /** default: @c NO */ static NSString* const Pref_groupUnreadIndicator = @"groupUnreadIndicator";
/** default: @c NO */ static NSString* const Pref_feedUnreadIndicator = @"feedUnreadIndicator"; /** default: @c NO */ static NSString* const Pref_feedUnreadIndicator = @"feedUnreadIndicator";
/** default: @c NO */ static NSString* const Pref_feedTruncateTitle = @"feedTruncateTitle";
/** default: @c NO */ static NSString* const Pref_feedLimitArticles = @"feedLimitArticles";
/** default: @c NO */ static NSString* const Pref_articleUnreadOnly = @"articleUnreadOnly";
/** default: @c YES */ static NSString* const Pref_articleUnreadIndicator = @"articleUnreadIndicator"; /** default: @c YES */ static NSString* const Pref_articleUnreadIndicator = @"articleUnreadIndicator";
/** default: @c NO */ static NSString* const Pref_groupUnreadOnly = @"groupUnreadOnly";
/** default: @c NO */ static NSString* const Pref_feedUnreadOnly = @"feedUnreadOnly";
/** default: @c NO */ static NSString* const Pref_articleUnreadOnly = @"articleUnreadOnly";
// article display
/** default: @c -1 */ static NSString* const Pref_articleCountLimit = @"articleCountLimit";
/** default: @c -1 */ static NSString* const Pref_articleTitleLimit = @"articleTitleLimit";
/** default: @c 2k */ static NSString* const Pref_articleTooltipLimit = @"articleTooltipLimit";
// ------ Hidden preferences ------ only modifiable via `defaults write de.relikd.baRSS {KEY}` ------ // ------ Hidden preferences ------ only modifiable via `defaults write de.relikd.baRSS {KEY}` ------
/** default: @c 10 */ static NSString* const Pref_openFewLinksLimit = @"openFewLinksLimit"; /** default: @c 10 */ static NSString* const Pref_openFewLinksLimit = @"openFewLinksLimit";
/** default: @c 60 */ static NSString* const Pref_shortArticleNamesLimit = @"shortArticleNamesLimit";
/** default: @c 2k */ static NSString* const Pref_articleTooltipLimit = @"articleTooltipLimit";
/** default: @c 40 */ static NSString* const Pref_articlesInMenuLimit = @"articlesInMenuLimit";
/** default: @c nil */ static NSString* const Pref_colorStatusIconTint = @"colorStatusIconTint"; /** default: @c nil */ static NSString* const Pref_colorStatusIconTint = @"colorStatusIconTint";
/** default: @c nil */ static NSString* const Pref_colorUnreadIndicator = @"colorUnreadIndicator"; /** default: @c nil */ static NSString* const Pref_colorUnreadIndicator = @"colorUnreadIndicator";

View File

@@ -21,15 +21,13 @@ void UserPrefsInit(void) {
]); ]);
defaultsAppend(defs, @NO, @[ defaultsAppend(defs, @NO, @[
Pref_globalToggleHidden, Pref_globalToggleHidden,
Pref_groupUnreadOnly, Pref_feedUnreadOnly, Pref_articleUnreadOnly, Pref_groupUnreadOnly, Pref_feedUnreadOnly, Pref_articleUnreadOnly,
Pref_groupUnreadIndicator, Pref_feedUnreadIndicator, Pref_groupUnreadIndicator, Pref_feedUnreadIndicator,
Pref_feedTruncateTitle,
Pref_feedLimitArticles
]); ]);
// Display limits & truncation ( defaults write de.relikd.baRSS {KEY} -int 10 ) // Display limits & truncation ( defaults write de.relikd.baRSS {KEY} -int 10 )
[defs setObject:[NSNumber numberWithUnsignedInteger:10] forKey:Pref_openFewLinksLimit]; [defs setObject:[NSNumber numberWithUnsignedInteger:10] forKey:Pref_openFewLinksLimit];
[defs setObject:[NSNumber numberWithInteger:-1] forKey:Pref_articlesInMenuLimit]; [defs setObject:[NSNumber numberWithInteger:-1] forKey:Pref_articleCountLimit];
[defs setObject:[NSNumber numberWithInteger:-1] forKey:Pref_shortArticleNamesLimit]; [defs setObject:[NSNumber numberWithInteger:-1] forKey:Pref_articleTitleLimit];
[defs setObject:[NSNumber numberWithInteger:2000] forKey:Pref_articleTooltipLimit]; [defs setObject:[NSNumber numberWithInteger:2000] forKey:Pref_articleTooltipLimit];
[defs setObject:[NSNumber numberWithUnsignedInteger:1] forKey:Pref_prefSelectedTab]; // feed tab [defs setObject:[NSNumber numberWithUnsignedInteger:1] forKey:Pref_prefSelectedTab]; // feed tab
[[NSUserDefaults standardUserDefaults] registerDefaults:defs]; [[NSUserDefaults standardUserDefaults] registerDefaults:defs];

View File

@@ -72,9 +72,8 @@
/// Generate items for @c FeedArticles menu. /// Generate items for @c FeedArticles menu.
- (void)setArticles:(NSArray<FeedArticle*>*)sortedList forMenu:(NSMenu*)menu { - (void)setArticles:(NSArray<FeedArticle*>*)sortedList forMenu:(NSMenu*)menu {
[menu insertDefaultHeader]; [menu insertDefaultHeader];
NSInteger mc = NSIntegerMax; NSInteger mc = UserPrefsInt(Pref_articleCountLimit);
if (UserPrefsBool(Pref_feedLimitArticles)) if (mc < 0) mc = NSIntegerMax;
mc = UserPrefsInt(Pref_articlesInMenuLimit);
BOOL onlyUnread = UserPrefsBool(Pref_articleUnreadOnly); BOOL onlyUnread = UserPrefsBool(Pref_articleUnreadOnly);
for (FeedArticle *fa in sortedList) { for (FeedArticle *fa in sortedList) {