this repo has no description
dotfiles
1#!/bin/bash
2
3FILEPATH="/tmp/screen.png"
4FILEPATH_LOCK="/tmp/lockscreen.png"
5IS_i3_RUNNING=false
6IS_SWAY_RUNNING=false
7
8#Check if i3 or sway are running
9if [ $(ps -ef | grep i3 | grep -v grep | wc -l) -gt 1 ]; then
10 IS_i3_RUNNING=true
11elif [ $(ps -ef | grep sway | grep -v grep | wc -l) -gt 1 ]; then
12 IS_SWAY_RUNNING=true
13else
14 >&2 echo "Could not find i3 or sway running on the system"
15fi
16
17#retrieve screenshot
18if $IS_i3_RUNNING; then
19 import -window root $FILEPATH
20elif $IS_SWAY_RUNNING; then
21 grim -t png $FILEPATH
22fi
23
24if [ -z $XDG_CONFIG_HOME ]; then
25 XDG_CONFIG_HOME=$HOME/.config
26fi
27
28time $XDG_CONFIG_HOME/i3/scripts/fourier.py $FILEPATH $FILEPATH_LOCK
29
30#mute all audio
31amixer -q sset Master,0 mute
32
33#lock the screen
34if $IS_i3_RUNNING; then
35 i3lock --image=$FILEPATH_LOCK
36elif $IS_SWAY_RUNNING; then
37 swaylock --tiling --image $FILEPATH_LOCK
38fi
39
40rm $FILEPATH