Skip to content

Commit 5fa1d40

Browse files
committed
feat(linux): linux support for t-rec
- make sure the generated images are visible by adjusting the alpha channel if it is missing (ubuntu: unity behaves this way) - cleanup unused imports - add env logger - grab a screenshot by window id - verifies the transparent border portion of the image and adjust the margins so that no transparent stuff is kept (tested on ubuntu)
1 parent c3cc86e commit 5fa1d40

30 files changed

+1111
-138
lines changed

Cargo.lock

Lines changed: 141 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ keywords = ["recorder", "image", "terminal", "gif", "commandline"]
1111
categories = ["multimedia::images", "command-line-utilities"]
1212
repository = "https://github.com/sassman/t-rec-rs"
1313
exclude = [".github/*", ".gitignore"]
14+
links = "X11"
15+
build = "build.rs"
1416

1517
[badges]
1618
github-actions = { repository = "sassman/t-rec-rs", branch = "main", workflow = "Build" }
@@ -21,10 +23,19 @@ clap = "2.33.3"
2123
image = "0.23.12"
2224
anyhow = "1.0.35"
2325
tempfile = "3.1.0"
26+
gif = "0.11"
27+
#image-convert = "0.10"
28+
29+
[dev-dependencies]
30+
env_logger = "0.8.2"
31+
log = "0.4.11"
2432

2533
[target.'cfg(target_os = "macos")'.dependencies]
2634
objc_id = "0.1.1"
2735
objc-foundation = "0.1.1"
2836
core-graphics = "0.22"
2937
core-foundation = "0.9"
3038
core-foundation-sys = "0.8"
39+
40+
[target.'cfg(target_os = "linux")'.dependencies]
41+
x11rb = "0.7"

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Blazingly fast terminal recorder that generates animated gif images for the web
4848

4949
**NOTE** `-f` just makes sure the latest version is installed
5050

51+
### Linux
52+
53+
```sh
54+
sudo apt-get install libx11-dev imagemagick
55+
```
56+
5157
## Usage
5258

5359
```sh
@@ -136,7 +142,6 @@ Code | 27600
136142
❯ WINDOWID=27600 t-rec
137143
138144
Frame cache dir: "/var/folders/m8/084p1v0x4770rpwpkrgl5b6h0000gn/T/trec-77862.BMYiHNRWqv9Y"
139-
Recording window id: 27600
140145
Press Ctrl+D to end recording
141146
142147
```
@@ -149,6 +154,12 @@ this is how it looks then:
149154
To contribute to t-rec you can either checkout existing issues [labeled with `good first issue`][4] or [open a new issue][5] and describe your problem.
150155
Also every PR is welcome. Support for Linux and Windows needs to be done.
151156
157+
## On the web & social media
158+
159+
- t-rec [on producthunt.com](https://www.producthunt.com/posts/t-rec)
160+
- t-rec [on hacker news](https://news.ycombinator.com/item?id=24742378)
161+
- t-rec [on reddit](https://www.reddit.com/r/rust/comments/j8tqs9/trec_a_blazingly_fast_terminal_recorder_that/)
162+
152163
## License
153164
154165
- **[GNU GPL v3 license](https://www.gnu.org/licenses/gpl-3.0)**

Vagrantfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
5+
# configures the configuration version (we support older styles for
6+
# backwards compatibility). Please don't change it unless you know what
7+
# you're doing.
8+
Vagrant.configure("2") do |config|
9+
# The most common configuration options are documented and commented below.
10+
# For a complete reference, please see the online documentation at
11+
# https://docs.vagrantup.com.
12+
13+
# Every Vagrant development environment requires a box. You can search for
14+
# boxes at https://vagrantcloud.com/search.
15+
# config.vm.box = "nodlams/mint-cinnamon-desktop"
16+
# config.vm.box = "ichang0301/linux-mint-cinnamon-20"
17+
18+
# config.vm.box = "microlinux/opensuse-15.2"
19+
20+
# config.vm.box_version = "0.1.0"
21+
config.vm.box = "peru/ubuntu-18.04-desktop-amd64"
22+
# config.vm.box = "peru/ubuntu-20.04-desktop-amd64"
23+
24+
# Disable automatic box update checking. If you disable this, then
25+
# boxes will only be checked for updates when the user runs
26+
# `vagrant box outdated`. This is not recommended.
27+
# config.vm.box_check_update = false
28+
29+
# Create a forwarded port mapping which allows access to a specific port
30+
# within the machine from a port on the host machine. In the example below,
31+
# accessing "localhost:8080" will access port 80 on the guest machine.
32+
# NOTE: This will enable public access to the opened port
33+
# config.vm.network "forwarded_port", guest: 80, host: 8080
34+
35+
# Create a forwarded port mapping which allows access to a specific port
36+
# within the machine from a port on the host machine and only allow access
37+
# via 127.0.0.1 to disable public access
38+
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
39+
40+
# Create a private network, which allows host-only access to the machine
41+
# using a specific IP.
42+
# config.vm.network "private_network", ip: "192.168.33.10"
43+
44+
# Create a public network, which generally matched to bridged network.
45+
# Bridged networks make the machine appear as another physical device on
46+
# your network.
47+
# config.vm.network "public_network"
48+
49+
# Share an additional folder to the guest VM. The first argument is
50+
# the path on the host to the actual folder. The second argument is
51+
# the path on the guest to mount the folder. And the optional third
52+
# argument is a set of non-required options.
53+
config.vm.synced_folder ".", "/t-rec"
54+
55+
# Provider-specific configuration so you can fine-tune various
56+
# backing providers for Vagrant. These expose provider-specific options.
57+
# Example for VirtualBox:
58+
#
59+
config.vm.provider "virtualbox" do |vb|
60+
# Display the VirtualBox GUI when booting the machine
61+
vb.gui = true
62+
63+
# Customize the amount of memory on the VM:
64+
vb.memory = "8192"
65+
end
66+
#
67+
# View the documentation for the provider you are using for more
68+
# information on available options.
69+
70+
# Enable provisioning with a shell script. Additional provisioners such as
71+
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
72+
# documentation for more information about their specific syntax and use.
73+
# config.vm.provision "shell", inline: <<-SHELL
74+
# apt-get update
75+
# apt-get install -y apache2
76+
# SHELL
77+
end

build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(target_os = "linux")]
2+
fn main() {
3+
println!("cargo:rustc-link-lib=X11");
4+
}
5+
6+
#[cfg(not(target_os = "linux"))]
7+
fn main() {}

0 commit comments

Comments
 (0)