custom bins
Christian Krinitsin christian@krinitsin.xyz
Sat, 16 Mar 2024 21:16:28 +0100
10 files changed,
113 insertions(+),
3 deletions(-)
A
bin/bluetooth-devices
@@ -0,0 +1,25 @@
+#!/bin/sh + +# +# This program lists all paired devices which you can select from, the selected one +# will be connected +# + +# Opens dmenu prompt, which lets you decide which device you want to connect to +DEVICE=$(bluetoothctl devices | sed 's/[^ ]* //' | sed 's/[^ ]* //' | dmenu) + +# If dmenu was cancelled, exit program +if [ $? -ne 0 ]; then + exit 1 +fi + +# Get MAC adress of the device you selected +MAC=$(bluetoothctl devices | grep "$DEVICE" | sed 's/[^ ]* //' | cut -d ' ' -f1) + +# Send a notify whether the connection was successful +if bluetoothctl connect $MAC | grep -q 'successful' +then + notify-send -t 5000 -r 2954 -u normal " Connected successfully to" " $DEVICE" +else + notify-send -t 5000 -r 2954 -u normal " Couldn't connect to" " $DEVICE" +fi
A
bin/qtb-load-session
@@ -0,0 +1,21 @@
+#!/bin/sh + +# +# This script opens a session in qutebrowser. There is a problem, that if one session is already open, +# the new selected session is 'empty'. To avoid this problem, all qutebrowser windows are killed before +# opening the new session. +# + +sessions_path=$(realpath ~/.local/share/qutebrowser/sessions) + +rm ~/.local/share/qutebrowser/sessions/_autosave.yml + +sel=$(find $sessions_path -iname "*.yml" -exec basename {} .yml ";" | sort -u | dmenu) + +if [ $? -ne 0 ]; then + exit 1 +fi + +ps -A | grep 'qutebrowser' && qutebrowser :wq + +qutebrowser -r $sel
A
bin/random-wallpaper
@@ -0,0 +1,13 @@
+#!/bin/sh + +# +# This script takes a random wallpaper out of the folder it cd's into +# In the repo there are duplicates of the backgrounds with different colorgrading, +# I'm "limiting" myself to one colorgrading + + +cd ~/.everforest-walls/nature/ + +IMAGE=$(find *'1.png' | sort -R | tail -n 1) + +swaymsg output "*" bg ~/.everforest-walls/nature/$IMAGE fill
A
bin/run-spotify-player
@@ -0,0 +1,5 @@
+#!/bin/sh + +ps -A | grep -q 'spotify_player' || spotify_player -d + +kitty -e spotify_player
A
bin/screenshot
@@ -0,0 +1,21 @@
+#!/bin/sh + +# +# Takes a screenshot with grimshot, in clipboard or in home directory +# + +MODE=$(printf "copy\nsave" | dmenu) + +# If dmenu was cancelled, exit program +if [ $? -ne 0 ]; then + exit 1 +fi + +case "$MODE" in + *save*) + grimshot save area ~/"screenshot-$(date +%F)-$(date +%T).png" && notify-send "screenshot-$(date +%F)-$(date +%T).png" "saved" + ;; + *copy*) + grimshot copy area && notify-send "Screenshot copied" + ;; +esac
A
bin/waterboy
@@ -0,0 +1,10 @@
+#!/bin/sh + +if [ $# = 0 ]; then + echo "Give me some names, Waterboy!" | cowsay + exit 1 +fi + +chosen_one=$(shuf -e $@ | head -n 1) + +echo "Go $chosen_one, Waterboy!" | cowsay
A
bin/zathura-fzf
@@ -0,0 +1,11 @@
+#!/bin/sh + +find "$@" -type f -iname '*pdf' > ~/.pdffiles.txt + +alacritty -e sh -c 'cat ~/.pdffiles.txt | fzf > ~/.zathurafile.txt' + +selected_file=$(cat ~/.zathurafile.txt) + +cat ~/.zathurafile.txt | grep '' && zathura "$selected_file" + +rm $HOME/.zathurafile.txt $HOME/.pdffiles.txt