Tech Stack
Super (Windows key) + SHIFT + E
opens a terminal window with a fzf
menu that lets you select between files from the home directory and its subdirectories.
neovim
from the fzf
menu, and after you quit, you'll be in the same directory as the selected file.{ MODKEY|ShiftMask, XK_e, spawn, SHCMD("st -t \"Select file to edit in Neovim\" sh -c 'fl=$(find ~ -type f | fzf); cd \"${fl%/*}\"; nvim \"$fl\"; exec $SHELL'") },
Super (Windows key) + E
opens a terminal window with a fzf
menu for selecting between folders from the home directory and its subdirectories.
cd
, search and enter directories instead of editing files.{ MODKEY, XK_e, spawn, SHCMD("st -t \"Directory search\" sh -c 'cd \"$(find ~ -type d | fzf)\"; printf \"\033]0;st\007\"; exec $SHELL'") },
Super (Windows key) + R
does basically what the neovim
keybinding does except it uses different programs for different file-types.
nsxiv
for images (png, jpg/jpeg, webp), It'll also open all the images in the same directory of the selected imagegrep -v ".cache/nsxiv"
part was added to filter out nsxiv cached imagesmpv
for:zathura
for PDFs${BROWSER:-xdg-open}
for HTMLNeovim
for other filesxdg-open
up properly so instead I just use a bunch of variables.{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("st -t \"Multi-tool\" sh -c 'fl=$(find ~ -type f | grep -v \".cache/nsxiv\" | fzf); cd \"${fl%/*}\"; case \"$fl\" in *.png|*.jpg|*.jpeg|*.webp) nsxiv \"$fl\" \"${fl%/*}\";; *.gif) mpv --loop \"$fl\";; *.mp3|*.flac|*.ogg|*.wav) mpv --no-vid --loop \"$fl\";; *.mp4|*.webm|*.mkv|*.avi) mpv \"$fl\";; *.html) ${BROWSER:-xdg-open} \"$fl\";; *.pdf|*.epub) zathura \"$fl\";; *.exe|*.sh) \"$fl\";; *) nvim \"$fl\";; esac; exec $SHELL'") },
fzf
enables image previews with ueberzug
, which look cool, as shown in the top screenshot.
{ MODKEY|ShiftMask, XK_z, spawn, SHCMD("st -t \"Multi-tool\" sh -c 'fl=$(echo ~/$(ueberzogen)); cd \"${fl%/*}\"; case \"$fl\" in *.png|*.jpg|*.jpeg|*.webp) nsxiv \"$fl\" \"${fl%/*}\";; *.gif) mpv --loop \"$fl\";; *.mp3|*.flac|*.wav) mpv --no-vid --loop \"$fl\";; *.mp4|*.webm|*.mkv|*.avi) mpv \"$fl\";; *.html) ${BROWSER:-xdg-open} \"$fl\";; *.pdf|*.epub) zathura \"$fl\";; *.exe|*.sh) \"$fl\";; *) nvim \"$fl\";; esac; exec $SHELL'") },
Super (Windows key) + SHIFT + D
opens a dmenu
menu for selecting between emojis on '~/stuff/doc/emojis.txt'
to copy to clipboard, based on their names.
curl -sSL "https://unicode.org/Public/emoji/latest/emoji-test.txt" | sed -ne 's/^.*; fully-qualified.*# \(\S*\) \S* \(.*$\)/\1 \2/gp' >"emojis.txt"
{ MODKEY|ShiftMask, XK_d, spawn, SHCMD("emoji=$(cat ~/stuff/doc/emojis.txt | dmenu -p \"Select emoji to copy:\" -i) && [ -n \"$emoji\" ] && echo \"$emoji\" | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard") },
Super (Windows key) + SHIFT + Return (Enter)
opens a terminal window with a fzf
menu, allowing you to select a command from '~/.cache/zsh/history'
to run.
xclip
to copy the selected command. Although it preserves the previous clipboard in a variable and restores it after pasting, the clipboard data is lost once the window is closed.zsh
by default stores history at ~/.zsh_history
, but you can change that in the .zshrc
using: HISTFILE="/home/$USER/.cache/zsh/history"
.zsh vi
mode history search '(ESC + /)
', or the shell's !<command>
, but this is more convenient in some cases.{ MODKEY|ShiftMask, XK_Return, spawn, SHCMD("st -t \"History search\" sh -c 'setxkbmap br; clip=\"$(xclip -selection clipboard -o 2>/dev/null)\"; tac ~/.cache/zsh/history | fzf --no-sort -e | tr -d \"\n\" | xclip -selection clipboard; xdotool key ALT+V; clear; printf \"%s\" \"$clip\" | xclip -selection clipboard; printf \"\033]0;st\007\"; exec $SHELL'") },
setxkbmap br
ensures that the keybind enables typing of Brazilian special characters.xdotool
to type, so pressing other keys while the command is being typed is ill-advised:Super
while the command is being written could trigger other keybindings, SHIFT
will modify the input as expected.{ MODKEY|ShiftMask, XK_Return, spawn, SHCMD("st -t st sh -c 'setxkbmap br & xdotool type \"$(tac ~/.cache/zsh/history | fzf --no-sort -e)\"; clear; exec $SHELL'") },
Super (Windows key) + C
opens a terminal window with a fzf
menu for selecting between media stored at '~/stuff/media/tv'
. It simply lists what's in the directory and lets you select what to play on mpv
from the fzf
menu.
{ MODKEY, XK_c, spawn, SHCMD("st -t \"Select media to play\" sh -c 'cd ~/stuff/media/tv; mpv --fs --save-position-on-quit --no-pause \"$(ls | fzf)\"'") },
Super (Windows key) + SHIFT + C
does about the same as the media keybinding but with zathura
for files at '~/stuff/media/pdf'
.
{ MODKEY|ShiftMask, XK_c, spawn, SHCMD("st -t \"Select book to read\" sh -c 'cd ~/stuff/media/pdf; zathura \"$(ls | fzf)\"'") },
Super (Windows key) + Esc
turns off the display (monitor or screen) until you move the mouse or press a key. Occasionally my monitor screen turns white depending on the angle at which I tilt it, so I need this to fix it.
{ MODKEY, XK_Escape, spawn, SHCMD("xset dpms force off") },
Super (Windows key) + SHIFT + Esc
turns the screen back to the normal defaults in case something messed it up.
{ MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("xrandr --output LVDS-1 --mode 1366x768 --brightness 1.0 --gamma 1:1:1") },
Super (Windows key) + F1
runs Luke Smith's dmenu
script sysact wich opens a menu with various options like closing dwm, rebooting, shutting down, and turning off the display like my "Clear Screen" kyebinding does.
{ MODKEY, XK_F1, spawn, SHCMD("sysact") },
Opens a dmenu
menu with two options "Shutdown" for turning off the computer and "Restart" for rebooting.
{ MODKEY, XK_F1, spawn, SHCMD("printf \"Shutdown\nRestart\" | dmenu | xargs -r sh -c 'case \"$1\" in Shutdown) sudo poweroff ;; Restart) sudo reboot ;; esac' _") },
Super (Windows key) + SHIFT + Backslash
opens a dmenu
menu listing available USB devices to mount, it assumes all devices starting with /dev/sd
that has a '1' and doesn't have sda
on it are USBs, which is true in my case.
udisks2
{ MODKEY|ShiftMask, XK_backslash, spawn, SHCMD("ls /dev/sd* | grep -v sda | grep 1 && dev=$(ls /dev/sd* | grep -v sda | grep 1 | dmenu -p \"Select device to mount:\") && notify-send \"USB Mount successful.\" \"$(udisksctl mount -b $dev)\" && st -t \"USB Storage Device\" sh -c 'cd $(cd /run/media/$USER && realpath $(ls -t | head -n 1)) && exec $SHELL' && notify-send \"USB Unmount successful.\" \"$(udisksctl unmount -b $dev)\" || notify-send 'USB Mount unsuccessful.' 'Error looking up object for device.'") },
Super (Windows key) + Backslash
opens a dmenu
menu listing all the images on my image directory and the one selected is copied to the clipboard.
/home/sor/stuff/img
with sed so only the relevant stuff would show up{ MODKEY, XK_backslash, spawn, SHCMD("xclip -selection clipboard -t image/png -i \"$(find ~/stuff/img -type f | grep -v webm | sed 's|/home/sor/stuff/img||g' | dmenu -p \"Select image to copy to clipboard:\" -i -l 5 | sed 's|^|/home/sor/stuff/img/|')\" && notify-send \"Image succesfully copied to clipboard.\"") },
Super (Windows key) + R
opens a dmenu
menu listing files available on '~/stuff/media/mu'
, it'll loop the selected file with mpv
until you select another song.
/home/sor/stuff/media/mu
with sed so only the relevant stuff would show upmpv
instances to stop the previous song, so avoid using it while using mpv
for other purposes.killall mpv
for that.dmenu
avoids the need to exit full-screen.{ MODKEY, XK_r, spawn, SHCMD("song=\"$(find ~/stuff/media/mu -type f | sed 's|/home/sor/stuff/media/mu||g' | dmenu -p \"Select song to loop:\" -i -l 5 | sed 's|^|/home/sor/stuff/media/mu/|')\" && pgrep -x mpv && killall mpv; mpv --loop --no-video \"$song\"") },
Some things need dwm patches to work.
Displays the current song playing on cmus (if running) in the format: "Artist - Song Title ▶️ 0:00-0:00"
'Herms Niel - Erika.flac'
static const char unknown_str[] = "";
in config.h
to remove slstatus' 'n/a' thing, so that nothing is displayed if cmus isn't running{ run_command, "%4s ", "pgrep -x cmus > /dev/null && (cmus-remote -C status | grep -q 'tag artist' && echo \"$(cmus-remote -C status | grep -oP '(?<=tag artist ).*') - $(cmus-remote -C status | grep -oP '(?<=tag title ).*') $(cmus-remote -Q | grep 'status ' | awk '{print $2}' | grep -q 'paused' && echo \"II \" || echo \"▶️\") $(cmus-remote -Q | awk '/position/ {pos=$2} /duration/ {dur=$2} END {printf \"%d:%02d-%d:%02d\\n\", pos/60, pos%60, dur/60, dur%60}')\" || echo \"$(cmus-remote -C status | grep -oP '(?<=file ).*' | sed 's|.*/||; s|\\.[^.]*$||') $(cmus-remote -Q | grep 'status ' | awk '{print $2}' | grep -q 'paused' && echo \"II \" || echo \"▶️\") $(cmus-remote -Q | awk '/position/ {pos=$2} /duration/ {dur=$2} END {printf \"%d:%02d-%d:%02d\\n\", pos/60, pos%60, dur/60, dur%60}')\")" }
Uses a seperator instead of the playback status and time, as shown in this page's screenshots.
{ run_command, "%4s ", "pgrep -x cmus > /dev/null && (cmus-remote -C status | grep -q 'tag artist' && echo \"$(cmus-remote -C status | grep -oP '(?<=tag artist ).*') - $(cmus-remote -C status | grep -oP '(?<=tag title ).*') |\" || echo \"$(cmus-remote -C status | grep -oP '(?<=file ).*' | sed 's|.*/||; s|\\.[^.]*$||') |\")" },
Displays network status as:
{ run_command, "%4s ", "nmcli general status | grep -q -w \"connected\" && echo Online || (nmcli general status | grep -q \"connecting\" && echo ... || echo Offline)" },
Gets volume percentage from amixer
{ run_command, "Vol: %4s ", "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" },
Gets package count from pacman
{ run_command, "Pkg:%4s " , "pacman -Qq | wc -l"},
Default commented-out reference examples redacted.
By default .zshrc
is located at ~/.zshrc
along with other zsh configuration files, this command will set ~/.config/zsh
as the default directory for zsh configuration: export ZDOTDIR=$HOME/.config/zsh
Based on how the default theme looked to me in older versions. (Unfinished, but works) Aaaand it stopped looking the way I meant it to in a new update...
This fixed the issue where Zathura suddenly stopped copying selected text like it used to.
input.conf
scripts
quality-menu - Change streamed video quality, like on YouTube. Simply use the 'F' key binding, don't bother with the OSC/UI stuff.This will block ads, even outside of the browser.
dns.adguard.com
I've set a randomizer on /etc/xprofile
so that when I boot up Xorg, I get a randomly selected wallpaper out of this bunch. Images are hotlinked to avoid DMCA gentoomen.