Port a few more options to zenity and separate dwm from the install script
412
config-files/.local/bin/dm-bluetooth
Executable file
@@ -0,0 +1,412 @@
|
||||
#!/usr/bin/env bash
|
||||
# _ _ _ _ _ _
|
||||
# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__
|
||||
# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \
|
||||
# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | |
|
||||
# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_|
|
||||
#
|
||||
# Author: Nick Clyde (clydedroid)
|
||||
# dmenu support by: Layerex
|
||||
# Original script: https://github.com/nickclyde/rofi-bluetooth
|
||||
#
|
||||
# A script that generates a dmenu menu that uses bluetoothctl to
|
||||
# connect to bluetooth devices and display status info.
|
||||
#
|
||||
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
|
||||
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
|
||||
#
|
||||
# Depends on:
|
||||
# Arch repositories: dmenu, bluez-utils (contains bluetoothctl)
|
||||
|
||||
# Constants
|
||||
divider="---------"
|
||||
goback="Back"
|
||||
exit="Exit"
|
||||
connected_icon=""
|
||||
|
||||
# Checks if bluetooth controller is powered on
|
||||
power_on() {
|
||||
if bluetoothctl show | grep -F -q "Powered: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles power state
|
||||
toggle_power() {
|
||||
if power_on; then
|
||||
bluetoothctl power off
|
||||
show_menu
|
||||
else
|
||||
if rfkill list bluetooth | grep -F -q 'blocked: yes'; then
|
||||
rfkill unblock bluetooth && sleep 3
|
||||
fi
|
||||
bluetoothctl power on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is scanning for new devices
|
||||
scan_on() {
|
||||
if bluetoothctl show | grep -F -q "Discovering: yes"; then
|
||||
echo "Scan: on"
|
||||
return 0
|
||||
else
|
||||
echo "Scan: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles scanning state
|
||||
toggle_scan() {
|
||||
if scan_on; then
|
||||
kill "$(pgrep -f "bluetoothctl scan on")"
|
||||
bluetoothctl scan off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl scan on &
|
||||
echo "Scanning..."
|
||||
sleep 5
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is able to pair to devices
|
||||
pairable_on() {
|
||||
if bluetoothctl show | grep -F -q "Pairable: yes"; then
|
||||
echo "Pairable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Pairable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles pairable state
|
||||
toggle_pairable() {
|
||||
if pairable_on; then
|
||||
bluetoothctl pairable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl pairable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is discoverable by other devices
|
||||
discoverable_on() {
|
||||
if bluetoothctl show | grep -F -q "Discoverable: yes"; then
|
||||
echo "Discoverable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Discoverable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles discoverable state
|
||||
toggle_discoverable() {
|
||||
if discoverable_on; then
|
||||
bluetoothctl discoverable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl discoverable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is connected
|
||||
device_connected() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Connected: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_connection() {
|
||||
if device_connected "$1"; then
|
||||
bluetoothctl disconnect "$1"
|
||||
# device_menu "$device"
|
||||
else
|
||||
bluetoothctl connect "$1"
|
||||
# device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is paired
|
||||
device_paired() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Paired: yes"; then
|
||||
echo "Paired: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Paired: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device paired state
|
||||
toggle_paired() {
|
||||
if device_paired "$1"; then
|
||||
bluetoothctl remove "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl pair "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is trusted
|
||||
device_trusted() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Trusted: yes"; then
|
||||
echo "Trusted: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Trusted: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_trust() {
|
||||
if device_trusted "$1"; then
|
||||
bluetoothctl untrust "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl trust "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prints a short string with the current bluetooth status
|
||||
# Useful for status bars like polybar, etc.
|
||||
print_status() {
|
||||
if power_on; then
|
||||
printf ''
|
||||
|
||||
mapfile -t paired_devices < <(bluetoothctl paired-devices | grep -F Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in "${paired_devices[@]}"; do
|
||||
if device_connected "$device"; then
|
||||
device_alias="$(bluetoothctl info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)"
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
((counter++))
|
||||
fi
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# A submenu for a specific device that allows connecting, pairing, and trusting
|
||||
device_menu() {
|
||||
device="$1"
|
||||
|
||||
# Get device name and mac address
|
||||
device_name="$(echo "$device" | cut -d ' ' -f 3-)"
|
||||
mac="$(echo "$device" | cut -d ' ' -f 2)"
|
||||
|
||||
# Build options
|
||||
if device_connected "$mac"; then
|
||||
connected="Connected: yes"
|
||||
else
|
||||
connected="Connected: no"
|
||||
fi
|
||||
paired="$(device_paired "$mac")"
|
||||
trusted="$(device_trusted "$mac")"
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\n$exit"
|
||||
|
||||
# Open dmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_dmenu "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$connected")
|
||||
toggle_connection "$mac"
|
||||
;;
|
||||
"$paired")
|
||||
toggle_paired "$mac"
|
||||
;;
|
||||
"$trusted")
|
||||
toggle_trust "$mac"
|
||||
;;
|
||||
"$goback")
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Opens a dmenu menu with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
power="Power: on"
|
||||
|
||||
# Human-readable names of devices, one per line
|
||||
# If scan is off, will only list paired devices
|
||||
if [[ -n "$connected_icon" ]]; then
|
||||
devices="$(bluetoothctl devices | grep -F Device | while read -r device; do
|
||||
device_name="$(echo "$device" | cut -d ' ' -f 3-)"
|
||||
mac="$(echo "$device" | cut -d ' ' -f 2)"
|
||||
icon=""
|
||||
|
||||
if device_connected "$mac" && [[ -n $connected_icon ]]; then
|
||||
icon=" $connected_icon"
|
||||
fi
|
||||
|
||||
echo "$device_name${icon}"
|
||||
done)"
|
||||
else
|
||||
devices="$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-)"
|
||||
fi
|
||||
|
||||
# Get controller flags
|
||||
scan="$(scan_on)"
|
||||
pairable="$(pairable_on)"
|
||||
discoverable="$(discoverable_on)"
|
||||
|
||||
# Options passed to dmenu
|
||||
[[ -n $devices ]] && devices_part="$devices\n$divider\n"
|
||||
options="$devices_part$power\n$scan\n$pairable\n$discoverable\n$exit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\n$exit"
|
||||
fi
|
||||
|
||||
# Open dmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_dmenu "Bluetooth")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$power")
|
||||
toggle_power
|
||||
;;
|
||||
"$scan")
|
||||
toggle_scan
|
||||
;;
|
||||
"$discoverable")
|
||||
toggle_discoverable
|
||||
;;
|
||||
"$pairable")
|
||||
toggle_pairable
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$connected_icon" ]]; then
|
||||
chosen="${chosen%% ${connected_icon}}"
|
||||
fi
|
||||
device="$(bluetoothctl devices | grep -F "$chosen")"
|
||||
# Open a submenu if a device is selected
|
||||
if [[ -n "$device" ]]; then device_menu "$device"; fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This
|
||||
# allows the user to set fonts, sizes, colours, etc.
|
||||
DMENU_BLUETOOTH_LAUNCHER="${DMENU_BLUETOOTH_LAUNCHER:-dmenu}"
|
||||
run_dmenu() {
|
||||
case "$DMENU_BLUETOOTH_LAUNCHER" in
|
||||
rofi)
|
||||
DMENU_BLUETOOTH_LAUNCHER="rofi -dmenu"
|
||||
;;
|
||||
fuzzel)
|
||||
DMENU_BLUETOOTH_LAUNCHER="fuzzel --dmenu"
|
||||
;;
|
||||
esac
|
||||
$DMENU_BLUETOOTH_LAUNCHER -i -p "$DMENU_BLUETOOTH_PROMPT" "-l" "20" "${dmenu_args[@]}"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
echo "usage: $0 [--help] [--status] [--connected-icon [ICON]] [PROMPT] DMENU_ARGS..."
|
||||
echo ""
|
||||
echo "A script that generates a dmenu menu that uses bluetoothctl to connect to bluetooth devices and display status info."
|
||||
echo ""
|
||||
echo "positional arguments:"
|
||||
echo " PROMPT dmenu prompt"
|
||||
echo " DMENU_ARGS... arguments passed to dmenu"
|
||||
echo ""
|
||||
echo "options:"
|
||||
echo "--help show this help message and exit"
|
||||
echo "--status print a short string about current bluetooth status and exit"
|
||||
echo "--connected-icon [ICON] add icon on device list next to connected devices"
|
||||
echo ""
|
||||
echo "environment variables:"
|
||||
echo " DMENU_BLUETOOTH_PROMPT dmenu prompt"
|
||||
echo " DMENU_BLUETOOTH_LAUNCHER command to use instead of 'dmenu'"
|
||||
echo ""
|
||||
echo "Positional arguments have to be placed after all other arguments."
|
||||
echo "A PROMPT positional argument will be interpreted as part of DMENU_ARGS if it starts with '-'. It won't be parsed if the DMENU_BLUETOOTH_PROMPT environment variable is set."
|
||||
echo "Use the DMENU_BLUETOOTH_LAUNCHER environment variable to use launchers other than dmenu. Rofi, fuzzel, and any dmenu-compatible launchers are supported."
|
||||
}
|
||||
|
||||
command_present() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "$1. $2." >&2
|
||||
command_present notify-send && notify-send "$1" "$2."
|
||||
}
|
||||
|
||||
# Check if bluetooth daemon is running. Start it if possible.
|
||||
if command_present systemctl; then
|
||||
systemctl is-active --quiet bluetooth
|
||||
case $? in
|
||||
3)
|
||||
error "Bluetooth daemon is not running" "Start it to use this script"
|
||||
systemctl start bluetooth || exit 3
|
||||
;;
|
||||
4)
|
||||
error "Bluetooth daemon is not present" "On Arch Linux install bluez and bluez-utils packages"
|
||||
exit 4
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dmenu_args=("$@")
|
||||
case "$1" in
|
||||
--help)
|
||||
print_help
|
||||
exit
|
||||
;;
|
||||
--status)
|
||||
print_status
|
||||
exit
|
||||
;;
|
||||
--connected-icon)
|
||||
if [[ "$2" == "--" ]]; then
|
||||
connected_icon=""
|
||||
else
|
||||
connected_icon="$2"
|
||||
fi
|
||||
dmenu_args=("${dmenu_args[@]:2}")
|
||||
;;
|
||||
esac
|
||||
case "${dmenu_args[0]}" in
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$DMENU_BLUETOOTH_PROMPT" ]]; then
|
||||
DMENU_BLUETOOTH_PROMPT="${dmenu_args[0]}"
|
||||
dmenu_args=("${dmenu_args[@]:1}")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
show_menu
|
||||
23
config-files/.local/bin/dm-kill
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# dmenu theming
|
||||
lines="-l 20"
|
||||
|
||||
selected="$(ps -a -u $USER | \
|
||||
dmenu -i -p "Type to search and select process to kill" \
|
||||
$lines | \
|
||||
awk '{print $1" "$4}')";
|
||||
|
||||
if [[ ! -z $selected ]]; then
|
||||
|
||||
answer="$(echo -e "Yes\nNo" | \
|
||||
dmenu -i -p "$selected will be killed, are you sure?" \
|
||||
$lines )"
|
||||
|
||||
if [[ $answer == "Yes" ]]; then
|
||||
selpid="$(awk '{print $1}' <<< $selected)";
|
||||
kill -9 $selpid
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
18
config-files/.local/bin/dm-mansearch
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
prompt="-p Manual:"
|
||||
|
||||
# terminal to open manual
|
||||
terminal="st"
|
||||
|
||||
# list all manuals
|
||||
manual="$(man -k . | dmenu $prompt | awk '{print $1}')"
|
||||
|
||||
# open selected manual with terminal
|
||||
if [[ ! -z "$manual" ]]; then
|
||||
eval "$($terminal -e man $manual)"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
76
config-files/.local/bin/dm-mpd
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
all_name='[ALL]'
|
||||
mode=library
|
||||
|
||||
d_artist() {
|
||||
mpc list artist | sort -f | dmenu -p artist "${dmenu_args[@]}"
|
||||
}
|
||||
|
||||
d_album() {
|
||||
local artist="$1"
|
||||
local albums
|
||||
|
||||
mapfile -t albums < <(mpc list album artist "$artist")
|
||||
if (( ${#albums[@]} > 1 )) ; then
|
||||
{
|
||||
printf '%s\n' "$all_name"
|
||||
printf '%s\n' "${albums[@]}" | sort -f
|
||||
} | dmenu -p album "${dmenu_args[@]}"
|
||||
else
|
||||
# We only have one album, so just use that.
|
||||
printf '%s\n' "${albums[0]}"
|
||||
fi
|
||||
}
|
||||
|
||||
d_playlist() {
|
||||
local format="%position% %title%"
|
||||
local extra_format="(%artist% - %album%)"
|
||||
local track
|
||||
local num_extras
|
||||
|
||||
# If all tracks are from the same artist and album, no need to display that
|
||||
num_extras=$(mpc playlist -f "$extra_format" | sort | uniq | wc -l)
|
||||
(( num_extras == 1 )) || format+=" $extra_format"
|
||||
|
||||
track=$(mpc playlist -f "$format" | dmenu -p track "${dmenu_args[@]}")
|
||||
printf '%s' "${track%% *}"
|
||||
}
|
||||
|
||||
i=2
|
||||
|
||||
for arg do
|
||||
if [[ $arg == :: ]]; then
|
||||
dmenu_args=( "${@:$i}" )
|
||||
break
|
||||
fi
|
||||
|
||||
case "$arg" in
|
||||
-l) mode=library ;;
|
||||
-p) mode=playlist ;;
|
||||
esac
|
||||
|
||||
let i++
|
||||
done
|
||||
|
||||
case "$mode" in
|
||||
library)
|
||||
artist=$(d_artist)
|
||||
[[ $artist ]] || exit 1
|
||||
|
||||
album=$(d_album "$artist")
|
||||
[[ $album ]] || exit 2
|
||||
|
||||
mpc clear
|
||||
if [[ $album == "$all_name" ]]; then
|
||||
mpc find artist "$artist" | sort | mpc add
|
||||
else
|
||||
mpc find artist "$artist" album "$album" | sort | mpc add
|
||||
fi
|
||||
|
||||
mpc play >/dev/null
|
||||
;;
|
||||
playlist)
|
||||
mpc play "$(d_playlist)" >/dev/null
|
||||
;;
|
||||
esac
|
||||
60
config-files/.local/bin/dm-pass
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
shopt -s nullglob globstar
|
||||
|
||||
typeit=0
|
||||
if [[ $1 == "--type" ]]; then
|
||||
typeit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
|
||||
BASEDIR=$STARTDIR
|
||||
DONE=0
|
||||
LEVEL=0
|
||||
PREVSELECTION=""
|
||||
SELECTION=""
|
||||
|
||||
while [ "$DONE" -eq 0 ] ; do
|
||||
password_files=( "$STARTDIR"/* )
|
||||
password_files=( "${password_files[@]#"$STARTDIR"/}" )
|
||||
password_files=( "${password_files[@]%.gpg}" )
|
||||
|
||||
if [ "$LEVEL" -ne 0 ] ; then
|
||||
password_files=(".." "${password_files[@]}")
|
||||
fi
|
||||
entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15)
|
||||
|
||||
echo "entry: $entry"
|
||||
if [ -z "$entry" ] ; then
|
||||
DONE=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$entry" != ".." ] ; then
|
||||
PREVSELECTION=$SELECTION
|
||||
SELECTION="$SELECTION/$entry"
|
||||
|
||||
# check if another dir
|
||||
if [ -d "$STARTDIR/$entry" ] ; then
|
||||
STARTDIR="$STARTDIR/$entry"
|
||||
LEVEL=$((LEVEL+1))
|
||||
else
|
||||
# not a directory so it must be a real password entry
|
||||
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass show -c "$SELECTION" 2>/dev/null
|
||||
else
|
||||
xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" | head -n 1)"
|
||||
fi
|
||||
DONE=1
|
||||
fi
|
||||
|
||||
else
|
||||
LEVEL=$((LEVEL-1))
|
||||
SELECTION=$PREVSELECTION
|
||||
STARTDIR="$BASEDIR/$SELECTION"
|
||||
fi
|
||||
done
|
||||
|
||||
28
config-files/.local/bin/dm-todo
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Write/remove a task to do later.
|
||||
#
|
||||
# Select an existing entry to remove it from the file, or type a new entry to
|
||||
# add it.
|
||||
#
|
||||
|
||||
file="$HOME/.todo"
|
||||
touch "$file"
|
||||
height=$(wc -l "$file" | awk '{print $1}')
|
||||
prompt="Add/delete a task: "
|
||||
|
||||
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
|
||||
while [ -n "$cmd" ]; do
|
||||
if grep -q "^$cmd\$" "$file"; then
|
||||
grep -v "^$cmd\$" "$file" > "$file.$$"
|
||||
mv "$file.$$" "$file"
|
||||
height=$(( height - 1 ))
|
||||
else
|
||||
echo "$cmd" >> "$file"
|
||||
height=$(( height + 1 ))
|
||||
fi
|
||||
|
||||
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
|
||||
done
|
||||
|
||||
exit 0
|
||||
4
config-files/.local/bin/dm-usb-mount
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl mount -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p mount)
|
||||
|
||||
3
config-files/.local/bin/dm-usb-poweroff
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl power-off -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p poweroff)
|
||||
3
config-files/.local/bin/dm-usb-unmount
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl unmount -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p unmount)
|
||||
28
config-files/.local/bin/dm-web
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
engine="https://www.google.com/search?q="
|
||||
|
||||
declare -A bookmarks=(
|
||||
["YouTube"]="https://www.youtube.com/"
|
||||
["GitHub"]="https://github.com/TrudeEH/dotfiles"
|
||||
["TrudeWeb"]="https://trudeeh.github.io/web/"
|
||||
["Gemini"]="https://gemini.google.com/app"
|
||||
["Element"]="https://app.element.io/#/home"
|
||||
["Gmail"]="https://mail.google.com/mail/u/0/#inbox"
|
||||
["Google Messages"]="https://messages.google.com/web/conversations"
|
||||
["WOL"]="https://wol.jw.org/pt-PT/"
|
||||
["Discord"]="https://discord.com/app"
|
||||
)
|
||||
|
||||
choice=$(printf "%s\n" "${!bookmarks[@]}" | dmenu -i -p "Search:")
|
||||
|
||||
if [[ -n "$choice" ]]; then
|
||||
# Find the matching URL
|
||||
url=${bookmarks[$choice]}
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
xdg-open $url
|
||||
else
|
||||
xdg-open $engine$choice
|
||||
fi
|
||||
fi
|
||||
1038
config-files/.local/bin/dm-wifi
Executable file
4
config-files/.local/bin/multimc
Executable file
@@ -0,0 +1,4 @@
|
||||
#! /bin/bash
|
||||
|
||||
/opt/multimc/run.sh
|
||||
|
||||
25
config-files/.local/bin/sb-battery
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints all batteries, their percentage remaining and an emoji corresponding
|
||||
# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).
|
||||
|
||||
# Loop through all attached batteries and format the info
|
||||
# for battery in /sys/class/power_supply/BAT?*; do # For standard devices, use this line instead.
|
||||
for battery in /sys/class/power_supply/?*; do
|
||||
# If non-first battery, print a space separator.
|
||||
[ -n "${capacity+x}" ] && [ -f "$battery/status" ] && printf " "
|
||||
# Sets up the status and capacity
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full") status=" " ;;
|
||||
"Discharging") status=" " ;;
|
||||
"Charging") status=" " ;;
|
||||
"Not charging") status=" " ;;
|
||||
"Unknown") status=" " ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
# Will make a warn variable if discharging and low
|
||||
[ "$status" = " " ] && [ "$capacity" -le 25 ] && warn=" "
|
||||
# Prints the info
|
||||
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
|
||||
done && printf "\\n"
|
||||
26
config-files/.local/bin/sb-cpu
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Module showing overall CPU usage as a percentage.
|
||||
# Cache in tmpfs to improve speed and reduce SSD load
|
||||
cache=/tmp/cpubarscache
|
||||
|
||||
# Extract CPU stats (total time and idle time)
|
||||
cpu_stats=$(awk '/^cpu / {print $2 + $3 + $4 + $5, $5}' /proc/stat)
|
||||
|
||||
# Check if cache exists, if not, initialize it
|
||||
[ ! -f $cache ] && echo "$cpu_stats" > "$cache"
|
||||
|
||||
# Read previous CPU stats from cache
|
||||
prev_stats=$(cat "$cache")
|
||||
|
||||
# Calculate CPU usage percentage and exit immediately
|
||||
echo "$cpu_stats $prev_stats" | awk '{
|
||||
total_diff = $1 - $3
|
||||
idle_diff = $2 - $4
|
||||
usage = 100 * (1 - idle_diff / total_diff)
|
||||
printf " %.1f%%\n", usage
|
||||
exit # Terminate script after printing the first line
|
||||
}'
|
||||
|
||||
# Update cache with current stats
|
||||
echo "$cpu_stats" > "$cache"
|
||||
3
config-files/.local/bin/sb-memory
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGB/%2.2fGB\n", ( $3 / 1024), ($2 / 1024))}'
|
||||
17
config-files/.local/bin/sb-network
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Show wifi 📶 and percent strength or 📡 if none.
|
||||
# Show 🌐 if connected to ethernet or ❎ if none.
|
||||
# Show 🔒 if a vpn connection is active
|
||||
|
||||
# Wifi
|
||||
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
|
||||
wifiicon="$(awk '/^[[:space:]]*w/ { gsub(/[[:space:]]+/, " "); print " ", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
|
||||
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
|
||||
wifiicon=" "
|
||||
fi
|
||||
|
||||
# Ethernet
|
||||
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=" " || ethericon=" "
|
||||
|
||||
printf "%s%s\n" "$wifiicon" "$ethericon"
|
||||
28
config-files/.local/bin/sb-volume
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints the current volume or if muted.
|
||||
|
||||
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||
|
||||
# If muted, print and exit.
|
||||
[ "$vol" != "${vol%\[MUTED\]}" ] && echo " " && exit
|
||||
|
||||
vol="${vol#Volume: }"
|
||||
|
||||
split() {
|
||||
# For ommiting the . without calling and external program.
|
||||
IFS=$2
|
||||
set -- $1
|
||||
printf '%s' "$@"
|
||||
}
|
||||
|
||||
vol="$(printf "%.0f" "$(split "$vol" ".")")"
|
||||
|
||||
case 1 in
|
||||
$((vol >= 70)) ) icon=" " ;;
|
||||
$((vol >= 30)) ) icon=" " ;;
|
||||
$((vol >= 1)) ) icon=" " ;;
|
||||
* ) echo " " && exit ;;
|
||||
esac
|
||||
|
||||
echo "$icon$vol%"
|
||||
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path d="M388 342c-2.207 0-4 1.793-4 4s1.793 4 4 4c2.208 0 4-1.793 4-4s-1.792-4-4-4z" style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.389;marker:none" transform="translate(-381 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 268 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline;opacity:1"><path style="color:#000;display:inline;fill:#bebebe;fill-opacity:1;stroke-linecap:round;-inkscape-stroke:none" d="M414.145 341.9a1.25 1.25 0 0 0-1.766.092l-5.68 6.305-2.881-2.909a1.25 1.25 0 0 0-1.766 1.77l4.743 4.768 7.442-8.262a1.25 1.25 0 0 0-.092-1.764z" transform="translate(-401 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 402 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path style="color:#000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000;solid-opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="M407 367h8c1.108 0 2 .892 2 2s-.892 2-2 2h-8c-1.108 0-2-.892-2-2s.892-2 2-2z" transform="translate(-404 -362)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 922 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 957 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 836 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 688 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 786 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 933 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 786 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 941 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 714 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 791 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 844 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 834 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 776 B |
|
After Width: | Height: | Size: 1.7 KiB |
3249
config-files/.local/share/themes/adw-gtk3-dark/gtk-3.0/gtk-dark.css
Normal file
3249
config-files/.local/share/themes/adw-gtk3-dark/gtk-3.0/gtk.css
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
This file will fix some legacy widget styles that aren't styled in libadwaita
|
||||
*/
|
||||
|
||||
/* add a bg color to notebook headers */
|
||||
notebook > header {
|
||||
background-color: @headerbar_bg_color;
|
||||
border-color: mix(currentColor,@window_bg_color,0.85);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* GTK NAMED COLORS ---------------- use responsibly! */
|
||||
@define-color accent_bg_color @blue_3;
|
||||
@define-color accent_fg_color white;
|
||||
@define-color accent_color #78aeed;
|
||||
@define-color destructive_bg_color @red_4;
|
||||
@define-color destructive_fg_color white;
|
||||
@define-color destructive_color #ff7b63;
|
||||
@define-color success_bg_color @green_5;
|
||||
@define-color success_fg_color white;
|
||||
@define-color success_color @green_1;
|
||||
@define-color warning_bg_color #cd9309;
|
||||
@define-color warning_fg_color rgba(0, 0, 0, 0.8);
|
||||
@define-color warning_color @yellow_2;
|
||||
@define-color error_bg_color @red_4;
|
||||
@define-color error_fg_color white;
|
||||
@define-color error_color #ff7b63;
|
||||
@define-color window_bg_color #242424;
|
||||
@define-color window_fg_color white;
|
||||
@define-color view_bg_color #1e1e1e;
|
||||
@define-color view_fg_color white;
|
||||
@define-color headerbar_bg_color #303030;
|
||||
@define-color headerbar_fg_color white;
|
||||
@define-color headerbar_border_color white;
|
||||
@define-color headerbar_backdrop_color @window_bg_color;
|
||||
@define-color headerbar_shade_color rgba(0, 0, 0, 0.36);
|
||||
@define-color headerbar_darker_shade_color rgba(0, 0, 0, 0.9);
|
||||
@define-color sidebar_bg_color #303030;
|
||||
@define-color sidebar_fg_color white;
|
||||
@define-color sidebar_backdrop_color #2a2a2a;
|
||||
@define-color sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color sidebar_border_color rgba(0, 0, 0, 0.36);
|
||||
@define-color secondary_sidebar_bg_color #2a2a2a;
|
||||
@define-color secondary_sidebar_fg_color white;
|
||||
@define-color secondary_sidebar_backdrop_color #272727;
|
||||
@define-color secondary_sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color secondary_sidebar_border_color rgba(0, 0, 0, 0.36);
|
||||
@define-color card_bg_color rgba(255, 255, 255, 0.08);
|
||||
@define-color card_fg_color white;
|
||||
@define-color card_shade_color rgba(0, 0, 0, 0.36);
|
||||
@define-color dialog_bg_color #383838;
|
||||
@define-color dialog_fg_color white;
|
||||
@define-color popover_bg_color #383838;
|
||||
@define-color popover_fg_color white;
|
||||
@define-color popover_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color thumbnail_bg_color #383838;
|
||||
@define-color thumbnail_fg_color white;
|
||||
@define-color shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color scrollbar_outline_color rgba(0, 0, 0, 0.5);
|
||||
@import '../gtk-3.0/libadwaita.css';
|
||||
@import '../gtk-3.0/libadwaita-tweaks.css';
|
||||
@@ -0,0 +1,50 @@
|
||||
/* GTK NAMED COLORS ---------------- use responsibly! */
|
||||
@define-color accent_bg_color @blue_3;
|
||||
@define-color accent_fg_color white;
|
||||
@define-color accent_color #78aeed;
|
||||
@define-color destructive_bg_color @red_4;
|
||||
@define-color destructive_fg_color white;
|
||||
@define-color destructive_color #ff7b63;
|
||||
@define-color success_bg_color @green_5;
|
||||
@define-color success_fg_color white;
|
||||
@define-color success_color @green_1;
|
||||
@define-color warning_bg_color #cd9309;
|
||||
@define-color warning_fg_color rgba(0, 0, 0, 0.8);
|
||||
@define-color warning_color @yellow_2;
|
||||
@define-color error_bg_color @red_4;
|
||||
@define-color error_fg_color white;
|
||||
@define-color error_color #ff7b63;
|
||||
@define-color window_bg_color #242424;
|
||||
@define-color window_fg_color white;
|
||||
@define-color view_bg_color #1e1e1e;
|
||||
@define-color view_fg_color white;
|
||||
@define-color headerbar_bg_color #303030;
|
||||
@define-color headerbar_fg_color white;
|
||||
@define-color headerbar_border_color white;
|
||||
@define-color headerbar_backdrop_color @window_bg_color;
|
||||
@define-color headerbar_shade_color rgba(0, 0, 0, 0.36);
|
||||
@define-color headerbar_darker_shade_color rgba(0, 0, 0, 0.9);
|
||||
@define-color sidebar_bg_color #303030;
|
||||
@define-color sidebar_fg_color white;
|
||||
@define-color sidebar_backdrop_color #2a2a2a;
|
||||
@define-color sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color sidebar_border_color rgba(0, 0, 0, 0.36);
|
||||
@define-color secondary_sidebar_bg_color #2a2a2a;
|
||||
@define-color secondary_sidebar_fg_color white;
|
||||
@define-color secondary_sidebar_backdrop_color #272727;
|
||||
@define-color secondary_sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color secondary_sidebar_border_color rgba(0, 0, 0, 0.36);
|
||||
@define-color card_bg_color rgba(255, 255, 255, 0.08);
|
||||
@define-color card_fg_color white;
|
||||
@define-color card_shade_color rgba(0, 0, 0, 0.36);
|
||||
@define-color dialog_bg_color #383838;
|
||||
@define-color dialog_fg_color white;
|
||||
@define-color popover_bg_color #383838;
|
||||
@define-color popover_fg_color white;
|
||||
@define-color popover_shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color thumbnail_bg_color #383838;
|
||||
@define-color thumbnail_fg_color white;
|
||||
@define-color shade_color rgba(0, 0, 0, 0.25);
|
||||
@define-color scrollbar_outline_color rgba(0, 0, 0, 0.5);
|
||||
@import '../gtk-3.0/libadwaita.css';
|
||||
@import '../gtk-3.0/libadwaita-tweaks.css';
|
||||
@@ -0,0 +1,6 @@
|
||||
[X-GNOME-Metatheme]
|
||||
Name=adw-gtk3-dark
|
||||
Type=X-GNOME-Metatheme
|
||||
Comment=adw-gtk3-dark theme
|
||||
Encoding=UTF-8
|
||||
GtkTheme=adw-gtk3-dark
|
||||
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path d="M388 342c-2.207 0-4 1.793-4 4s1.793 4 4 4c2.208 0 4-1.793 4-4s-1.792-4-4-4z" style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.389;marker:none" transform="translate(-381 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 268 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline;opacity:1"><path style="color:#000;display:inline;fill:#bebebe;fill-opacity:1;stroke-linecap:round;-inkscape-stroke:none" d="M414.145 341.9a1.25 1.25 0 0 0-1.766.092l-5.68 6.305-2.881-2.909a1.25 1.25 0 0 0-1.766 1.77l4.743 4.768 7.442-8.262a1.25 1.25 0 0 0-.092-1.764z" transform="translate(-401 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 402 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path style="color:#000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000;solid-opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="M407 367h8c1.108 0 2 .892 2 2s-.892 2-2 2h-8c-1.108 0-2-.892-2-2s.892-2 2-2z" transform="translate(-404 -362)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 922 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 957 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 836 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 688 B |
|
After Width: | Height: | Size: 1.4 KiB |