From 82a32ab8b3e62639e4f9cf787b8967c8da1f1232 Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Wed, 12 Jun 2024 20:04:26 +0200 Subject: remove waybar elements, add and modify scripts, add mult. monitor support --- bin/bluetooth-devices | 4 ++-- bin/screenshot | 26 +++++++++++++++++++++++--- bin/toggle_monitor_focus | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100755 bin/toggle_monitor_focus (limited to 'bin') diff --git a/bin/bluetooth-devices b/bin/bluetooth-devices index f5fe284..d14ff0a 100755 --- a/bin/bluetooth-devices +++ b/bin/bluetooth-devices @@ -10,9 +10,9 @@ connect_bluetooth() { local DEVICE=$2 if bluetoothctl connect $MAC | grep -q 'successful' then - notify-send -t 5000 -r 2954 -u normal " Connected successfully from" " $DEVICE" + notify-send -t 5000 -r 2954 -u normal " Connected successfully to" " $DEVICE" else - notify-send -t 5000 -r 2954 -u normal " Couldn't connect from" " $DEVICE" + notify-send -t 5000 -r 2954 -u normal " Couldn't connect to" " $DEVICE" fi } diff --git a/bin/screenshot b/bin/screenshot index e5391c8..e6956cb 100755 --- a/bin/screenshot +++ b/bin/screenshot @@ -1,7 +1,7 @@ #!/bin/sh # -# Takes a screenshot with grimshot, in clipboard or in home directory +# Takes a screenshot with grimshot, in clipboard or in given directory # MODE=$(printf "copy\nsave" | dmenu) @@ -13,9 +13,29 @@ fi case "$MODE" in *save*) - grimshot save area ~/"screenshot-$(date +%F)-$(date +%T).png" && notify-send "screenshot-$(date +%F)-$(date +%T).png" "saved" + cd $HOME + while true; do + selected_dir=$(ls | dmenu -i) + if [ -z "$selected_dir" ]; then + exit 0 + fi + + if [ -d "$selected_dir" ]; then + cd "$selected_dir" + continue + fi + + if [ -e "$selected_dir" ]; then + notify-send "Error: File exists!" + exit 0 + fi + + break + done + + grimshot save area "$PWD/$selected_dir.png" && notify-send "$PWD/$selected_dir.png" "saved" ;; *copy*) - grimshot copy area && notify-send "Screenshot copied" + grimshot copy area && notify-send "Screenshot copied" ;; esac diff --git a/bin/toggle_monitor_focus b/bin/toggle_monitor_focus new file mode 100755 index 0000000..790ebe2 --- /dev/null +++ b/bin/toggle_monitor_focus @@ -0,0 +1,21 @@ +#!/bin/bash + +# Get the currently focused output +current_output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') + +# Get the list of outputs +outputs=($(swaymsg -t get_outputs | jq -r '.[].name')) + +# Find the index of the currently focused output +for i in "${!outputs[@]}"; do + if [[ "${outputs[$i]}" == "$current_output" ]]; then + current_index=$i + break + fi +done + +# Calculate the index of the next output +next_index=$(( (current_index + 1) % ${#outputs[@]} )) + +# Focus the next output +swaymsg focus output "${outputs[$next_index]}" -- cgit 1.4.1