make scripts posix sh

This commit is contained in:
thek4n 2024-11-02 11:14:41 +03:00
parent 6f0c0047d0
commit 5c82197471
15 changed files with 26 additions and 31 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# g# e f# b | b f# g# e | g# f# e b # g# e f# b | b f# g# e | g# f# e b

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# usermod -aG input $USER # usermod -aG input $USER

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
beep \ beep \
-f 1198.64491 -l 200 \ -f 1198.64491 -l 200 \

View File

@ -5,7 +5,7 @@ bssid="$(bluetoothctl devices | rofi -dmenu -p "Devices: " -l 20 | cut -d' ' -f2
exit_counter=0 exit_counter=0
until bluetoothctl connect "$bssid" until bluetoothctl connect "$bssid"
do do
((exit_counter+=1)) exit_counter=$((exit_counter+1))
if [ "$exit_counter" -gt 3 ]; then if [ "$exit_counter" -gt 3 ]; then
break break

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
gen_workspaces() gen_workspaces()
{ {

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# The idea is to define "holder" modules in i3status config and then replace them # The idea is to define "holder" modules in i3status config and then replace them
@ -12,15 +12,14 @@
[ -x "/usr/bin/jq" ] || exec i3status [ -x "/usr/bin/jq" ] || exec i3status
update_holder() { update_holder() {
local instance="$1" instance="$1"
local replacement="$2" replacement="$2"
echo "$3" | jq --argjson arg_j "$replacement" "(.[] | (select(.instance==\"$instance\"))) |= \$arg_j" echo "$3" | jq --argjson arg_j "$replacement" "(.[] | (select(.instance==\"$instance\"))) |= \$arg_j"
} }
get_device_battery_status() { get_device_battery_status() {
for uuid in $(timeout 1 bluetoothctl devices | cut -f2 -d' ' 2>/dev/null) for uuid in $(timeout 1 bluetoothctl devices | cut -f2 -d' ' 2>/dev/null)
do do
local device_info
device_info="$(timeout 1 bluetoothctl info "$uuid")" device_info="$(timeout 1 bluetoothctl info "$uuid")"
if echo "$device_info" | grep -q 'Connected: yes\|Battery Percentage'; then if echo "$device_info" | grep -q 'Connected: yes\|Battery Percentage'; then
@ -31,7 +30,7 @@ get_device_battery_status() {
} }
update_json_with_text() { update_json_with_text() {
local json="{ \"full_text\": \"$1\", \"color\": \"#FFFFFF\"}" json="{ \"full_text\": \"$1\", \"color\": \"#FFFFFF\"}"
update_holder "holder__headphones" "$json" "$2" update_holder "holder__headphones" "$json" "$2"
} }

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
pidd="$(ps -u $USER -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | rofi -dmenu -i -l 15 | awk '{print $1}')" pidd="$(ps -u "${USER}" -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | rofi -dmenu -i -l 15 | awk '{print $1}')"
kill -15 "$pidd" kill -15 "$pidd"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
eval "$(echo "i3-msg exit eval "$(echo "i3-msg exit

View File

@ -63,4 +63,3 @@ case "$1" in
*) shift; cmd_help "$@" ;; *) shift; cmd_help "$@" ;;
esac esac
exit 0 exit 0

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
choosed_screen_layout="$(slm ls | rofi -dmenu -m -1 -i -p "Select screen layout")" choosed_screen_layout="$(slm ls | rofi -dmenu -m -1 -i -p "Select screen layout")"
slm load "$choosed_screen_layout" slm load "$choosed_screen_layout"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
readonly tmux_list_sessions_script="$HOME/.local/bin/tmux_list_sessions.sh" readonly tmux_list_sessions_script="${HOME}/.local/bin/tmux_list_sessions.sh"
export FZF_DEFAULT_OPTS="\ export FZF_DEFAULT_OPTS="\
${FZF_DEFAULT_OPTS} ${FZF_DEFAULT_OPTS}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
readonly tmux_list_sessions_script="$HOME/.local/bin/tmux_list_sessions.sh" readonly tmux_list_sessions_script="${HOME}/.local/bin/tmux_list_sessions.sh"
export FZF_DEFAULT_OPTS="\ export FZF_DEFAULT_OPTS="\
${FZF_DEFAULT_OPTS} ${FZF_DEFAULT_OPTS}

View File

@ -1,15 +1,12 @@
#!/usr/bin/env bash #!/bin/sh
declare current_session
current_session="$(tmux display-message -p '#S')" current_session="$(tmux display-message -p '#S')"
readonly current_session readonly current_session
declare last_session
last_session="$(tmux display-message -p '#{client_last_session}')" last_session="$(tmux display-message -p '#{client_last_session}')"
readonly last_session readonly last_session
declare sessions
sessions="$(tmux list-session -F '#S#{?session_attached, (attached) , }')" sessions="$(tmux list-session -F '#S#{?session_attached, (attached) , }')"
sessions="$(echo "${sessions}" | sed "s/^${current_session} /${current_session} (current) /")" sessions="$(echo "${sessions}" | sed "s/^${current_session} /${current_session} (current) /")"
sessions="$(echo "${sessions}" | sed "s/^${last_session} /${last_session} (last) /")" sessions="$(echo "${sessions}" | sed "s/^${last_session} /${last_session} (last) /")"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/bin/sh
export FZF_DEFAULT_OPTS="\ export FZF_DEFAULT_OPTS="\

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/sh
set -eo pipefail set -ue
bssid="$(nmcli -f BSSID,SSID,SIGNAL,RATE,BARS,SECURITY dev wifi list | sed -n '1!p' | rofi -dmenu -p "WiFi: " -l 20 | cut -d' ' -f1)" bssid="$(nmcli -f BSSID,SSID,SIGNAL,RATE,BARS,SECURITY dev wifi list | sed -n '1!p' | rofi -dmenu -p "WiFi: " -l 20 | cut -d' ' -f1)"
pass="$(echo "" | rofi -dmenu -p "Password: ")" pass="$(echo "" | rofi -dmenu -p "Password: ")"