Files
64gram-desktop/README.md
2023-10-04 02:18:09 +05:00

82 lines
3.2 KiB
Markdown

## I hate the future
Stories in every app, rounded corners, I hate them, this is a container of 64gram-desktop from aur before those annoying things were added. :)
### Please dont use docker, use podman instead
reason is that if you saved a file from telegram to your host, it will be saved as root user and your user cannot delete it
and podman runs as your user, so thats not an issue.
Now, Look this isnt best solution or even a good solution.
but you need to run this command first, before starting the container!
```bash
socat UNIX-LISTEN:/tmp/xdg-open.socket,fork EXEC:"xargs -n 1 xdg-open"
```
There is a script called `socat-server.sh` with this command as well.
OK but what is this, why do i need this??
Because, my dear, Telegram cannot open links when you click on them because telegram dont have access to browser to execute the command.
AND that command starts a unix socket which then telegram can send `xdg-open` commands to, the container has a modified `xdg-open` command to accept from the socket.
the modified xdg-open is also in this repo, its called `xdg-open-listener.sh`, i just renam it to `xdg-open` when building the container, see `Dockerfile`
hehe, simple :) ok anyway
save this as `podman-compose.yml` or if you like pain save as `docker-compose.yml`
```yml
version: '3.5'
services:
64gram:
hostname: 64gram
image: git.shihaam.dev/dockerfiles/64gram
environment:
- DISPLAY # For GUI access
devices:
- /dev/snd:/dev/snd # Mic and Speaker support
- /dev/video0:/dev/video0 # Webcam support
volumes:
- $HOME/.local/share/64Gram:/root/.local/share/64Gram # Telegram data
- $HOME/Downloads:/root/Downloads # Downloads folder
- $HOME/Pictures:/root/Pictures # Pictures folder
- $HOME/Documents:/root/Documents # Documents folder
- /usr/share/icons:/usr/share/icons # Icons for UI, like Mouse cursor
- /tmp/.X11-unix:/tmp/.X11-unix # X11 socket for GUI
- /tmp/xdg-open.socket:/tmp/xdg-open.socket # Add support for xdg-open
```
obviously change the docker.host to your host machines IP. \
and run `podman-compose up -d` or if you wanna live dangerously then you may..: `docker compose up -d`
here is a script that uses podman run command that does exactly the thing above lol
```bash
#!/bin/bash
SOCKET_ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)
# Start socat in the background
socat UNIX-LISTEN:/tmp/xdg-open$SOCKET_ID.socket,fork EXEC:"xargs -n 1 xdg-open" &
# Run the Podman container
podman run --rm \
--name 64gram \
--hostname 64gram \
-e DISPLAY \
--device /dev/snd:/dev/snd \
--device /dev/video0:/dev/video0 \
-v $HOME/.local/share/64Gram:/root/.local/share/64Gram \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/Documents:/root/Documents \
-v /usr/share/icons:/usr/share/icons \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /tmp/xdg-open$SOCKET_ID.socket:/tmp/xdg-open.socket \
git.shihaam.dev/dockerfiles/64gram
# Wait for all background processes to finish
wait
```
LOOK it even sets a random socket value so it wont mess up when you attempt to run it more than once, dont do it though \
im just gonna have this symlinked to `/sbin/telegram-desktop` when the future is today.
k, thanks, bye.