Compare commits

...

9 Commits

Author SHA1 Message Date
Michael Chalupiak
da611595f6 polybar 2024-11-06 21:16:41 -05:00
Michael Chalupiak
e632050dfe Merge branch 'master' into arch-laptop 2024-11-06 21:14:43 -05:00
Michael Chalupiak
e93e688c40 polybar 2024-11-06 21:14:15 -05:00
Michael Chalupiak
967c00aebf polybar 2024-11-06 21:07:46 -05:00
Michael Chalupiak
ac7bf94094 discard 2024-11-06 21:05:58 -05:00
Michael Chalupiak
0117e4085f Merge branch 'master' into arch-laptop 2024-11-06 21:04:19 -05:00
Michael Chalupiak
57c76fc044 bspwm swallow 2024-11-06 21:04:03 -05:00
Michael Chalupiak
6f02789d3f scripts 2024-11-06 21:02:19 -05:00
Michael Chalupiak
e64b64d3f6 picom 2024-11-06 20:59:37 -05:00
15 changed files with 548 additions and 96 deletions

View File

@ -3,6 +3,7 @@
## Autostart Programs
sxhkd &
xsetroot -cursor_name left_ptr
pgrep bspswallow || bspswallow &
# polybar example &
#~/.scripts/panel.sh
if [ $(pgrep polybar) ]; then

View File

@ -0,0 +1 @@
xev

View File

@ -0,0 +1 @@
St

View File

@ -12,8 +12,11 @@ function colors(color, theme)
if color == 'gruvbox-dark-hard' then
color = 'gruvbox-material'
vim.g.gruvbox_material_background = 'hard'
elseif color == 'gruvbox-dark-soft' then
color = 'gruvbox-material'
vim.g.gruvbox_material_background = 'soft'
end
if theme then
if theme then
vim.cmd.colorscheme(alt_color)
elseif not pcall(vim.cmd.colorscheme, color) then
vim.cmd.colorscheme(alt_color)

View File

@ -260,18 +260,8 @@ return require('packer').startup(function(use)
end
}
use {
"utilyre/barbecue.nvim",
tag = "*",
requires = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons", -- optional dependency
},
after = "nvim-web-devicons", -- keep this if you're using NvChad
config = function()
require("barbecue").setup()
end,
}
use 'nvim-tree/nvim-web-devicons'
use {
'nvim-lualine/lualine.nvim',
@ -326,5 +316,5 @@ return require('packer').startup(function(use)
cmd = { "DBUIToggle", "DBUI", "DBUIAddConnection", "DBUIFindBuffer", "DBUIRenameBuffer", "DBUILastQueryInfo" },
}
use 'eandrju/cellular-automaton.nvim'
use 'eandrju/cellular-automaton.nvim'
end)

View File

@ -13,6 +13,9 @@ vim.opt.showmode = false
vim.opt.smartindent = true
vim.opt.spell = true
vim.opt.spelllang = "en_us"
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"

View File

@ -7,23 +7,23 @@
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
#
shadow = false;
#shadow = true;
# shadow = false;
shadow = true;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 5;
shadow-radius = 4;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
shadow-opacity = .15
shadow-opacity = .45
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
shadow-offset-x = 4;
shadow-offset-x = 3;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
shadow-offset-y = 4;
shadow-offset-y = 2;
# Avoid drawing shadows on dock/panel windows. This option is deprecated,
# you should use the *wintypes* option in your config file instead.

View File

@ -22,7 +22,7 @@ screenchange-reload = true
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false
;pseudo-transparency = true
[global/wm]
margin-top = 0
@ -39,59 +39,78 @@ background = ${xrdb:background}
foreground = ${xrdb:foreground}
override-redirect = true
wm-restack = bspwm
font-0 = Olympe Mono Hacked:style=Regular:pixelsize=13;2
font-1 = Cascadia Code:style=Regular:pixelsize=13:2
font-2 = NotoColorEmoji:pixelsize=16
font-3 = Font Awesome 5 Brands:style=Regular:size=13;2
font-4 = Font Awesome 5 Free Solid:style=Regular:size=9;2
height = 20
font-0 = Olympe Mono Hacked:style=Regular:pixelsize=20;2
font-1 = CaskaydiaCove Nerd Font:style=Regular:pixelsize=20:2
font-2 = NotoColorEmoji:pixelsize=20
font-3 = Font Awesome 6 Brands:style=Regular:size=20;2
font-4 = Font Awesome 6 Free Solid:style=Regular:size=20;2
height = 36
line-size = 2
modules-left = bspwm
modules-right = music pulseaudio battery network redshift datetime
padding = 3
modules-right = music memory filesystem xkeyboard network redshift pulseaudio backlight tray battery datetime
padding = 0
module-margin = 1.5
#[module/apple]
#type = custom/text
#content = 
[module/tray]
type = internal/tray
[module/xkeyboard]
type = internal/xkeyboard
format = 󰌌 <label-layout>
[module/filesystem]
type = internal/fs
mount-0 = /
format-mounted =  <label-mounted>
label-mounted = %used% / %total%
[module/memory]
type = internal/memory
format = <label>
label =  %used%
[module/bspwm]
type = internal/bspwm
label-focused = %name%
label-focused = %icon%
label-focused-underline= ${xrdb:foreground}
label-focused-background = ${xrdb:foreground}
label-focused-foreground = ${xrdb:background}
label-focused-padding = 1
label-focused-font = 0
label-occupied = %name%
label-occupied = %icon%
label-occupied-padding = 1
label-occupied-font = 0
label-occupied-underline= ${xrdb:foreground}
label-urgent = %name%!
label-urgent = %icon%
label-urgent-padding = 1
label-urgent-font = 0
label-urgent-background = ${xrdb:color1}
label-urgent-underline = ${xrdb:color1}
label-empty = %name%
label-empty = %icon%
label-empty-padding = 1
label-empty-font = 0
;extra icons to choose from
;http://fontawesome.io/cheatsheet/
;       v    
ws-icon-0 = Web;
ws-icon-1 = Term;
ws-icon-2 = School;
ws-icon-3 = Game;
ws-icon-4 = Music;
ws-icon-5 = Chat;
ws-icon-6 = Sys;
ws-icon-7 = Dev;
ws-icon-8 = Extra;
# ws-icon-0 = 1;
ws-icon-0 = 1;א
ws-icon-1 = 2;ב
ws-icon-2 = 3;ג
ws-icon-3 = 4;ד
ws-icon-4 = 5;ה
ws-icon-5 = 6;ו
ws-icon-6 = 7;ז
ws-icon-7 = 8;ח
ws-icon-8 = 9;ט
;ws-icon-9 = 10;
ws-icon-default = " "
#; Separator in between workspaces
#; label-separator = |
# label-separator = |
#
;[module/music]
@ -105,16 +124,27 @@ ws-icon-default = " "
[module/battery]
type = internal/battery
battery = BAT0
battery = BAT1
adapter = ADP0
format-charging = <ramp-capacity>
format-discharging = <ramp-capacity>
ramp-capacity-0 = ""
ramp-capacity-1 = ""
ramp-capacity-2 = ""
ramp-capacity-3 = ""
ramp-capacity-4 = ""
format-charging = 󰂄 <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
label-discharging = %percentage%%
label-charging = %percentage%%
label-full = 󱟢 %percentage%%
# ramp-capacity-0 = ""
ramp-capacity-0 = "󰁺"
# ramp-capacity-1 = ""
ramp-capacity-1 = "󰁼"
# ramp-capacity-2 = ""
ramp-capacity-2 = "󰁾"
# ramp-capacity-3 = ""
ramp-capacity-3 = "󰂀"
# ramp-capacity-4 = ""
ramp-capacity-4 = "󰁹"
[module/backlight]
type = internal/backlight
format = 󰌵 <label>
[module/pulseaudio]
type = internal/pulseaudio
@ -132,7 +162,7 @@ interval = 5
; <label-volume> (default)
; <ramp-volume>
; <bar-volume>
format-volume = <label-volume>
format-volume = <ramp-volume> <label-volume>
; Available tags:
; <label-muted> (default)
; <ramp-volume>
@ -147,7 +177,7 @@ label-volume = %percentage%%
; Available tokens:
; %percentage% (default)
; %decibels%
label-muted = muted
label-muted =  %percentage%%
; Only applies if <ramp-volume> is used
ramp-volume-0 =
@ -155,14 +185,15 @@ ramp-volume-1 = 
ramp-volume-2 =
; Right and Middle click
click-right = kitty -e pulsemixer
click-right = st -e pulsemixer
; click-middle =
[module/network]
type = internal/network
interface = enp4s0
label-disconnected = " Not connected"
label-connected = ""
interface = wlan0
label-disconnected = "󰖪"
label-connected = " %essid%:%local_ip%"
click-left = st -e iwctl
[module/redshift]
type = custom/text
@ -172,4 +203,4 @@ click-right = redshift -x
[module/datetime]
type = internal/date
date = %a %b %d %I:%M %p
date = %a %b %d %I:%M:%S %p

View File

@ -1,25 +1,25 @@
# base16-qutebrowser (https://github.com/theova/base16-qutebrowser)
# Scheme name: Gruvbox dark, hard
# Scheme author: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
# Scheme name: Rosé Pine
# Scheme author: Emilia Dunfelt &lt;edun@dunfelt.se&gt;
# Template author: theova
# Commentary: Tinted Theming: (https://github.com/tinted-theming)
base00 = "#1d2021"
base01 = "#3c3836"
base02 = "#504945"
base03 = "#665c54"
base04 = "#bdae93"
base05 = "#d5c4a1"
base06 = "#ebdbb2"
base07 = "#fbf1c7"
base08 = "#fb4934"
base09 = "#fe8019"
base0A = "#fabd2f"
base0B = "#b8bb26"
base0C = "#8ec07c"
base0D = "#83a598"
base0E = "#d3869b"
base0F = "#d65d0e"
base00 = "#191724"
base01 = "#1f1d2e"
base02 = "#26233a"
base03 = "#6e6a86"
base04 = "#908caa"
base05 = "#e0def4"
base06 = "#e0def4"
base07 = "#524f67"
base08 = "#eb6f92"
base09 = "#f6c177"
base0A = "#ebbcba"
base0B = "#31748f"
base0C = "#9ccfd8"
base0D = "#c4a7e7"
base0E = "#f6c177"
base0F = "#524f67"
# set qutebrowser colors

70
config/.scripts/bspswallow Executable file
View File

@ -0,0 +1,70 @@
#!/bin/sh
# Get class of a wid
get_class() {
id=$1
if [ -z "$id" ]; then
echo ""
else
xprop -id "$id" | sed -n \
-e '/WM_CLASS/s/\( "\)/\n/g; s/[^\n]*\n\([^"]*\)[^\n]*/\1\n/g' \
-e '/WM_COMMAND/s/[^"]*/\n\n/1; s/\n"//1; s/\n\([^"]*\)".*/\n\1/; /\n/p' | sed '/^$/d' | head -n1
fi
}
get_pid() {
xprop _NET_WM_PID -id "$1" | awk '/[0-9]+/ {print $3}'
}
get_ppid() {
ps -o ppid= -p $1
}
check_swallowing_process() {
pid=$(get_pid $1)
[ -z $pid ] && return 0
gppid=$(get_ppid $(get_ppid $pid))
grep -i "^$(ps -o cmd= -p $gppid | awk '{print $1}' | sed 's_^.*/__')$" ~/.config/bspwm/terminals && return 0
[ "$(get_ppid "$(get_ppid "$(get_pid "$1")")")" = "$(get_pid "$2")" ] && return 0 || return 1
}
swallow() {
addedtodesktop=$2
lasttermdesktop=$(bspc query -D -n last)
swallowerid=$1
swallowingid=$(bspc query -N -n last)
if [ "$addedtodesktop" = "$lasttermdesktop" ] && check_swallowing_process "$swallowerid" "$swallowingid"; then
grep -q "^$(get_class "$swallowerid")$" ~/.config/bspwm/{noswallow, terminals} && return
grep -i "^$(get_class "$swallowingid")$" ~/.config/bspwm/terminals || return
echo "$swallowerid $swallowingid" >> /tmp/swallowids
bspc node "$swallowingid" --flag hidden=on
fi
}
spit() {
spitterid=$1
spitterdesktop=$2
grep "^$spitterid" /tmp/swallowids || return
spittingid=$(grep "^$spitterid" /tmp/swallowids | head -n1 | awk '{print $2}')
bspc node "$spittingid" --flag hidden=off
termdesktop=$(bspc query -D -n "$spittingid")
[ "$termdesktop" = "$spitterdesktop" ] || bspc node "$spittingid" -d "$spitterdesktop"
bspc node "$spittingid" -f
sed -i "/^$spitterid/d" /tmp/swallowids
}
bspc subscribe node_add node_remove | while read -r event
do
case $(echo "$event" | awk '{ print $1 }') in
node_add)
swallow $(echo "$event" | awk '{print $5 " " $3}')
;;
node_remove)
spit $(echo "$event" | awk '{print $4 " " $3}')
;;
esac
done

82
config/.scripts/displayselect Executable file
View File

@ -0,0 +1,82 @@
#!/bin/sh
# A UI for detecting and selecting all displays. Probes xrandr for connected
# displays and lets user select one to use. User may also select "manual
# selection" which opens arandr.
twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v ^"$primary"$)
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v ^"$primary"$ | dmenu -i -p "Select secondary display:")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
tertiary=$(echo "$screens" | grep -v ^"$primary"$ | grep -v ^"$secondary"$ | dmenu -i -p "Select third display:")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
}
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
2) twoscreen ;;
*) morescreen ;;
esac ;}
onescreen() { # If only one output available or chosen.
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
}
postrun() { # Stuff to run to clean up.
setbg # Fix background if screen size/arangement has changed.
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
}
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;}
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) onescreen "$chosen" ;;
esac
postrun

123
config/.scripts/dmenurecord Executable file
View File

@ -0,0 +1,123 @@
#!/bin/sh
# Usage:
# `$0`: Ask for recording type via dmenu
# `$0 screencast`: Record both audio and screen
# `$0 video`: Record only screen
# `$0 audio`: Record only audio
# `$0 kill`: Kill existing recording
#
# If there is already a running instance, user will be prompted to end it.
getdim() { xrandr | grep -oP '(?<=current ).*(?=,)' | tr -d ' ' ;}
updateicon() { \
echo "$1" > /tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
}
killrecording() {
recpid="$(cat /tmp/recordingpid)"
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
}
screencast() { \
ffmpeg -y \
-f x11grab \
-framerate 30 \
-s "$(getdim)" \
-i "$DISPLAY" \
-r 24 \
-use_wallclock_as_timestamps 1 \
-f alsa -thread_queue_size 1024 -i default \
-c:v h264 \
-crf 0 -preset ultrafast -c:a aac \
"$HOME/Videos/Capture/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! > /tmp/recordingpid
updateicon "⏺️🎙️"
}
video() { ffmpeg \
-f x11grab \
-framerate 30 \
-s "$(getdim)" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/Videos/Capture/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "⏺️"
}
webcamhidef() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/Videos/Capture/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "🎥"
}
webcam() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/Videos/Capture/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "🎥"
}
audio() { \
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/Videos/Capture/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! > /tmp/recordingpid
updateicon "🎙️"
}
askrecording() { \
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast;;
audio) audio;;
video) video;;
*selected) videoselected;;
webcam) webcam;;
"webcam (hi-def)") webcamhidef;;
esac
}
asktoend() { \
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
videoselected()
{
slop -f "%x %y %w %h" > /tmp/slop
read -r X Y W H < /tmp/slop
rm /tmp/slop
ffmpeg \
-f x11grab \
-framerate 30 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/Videos/Capture/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "⏺️"
}
case "$1" in
screencast) screencast;;
audio) audio;;
video) video;;
*selected) videoselected;;
kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac

119
config/.scripts/mounter Executable file
View File

@ -0,0 +1,119 @@
#!/bin/bash
# Mounts Android Phones and USB drives (encrypted or not). This script will
# replace the older `dmenumount` which had extra steps and couldn't handle
# encrypted drives.
# TODO: Try decrypt for drives in crtypttab
# TODO: Add some support for connecting iPhones (although they are annoying).
IFS='
'
# Function for escaping cell-phone names.
escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g" ;}
# Check for phones.
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
# If there are already mounted phones, remove them from the list of mountables.
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
for mounted in $mountedphones; do
escphone="$(escape "$phone")"
[[ "$mounted" =~ "$escphone" ]] && break 1
done && continue 1
echo "$phone"
done)"
# Check for drives.
lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
# Get all LUKS drives
allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)"
# Get a list of the LUKS drive UUIDs already decrypted.
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
# Functioning for formatting drives correctly for dmenu:
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; }
# Get only LUKS drives that are not decrypted.
unopenedluks="$(for drive in $allluks; do
uuid="${drive%% *}"
uuid="${uuid//-}" # This is a bashism.
[ -n "$decrypted" ] && for open in $decrypted; do
[ "$uuid" = "$open" ] && break 1
done && continue 1
echo "🔒 $drive"
done | filter)"
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
$unopenedluks
$normalparts" | sed "/^$/d;s/ *$//")"
# Quit the script if a sequential command fails.
set -e
test -n "$alldrives"
# Feed all found drives to dmenu and get user choice.
chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)"
# Function for prompting user for a mountpoint.
getmount(){
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
test -n "$mp"
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
attemptmount(){
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send "💾Drive Mounted." "$chosen mounted."
exit
}
case "$chosen" in
💾*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
parttype="$(echo "$lsblkoutput" | grep "$chosen")"
attemptmount || getmount
case "${parttype##* }" in
vfat) sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
btrfs) sudo -A mount "$chosen" "$mp" ;;
*) sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
esac
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
;;
🔒*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num +1))")"
done
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
📱*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
;;
esac

28
config/.scripts/unmounter Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
# Unmount USB drives or Android phones. Replaces the older `dmenuumount`. Fewer
# prompt and also de-decrypts LUKS drives that are unmounted.
set -e
mounteddroids="$(grep simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
lsblkoutput="$(lsblk -nrpo "name,type,size,mountpoint")"
mounteddrives="$(echo "$lsblkoutput" | awk '($2=="part"||$2="crypt")&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "💾%s (%s)\n",$4,$3}')"
allunmountable="$(echo "$mounteddroids
$mounteddrives" | sed "/^$/d;s/ *$//")"
test -n "$allunmountable"
chosen="$(echo "$allunmountable" | dmenu -i -p "Unmount which drive?")"
chosen="${chosen%% *}"
test -n "$chosen"
sudo -A umount -l "/${chosen#*/}"
notify-send "Device unmounted." "$chosen has been unmounted."
# Close the chosen drive if decrypted.
cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")"
cryptid="${cryptid%% *}"
test -b /dev/mapper/"${cryptid##*/}"
sudo -A cryptsetup close "$cryptid"
notify-send "🔒Device dencryption closed." "Drive is now securely locked again."

View File

@ -1,22 +1,22 @@
! base16 Gruvbox dark, hard
! Scheme author: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
! base16 Rosé Pine
! Scheme author: Emilia Dunfelt &lt;edun@dunfelt.se&gt;
! Template author: Tinted Theming (https://github.com/tinted-theming)
#define base00 #1d2021
#define base01 #3c3836
#define base02 #504945
#define base04 #bdae93
#define base05 #d5c4a1
#define base06 #ebdbb2
#define base07 #fbf1c7
#define base08 #fb4934
#define base09 #fe8019
#define base0A #fabd2f
#define base0B #b8bb26
#define base0C #8ec07c
#define base0D #83a598
#define base0E #d3869b
#define base0F #d65d0e
#define base00 #191724
#define base01 #1f1d2e
#define base02 #26233a
#define base04 #908caa
#define base05 #e0def4
#define base06 #e0def4
#define base07 #524f67
#define base08 #eb6f92
#define base09 #f6c177
#define base0A #ebbcba
#define base0B #31748f
#define base0C #9ccfd8
#define base0D #c4a7e7
#define base0E #f6c177
#define base0F #524f67
*foreground: base05
#ifdef background_opacity