1
0
Fork 0
This commit is contained in:
Luca Bilke 2023-02-06 14:20:01 +01:00
commit 5dabd619bf
49 changed files with 3567 additions and 1761 deletions

View file

@ -1,3 +1,3 @@
#!/usr/bin/env bash
kitty +icat --clear --silent --transfer-mode file
kitty +kitten icat --clear --transfer-mode file

View file

@ -196,6 +196,7 @@ map n &echo $f | xclip -r -selection c
map <esc> quit
map N
map g/ cd "/"
map W &setsid $TERMINAL -e $SHELL -c "lf; $SHELL"
# Kitty Specific
map W &setsid $TERMINAL $SHELL -c "lf; exec $SHELL"

View file

@ -5,8 +5,8 @@ image() {
h=$3
x=$4
y=$5
[[ -v f ]] && kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$f" && exit 1
chafa "$f" -f symbols -s "$(($w-2))x$h" && exit 1
kitty +kitten icat --transfer-mode file --place "${w}x${h}@${x}x${y}" -- "$f"
chafa "$f" -f symbols -s "$((w-2))x$h" && exit 1
echo -e "\e[31mImage previewer not installed\e[0m"
return 1
}
@ -17,7 +17,7 @@ video() {
h=$3
x=$4
y=$5
thumb="$(vidthumb $f)" || ( echo -e "\e[31mvidthumb script not in path\e[0m" && return 1 )
thumb="$(vidthumb "$f")" || ( echo -e "\e[31mvidthumb script not in path\e[0m" && return 1 )
image "$thumb" "$w" "$h" "$x" "$y"
return 1
}
@ -25,8 +25,8 @@ video() {
batorcat() {
f=$1
w=$2
command -v bat > /dev/null 2>&1 && bat --color=always --style=plain --pager=never --terminal-width "$(($w-2))" "$f" && exit 0
command -v batcat > /dev/null 2>&1 && batcat --color=always --style=plain --pager=never --terminal-width "$(($w-2))" "$f" && exit 0
command -v bat > /dev/null 2>&1 && bat --color=always --style=plain --pager=never --terminal-width "$((w-2))" "$f" && exit 0
command -v batcat > /dev/null 2>&1 && batcat --color=always --style=plain --pager=never --terminal-width "$((w-2))" "$f" && exit 0
cat "$f" && exit 0
}

View file

@ -1,10 +1,8 @@
vim.defer_fn(function()
pcall(require, "impatient")
end, 0)
require('impatient')
require('config.options')
require('funcs').bootstrap()
require('plugins')
require('config.autocmdlist')
require('config.filetypelist')
require('config.autocmds').setup()
require('config.filetypes').setup()
require('config.icons').setup()
require('funcs').map('general')

View file

@ -0,0 +1,124 @@
local M = {}
M.list = {
{ -- Handles the automatic line numeration changes
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command = "if &nu && mode() != \"i\" | set rnu | endif"
}
},
{ -- Handles the automatic line numeration changes
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command = "if &nu | set nornu | endif"
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
"BufWritePost",
{
pattern = "*.java",
callback = function()
vim.lsp.codelens.refresh()
end
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{ -- Use 'q' to quit from common plugins
'FileType',
{
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end
}
},
{
'Filetype',
{
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
}
},
{ -- Automatically apply changes to plugins.lua
'BufWritePost',
{
group = 'packer_user_config',
pattern = { "plugins.lua", "pluginlist.lua" },
command = "source <afile> | PackerCompile"
}
},
{ -- Fix auto comment
'BufWinEnter',
{
callback = function()
vim.cmd("set formatoptions-=cro")
end
}
},
{ -- Highlight yanked text
'TextYankPost',
{
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end
}
}
}
M.setup = function()
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
for _, entry in ipairs(M.list) do
local event = entry[1]
local opts = entry[2]
if type(opts.group) == "string" and opts.group ~= "" then
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
if not exists then
vim.api.nvim_create_augroup(opts.group, {})
end
end
vim.api.nvim_create_autocmd(event, opts)
end
end
return M

View file

@ -0,0 +1,33 @@
local M = {}
M.list = {
{
extension = {
yml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end,
yaml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end
}
}
}
M.setup = function()
for _, entry in pairs(M.list) do
vim.filetype.add(entry)
end
end
return M

View file

@ -0,0 +1,173 @@
local M = {}
M.list = {
kind = {
Array = "",
Boolean = "",
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Function = "",
Interface = "",
Key = "",
Keyword = "",
Method = "",
Module = "",
Namespace = "",
Null = "",
Number = "",
Object = "",
Operator = "",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
},
git = {
LineAdded = "",
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
FileUntracked = "U",
Diff = "",
Repo = "",
Octoface = "",
Branch = "",
},
ui = {
ArrowCircleDown = "",
ArrowCircleLeft = "",
ArrowCircleRight = "",
ArrowCircleUp = "",
BoldArrowDown = "",
BoldArrowLeft = "",
BoldArrowRight = "",
BoldArrowUp = "",
BoldClose = "",
BoldDividerLeft = "",
BoldDividerRight = "",
BoldLineLeft = "",
BookMark = "",
BoxChecked = "",
Bug = "",
Stacks = "",
Scopes = "",
Watches = "",
DebugConsole = "",
Calendar = "",
Check = "",
ChevronRight = ">",
ChevronShortDown = "",
ChevronShortLeft = "",
ChevronShortRight = "",
ChevronShortUp = "",
Circle = "",
Close = "",
CloudDownload = "",
Code = "",
Comment = "",
Dashboard = "",
DividerLeft = "",
DividerRight = "",
DoubleChevronRight = "",
DoubleChevronLeft = "",
Ellipsis = "",
EmptyFolder = "",
EmptyFolderOpen = "",
File = "",
FileSymlink = "",
Files = "",
FindFile = "",
FindText = "",
Fire = "",
Folder = "",
FolderOpen = "",
FolderSymlink = "",
Forward = "",
Gear = "",
History = "",
Lightbulb = "",
LineLeft = "",
LineMiddle = "",
List = "",
Lock = "",
MinusCircle = "",
NewFile = "",
Note = "",
Package = "",
Pencil = "",
Plus = "",
Project = "",
Search = "",
SignIn = "",
SignOut = "",
Tab = "",
Table = "",
Target = "",
Telescope = "",
Text = "",
Tree = "",
Triangle = "",
TriangleShortArrowDown = "",
TriangleShortArrowLeft = "",
TriangleShortArrowRight = "",
TriangleShortArrowUp = "",
},
diagnostics = {
BoldError = "",
Error = "",
BoldWarning = "",
Warning = "",
BoldInformation = "",
Information = "",
BoldQuestion = "",
Question = "",
BoldHint = "",
Hint = "",
Debug = "",
Trace = "",
},
progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}
M.setup = function()
local icons = M.list.diagnostics
local signs = {
DiagnosticSignError = icons.BoldError,
DiagnosticSignWarn = icons.BoldWarning,
DiagnosticSignHint = icons.BoldHint,
DiagnosticSignInfo = icons.BoldInformation
}
for type, icon in pairs(signs) do
local hl = type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
end
return M

View file

@ -3,8 +3,8 @@ if not status_ok then
return
end
local dashboard = require 'alpha.themes.dashboard'
local icons = require 'config.iconlist'
local dashboard = require('alpha.themes.dashboard')
local icons = require('config.icons').list
local banner = {
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀",

View file

@ -5,7 +5,7 @@ if not status_ok then
return
end
local icons = require 'config.iconlist'
local icons = require('config.icons').list
local function is_ft(b, ft)
return vim.bo[b].filetype == ft

View file

@ -1,4 +1,4 @@
local icons = require('config.iconlist')
local icons = require('config.icons').list
local dap_status_ok, dap = pcall(require, 'dap')
if not dap_status_ok then

View file

@ -4,7 +4,7 @@ if not status_ok then
end
local colors = require('tokyonight.colors').setup({ transform = true })
local icons = require('config.iconlist')
local icons = require('config.icons').list
local conditions = {
buffer_not_empty = function()
@ -106,8 +106,11 @@ ins_left {
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 and client.name ~= "null-ls" then
return client.name
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
if client.name ~= "null-ls" then
return client.name
end
msg = client.name
end
end
return msg

View file

@ -3,7 +3,7 @@ if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
local settings = {
ui = {

View file

@ -3,7 +3,7 @@ if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
telescope.setup {
defaults = {

View file

@ -2,7 +2,7 @@ local status_ok, whichkey = pcall(require, 'which-key')
if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
whichkey.setup {
marks = false,

View file

@ -1,4 +1,4 @@
local icons = require "config.iconlist"
local icons = require('config.icons').list
local plugins = {
{ "wbthomason/packer.nvim",
config = function()

View file

@ -13,5 +13,4 @@ if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then
else
. "$HOME/.xprofile"
fi
dwm

View file

@ -6,11 +6,11 @@ setbg &
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" & xrdbpid=$!
remaps &
autostart="checkup mpd dunst unclutter pipewire dwmblocks"
autostart="picom checkup dunst unclutter pipewire dwmblocks"
for program in $autostart; do
pidof -s "$program" || "$program" &
done >/dev/null 2>&1
pidof -s "picom" || picom --experimental-backends &
playerctld daemon
if ! pgrep -x -u "${USER}" gpg-agent 1> /dev/null 2>&1; then
gpg-connect-agent /bye 1> /dev/null 2>&1
@ -34,7 +34,7 @@ export XSECURELOCK_PASSWORD_PROMPT="time_hex"
export XSECURELOCK_AUTH_TIMEOUT=10
export XSECURELOCK_SHOW_DATETIME=1
export XSECURELOCK_COMPOSITE_OBSCURER=0
export XSECURELOCK_SAVER="/usr/libexec/xscreensaver/cubicgrid"
export XSECURELOCK_SAVER="/usr/lib/xscreensaver/cubicgrid"
export XSECURELOCK_SHOW_DATETIME=1
export XSECURELOCK_SHOW_HOSTNAME=1
xset s 300

View file

@ -1,4 +1,3 @@
/* set sandbox none */
set statusbar-h-padding 0
set statusbar-v-padding 0
set page-padding 1

View file

@ -4,7 +4,7 @@
# have this script run via vim.
#
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extention or shebang.
# presentations. Runs scripts based on extension or shebang.
#
# Note that .tex files which you wish to compile with XeLaTeX should have the
# string "xelatex" somewhere in a comment/command in the first 5 lines.
@ -39,9 +39,9 @@ case "$ext" in
java) loc=$(findup . -name gradlew); [ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)" ;;
m) octave "$file" ;;
md) if [ -x "$(command -v lowdown)" ]; then
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf
elif [ -x "$(command -v groffdown)" ]; then
groffdown -i "$file" | groff > "$base.pdf"
groffdown -i "$file" | groff -T pdf > "$base.pdf"
else
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
fi ; ;;
@ -51,9 +51,10 @@ case "$ext" in
py) python "$file" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "$file" "$base.css" ;;
sass) sassc -a "$file" "$base".css ;;
scad) openscad -o "$base".stl "$file" ;;
sent) setsid -f sent "$file" 2>/dev/null ;;
tex) textype "$file" ;;
fnl) fennel --compile "$file" > "$base.lua" ;;
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;;
esac

View file

@ -36,31 +36,31 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
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
}
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 ;}
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 ' ' -)
}
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.
remaps # Re-remap keys if keyboard added (for laptop bases)
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
}
setbg # Fix background if screen size/arangement has changed.
remaps-no-change # Re-remap keys if keyboard added (for laptop bases)
{ 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")
@ -70,14 +70,14 @@ 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 ;}
{ 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" ;;
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) onescreen "$chosen" ;;
esac
postrun

View file

@ -4,17 +4,17 @@
# some choice programs to use to open it.
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in
case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
"copy url") echo "$feed" | xclip -selection clipboard ;;
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
"queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;;
"queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;;
"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
lynx) lynx "$feed" >/dev/null 2>&1 ;;

View file

@ -27,18 +27,18 @@ mountusb() { \
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac
notify-send "禍 USB mounting" "$chosen mounted to $mp."
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
}
mountandroid() { \
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp"
notify-send " Android Mounting" "Android device mounted to $mp."
simple-mtpfs --device "$chosen" "$mp" &&
notify-send " Android Mounting" "Android device mounted to $mp." ||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
}
asktype() { \

View file

@ -4,41 +4,22 @@
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() {
[ -z "$drives" ] && exit
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
drives="$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'; awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab)"
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
case "$chosen" in
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
;;
*)
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send " Android unmounting" "$chosen unmounted."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
case "$choice" in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
}
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else
if [ -z "$drives" ]
then
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

View file

@ -3,7 +3,7 @@
# The famous "get a menu of emojis to copy" script.
# Get user selection via dmenu from emoji file.
chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 30 | sed "s/ .*//")
chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//")
# Exit if none chosen.
[ -z "$chosen" ] && exit

View file

@ -1,7 +0,0 @@
#!/bin/sh
cat <<EOF | xmenu
[]= Tiled Layout 0
><> Floating Layout 1
[M] Monocle Layout 2
EOF

View file

@ -6,18 +6,22 @@
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
# If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$BROWSER"; exit; }
if [ -z "$1" ]; then
url="$(xclip -o)"
else
url="$1"
fi
case "$1" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*odysee.com*)
setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
case "$url" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*pdf|*cbz|*cbr)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
qndl "$1" 'curl -LO' >/dev/null 2>&1 ;;
qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
*)
[ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
esac

View file

@ -4,13 +4,16 @@
# choose the kind of screenshot to take, including copying the image or even
# highlighting an area to copy. scrotcucks on suicidewatch right now.
dir="$HOME/Photos/Screenshots/"
# variables
output="$(date '+%y%m%d-%H%M-%S').png"
xclip_cmd="xclip -sel clip -t image/png"
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s "${dir}pic-selected-$(date '+%y%m%d-%H%M-%S').png" ;;
"current window") maim -i "$(xdotool getactivewindow)" "${dir}pic-window-$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") maim "${dir}pic-full-$(date '+%y%m%d-%H%M-%S').png" ;;
"a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
"a selected area") maim -s pic-selected-"${output}" ;;
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
"a selected area (copy)") maim -s | ${xclip_cmd} ;;
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
esac

View file

@ -5,7 +5,7 @@
base="$(basename "$1")"
notify-send "羽Queuing $base..."
cmd="$2"
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata -ic"
[ -z "$cmd" ] && cmd="yt-dlp --embed-metadata -ic"
idnum="$(tsp $cmd "$1")"
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
tsp -D "$idnum" mv "$base" "$realname"

View file

@ -2,7 +2,7 @@
# Podboat sucks. This script replaces it.
# It reads the newsboat queue, queuing downloads with taskspooler.
# It also removes the junk from extentions.
# It also removes the junk from extensions.
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
while read -r line; do

10
.local/bin/remaps-no-change Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
setxkbmap -layout "$(echo "$current" | cut -d ':' -f1)" -variant "$(echo "$current" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
xset r rate 300 50
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
sleep 0.03
pkill -RTMIN+15 dwmblocks

View file

@ -2,9 +2,21 @@
# Open a terminal window in the same directory as the currently active window.
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
PID="$(pstree -lpA "$PID")"
PID="${PID##*(}"
PID="${PID%)}"
cd "$(readlink /proc/"$PID"/cwd)" || return 1
windowPID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
PIDlist=$(pstree -lpATna "$windowPID" | sed -En 's/.*,([0-9]+).*/\1/p' | tac)
for PID in $PIDlist; do
cmdline=$(ps -o args= -p "$PID")
process_group_leader=$(ps -o comm= -p "$(ps -o pgid= -p "$PID" | tr -d ' ')")
cwd=$(readlink /proc/"$PID"/cwd)
# zsh and lf won't be ignored even if it shows ~ or /
case "$cmdline" in
'lf -server') continue ;;
"${SHELL##*/}"|'lf'|'lf '*) break ;;
esac
# git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored
[ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue
# This is to ignore programs that show ~ or / instead of the actual working directory
[ "$cwd" != "$HOME" ] && [ "$cwd" != '/' ] && break
done
[ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; }
"$TERMINAL"

View file

@ -4,15 +4,9 @@
# Run by itself, set the wallpaper (at X start).
# If given a file, set that as the new wallpaper.
# If given a directory, choose random file in it.
# If wal is installed, also generates a colorscheme.
# Location of link to wallpaper link.
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
# Configuration files of applications that have their themes changed by pywal.
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
trueloc="$(readlink -f "$1")" &&
case "$(file --mime-type -b "$trueloc")" in
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
@ -20,14 +14,4 @@ case "$(file --mime-type -b "$trueloc")" in
*) notify-send "Error" "Not a valid image." ; exit 1;;
esac
# If pywal is installed, use it.
if command -v wal >/dev/null 2>&1 ; then
wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
pidof dwm >/dev/null && xdotool key super+F12
# If pywal is removed, return config files to normal.
else
[ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf"
[ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf"
fi
xwallpaper --zoom "$bgloc"

View file

@ -12,3 +12,4 @@ filter() {
fi
}
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
filter

View file

@ -0,0 +1,8 @@
#!/bin/sh
pidof -x sbd-playerctl >/dev/null 2>&1 || sbd-playerctl >/dev/null 2>&1 &
[ "$(playerctl status 2>&1)" = "No players found" ] && echo ""ﱙ && exit 1
# song="$(playerctl metadata xesam:artist) - $(playerctl metadata xesam:title)"
song="$(playerctl metadata xesam:title)"
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
icon=$(playerctl status | sed "s/Playing//;s/Paused//;")
echo "$icon $song"

View file

@ -1,6 +1,5 @@
#!/bin/sh
# TODO: Rewrite this shit to connect to an external deluged
transmission-remote -l | grep % |
transmission-remote "$1" -l | grep % |
sed " # The letters are for sorting and will not appear.
s/.*Stopped.*/A /;
s/.*Seeding.*/Z 﫠/;
@ -8,20 +7,4 @@ transmission-remote -l | grep % |
s/.*Idle.*/B ﭦ/;
s/.*Uploading.*/L /;
s/.*%.*/M /" |
sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e tremc ;;
2) td-toggle ;;
3) notify-send " Torrent module" "\- Left click to open tremc.
- Middle click to toggle transmission.
- Shift click to edit script.
Module shows number of torrents:
: paused
ﭦ: idle (seeds needed)
: uploading (unfinished)
: downloading
﫠: done
﫠: done and seeding" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -

View file

@ -1,3 +1,3 @@
#/bin/sh
pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/ /')"

View file

@ -0,0 +1,2 @@
#!/bin/sh
playerctl status -F | tee "/tmp/playerctl-status" | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)

View file

@ -9,8 +9,8 @@ case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep
' lock') xset s activate & gpg-connect-agent --no-autostart reloadagent /bye;;
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
# 'ﭦ hibernate') slock $ctl hibernate ;;
# ' sleep') slock $ctl suspend ;;
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
# ' sleep') slock $ctl suspend -i ;;
'ﰇ reboot') $ctl reboot ;;
'襤 shutdown') $ctl poweroff ;;
' display off') xset dpms force off ;;

1631
.local/share/chars/emoji Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff