@naarang/glancebar 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +5 -9
  2. package/package.json +1 -1
  3. package/src/cli.ts +8 -29
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # @naarang/glancebar
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@naarang/glancebar.svg)](https://www.npmjs.com/package/@naarang/glancebar)
4
- [![license](https://img.shields.io/npm/l/@naarang/glancebar.svg)](https://github.com/vishal-android-freak/glancebar/blob/main/LICENSE)
3
+ [![npm version](https://img.shields.io/npm/v/%40naarang%2Fglancebar)](https://www.npmjs.com/package/@naarang/glancebar)
4
+ [![license](https://img.shields.io/github/license/vishal-android-freak/glancebar)](https://github.com/vishal-android-freak/glancebar/blob/main/LICENSE)
5
5
 
6
- A customizable statusline for [Claude Code](https://claude.ai/claude-code) - display calendar events, tasks, and more at a glance.
6
+ A customizable statusline for [Claude Code](https://claude.com/product/claude-code) - display calendar events, tasks, and more at a glance.
7
7
 
8
8
  ## Features
9
9
 
@@ -47,7 +47,7 @@ npm install -g @naarang/glancebar
47
47
  # 1. Run setup guide
48
48
  glancebar setup
49
49
 
50
- # 2. Add your Google account
50
+ # 2. Add your Google account (after setting up credentials)
51
51
  glancebar auth --add your-email@gmail.com
52
52
 
53
53
  # 3. Test it
@@ -141,9 +141,6 @@ glancebar config --show-calendar false
141
141
  # Enable/disable water reminders
142
142
  glancebar config --water-reminder true
143
143
 
144
- # Set water reminder interval (in minutes)
145
- glancebar config --water-interval 45
146
-
147
144
  # Reset to defaults
148
145
  glancebar config --reset
149
146
  ```
@@ -180,8 +177,7 @@ All configuration is stored in `~/.glancebar/`:
180
177
  | `countdownThresholdMinutes` | 60 | Minutes threshold for countdown display |
181
178
  | `maxTitleLength` | 120 | Maximum event title length |
182
179
  | `showCalendarName` | true | Show account name after event |
183
- | `waterReminderEnabled` | false | Enable water break reminders |
184
- | `waterReminderIntervalMinutes` | 45 | Minutes between water reminders |
180
+ | `waterReminderEnabled` | true | Enable random water break reminders (~30% chance) |
185
181
 
186
182
  ## Building from Source
187
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naarang/glancebar",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A customizable statusline for Claude Code - display calendar events, tasks, and more at a glance",
5
5
  "author": "Vishal Dubey",
6
6
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -16,7 +16,6 @@ interface Config {
16
16
  countdownThresholdMinutes: number;
17
17
  maxTitleLength: number;
18
18
  waterReminderEnabled: boolean;
19
- waterReminderIntervalMinutes: number;
20
19
  }
21
20
 
22
21
  const COLORS: Record<string, string> = {
@@ -48,7 +47,6 @@ const DEFAULT_CONFIG: Config = {
48
47
  countdownThresholdMinutes: 60,
49
48
  maxTitleLength: 120,
50
49
  waterReminderEnabled: true,
51
- waterReminderIntervalMinutes: 30,
52
50
  };
53
51
 
54
52
  const WATER_REMINDERS = [
@@ -75,10 +73,6 @@ function getTokensDir(): string {
75
73
  return join(getConfigDir(), "tokens");
76
74
  }
77
75
 
78
- function getCredentialsPath(): string {
79
- return join(getConfigDir(), "credentials.json");
80
- }
81
-
82
76
  function ensureConfigDir(): void {
83
77
  const dir = getConfigDir();
84
78
  if (!existsSync(dir)) {
@@ -118,11 +112,15 @@ interface Credentials {
118
112
  web?: { client_id: string; client_secret: string };
119
113
  }
120
114
 
115
+ function getCredentialsPath(): string {
116
+ return join(getConfigDir(), "credentials.json");
117
+ }
118
+
121
119
  function loadCredentials(): Credentials {
122
120
  const credPath = getCredentialsPath();
123
121
  if (!existsSync(credPath)) {
124
122
  throw new Error(
125
- `credentials.json not found at ${credPath}\n\nPlease download OAuth credentials from Google Cloud Console and save to:\n${credPath}`
123
+ `credentials.json not found at ${credPath}\n\nPlease download OAuth credentials from Google Cloud Console and save to:\n${credPath}\n\nRun 'glancebar setup' for detailed instructions.`
126
124
  );
127
125
  }
128
126
  return JSON.parse(readFileSync(credPath, "utf-8"));
@@ -442,14 +440,13 @@ Usage:
442
440
  glancebar config --max-title <length> Set max title length (default: 120)
443
441
  glancebar config --show-calendar <true|false> Show calendar name (default: true)
444
442
  glancebar config --water-reminder <true|false> Enable/disable water reminders (default: true)
445
- glancebar config --water-interval <mins> Set water reminder interval (default: 30)
446
443
  glancebar config --reset Reset to default configuration
447
444
  glancebar setup Show setup instructions
448
445
 
449
446
  Examples:
450
447
  glancebar auth --add user@gmail.com
451
448
  glancebar config --lookahead 12
452
- glancebar config --water-interval 45
449
+ glancebar config --water-reminder true
453
450
 
454
451
  Config location: ${getConfigDir()}
455
452
  `);
@@ -684,20 +681,6 @@ function handleConfig(args: string[]) {
684
681
  return;
685
682
  }
686
683
 
687
- // Handle --water-interval
688
- const waterIntervalIndex = args.indexOf("--water-interval");
689
- if (waterIntervalIndex !== -1) {
690
- const value = parseInt(args[waterIntervalIndex + 1], 10);
691
- if (isNaN(value) || value < 5 || value > 120) {
692
- console.error("Error: water-interval must be between 5 and 120 minutes");
693
- process.exit(1);
694
- }
695
- config.waterReminderIntervalMinutes = value;
696
- saveConfig(config);
697
- console.log(`Water reminder interval set to ${value} minutes`);
698
- return;
699
- }
700
-
701
684
  // Show current config
702
685
  console.log(`
703
686
  Glancebar Configuration
@@ -713,18 +696,14 @@ Calendar Settings:
713
696
 
714
697
  Reminders:
715
698
  Water reminder: ${config.waterReminderEnabled ? "enabled" : "disabled"}
716
- Water interval: ${config.waterReminderIntervalMinutes} minutes
717
699
  `);
718
700
  }
719
701
 
720
702
  function shouldShowWaterReminder(config: Config): boolean {
721
703
  if (!config.waterReminderEnabled) return false;
722
704
 
723
- const now = new Date();
724
- const minutes = now.getHours() * 60 + now.getMinutes();
725
-
726
- // Show water reminder if current minute falls on the interval
727
- return minutes % config.waterReminderIntervalMinutes === 0;
705
+ // ~30% chance to show water reminder
706
+ return Math.random() < 0.3;
728
707
  }
729
708
 
730
709
  function getWaterReminder(): string {