mirror of
https://github.com/ksyasuda/rice.git
synced 2025-12-05 20:53:38 -08:00
add scripts for i3
This commit is contained in:
7
scripts/calendar.sh
Executable file
7
scripts/calendar.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop on errors, print commands
|
||||
# See https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||
set -Eeuo pipefail
|
||||
|
||||
plasmawindowed org.kde.plasma.eventcalendar &
|
||||
@@ -8,4 +8,5 @@ killall -q polybar
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
polybar -c ~/i3/configs/config.ini main &
|
||||
# polybar -c ~/i3/configs/config.ini main &
|
||||
polybar -c ~/SudacodeRice/polybar/config.ini main &
|
||||
|
||||
13
scripts/new-wallpaper.sh
Executable file
13
scripts/new-wallpaper.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# set -Eeuo pipefail
|
||||
|
||||
DIR=/home/sudacode/Pictures/wallpapers/
|
||||
|
||||
img=$(ls $DIR | shuf -n 1)
|
||||
|
||||
if [[ $# -gt 0 && $1 == "-v" ]]; then
|
||||
echo $img
|
||||
fi
|
||||
|
||||
feh --bg-scale $DIR$img
|
||||
68
scripts/picom.sh
Executable file
68
scripts/picom.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script to launch a new instance of picom in the background
|
||||
|
||||
set -Euo pipefail
|
||||
# set -Eeuo pipefail
|
||||
# remove the e argument so that it does not stop on any command failure
|
||||
# e.g. having no picom running and having line 15 return non 0 return code
|
||||
|
||||
verbose=0
|
||||
justKillIt=0
|
||||
# if [[ $# -gt 0 && $1 == "-v" ]]; then
|
||||
# verbose=1
|
||||
# fi
|
||||
|
||||
while getopts "vk" arg; do
|
||||
case $arg in
|
||||
v) verbose=1;;
|
||||
k) justKillIt=1;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $justKillIt -eq 1 ]]; then
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
echo 'Searching for running picom instance'
|
||||
fi
|
||||
if [[ $(pgrep -x "picom") != '' ]]; then
|
||||
PID=$(pidof "picom")
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
echo 'Found running instance of picom with pid '$PID
|
||||
echo 'Killing instance'
|
||||
fi
|
||||
kill -9 $PID
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
echo 'Killed picom instance with pid' $PID
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
echo 'No running instance of picom found'
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
res=$(pgrep -x picom)
|
||||
if [[ $res != '' ]]; then
|
||||
pid=$(pidof picom)
|
||||
if [[ $verbose -eq 1 ]]
|
||||
then
|
||||
echo 'killing process pid '$pid
|
||||
fi
|
||||
kill -9 $pid
|
||||
while pgrep -x picom >/dev/null; do sleep 1;
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
picom &
|
||||
else
|
||||
picom &>/dev/null &
|
||||
fi
|
||||
|
||||
if [[ $verbose -eq 1 ]]
|
||||
then
|
||||
pid=$(pidof picom)
|
||||
echo 'launched new instance of picom with pid '$pid
|
||||
fi
|
||||
21
scripts/spotify-controls.sh
Executable file
21
scripts/spotify-controls.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
printf 'Must be run with a single argument'
|
||||
printf 'either p (Play Pause), n (Next Song), b (back)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
arg=$1
|
||||
if [[ $arg == '-p' ]]; then
|
||||
qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \
|
||||
org.mpris.MediaPlayer2.Player.PlayPause
|
||||
elif [[ $arg == '-n' ]]; then
|
||||
qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \
|
||||
org.mpris.MediaPlayer2.Player.Next
|
||||
elif [[ $arg == '-b' ]]; then
|
||||
qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \
|
||||
org.mpris.MediaPlayer2.Player.Previous
|
||||
fi
|
||||
5
scripts/todo.sh
Executable file
5
scripts/todo.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# launch the todolist KDE widget
|
||||
plasmawindowed com.github.zren.todolist
|
||||
23
scripts/wallpaper.sh
Executable file
23
scripts/wallpaper.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
dir="/usr/share/wallpapers/"
|
||||
EXT="/contents/images/1920x1080.jpg"
|
||||
EXT2="/contents/images/"
|
||||
count=0
|
||||
# choose a random directory in wallpapers folder
|
||||
chosen=$(ls /usr/share/wallpapers | shuf -n 1)
|
||||
# check to make sure it is a directory
|
||||
if [[ -d $dir$chosen ]]; then
|
||||
if [[ -f "$dir$chosen$EXT" ]]; then
|
||||
feh --bg-scale $dir$chosen$EXT
|
||||
file=$chosen
|
||||
else
|
||||
file=$(ls $dir$chosen$EXT2 | shuf -n 1)
|
||||
feh --bg-scale $dir$chosen$EXT2$file
|
||||
fi
|
||||
echo $file
|
||||
else
|
||||
echo 'something went wrong'
|
||||
fi
|
||||
Reference in New Issue
Block a user