fregante / GhostText

šŸ‘» Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.32k stars 115 forks source link

Add connection indicator somewhere #30

Closed fregante closed 10 years ago

fregante commented 10 years ago

Right now it's impossible to see whether a Sublime Text tab is currently listening for events and "connected".

Perhaps even just [CONNECTED] in the tab title and/or a blue circle on the first line's gutter using add_regions()

blue circle in gutter

sejbr commented 10 years ago

That would be great but I think it would be better placed either in tab title using some shortcut like [C], or in the status bar with the full [CONNECTED]. Using the icons might confuse people using sublimelinter, gitgutter, colorhighlighter (which can show colors as icons on the left) ect.

fregante commented 10 years ago

You're right about the gutter icons. I was looking for some color and that was the only place I remember seeing it.

OS X supports colored emoji and I think they would be a perfect replacement for "[CONNECTED]".

colored emoji in tab

Other OSes could just use some unicode character like āš‡ ON or anything that looks decent on the respective platform.

sejbr commented 10 years ago

This could work " ā–ˆ " in windows but I'm not sure if it will be visible if the tab font is changed (If it can be changed. I never looked into this.). Otherwise It will be a rectangle with cross in it as with most unknown characters. The character is U+2588 or FULL BLOCK.

But doesn't windows support emoji? I might be mistaken but I don't recall installing additional software yet my linter does show them correctly at least in the line indicator:

fregante commented 10 years ago

I think those in the gutter are just images from the package you're using. Windows 8 has a subset of emoji, but I don't know if ST/win supports them. W8 might be a bit too recent though, the majority of users might not support them at all.

Here's the full cross-platform list

sejbr commented 10 years ago

I'm on Windows 7 :). I think that the block will work just fine if no other solution is found.

fregante commented 10 years ago

It looks like Emoji were added to Windows 7 too in 2012. That could work.

ON

:ghost: :white_check_mark:

Ghost Checkmark

OFF

:ghost: :white_circle:

Ghost White circle

Now only Linux is missing!

Feltzer commented 10 years ago

Linux user chiming in:

Some emojis like šŸ˜ƒ ā˜ŗ ā˜‘ are supported by default on Ubuntu but not converted to their pictorial representation.

For the two above, šŸ‘» and āœ…, I had to install ttf-ancient-fonts. This is what they look like in Sublime:

screenshot_2014-07-16_084701

@sejbr, the square icon you suggested works great. Here are some more options that display correctly on default Ubuntu (taken from this wikipedia entry):

ā—‰ ā–¤ ā–£

Cacodaimon commented 10 years ago

The idea is nice, but it might include some pitfalls.

It's not possible, by the plug in, to detect when sublime text is closed. This means tabs with an "icon" marking the connection state are going to keep this indicator after an restart of ST.

Whats about an 'animation' of theses four characters: ā—“ ā—µ ā—¶ ā—· for example changed once a second when the connection is open? If it's sopped rotating the connection mus be closedā€¦

About the ghost Emoji on Linux, it's not in my font (Droid Sans) available.

fregante commented 10 years ago

Good point about not being able to remove them on exit. What about getting the tabs on open and checking for the first character of their titles? It shouldn't be expensive.

Animated characters would be nice but may be distracting.

Cacodaimon commented 10 years ago

You are right, animating could be distractingā€¦

But I have still afraid that removing a retained title char on startup might not work because another plug in modified the title in another way - it's complete deterministicā€¦

fregante commented 10 years ago

If other plugins ADD text like we do, we can just check the entire string for our characters, specifically the sequence :ghost::white_check_mark: for example, and remove them. Not a big deal. If they remove/modify our characters, it's not our fault and of course if they do we don't need to remove them anymore (since they are not there)

I mean ideally ST would offer a way to add unique icons to the title, but we don't have that.

Cacodaimon commented 10 years ago

Okey I just wats have all cases discussed before start implementingā€¦

The ghost is available on arch LInux if ttf-symbola is installed.

fregante commented 10 years ago

Of course, the earlier we see the problems the better.

Does that font come preinstalled usually? If not I think we should use something more common, that works out of the box (and also because at that size IMHO it doesn't look much like a Ghost, more like a chalk outline)

sejbr commented 10 years ago

Well linux is so open that in some distributions if I remember correctly, you don't have any fonts outside the kernel built-in font with CP437 character set used in console. It will vary from distribution to distribution. It can be resolved with forced readme in which links to packages with that font is included. Linux users can handle something like that. The amount of sh*t you have to handle on linux is so big that this won't make any difference :P.

Cacodaimon commented 10 years ago

(and also because at that size IMHO it doesn't look much like a Ghost, more like a chalk outline) This is how it looks on my system, if I would not know this is a ghostā€¦ : screenshot - 07172014 - 07 48 02 pm

I think we just need a simple fail safe default and the user can define a own prefix if he wants, title_prefix_connected and title_prefix_disconnected.

Cacodaimon commented 10 years ago

Is used [GĢ¶TĢ¶] and [GT] as defaults, can you guys test my changes before I create a new tag?

sejbr commented 10 years ago

The default [GĢ¶TĢ¶] looks awful on windows (7 atleast)

Cacodaimon commented 10 years ago

Yes this sucksā€¦

But besides the chars does it works without any bugs?

sejbr commented 10 years ago

I haven't noticed any.

fregante commented 10 years ago

Great! That works for me. I tested on restart too, it works ;)

I added a OSX-specific setting that uses Emoji (supported everywhere ST3/Mac is supported ;) )

osx emoji

Now we need someone testing the Windows emoji. I'm not sure if they are the same characters (they probably are)

How to test on Windows

Open GhostText (OSX).sublime-settings in Sublime Text. If it includes icons then it works and we can duplicate the file asGhostText (Windows).sublime-settings

sejbr commented 10 years ago

The OSX stuff doesn't work on Win. At least Win7, looking at google, those could work on windows 8. I couldn't find ghost emoji working with sublime and I couldn't find anything that would even resemble a ghost, so I don't know what to do with it. For the check and cross āœ” - U+2714 Heavy Check Mark āœ– - U+2716 Heavy Multiplication X These look the best

It could be [GTāœ”] and [GTāœ–] for Win7 or something like that if no ghost is to be found.

fregante commented 10 years ago

I'd avoid crosses or anything red, they look like errors and this isn't the case.

ST doesn't support colored emojis even in Windows 8.1; Windows 7 only supports them if you installed that 2-year-old update.

This is how they are shown in Windows 8 and Windows 8.1 windows emoji

I pushed a commit so W8 users can test it out, but if you want to see it on W7 you gotta install that update. I'm using the Ghost and that ā€” to show the "off" state; the uncolored circle looks like an o.

We can only use these if we can afford unupdated W7 machines to have unrecognized characters. If not we need different characters for Windows.

sejbr commented 10 years ago

The problem is, I have the 2729094 update installed yet still these doesn't work. It indeed added a bunch of icons, but those ain't the ones in them. I even checked the emoji font with charmap and searched manually but still nothing. Can you check the unicode (U+XXXX) and give me them so I could search it?

fregante commented 10 years ago

On here you'll find all the emojis and their unicode: http://www.unicode.org/reports/tr51/full-emoji-list.html

ghost here

fregante commented 10 years ago

Another nice emoji option would be :ghost::waning_crescent_moon: and :ghost::full_moon: which kind of keeps the ghostly mood and looks pretty nice GhostText moon connection indicator


For Windows I found these: connected: ā˜— āœ“ disconnected: ā˜— ā˜¾

The ā˜— sort of looks like a Ghost at that size. The moon sort of looks like it's in a "suspended" state, paving the way for a possible #15


I created a branch for both the platforms, so you can test it out https://github.com/Cacodaimon/GhostText-for-SublimeText/tree/connection-indicator-tests-%2330

Cacodaimon commented 10 years ago

ā˜— āœ“ and ā˜— ā˜¾ works on Ubuntu with no special font installedā€¦ But whats about ā— instead of this āœ“ then we would use a same looking icon everywhere.

But I like the Idea with the moon and the sun.

screenshot - 07182014 - 04 47 26 pm

fregante commented 10 years ago

That would work too! Should we ship it?

Cacodaimon commented 10 years ago

Ship it or wait until: https://github.com/Cacodaimon/GhostText-for-SublimeText/issues/15 is finished? It should be easy to do now and the both features are loose connected.

fregante commented 10 years ago

Either way works. But for now we can add them in master and mark this as closed. ;)