initial dotfiles

This commit is contained in:
srtk 2026-04-25 16:39:11 +05:30
commit 45e5fe53d2
370 changed files with 25449 additions and 0 deletions

View file

@ -0,0 +1,51 @@
#!/bin/bash
# Audio Output Management (Rofi-based)
# Dependencies: libpulse (pactl), rofi
get_volume() {
pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]+(?=%)' | head -n 1
}
manage_sinks() {
# Get list of sinks and their descriptions
local sinks=$(pactl list short sinks | awk '{print $2}')
local sink_descriptions=""
while read -r line; do
local desc=$(pactl list sinks | grep -A 20 "Name: $line" | grep "Description:" | cut -d: -f2- | xargs)
sink_descriptions+="$desc|$line\n"
done <<< "$sinks"
local chosen=$(echo -e "$sink_descriptions" | column -t -s '|' | rofi -dmenu -i -p "Select Audio Output: ")
if [ -n "$chosen" ]; then
local sink_name=$(echo "$chosen" | awk '{print $NF}')
pactl set-default-sink "$sink_name"
notify-send "Audio" "Output switched to: $sink_name"
fi
}
change_volume() {
local action=$(echo -e "󰝝 Increase (+10%)\n󰝞 Decrease (-10%)\n󰝟 Mute/Unmute" | rofi -dmenu -p "Volume: $(get_volume)%")
case $action in
*"Increase"*) pactl set-sink-volume @DEFAULT_SINK@ +10% ;;
*"Decrease"*) pactl set-sink-volume @DEFAULT_SINK@ -10% ;;
*"Mute"*) pactl set-sink-mute @DEFAULT_SINK@ toggle ;;
esac
}
# Main Menu
chosen=$(echo -e "󰓃 Switch Output\n󰕾 Adjust Volume\n󰍬 Manage Inputs (Microphone)" | rofi -dmenu -p "Audio Management: ")
case $chosen in
*"Output"*) manage_sinks ;;
*"Volume"*) change_volume ;;
*"Inputs"*)
# Logic for inputs is identical to sinks, just swap 'sink' with 'source'
sources=$(pactl list short sources | awk '{print $2}')
chosen_source=$(echo -e "$sources" | rofi -dmenu -p "Select Input: ")
[ -n "$chosen_source" ] && pactl set-default-source "$chosen_source"
;;
esac

View file

@ -0,0 +1,97 @@
#!/bin/bash
# Bluetooth Management Script (Rofi-based)
# Dependencies: bluez, bluez-utils, rofi
SESSION_TYPE="$XDG_SESSION_TYPE"
ENABLED_COLOR="#81A1C1"
DISABLED_COLOR="#D35F5E"
CONNECTED_ICON="󰂄"
DISCONNECTED_ICON="󰂃"
get_status() {
if bluetoothctl show | grep -q "Powered: yes"; then
local status_icon=""
local status_color=$ENABLED_COLOR
# Check if any device is connected
if bluetoothctl info | grep -q "Connected: yes"; then
status_icon="󰂱"
fi
else
local status_icon="󰂲"
local status_color=$DISABLED_COLOR
fi
if [[ "$SESSION_TYPE" == "wayland" ]]; then
echo "<span color=\"$status_color\">$status_icon</span>"
else
echo "%{F$status_color}$status_icon%{F-}"
fi
}
manage_devices() {
# Get paired devices
local devices_list=$(bluetoothctl devices | awk '{print $3 " " $2}')
if [ -z "$devices_list" ]; then
notify-send "Bluetooth" "No paired devices found."
return
fi
local chosen_device=$(echo -e "$devices_list" | rofi -dmenu -i -p "Bluetooth Devices: ")
if [ -z "$chosen_device" ]; then return; fi
local device_mac=$(echo "$chosen_device" | awk '{print $NF}')
local device_name=$(echo "$chosen_device" | awk '{$NF=""; print $0}')
# Check connection status
local is_connected=$(bluetoothctl info "$device_mac" | grep "Connected: yes")
if [ -n "$is_connected" ]; then
action=$(echo -e "󰂲 Disconnect\n󰆴 Remove/Forget" | rofi -dmenu -p "Action for $device_name: ")
else
action=$(echo -e "󰂄 Connect\n󰆴 Remove/Forget" | rofi -dmenu -p "Action for $device_name: ")
fi
case $action in
*"Connect")
bluetoothctl connect "$device_mac" && notify-send "Bluetooth" "Connected to $device_name"
;;
*"Disconnect")
bluetoothctl disconnect "$device_mac" && notify-send "Bluetooth" "Disconnected from $device_name"
;;
*"Remove"*)
bluetoothctl remove "$device_mac" && notify-send "Bluetooth" "Removed $device_name"
;;
esac
}
# Main Logic
if [[ "$1" == "--status" ]]; then
get_status
exit 0
fi
power_status=$(bluetoothctl show | grep "Powered: yes")
if [ -z "$power_status" ]; then
toggle_label="󰂯 Enable Bluetooth"
toggle_cmd="power on"
else
toggle_label="󰂲 Disable Bluetooth"
toggle_cmd="power off"
fi
chosen_option=$(echo -e "$toggle_label\n󰂱 Manage Devices\n󰘧 Scan for New Devices" | rofi -dmenu -p "Bluetooth: ")
case $chosen_option in
*"Enable"*|*"Disable"*)
bluetoothctl $toggle_cmd
;;
*"Manage"*)
manage_devices
;;
*"Scan"*)
notify-send "Bluetooth" "Scanning for 15 seconds..."
bluetoothctl --timeout 15 scan on
manage_devices
;;
esac

View file

@ -0,0 +1,21 @@
#!/bin/bash
# ┏━━━┳━━┳━┓┏━┳━━━┳┓╋╋┏━━┳━┓┏━┓
# ┗┓┏┓┣┫┣┫┃┗┛┃┃┏━━┫┃╋╋┗┫┣┻┓┗┛┏┛
# ╋┃┃┃┃┃┃┃┏┓┏┓┃┗━━┫┃╋╋╋┃┃╋┗┓┏┛
# ╋┃┃┃┃┃┃┃┃┃┃┃┃┏━━┫┃╋┏┓┃┃╋┏┛┗┓
# ┏┛┗┛┣┫┣┫┃┃┃┃┃┃╋╋┃┗━┛┣┫┣┳┛┏┓┗┓
# ┗━━━┻━━┻┛┗┛┗┻┛╋╋┗━━━┻━━┻━┛┗━┛
# The program was created by DIMFLIX
# Github: https://github.com/DIMFLIX-OFFICIAL
session_type=$XDG_SESSION_TYPE
if [ "$session_type" == "wayland" ]; then
cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
elif [ "$session_type" == "x11" ]; then
cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | xclip -selection clipboard
else
echo "Тип сеанса не определен или не является Wayland/X11."
fi

View file

@ -0,0 +1,250 @@
#!/bin/bash
# ┏━━━┳━━┳━┓┏━┳━━━┳┓╋╋┏━━┳━┓┏━┓
# ┗┓┏┓┣┫┣┫┃┗┛┃┃┏━━┫┃╋╋┗┫┣┻┓┗┛┏┛
# ╋┃┃┃┃┃┃┃┏┓┏┓┃┗━━┫┃╋╋╋┃┃╋┗┓┏┛
# ╋┃┃┃┃┃┃┃┃┃┃┃┃┏━━┫┃╋┏┓┃┃╋┏┛┗┓
# ┏┛┗┛┣┫┣┫┃┃┃┃┃┃╋╋┃┗━┛┣┫┣┳┛┏┓┗┓
# ┗━━━┻━━┻┛┗┛┗┻┛╋╋┗━━━┻━━┻━┛┗━┛
# The program was created by DIMFLIX
# Github: https://github.com/DIMFLIX-OFFICIAL
SESSION_TYPE="$XDG_SESSION_TYPE"
ENABLED_COLOR="#A3BE8C"
DISABLED_COLOR="#D35F5E"
SIGNAL_ICONS=("󰤟 " "󰤢 " "󰤥 " "󰤨 ")
SECURED_SIGNAL_ICONS=("󰤡 " "󰤤 " "󰤧 " "󰤪 ")
WIFI_CONNECTED_ICON=" "
ETHERNET_CONNECTED_ICON=" "
get_status() {
if nmcli -t -f TYPE,STATE device status | grep 'ethernet:connected' > /dev/null; then
local status_icon="󰈀"
local status_color=$ENABLED_COLOR
elif nmcli -t -f TYPE,STATE device status | grep 'wifi:connected' > /dev/null; then
local wifi_info=$(nmcli --terse --fields "IN-USE,SIGNAL,SECURITY,SSID" device wifi list --rescan no | grep '\*')
if [ -n "$wifi_info" ]; then
IFS=: read -r in_use signal security ssid <<< "$wifi_info"
local signal_icon="${SIGNAL_ICONS[3]}"
local signal_level=$((signal / 25))
if [[ "$signal_level" -lt "${#SIGNAL_ICONS[@]}" ]]; then
signal_icon="${SIGNAL_ICONS[$signal_level]}"
fi
if [[ "$security" =~ WPA || "$security" =~ WEP ]]; then
signal_icon="${SECURED_SIGNAL_ICONS[$signal_level]}"
fi
status_icon="$signal_icon"
local status_color=$ENABLED_COLOR
else
status_icon=" "
local status_color=$DISABLED_COLOR
fi
else
local status_icon=" "
local status_color=$DISABLED_COLOR
fi
if [[ "$SESSION_TYPE" == "wayland" ]]; then
echo "<span color=\"$status_color\">$status_icon</span>"
elif [[ "$SESSION_TYPE" == "x11" ]]; then
echo "%{F$status_color}$status_icon%{F-}"
fi
}
manage_wifi() {
nmcli --terse --fields "IN-USE,SIGNAL,SECURITY,SSID" device wifi list > /tmp/wifi_list.txt
local ssids=()
local formatted_ssids=()
local active_ssid=""
while IFS=: read -r in_use signal security ssid; do
if [ -z "$ssid" ]; then continue; fi # Пропускаем сети без SSID
local signal_icon="${SIGNAL_ICONS[3]}"
local signal_level=$((signal / 25))
if [[ "$signal_level" -lt "${#SIGNAL_ICONS[@]}" ]]; then
signal_icon="${SIGNAL_ICONS[$signal_level]}"
fi
if [[ "$security" =~ WPA || "$security" =~ WEP ]]; then
signal_icon="${SECURED_SIGNAL_ICONS[$signal_level]}"
fi
# Добавляем иконку подключения, если сеть активна
local formatted="$signal_icon $ssid"
if [[ "$in_use" =~ \* ]]; then
active_ssid="$ssid"
formatted="$WIFI_CONNECTED_ICON $formatted"
fi
ssids+=("$ssid")
formatted_ssids+=("$formatted")
done < /tmp/wifi_list.txt
local formatted_list=""
for formatted_ssid in "${formatted_ssids[@]}"; do
formatted_list+="$formatted_ssid\n"
done
formatted_list=$(printf "%s" "$formatted_list")
local chosen_network=$(echo -e "$formatted_list" | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: ")
local ssid_index=-1
for i in "${!formatted_ssids[@]}"; do
if [[ "${formatted_ssids[$i]}" == "$chosen_network" ]]; then
ssid_index=$i
break
fi
done
local chosen_id="${ssids[$ssid_index]}"
if [ -z "$chosen_network" ]; then
rm /tmp/wifi_list.txt
return
else
# Проверяем состояние выбранной сети
local device_status=$(nmcli -t -f STATE device show wlan0 | grep STATE | cut -d: -f2)
# Определяем действие в зависимости от состояния сети
local action
if [[ "$chosen_id" == "$active_ssid" ]]; then
action=" Disconnect"
else
action="󰸋 Connect"
fi
action=$(echo -e "$action\n Forget" | rofi -dmenu -p "Action: ")
case $action in
"󰸋 Connect")
local success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
local saved_connections=$(nmcli -g NAME connection show)
if [[ $(echo "$saved_connections" | grep -Fx "$chosen_id") ]]; then
nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Connection Established" "$success_message"
else
local wifi_password=$(rofi -dmenu -p "Password: " -password)
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
fi
;;
" Disconnect")
nmcli device disconnect wlan0 && notify-send "Disconnected" "You have been disconnected from $chosen_id."
;;
" Forget")
nmcli connection delete id "$chosen_id" && notify-send "Forgotten" "The network $chosen_id has been forgotten."
;;
esac
fi
rm /tmp/wifi_list.txt
}
# Функция для управления Ethernet
manage_ethernet() {
# Получаем список Ethernet устройств
local eth_devices=$(nmcli device status | grep ethernet | awk '{print $1}')
if [ -z "$eth_devices" ]; then
notify-send "Error" "Ethernet device not found."
return
fi
# Подготавливаем список для выбора
local eth_list=""
for dev in $eth_devices; do
local dev_status=$(nmcli device status | grep "$dev" | awk '{print $3}')
if [ "$dev_status" = "connected" ]; then
eth_list+="$ETHERNET_CONNECTED_ICON$dev\n"
else
eth_list+="$dev\n"
fi
done
# Позволяем пользователю выбрать устройство
local chosen_device=$(echo -e "$eth_list" | rofi -dmenu -i -p "Select Ethernet device: ")
if [ -z "$chosen_device" ]; then
return
fi
# Получаем статус выбранного устройства
chosen_device=$(echo $chosen_device | sed "s/$ETHERNET_CONNECTED_ICON//")
local device_status=$(nmcli device status | grep "$chosen_device" | awk '{print $3}')
# Выполняем действие в зависимости от статуса
if [ "$device_status" = "connected" ]; then
nmcli device disconnect "$chosen_device" && notify-send "Disconnected" "You have been disconnected from $chosen_device."
elif [ "$device_status" = "disconnected" ]; then
nmcli device connect "$chosen_device" && notify-send "Connected" "You are now connected to $chosen_device."
else
notify-send "Error" "Unable to determine the action for $chosen_device."
fi
}
# Главное меню
main_menu() {
##==> Получаем необходимые аргументы
###############################################
while [[ $# -gt 0 ]]; do
case $1 in
--status)
status_mode=true
shift
;;
--enabled-color)
ENABLED_COLOR="$2"
shift 2
;;
--disabled-color)
DISABLED_COLOR="$2"
shift 2
;;
*)
shift
;;
esac
done
if [[ $status_mode == true ]]; then
get_status
exit 1
fi
##==> Если служба не запущена
###############################################
if ! pgrep -x "NetworkManager" > /dev/null; then
echo -n "Root Password: "
read -s password
echo "$password" | sudo -S systemctl start NetworkManager
fi
##==> Получаем кнопки действий и функцианал для них
#######################################################
local wifi_status=$(nmcli -fields WIFI g)
local wifi_toggle
if [[ "$wifi_status" =~ "enabled" ]]; then
wifi_toggle="󱛅 Disable Wi-Fi"
wifi_toggle_command="off"
manage_wifi_btn="\n󱓥 Manage Wi-Fi"
else
wifi_toggle="󱚽 Enable Wi-Fi"
wifi_toggle_command="on"
manage_wifi_btn=""
fi
##==> Выводим Rofi меню
#######################################################
local chosen_option=$(echo -e "$wifi_toggle$manage_wifi_btn\n󱓥 Manage Ethernet" | rofi -dmenu -p " Network Management: ")
case $chosen_option in
"$wifi_toggle")
nmcli radio wifi $wifi_toggle_command
;;
"󱓥 Manage Wi-Fi")
manage_wifi
;;
"󱓥 Manage Ethernet")
manage_ethernet
;;
esac
}
main_menu "$@"

View file

@ -0,0 +1,11 @@
#!/bin/env bash
choice=$(printf " Lock\n󰍃 Logout\n󰒲 Suspend\n Reboot\n Shutdown" | rofi -dmenu)
case "$choice" in
" Lock") sh $HOME/bin/screen-lock.sh ;;
"󰍃 Logout") pkill -KILL -u "$USER" ;;
"󰒲 Suspend") sh $HOME/bin/screen-lock.sh --suspend ;;
" Reboot") systemctl reboot ;;
" Shutdown") systemctl poweroff ;;
esac

View file

@ -0,0 +1 @@
rofimoji --selector-args="-theme ~/.config/rofi/emoji.rasi -kb-row-left Left -kb-row-right Right -kb-move-char-back Control+b -kb-move-char-forward Control+f" --hidden-descriptions --action copy --max-recent 0

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# digitalCanine [DC] VPN Launcher (polybar-safe)
UI="$HOME/Documents/openvpn/vpn-ui.sh"
# detach completely from polybar
nohup "$UI" >/dev/null 2>&1 &
exit 0