From e992c3c164e9bf8869fb8b20eaa17ca595d92aac Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Sat, 16 Mar 2024 21:16:28 +0100 Subject: custom bins --- .bashrc | 2 +- .profile | 3 +-- bin/bluetooth-devices | 25 +++++++++++++++++++++++++ bin/dmenu | 5 +++++ bin/qtb-load-session | 21 +++++++++++++++++++++ bin/random-wallpaper | 13 +++++++++++++ bin/run-spotify-player | 5 +++++ bin/screenshot | 21 +++++++++++++++++++++ bin/waterboy | 10 ++++++++++ bin/zathura-fzf | 11 +++++++++++ 10 files changed, 113 insertions(+), 3 deletions(-) create mode 100755 bin/bluetooth-devices create mode 100755 bin/dmenu create mode 100755 bin/qtb-load-session create mode 100755 bin/random-wallpaper create mode 100755 bin/run-spotify-player create mode 100755 bin/screenshot create mode 100755 bin/waterboy create mode 100755 bin/zathura-fzf diff --git a/.bashrc b/.bashrc index 547fb5e..ab1bf09 100644 --- a/.bashrc +++ b/.bashrc @@ -1,5 +1,5 @@ # Export own script path -export PATH=/usr/local/bin/:$HOME/.local/bin/:$PATH +export PATH=/usr/local/bin/:$HOME/.dotfiles/bin/:$PATH # Aliases alias ls='ls --color=auto' diff --git a/.profile b/.profile index ff67372..30fcca4 100755 --- a/.profile +++ b/.profile @@ -1,4 +1,3 @@ export GPG_TTY=$(tty) -export PATH=/home/chris/.local/bin:$PATH +export PATH=/home/chris/.dotfiles/bin:$PATH export ELECTRON_OZONE_PLATFORM_HINT=auto -#export QT_QPA_PLATFORMTHEME=qt5ct diff --git a/bin/bluetooth-devices b/bin/bluetooth-devices new file mode 100755 index 0000000..5cc4876 --- /dev/null +++ b/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 diff --git a/bin/dmenu b/bin/dmenu new file mode 100755 index 0000000..6ca1a50 --- /dev/null +++ b/bin/dmenu @@ -0,0 +1,5 @@ +#!/bin/sh + +/usr/local/bin/dmenu-wl $* -nb '#2b3339' -nf '#d3c6aa' -sb '#d3c6aa' -sf '#212736' -i -fn 'DroidSansM Nerd Font' + +exit $? diff --git a/bin/qtb-load-session b/bin/qtb-load-session new file mode 100755 index 0000000..bf2ead3 --- /dev/null +++ b/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 diff --git a/bin/random-wallpaper b/bin/random-wallpaper new file mode 100755 index 0000000..796d44c --- /dev/null +++ b/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 diff --git a/bin/run-spotify-player b/bin/run-spotify-player new file mode 100755 index 0000000..865aecd --- /dev/null +++ b/bin/run-spotify-player @@ -0,0 +1,5 @@ +#!/bin/sh + +ps -A | grep -q 'spotify_player' || spotify_player -d + +kitty -e spotify_player diff --git a/bin/screenshot b/bin/screenshot new file mode 100755 index 0000000..e5391c8 --- /dev/null +++ b/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 diff --git a/bin/waterboy b/bin/waterboy new file mode 100755 index 0000000..9a1e425 --- /dev/null +++ b/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 diff --git a/bin/zathura-fzf b/bin/zathura-fzf new file mode 100755 index 0000000..2b5ddbd --- /dev/null +++ b/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 -- cgit 1.4.1