organize
This commit is contained in:
parent
1899031269
commit
1a78e53fb7
31 changed files with 86 additions and 65 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -129,3 +129,5 @@ signond/
|
|||
torbrowser/
|
||||
Mumble/
|
||||
vlc/
|
||||
lxqt/
|
||||
rofi/
|
||||
|
|
3
bashrc
3
bashrc
|
@ -9,6 +9,8 @@ PROMPT_COMMAND="echo" # Line jump after every command
|
|||
|
||||
# General configs
|
||||
PATH="$HOME/.config/scripts${PATH:+:${PATH}}" # Enables custom scripts dir
|
||||
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
|
||||
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
|
||||
bind "set completion-ignore-case on" # Case insensitive TAB complete
|
||||
shopt -s cdspell # Autocorrect directory name
|
||||
shopt -s autocd # cd into dir by typing the name
|
||||
|
@ -22,6 +24,7 @@ export \
|
|||
XDG_CONFIG_HOME="$HOME/.config" \
|
||||
PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" \
|
||||
GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" \
|
||||
MINETEST_USER_PATH="$XDG_DATA_HOME/minetest" \
|
||||
VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc" \
|
||||
XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" \
|
||||
XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" \
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
width = (200, 300)
|
||||
height = 200
|
||||
origin = top-right
|
||||
offset = 36x48
|
||||
offset = 16x32
|
||||
scale = 0
|
||||
|
||||
notification_limit = 0
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
$(ls ~/.config/scripts/ | dmenu -i -p "Script:")
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Depends on script that grabs network name
|
||||
|
||||
# Executes and notifies command success
|
||||
iwctl station wlan0 disconnect "$iwdstat" && notify-send "直 Wireless Network" "Disconnected" || "直 Wireless Network" "Operation unsuccessful"
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
# 'iwd' connect helper using dmenu
|
||||
|
||||
# Possibly very convoluted way of fetching SSIDs
|
||||
network=$(iwctl station wlan0 get-networks | cut -d " " -f 7-21 | tail +5 | awk '{if(NF>0) {print $0}}' | awk -F " " '{print $1}' | dmenu -p "Connect:")
|
||||
[ -z "$network" ] && exit # Exit if empty SSID
|
||||
|
||||
# Attempt connection
|
||||
iwctl station wlan0 connect --dont-ask "$network"
|
||||
sleep 2 # Bit of grace time
|
||||
# Exit with notification if $network is shown on status
|
||||
iwctl station wlan0 show | grep "network" | awk '{print $3}' | grep -q "$network" && notify-send " Wireless Network" "Connected to $network" && exit
|
||||
|
||||
# Try connecting with passphrase
|
||||
pass=$(dmenu -p "Passphrase:" -P < /dev/null)
|
||||
# Test for empty password, exit if true
|
||||
[ -z "$pass" ] && notify-send " Wireless Network" "Invalid password: Empty" && exit
|
||||
# Attempt conection with provided pass, notify and exit on success
|
||||
iwctl --passphrase="$pass" station wlan0 connect --dont-ask "$network"
|
||||
sleep 2 # Bit of grace time
|
||||
# Exit with notification if $network is shown on status
|
||||
iwctl station wlan0 show | grep "network" | awk '{print $3}' | grep -q "$network" && notify-send " Wireless Network" "Connected to $network" && exit
|
||||
|
||||
# Notify unsuccessful operation
|
||||
notify-send " Wireless Network" "Operation unsuccessful"
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Shortcut for scanning networks
|
||||
|
||||
# Attempt to scan networks, notify operation success
|
||||
iwctl station wlan0 scan && notify-send " Wireless Network" "Scanning..." || notify-send " Wireless Network" "Operation unsuccessful"
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Depends on 'iwd'
|
||||
# Get current network SSID
|
||||
|
||||
# Get SSID name and format properly
|
||||
ssid=$(iwctl station wlan0 show | grep network | cut -d " " -f 19-23 | awk -F " " '{print $1}')
|
||||
|
||||
# If $ssid variable is empty, display "Disconnected"
|
||||
# Display network SSID otherwise
|
||||
[ -z "$ssid" ] && echo "Disconnected" || echo "$ssid"
|
63
scripts/menu/menu
Executable file
63
scripts/menu/menu
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
# Script for using either bemenu or dmenu
|
||||
# with preconfigured options
|
||||
|
||||
# Simple configuration
|
||||
MENU="bemenu"
|
||||
col_main="#83a598"
|
||||
col_second="#121212"
|
||||
|
||||
# If given 'pass' as arg,
|
||||
# format accordingly
|
||||
PROMPT="$1"
|
||||
MODE="$2"
|
||||
|
||||
[ "$MODE" = "pass" ] &&
|
||||
BPASS="-x" &&
|
||||
DPASS="-P"
|
||||
|
||||
# bemenu opts
|
||||
BEMENU_OPTS=" \
|
||||
-c \
|
||||
-i \
|
||||
-l 10 \
|
||||
-M 5 \
|
||||
-W 0.3 \
|
||||
-B 2 \
|
||||
--cw 2 \
|
||||
--tb $col_main \
|
||||
--tf $col_second \
|
||||
--nb $col_second \
|
||||
--nf $col_main \
|
||||
--hb $col_main \
|
||||
--hf $col_second \
|
||||
--ab $col_second \
|
||||
--af $col_main \
|
||||
--bdr $col_main \
|
||||
-p $PROMPT \
|
||||
$BPASS \
|
||||
"
|
||||
# If chosen bemenu, use this args
|
||||
[ "$MENU" = "bemenu" ] &&
|
||||
OPTS="$BEMENU_OPTS" &&
|
||||
RUN="-run"
|
||||
|
||||
# dmenu opts
|
||||
DMENU_OPTS=" \
|
||||
-i \
|
||||
-l 10 \
|
||||
-nb $col_second \
|
||||
-nf $col_main \
|
||||
-sb $col_main \
|
||||
-sf $col_second \
|
||||
-p $PROMPT \
|
||||
$DPASS \
|
||||
"
|
||||
# If chosen dmenu, use this args
|
||||
[ "$MENU" = "dmenu" ] &&
|
||||
RUN="_run"
|
||||
|
||||
[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "run" ] && $MENU$RUN $OPTS
|
||||
[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS
|
||||
[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS
|
||||
[ -e "/usr/bin/dmenu" ] && [ -z "$MODE" ] && $MENU $OPTS
|
|
@ -7,7 +7,8 @@ bookmark="$(xsel -ob)"
|
|||
if grep -q "$bookmark" "$HOME/Documents/bookmarks" ; then
|
||||
notify-send " Bookmarks" "Already bookmarked"
|
||||
else
|
||||
name="$(dmenu -p 'Bookmark name:' < /dev/null)"
|
||||
name="$(menu 'Bookmark name:' empty)"
|
||||
[ -z "$name" ] && exit
|
||||
entry="$name-$bookmark"
|
||||
echo "$entry" >> "$HOME/Documents/bookmarks"
|
||||
notify-send " Bookmarks" "Added '$entry'"
|
|
@ -2,7 +2,7 @@
|
|||
# Open URLs from bookmarks file
|
||||
|
||||
# Print site names, then get URL based on the name. Exit if empty
|
||||
name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | dmenu -i -p "Site:")
|
||||
name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | menu "Site:")
|
||||
[ -z "$name" ] && exit
|
||||
|
||||
grep "$name" $HOME/Documents/bookmarks | cut -d '-' -f 2- | xsel -ib && notify-send " Bookmarks" "'$name' copied to clipboard"
|
|
@ -3,8 +3,8 @@
|
|||
# Custom version of Luke Smith's
|
||||
# famous "get a menu of emojis to copy" script.
|
||||
|
||||
# Get user selection via dmenu from emoji file.
|
||||
chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -p "Emoji: " | sed "s/ .*//")
|
||||
# Get user selection via menu from emoji file.
|
||||
chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | menu "Emoji:" | sed "s/ .*//")
|
||||
|
||||
# Exit if none chosen.
|
||||
[ -z "$chosen" ] && exit
|
|
@ -2,7 +2,7 @@
|
|||
# Set default input device
|
||||
|
||||
# Get proper name from sources
|
||||
input=$(pactl list short sources | cut -f 2 | grep input | dmenu -i -p "Input:")
|
||||
input=$(pactl list short sources | cut -f 2 | grep input | menu "Input:")
|
||||
|
||||
# Set audio device, notify command success
|
||||
pactl set-default-source "$input" && notify-send " Default Input" "Set to '$input'" || notify-send " Default Input" "Didn't change"
|
|
@ -4,7 +4,7 @@
|
|||
# disk identification method
|
||||
|
||||
# Get LABEL of disk and device name
|
||||
disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | dmenu -p "Mount: ")
|
||||
disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | menu "Mount:")
|
||||
device=$(blkid | grep "$disk" | cut -d ':' -f 1 | cut -d '/' -f 3)
|
||||
|
||||
# Attempt to mount $device and notify success of command
|
|
@ -2,7 +2,7 @@
|
|||
# OTP script for 'pass'
|
||||
|
||||
# Ask for password name in vault
|
||||
password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' | sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "OTP:")
|
||||
password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' | sed 's/.*\/\(.*\)\.gpg$/\1/' | menu "OTP:")
|
||||
|
||||
# Exit if none chosen
|
||||
[ -z "$password" ] && exit
|
|
@ -2,7 +2,7 @@
|
|||
# Set default output device
|
||||
|
||||
# Get proper name from sinks
|
||||
output=$(pactl list short sinks | cut -f 2 | dmenu -i -p "Output:")
|
||||
output=$(pactl list short sinks | cut -f 2 | menu "Output:")
|
||||
|
||||
# Set audio device, notify command success
|
||||
pactl set-default-sink "$output" && notify-send " Default Output" "Set to '$output'" || notify-send " Default Output" "Didn't change"
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Ask for password name in vault
|
||||
password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' |
|
||||
sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "Password:")
|
||||
sed 's/.*\/\(.*\)\.gpg$/\1/' | menu "Password:")
|
||||
|
||||
# Exit if none chosen
|
||||
[ -z "$password" ] && exit
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# Prompt for power options using dmenu
|
||||
|
||||
option=$(printf "Shutdown\nRestart" | dmenu -i -p "Power:")
|
||||
option=$(printf "Shutdown\nRestart" | menu "Power:")
|
||||
|
||||
case "$option" in
|
||||
"Shutdown") sudo poweroff ;;
|
3
scripts/menu/menu-scripts
Executable file
3
scripts/menu/menu-scripts
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
$(ls ~/.config/scripts/ | menu "Script:")
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
# Snippets directory
|
||||
snippets=~/.config/snippets
|
||||
# Select using dmenu, copy if successful
|
||||
snippet=$(ls "$snippets" | dmenu -p "Snippet:")
|
||||
# Select using menu, copy if successful
|
||||
snippet=$(ls "$snippets" | menu "Snippet:")
|
||||
|
||||
# Exit if empty
|
||||
[ -z "$snippet" ] && exit
|
|
@ -4,7 +4,7 @@
|
|||
# disk identification method
|
||||
|
||||
# Get LABEL of disk and device name
|
||||
disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | dmenu -p "Unmount: ")
|
||||
disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | menu "Unmount:")
|
||||
device=$(blkid | grep "$disk" | cut -d ':' -f 1 | cut -d '/' -f 3)
|
||||
|
||||
# Attempt to unmount $device and notify success of command
|
|
@ -26,7 +26,6 @@ case 1 in
|
|||
$((vol >= 20)) ) bar="━━────────" ;;
|
||||
$((vol >= 10)) ) bar="━─────────" ;;
|
||||
$((vol >= 0)) ) bar="──────────" ;;
|
||||
$((vol = 0)) ) bar="──────────" ;;
|
||||
esac
|
||||
|
||||
# Print and notify
|
|
@ -20,7 +20,6 @@ int() { # Type of interface & status
|
|||
$((strength >= 20)) ) bar="━━────────" ;;
|
||||
$((strength >= 10)) ) bar="━─────────" ;;
|
||||
$((strength >= 0)) ) bar="──────────" ;;
|
||||
$((strength = 0)) ) bar="──────────" ;;
|
||||
esac
|
||||
echo " $bar"
|
||||
return 0
|
|
@ -26,7 +26,6 @@ case 1 in
|
|||
$((vol >= 20)) ) bar="━━────────" ;;
|
||||
$((vol >= 10)) ) bar="━─────────" ;;
|
||||
$((vol >= 0)) ) bar="──────────" ;;
|
||||
$((vol = 0)) ) bar="──────────" ;;
|
||||
esac
|
||||
|
||||
# Print and notify
|
Loading…
Reference in a new issue