Developer Blog

by Roman Soldatow


  • Home

  • Tags

  • Archives

  • Projects

  • Impressum

Zoom and Compton

Posted on 2022-02-10

If you use Zoom and Compton in a combination you might already had the issue that if you start sharing in zoom, you got a grey/dark overlay (shadow).

The fix for that was to disable Compton shadow in general or exclude Zoom Share Frame (“cpt_frame_window”) in the Compton shadow config.

E.g. in .config/compton.conf

1
2
3
shadow-exclude = [
"name = 'cpt_frame_window'"
];

But since Zoom version 5.9.3 the problem came back again because Zoom renamed the name of Zoom Share Frame to “cpt_frame_xcb_window”. So that it can be adjusted the same way.

1
2
3
shadow-exclude = [
"name = 'cpt_frame_xcb_window'"
];

Caddy v2 examples

Posted on 2021-11-24

It’s been a while since I started using caddy v2 in production. Therefore I would like to show some caddy configuration examples that I also use by myself.

HTTP3 in Caddy v2

In the last caddy post I mentioned how to setup HTTP3, however the syntax has changed slightly.

1
2
3
4
5
6
7
{
servers :443 {
protocol {
experimental_http3
}
}
}

Reverse proxy

Simple reverse proxy (to a specific port)

1
2
3
matrix.rmsol.de {
reverse_proxy localhost:8008
}

File server

Serving a static page (html/css). In that case with gzip and extended Cache-Control.

1
2
3
4
5
6
rmsol.de {
root * /var/www/rmsol.de
encode gzip
header Cache-Control max=age=3600
file_server
}

PHP website

Serving a PHP website.

1
2
3
4
5
ip-whois.de {
root * /var/www/ip-whois.de
file_server
php_fastcgi unix//var/run/php/php7.4-fpm.sock
}

Nextcloud

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
nextcloud.rmsol.de {
root * /var/www/nc
file_server

php_fastcgi unix//var/run/php/php7.4-fpm.sock
header {
Strict-Transport-Security max-age=31536000; # enable HSTS
}

redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301

@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}

respond @forbidden 404
}

Polybar modules (Zoom and service)

Posted on 2021-03-31

Some time ago I wrote several i3 blocklets, in particular Zoom Dunst notification and a service blocklet (to be able easily to enable/disable services). And since I moved from i3blocks to polybar, I had slightly to adjust the scripts.

Zoom Dunst module

I already wrote a short post about the Zoom dunst module. Here is just a slightly adjusted version for polybar.

To integrate the module, just add the snippet to your polybar modules and adjust the path to the zoom.sh script.

1
2
3
4
5
[module/zoom]
type = custom/script
exec = ~/polybar-scripts/zoom.sh
interval = 5
label = %output% Zoom

zoom.sh script

The zoom.sh file looks like that

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

DUNST_TIMEOUT=${DUNST_TIMEOUT:-3} # duration in seconds
DUNST_URGENCY=${DUNST_URGENCY:-"low"} # low, normal or critical

enable () {
touch /tmp/i3zoom.lock
notify-send -u ${DUNST_URGENCY} -t ${DUNST_TIMEOUT}000 Zoom "Sharing mode activated"
sleep ${DUNST_TIMEOUT}
notify-send DUNST_COMMAND_PAUSE
}

disable () {
rm /tmp/i3zoom.lock
notify-send DUNST_COMMAND_RESUME
}

xwininfo -name as_toolbar >/dev/null 2>&1
if [ $? -eq 0 ]; then
if ! [ -f "/tmp/i3zoom.lock" ]; then
enable
echo "%{F#ff0000}"
else
echo "%{F#ff0000}"
fi

else
if [ -f "/tmp/i3zoom.lock" ]; then
disable
fi
echo "%{F#ff0000}"
fi

Service module

The service module is an easy integration of your Linux service, which you can enable/disable/toggle. E.g. I use it often to enable/disable the OpenVPN service or other frequently toggled services.

It can be turned on/off just by clicking on the name of the service.

To integrate the module, just add the snippet to your polybar modules and adjust the path to the service.sh script.

1
2
3
4
5
6
7
8
[module/service]
type = custom/script
exec = ~/polybar-scripts/service.sh
interval = 5
click-middle = ~/polybar-scripts/service.sh toggle &
click-left = ~/polybar-scripts/service.sh enable &
click-right = ~/polybar-scripts/service.sh disable &
label = %output%

service.sh script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

SERVICE_NAME="openvpn"

if [ "$(systemctl is-active "$SERVICE_NAME")" != "active" ]
then
echo '%{F#ff0000} '$SERVICE_NAME
else
echo '%{F#00ff00} '$SERVICE_NAME
fi


enable () {
sudo systemctl start "$SERVICE_NAME"
}

disable () {
sudo systemctl stop "$SERVICE_NAME"
}

toggle () {
if [ "$(systemctl is-active $SERVICE_NAME)" != "active" ]
then
sudo systemctl start $SERVICE_NAME
else
sudo systemctl stop $SERVICE_NAME
fi
}

"$@"

Control specific audio device with amixer and i3block

Posted on 2020-12-02

I wrote another blocklet to be able to control my USB headset, next to my normal audio output. So that I was able to control my headset volume and PC speakers at the same time.

You can identify the audio device you would like to control with:

1
cat /proc/asound/cards

The output looks like that:

In my case, I was interested in the USB Audio Device called “C-Media”, which you will also find in the script itself. (Just take the first word, of your device name, from the second row)

The volume can be easily controlled by scrolling up/down over the icon.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

CARD=$(awk '$1 == "C-Media" {print f} {f=$1}' /proc/asound/cards)
VOLUME=$(amixer -M -c ${CARD} | grep -E -o '[0-9]{1,3}?%' | head -1)

if [ $BLOCK_BUTTON == '4' ]
then
amixer -D pulse sset Master 5%+ unmute -q
VOLUME=$(amixer -M -c ${CARD} | grep -E -o '[0-9]{1,3}?%' | head -1)
echo "<span foreground=\"#00FF00\">🎧 ${VOLUME}</span>"
fi

if [ $BLOCK_BUTTON == '5' ]
then
amixer -D pulse sset Master 5%- unmute -q
VOLUME=$(amixer -M -c ${CARD} | grep -E -o '[0-9]{1,3}?%' | head -1)
echo "<span foreground=\"#00FF00\">🎧 ${VOLUME}</span>"
else
echo "<span foreground=\"#00FF00\">🎧 ${VOLUME}</span>"
fi

Caddy v2

Posted on 2020-09-17

For about 10 years I’m running Nginx as my webserver (also for this blog). That’s why I wanted to look for something new, not because I’m not satisfied with Nginx, but because I just wanted to try another webserver with the hope that there might be something better out there.

It came handy that Caddy v2 was released. At that time I already wanted to test the first version, but I didn’t have the chance. Therefore I decided to use Caddy v2 and have been running it for 3 months. And I must say I like it.

What is different about Caddy?

  • Live config API (Seamlessly update your server’s config without downtime using elegant and intuitive REST endpoints)
  • Secure by Default (Caddy is the only web server that uses HTTPS by default)
    • Auto-renew certificates (with Let’s encrypt)
    • It also works with localhost (https)
  • HTTP/2 out of the box, and HTTP/3 by enabling
  • Reverse Proxy/Load balancing
  • No Dependencies (Because Caddy is is written in Go, its binaries are entirely self-contained and run on every platform, including containers without libc)
  • Modular Stack (Take back control over your compute edge. Caddy can be extended with everything you need using plugins)

Check more features on the caddy website.

How do the Caddyfile (config) looks like?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
experimental_http3
}

rmsol.de {
root * /var/www/rmsol.de
encode gzip
header Cache-Control max=age=3600
file_server
}

imagestack.de {
root * /var/www/imagestack.de
file_server
php_fastcgi unix//var/run/php/php7.0-fpm.sock
}

It is much cleaner than Nginx.
PS: you can migrate your Nginx config file to Caddy over config adapters

HTTP 3 support

I also enabled HTTP 3, it is still experimental (not just in Caddy, but in general).
Your browser need also to support it.

  • It can be enabled in Firefox (from version 72) via the network.http.http3.enabled pref in about:config.
  • It can be enabled in Chrome (from version 79) via the –enable-quic & –quic-version=h3-23 command line arguments.
12…6

Roman Soldatow

Developer Blog over coding and embedded systems (DIY) projects, and also some tips and tricks around the IT world.
30 posts
16 tags
RSS
GitHub StackOverflow
© 2022 Roman Soldatow