Coder Social home page Coder Social logo

chylex / tweetduck Goto Github PK

View Code? Open in Web Editor NEW
192.0 16.0 23.0 13.14 MB

A Windows Client for TweetDeck. Not affiliated with Twitter.

Home Page: https://tweetduck.chylex.com

License: MIT License

C# 58.12% JavaScript 20.27% Batchfile 0.01% Inno Setup 1.79% HTML 4.75% PowerShell 0.19% CSS 10.37% F# 4.42% Shell 0.08%
twitter tweetdeck cef cefsharp desktop app csharp winforms

tweetduck's Introduction

Follow TweetDuck on Twitter  |  Support via Ko-fi  |  Support via Patreon

Table of Contents

  1. Installation
  2. Source Code
  3. Development (Windows)
  4. Development (Linux)

Installation

Download links and system requirements are on the official website.

Source Code

Requirements

Building TweetDuck for Windows requires at minimum Visual Studio 2019 and Windows 7. Before opening the solution, open Visual Studio Installer and make sure you have the following Visual Studio workloads and components installed:

  • .NET desktop development
    • .NET SDK
    • F# desktop language support
  • Desktop development with C++
    • MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.20 / Latest)

In the Installation details panel, you can expand the workloads you selected, and uncheck any components that are not listed above to save space. You may uncheck the .NET SDK component if you installed the .NET 6 SDK directly.

Building TweetDuck for Linux requires .NET 6 SDK. The Linux project has its own solution file in the linux/ folder.

Editors

For editing code, I recommend either:

  • Visual Studio for C# / F# + VS Code for the rest (free when using the Community edition of Visual Studio)
  • Rider for all languages (paid)

Icons and logos were designed in Affinity Designer (paid). The original design projects are in the resources/Design/ folder (.afdesign extension).

Installers

If you don't want to build installers using the existing foundations, you can skip this section.

Official Windows installers are built using InnoSetup and Inno Download Plugin, specifically:

During installation, the download plugin will ask whether to add its include path to ISPPBuiltins.iss. Note that this option does not work with InnoSetup 6, so TweetDuck installers don't need it.

Scripts for building installers require the PATH environment variable to include the InnoSetup installation folder. You can either edit PATH manually, or use a program like Rapid Environment Editor to simplify the process. For example, this is the installation folder I added to PATH under User variables:

  • C:\Program Files (x86)\Inno Setup 6

You may need to restart Visual Studio or Rider after changing PATH for the change to take place.

Solution Overview

Open the solution file TweetDuck.sln (or linux/TweetDuck.Linux.sln) in an IDE, and use the Restore NuGet Packages option in your IDE to install dependencies.

On Windows, TweetDuck uses the CefSharp library for the browser component, and Windows Forms for the GUI.

On Linux, TweetDuck uses the ChromiumGtk library, which combines CefGlue for the browser component and GtkSharp for the GUI.

The solution contains several C# projects for executables and libraries, and F# projects for automated tests. All projects target .NET 6 and either C# 10 or F#.

Projects are organized into folders:

  • Windows projects are in the windows/ folder
  • Linux projects are in the linux/ folder
  • Libraries (TweetLib.*) are in the lib/ folder
  • Tests (TweetTest.*) are also in the lib/ folder

Here are a few things to keep in mind:

  • Executable projects have their entry points in Program.cs
  • Library projects targeting .NET Standard have their assembly information in Lib.cs
  • All non-test projects include a link to the Version.cs file in the root of the repository, which allows changing the version of all executables and library files in one place

Web resource files (HTML, CSS, JS) are in the Resources/ folder:

  • Resources/Content/ contains all the core features of TweetDuck injected into the browser components
  • Resources/Guide/ contains the official TweetDuck guide that opens as a popup
  • Resources/Plugins/ contains all official plugins, and a .debug plugin for testing

These resource folders are linked as part of the TweetLib.Core project so they can be edited directly within an IDE. Alternatively, you can edit them using VS Code by opening the workspace file Resources/..code-workspace.

Core Libraries

TweetLib.Core

This library contains the core TweetDuck application and browser logic. It is built around simple dependency injection that makes it independent of any concrete OS, GUI framework, or browser implementation.

To simplify porting to other systems, it is not necessary to implement all interfaces, but some functionality will be missing (for ex. if clipboard-related interfaces are not implemented, then context menus will not contain options to copy text or images to clipboard).

TweetLib.Browser

This library provides a zero-dependency abstraction of browser components and logic. It defines interfaces, events, and container objects that are used by the TweetLib.Core library to describe how a browser should behave, while making as few assumptions about the actual browser implementation as possible.

TweetLib.Browser.CEF

This library is a partial implementation of TweetLib.Browser based on CEF interfaces and conventions.

While TweetLib.Browser is highly generic, most browser libraries are likely to be using some form of CEF, so this library significantly reduces the amount of work required to swap between browser libraries that are based on CEF.

Windows Projects

TweetDuck

Main Windows executable. It has a dependency on CefSharp and Windows Forms. Here you will find the entry point that bootstraps the main application, as well as code for GUIs and Windows-specific functionality.

TweetDuck.Browser

Windows executable that hosts various Chromium processes. It has a dependency on CefSharp.

TweetDuck.Video

Windows executable that hosts a video player, which is based on the WMPLib ActiveX component responsible for integrating Windows Media Player into .NET Framework.

By default, CefSharp is not built with support for H.264 video playback due to software patent nonsense, and even though TweetDuck could be moved entirely to Europe where MPEG LA's patent means nothing, it would require building a custom version of Chromium which requires too many resources. Instead, when a Twitter video played, TweetDuck launches this video player process, which uses Windows Media Player to play H.264 videos.

TweetImpl.CefSharp

Windows library that implements TweetLib.Browser.CEF using the CefSharp library and Windows Forms.

TweetLib.WinForms.Legacy

Windows library that re-adds some legacy Windows Forms components that were removed in .NET Core 3.1. The sources were taken from the .NET Core 3.0 sources of Windows Forms, and edited to remove unnecessary features.

Linux Projects

TweetDuck

Main Linux executable. It has a transitive dependency on ChromiumGtk. Here you will find the entry point that bootstraps the main application, as well as code for GUIs and Linux-specific functionality.

TweetImpl.CefGlue

Linux library that implements TweetLib.Browser.CEF using ChromiumGtk, which is based on CefGlue and GtkSharp.

Miscellaneous

TweetLib.Communication

This library provides a DuplexPipe class for two-way communication between processes.

TweetLib.Utils

This library contains various utilities that fill some very specific holes in the .NET standard library.

TweetTest.*

These are F# projects with automated tests.

Development (Windows)

When developing with Rider, it must be configured to use MSBuild from Visual Studio, and the DevEnvDir property must be set to the full path to the Common7\IDE folder which is inside Visual Studio's installation folder. You can set both in File | Settings | Build, Execution, Deployment | Toolset and Build:

  1. Click the MSBuild version drop-down, and select the path that includes the Visual Studio installation folder.
  2. Click the Edit button next to MSBuild global properties.
  3. Add a new property named DevEnvDir, and set its value to the full path to Common7\IDE. For example:
    • VS 2019 Community - C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE
    • VS 2022 Community - C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE

Building

The windows/TweetDuck/TweetDuck.csproj project file has several tasks (targets) that run before and after a build:

  • PreBuildEvent runs a PowerShell script that kills TweetDuck.Browser processes, in case they got stuck
  • CopyResources copies resource files into the build folder, and patches and validates them using the PostBuild.ps1 PowerShell script
  • FinalizeDebug copies a debug plugin (Resources/Plugins/.debug) into the build folder (Debug only)
  • FinalizeRelease prepares the build folder for publishing, and if InnoSetup is installed, regenerates the update installer (Release only)

If the build fails, usually with an error like The command (...) exited with code 1, open the Output tab for detailed logs. A possible cause is the PostBuild.ps1 script's file validation:

  • Resources/Plugins/emoji-keyboard/emoji-ordering.txt line endings must be LF (line feed); if the file contains any CR (carriage return) characters, the build will fail

Debugging

The Debug configuration uses a separate data folder by default (%LOCALAPPDATA%\TweetDuckDebug) to avoid affecting an existing installation of TweetDuck. You can modify this by opening TweetDuck Properties in Visual Studio, clicking the Debug tab, and changing the Command line arguments field.

While debugging, opening the main menu and clicking Reload browser automatically applies all changes to HTML/CSS/JS files in the Resources/ folder. This allows editing and testing resource files without restarting the program, but it will cause a short delay between browser reloads.

Release

Open Batch Build, tick all Release configurations with x86 platform, and click Rebuild. Check the status bar to make sure it says Rebuild All succeeded; if not, see the end of the Building section.

If the build succeeds, the windows/TweetDuck/bin/x86/Release folder will contain files intended for distribution (no debug symbols or other unnecessary files). You may package these files yourself, or see the Installers section for automated installer generation.

If you decide to publicly release a custom version, please change all references to the TweetDuck name, website, and other links such as the issue tracker. The source files contain several constants and references to the official website and this repository, so don't forget to search all files for chylex.com and github.com in all files and replace them appropriately.

Installers

If you have all the requirements for building installers, you can generate them by running bld/GEN INSTALLERS.bat. Note that this will only package the files, you still need to create a release build in Visual Studio first!

After the window closes, three installers will be generated inside the bld/Output/ folder:

  • TweetDuck.exe
    • This is the main installer that creates entries in the Start Menu & Programs and Features, and an optional desktop icon
  • TweetDuck.Update.exe
    • This is a lightweight update installer that only contains the most important files that usually change across releases
    • It will automatically download and apply the full installer if the user's current version of CEF does not match
  • TweetDuck.Portable.exe
    • This is a portable installer that does not need administrator privileges
    • It automatically creates a makeportable file in the program folder, which forces TweetDuck to run in portable mode

If you plan to distribute your own installers, you can change the variables in the .iss installer files and in the update system to point to your own repository, and use the power of the existing update system.

There is a small chance running GEN INSTALLERS.bat immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again.

Running GEN INSTALLERS.bat uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening gen_full.iss and gen_port.iss, and changing LZMADictionarySize=15360 to LZMADictionarySize=4096.

Development (Linux)

Unfortunately the development experience on Linux is terrible, likely due to mixed C# and native code. The .NET debugger seems to crash the moment it enters native code, so the only way to run the app is without the debugger attached. If any C# code throws an exception, it will crash the whole application with no usable stack trace or error message. Please let me know if you find a way to make this better.

Building

The linux/TweetDuck/TweetDuck.csproj project file has several tasks (targets) that run after a build:

  • CopyResources copies resource files into the build folder, and patches and validates them using the build.sh Bash script
  • FinalizeDebug copies a debug plugin (Resources/Plugins/.debug) into the build folder (Debug only)
  • FinalizeRelease prepares the build folder for publishing (Release only)

Release

To change the application version before a release, search for the <Version> tag in every .csproj file in the linux/ folder and modify it.

To build the application, execute the linux/publish.sh Bash script. This will build the Release configuration for the linux-x64 runtime platform, and create a tarball in the linux/bld/ folder.

If you decide to publicly release a custom version, please change all references to the TweetDuck name, website, and other links such as the issue tracker. The source files contain several constants and references to the official website and this repository, so don't forget to search all files for chylex.com and github.com in all files and replace them appropriately.

tweetduck's People

Contributors

chylex avatar spirifoxy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tweetduck's Issues

Settings - new options, UI/UX improvements

Post all suggestions for the new Settings menu here. I will be updating the main list over time.

New Options

  • Notification timer countdown toggle
  • Toggle for using the old notification loading system

Improvements

  • Add tooltips to everything
  • Better customization for notification delay
  • Move Export/Import/Defaults to Advanced and use that space for a tooltip tip
  • Add px units to Distance from edge
  • Fix labels

"Minimize to tray on close"

Tweetdeck had the possibility to minimize to tray when you hit the close button.
Is it possible to add this feature also in TweetDick?

When you put this code in code.js before the rule "var initializeTweetDick = function(){" you can see in settings/general the option "Minimize to tray on close".
window.minimizetotray = true; window.deck = { "inApp": function(){ return true; }, "osname": function(){ return "osx"; }, "getWrapperVersion":function(){ return "3.7.0"; }, "getMinimizeToTraySetting":function(){ return window.minimizetotray; }, "setMinimizeToTraySetting":function(){ return window.minimizetotray = !window.minimizetotray; } } TD.util.isWrapperApp.cache.set(undefined,true);
Off course it don't work at the moment .
Here some information about it. http://stackoverflow.com/questions/3737053/cancel-a-winform-minimize http://stackoverflow.com/questions/17681686/minimized-application-showing-above-the-task-bar

Poll support

Add support for creating and viewing Twitter polls (unless Twitter implements the functionality first).

Extended tray icon functionality

TODO: Figure out if Microsoft has any documents on tray functionality design.

  • Add context menu to the tray icon (Restore, Close)
  • Either add multiple modes (Disabled, Minimize to Tray, Close to Tray) or find the official design guidelines and use those

Add a process name check for .lock

If the program closes unsuccessfully, the lock file may contain the ID of a newly spawned process, so check the process name to make sure it is TweetD*ck.

Hovering over URLs is impractical

I don't think lengthening URLs when you hover the cursor over links is really useful. The following messages change position all around and it's distracting. I think placing the cursor over the link for a second and showing the full URL in a fading message would be much more comfortable for user experience.

issue

proposal

No alerts available

On my system (Win7/64), no notifications are shown and no sound is heard. But when restoring the TweetDuck window the message counter is increased.

Mute function

Add a Mute option to the program settings and tray context menu to temporarily disable pop-up and sound notifications. Requires the new notification system to be implemented first.

Custom CSS

Option to inject custom CSS to both the browser and notification window.

Copy Link Location by right-clicking without focusing a tweet

Right now if you right click the timestamp of a tweet after opening it you can copy link location to get a permalink to the tweet. It would be awesome if you could do this by right-clicking in the blank space of the tweet without focusing first

Plugin functionality

Adding a new object to call C# code.

JS functionality

  • $token variable in each plugin to allow plugin-specific method calls

C# functionality

  • string ReadFile(int token, string path, bool cache) opens a file inside the plugin folder* and reads the contents into a string (returns empty string on error of if the file does not exist); if cache is enabled and the file is present in it, the cached value is returned instead
  • bool WriteFile(int token, string path, string contents) opens a file in the plugin folder* and writes the contents into it, returns true on success
  • bool DeleteFile(int token, string path) deletes a file in the plugin folder*, returns true on success

* all paths are relative and children of the plugin content folder (where .meta etc are located; no absolute paths or going above using ..), created automatically if they don't exist

Shift + enter to submit tweet

It would be nice if you could use shift + enter (or an equivalent shortcut) to submit a tweet. Not exactly a very important feature, but it'd be nice.

Suggestion: close to tray

Having the program active in the tray is what I value the most in a Twitter client. It would be nice if you could bring this feature back.

Context menu improvements

  • Clicking on URLs should bring up "Open in browser" and "Copy link to clipboard" (alternatively "Copy link address")
  • Clicking on images should add "Save image as..." and "Copy image URL"

Update notification doesn't (but should) use Notification Settings

When checking for TweetDuck updates, the 'Update available' dialog (notification window) is displayed (in my case) on Monitor 2, bottom-left corner, and never goes away, which is not the same as the settings configured in Notifications settings.

My current notification settings are:

  • Bottom-Right
  • Monitor 1 (Explicit)

As a user I expect all notifications to use these settings, unless there are separate settings for each (which seems unnecessary

Update notifications should:

  • Use/inherit Notification Location setting
  • Use/inherit Notification Duration setting
  • Use/inherit Distance From Edge setting
  • Use/Show Notification Timer if enabled in settings

Add a combined tray icon action

Minimize to tray and close to tray are nice, but a combination of both would even be better -> Go to tray either on minimize or close.

Not seeing that 'second tray icon' for notifying of new tweets/how to enable?

I don't see any mention of it in the settings. Do notifications need to be enabled in a feed for it to work?

Because I'm afraid of them getting in the way while I do a recording, I have alerts and sound notifications off, but I would like to be able to glance at the tray to know whether there have been new tweets since I last checked.

Post video files

It's somewhat ironic that you can't upload video files through the TweetDeck webapp but you can via the Twitter web client. Is there any way you could add compatibility with mp4 videos?

Additionally, another feature I really like from the website client is that you can paste pictures directly from the clipboard. Could this be also possible to implement?

Thanks!

Plugin system

Plugins will be folders placed in the /plugins/user/ (with official plugins in /plugins/official/).

Each plugin consists of a .meta file which contains information about the plugin, and at least one of browser.js and notification.js files, which contain the actual script that is ran either in the browser or notification window.

Browser plugins have access to the full library set of TweetDeck (such as jQuery or TD's custom front-end functions), notification plugins can only use vanilla JS. All plugins have access to global variables, including $TD for communication with the C# end.

Here is a rough base of a plugin. All overridden functions except for constructor are empty and do not require a super call.

.meta

[name]
Example Plugin

[description]
This is an example plugin.
It does stuff.

[author]
chylex

[version]
1.0

[requires]
1.2.3

(only name tag is required; the value of requires defaults to wildcard (*) but the program will not load the plugin if an invalid version is provided)

browser.js

constructor(){
  super({
    requiresPageReload: true // reloads page when manually enabled or disabled
  });
}

enabled(){
  // prepare variables, modify global variables, update stylesheets
}

ready(){
  // modify the contents as the page has finished loading, add event listeners
}

disabled(){
  // remove event listeners and revert everything to original state
}

notification.js

constructor(){
  super({
    // currently no options
  });
}

run(){
  // setup everything, ran for every notification
}

This is a very basic plugin system that will be expanded in the future if there is any interest in it. Ideas and feedback appreciated.

[Feature Request] Don't change default reply account based on the column

It used to be, if I have a column belonging to @A, and @b is currently my default selected "reply from" account, and I click "reply" from a tweet in @A's column, it replies from @b.

But now it assumes that because the feed is from @A, I want to reply from @A. Is it possible to make it not do this (as a toggleable option), i.e. so it will never change the default acc that I'm replying from based on column?

If it were a toggle per column that would be super awesome (ie have it be the old way for @A home but the new way for Mentions (all accounts) but mostly just the above is what I care about.

Links in About TweetDuck

Links in the About TweetDuck pop-up do not do anything when clicked. Just thought you should know :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.