echoes 0.2.0
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.
- checksums.yaml +7 -0
- data/CLAUDE.md +33 -0
- data/Echoes.app/Contents/Info.plist +16 -0
- data/Echoes.app/Contents/MacOS/Echoes +50 -0
- data/EchoesEmbed.app/Contents/Info.plist +16 -0
- data/EchoesEmbed.app/Contents/MacOS/EchoesEmbed +41 -0
- data/LICENSE.txt +21 -0
- data/README.md +133 -0
- data/Rakefile +45 -0
- data/exe/echoes +15 -0
- data/lib/echoes/cell.rb +54 -0
- data/lib/echoes/client.rb +96 -0
- data/lib/echoes/configuration.rb +135 -0
- data/lib/echoes/copy_mode.rb +545 -0
- data/lib/echoes/cursor.rb +18 -0
- data/lib/echoes/editor.rb +225 -0
- data/lib/echoes/embedded_shell.rb +360 -0
- data/lib/echoes/embedded_shell_helper.rb +265 -0
- data/lib/echoes/gui.rb +2861 -0
- data/lib/echoes/installer.rb +95 -0
- data/lib/echoes/objc.rb +188 -0
- data/lib/echoes/pane.rb +1122 -0
- data/lib/echoes/pane_tree.rb +194 -0
- data/lib/echoes/parser.rb +821 -0
- data/lib/echoes/preferences.rb +45 -0
- data/lib/echoes/screen.rb +1468 -0
- data/lib/echoes/sixel_decoder.rb +221 -0
- data/lib/echoes/tab.rb +152 -0
- data/lib/echoes/terminal.rb +124 -0
- data/lib/echoes/version.rb +5 -0
- data/lib/echoes.rb +37 -0
- data/sig/echoes.rbs +4 -0
- metadata +123 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'objc'
|
|
4
|
+
|
|
5
|
+
module Echoes
|
|
6
|
+
# Thin wrapper around `[NSUserDefaults initWithSuiteName:]` for
|
|
7
|
+
# cross-launch persistence of small user-tweaked values (font size,
|
|
8
|
+
# …). The on-disk plist lives at `~/Library/Preferences/<SUITE>.plist`
|
|
9
|
+
# and `defaults read|write|delete <SUITE>` from the shell works as
|
|
10
|
+
# expected.
|
|
11
|
+
#
|
|
12
|
+
# We use an explicit suite name rather than `standardUserDefaults`
|
|
13
|
+
# because echoes runs under `bundle exec exe/echoes` (no Info.plist
|
|
14
|
+
# bundle ID) and as a future `.app`. A fixed suite gives stable
|
|
15
|
+
# storage across both.
|
|
16
|
+
module Preferences
|
|
17
|
+
SUITE = 'jp.dio.echoes'
|
|
18
|
+
|
|
19
|
+
def self.defaults
|
|
20
|
+
@defaults ||= begin
|
|
21
|
+
obj = ObjC::MSG_PTR.call(ObjC.cls('NSUserDefaults'), ObjC.sel('alloc'))
|
|
22
|
+
ObjC::MSG_PTR_1.call(obj, ObjC.sel('initWithSuiteName:'), ObjC.nsstring(SUITE))
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns the stored Float for `key`, or `default` if the key isn't
|
|
27
|
+
# set. We round-trip through `objectForKey:` so we can distinguish
|
|
28
|
+
# "missing" from "set to 0.0" — `doubleForKey:` collapses both.
|
|
29
|
+
def self.fetch_double(key, default:)
|
|
30
|
+
obj = ObjC::MSG_PTR_1.call(defaults, ObjC.sel('objectForKey:'), ObjC.nsstring(key.to_s))
|
|
31
|
+
return default if obj.null?
|
|
32
|
+
ObjC::MSG_RET_D.call(obj, ObjC.sel('doubleValue'))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.set_double(key, value)
|
|
36
|
+
ObjC::MSG_VOID_D_1.call(defaults, ObjC.sel('setDouble:forKey:'),
|
|
37
|
+
value.to_f, ObjC.nsstring(key.to_s))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.delete(key)
|
|
41
|
+
ObjC::MSG_VOID_1.call(defaults, ObjC.sel('removeObjectForKey:'),
|
|
42
|
+
ObjC.nsstring(key.to_s))
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|