qdesk 1.0.5 → 1.0.7

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 (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,10 +20,17 @@ function getPackageVersion() {
20
20
  return "unknown";
21
21
  }
22
22
  }
23
+ function setTerminalTitle(title) {
24
+ process.title = title;
25
+ if (process.stdout.isTTY) {
26
+ process.stdout.write(`\u001b]0;${title}\u0007`);
27
+ }
28
+ }
23
29
  if (hasCliFlag("--version") || hasCliFlag("-v")) {
24
30
  console.log(getPackageVersion());
25
31
  process.exit(0);
26
32
  }
33
+ setTerminalTitle("qdesk");
27
34
  function normalizeChordInput(chord) {
28
35
  return normalizeChord(chord.trim().toLowerCase());
29
36
  }
@@ -49,7 +56,6 @@ let activeRecording;
49
56
  let awaitingChordRemoval = false;
50
57
  const toolWindowAtStartup = getActiveWindowHandleAndName() ?? undefined;
51
58
  console.log("[info] Tool window at startup:", toolWindowAtStartup?.name ?? "(unknown)");
52
- let removalReturnWindow;
53
59
  const listener = startListening({
54
60
  onEscape: (stopPropagating) => {
55
61
  if (!activeRecording && !awaitingChordRemoval) {
@@ -68,6 +74,7 @@ const listener = startListening({
68
74
  stopPropagating();
69
75
  },
70
76
  onChord: (chord, stopPropagating) => {
77
+ // recording
71
78
  if (activeRecording) {
72
79
  if ([ADD_CHORD, DROP_CHORD].includes(chord)) {
73
80
  console.warn(`[warn] Ignoring ${chord} chord during active recording to avoid conflicts.`);
@@ -80,6 +87,7 @@ const listener = startListening({
80
87
  printBindings();
81
88
  return stopPropagating();
82
89
  }
90
+ // removing
83
91
  if (awaitingChordRemoval) {
84
92
  awaitingChordRemoval = false;
85
93
  setScreenHue("off");
@@ -92,6 +100,7 @@ const listener = startListening({
92
100
  printBindings();
93
101
  return stopPropagating();
94
102
  }
103
+ // trigger recording
95
104
  if (chord === ADD_CHORD) {
96
105
  awaitingChordRemoval = false;
97
106
  setScreenHue("off");
@@ -105,6 +114,7 @@ const listener = startListening({
105
114
  }
106
115
  return stopPropagating();
107
116
  }
117
+ // trigger removing
108
118
  if (chord === DROP_CHORD) {
109
119
  if (activeRecording) {
110
120
  activeRecording = undefined;
@@ -119,6 +129,7 @@ const listener = startListening({
119
129
  setScreenHue("remove");
120
130
  return stopPropagating();
121
131
  }
132
+ // switching
122
133
  const binding = bindings.get(chord);
123
134
  if (binding) {
124
135
  const result = activateWindowByHandle(binding.handle);
@@ -127,6 +138,7 @@ const listener = startListening({
127
138
  bindings.delete(chord);
128
139
  }
129
140
  else if (result === "activated") {
141
+ binding.name = getActiveWindowHandleAndName()?.name ?? binding.name; // warm the cache to speed up subsequent switches
130
142
  console.log(`[binding ${chord}] Switched to "${binding.name}"`);
131
143
  }
132
144
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdesk",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",