How to Organize Your Social Media Content Calendar By Photo Editor

Keeping an organized and updated social media content calendar is a golden rule to live by for social media marketers and pretty much anyone who intends to use social media for business purposes. A…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Telegram file sharing from command line

Apparently there are Share menus everywhere on modern systems: OS X, Windows, Android, iOS. Everywhere, but not on Linux.

I often send different documents via Telegram and proper Share menu would be super handy. But since I couldn’t find any graphical way to do that I decided to write my own script for this very purpose.

That’s how Telegram looks when you try to send file via this command

To achieve that I have created a script, which accepts only one argument — a file path. Executing this script brings up Telegram window in “Choose recipient…” mode, where you can immediately type desired receiver name. A file will be sent as soon as Enter is pressed. No more Alt+Tab and drag and dropping. No more clunky file chooser navigation.

You may need to install wmctrl as prerequisite. On Debian-based system it can be done using sudo apt install wmctrl

Now create the following two-line script

First statement resolves any provided path to an absolute path using readlink utility and then invokes Telegram passing a special flag. Second line asks your window manager to focus and activate Telegram window so you can immediately start typing recipient name.

Save this script to file at your favorite scripts location and apply chmod +x to it. Then to execute this script use

./tg-share-file.sh file-to-send.jpg

For convenience you may want to add it to your aliases by the name of, for example, tgsend

And invoke it anywhere like so:

I would also advice considering integration into your favorite File manager if you need to send files or photos often. One handy shortcut may save you a lot of time otherwise spent dragging and dropping files. Just find a way to pass selected file path as argument to this script and you are good to go! But because there are myriads of file managers out there I leave this as an exercise for the reader :)

Add a comment

Related posts:

The Elusive Female Orgasm

A comprehensive guide on the elusive female orgasm, why your partner hasn't climaxed yet, and why you may be doing something wrong. A must-read article for men who aren't sexually satisfying their partners. If you want to make her cum, read this to find out how.

Townhall Report of 2 Week Period

Townhall Report of 2 Week Period. Hello Crafters, from now on we will publish rewind of every 2 week period on medium. You can also follow weekly townhalls at our discord….

Unexpected Lessons on Life From an Injured Donkey

Christopher McDougall is a well-known author who has written three great books about running. In McDougall’s most recently published book, Running With Sherman, we learn the story about a near-death…