File tree Expand file tree Collapse file tree 2 files changed +43
-24
lines changed
Expand file tree Collapse file tree 2 files changed +43
-24
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd " $( dirname " $0 " ) "
4+
5+ SOCK_FILE=sway_i3rs.sock
6+
7+ set_theme () {
8+ theme_name=$1
9+ sed -i -r " s/theme = .*/theme = \" $theme_name \" /" screenshot_config.toml
10+ }
11+
12+ cleanup () {
13+ # Reset theme so that config is not changed
14+ set_theme srcery
15+ # Remove the socket file
16+ rm -f $SOCK_FILE
17+ }
18+
19+ trap cleanup EXIT
20+
21+ # Screenshot area depends on the current monitor's position and size, and we only want the relevant part of the bar
22+ read x y w <<< $( swaymsg -t get_outputs | jq --raw-output " .. | objects | select(.focused == true) | .rect | \" \(.x) \(.y) \(.width)\" " )
23+ BAR_COORDS=" $(( $w / 2 + $x )) ,$y $(( $w / 2 )) x16"
24+
25+ swaymsg fullscreen off
26+ SWAYSOCK=$SOCK_FILE I3RS_PWD=$PWD sway --config swayconfig_i3rs &
27+ sleep 1
28+ swaymsg fullscreen toggle
29+
30+ for theme in ../files/themes/* ; do
31+ theme_name=$( basename $theme .toml)
32+ if [ -f ../img/themes/" $theme_name " .png ]; then
33+ echo Image for theme $theme_name already exists, skipping
34+ continue
35+ fi
36+ set_theme $theme_name
37+ pkill -SIGUSR2 i3status-rs
38+ sleep 1
39+ grim -g " $BAR_COORDS " ../img/themes/" $theme_name " .png
40+ done
41+
42+ SWAYSOCK=$SOCK_FILE swaymsg exit
43+
You can’t perform that action at this time.
0 commit comments