diff --git a/README.md b/README.md index 25931b5..6b5e711 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,13 @@ When a file is opened with prompt open, it moves to the top of the home list #### COMMMAND - init - update +- updatedirs - output - list - insert [ FILE ] +### Get Started + `mru init; mru update; mru updatedirs` #### Notes - by default, it ignores hidden directories - If no cache is specified, it assumes 'home' @@ -71,14 +74,17 @@ When a file is opened with prompt open, it moves to the top of the home list - If if the file passed to `mru insert` does not exist, it is removed from the cache - You may want to run mru update at startup to add new files and cleanup hidden files in .cache/mru +- You don't need to install jump or some other hack to switch directories + quickly. Use this alias: + `alias cdz='cd $((mru listdirs | fzf --height=50%) || printf ".")'` ### Initializing mru init ## pages -pages is a command for viewing /tmp/pages-{number} files with less or zathura. +pages is a command for viewing /tmp/pages-{number} files with st or zathura. The files are the result of prompt commands like `prompt search` -> Go page or -can be created from your own tools. I use it for viewing local documentation +can be created from your own scripts. I use it for viewing local documentation quickly. ### Usage @@ -90,9 +96,10 @@ exists. #### Notes * Page names don't have to be numbers, here is an example vim Ex mode command I - use to convert a markdown file to html and open it in a browser: `:!markdown - % | pages send 1.html | pages browser 1.html` This could then be given it's - own keybinding. + use to convert a markdown file to html and open it in a browser: + `:!markdown + % | pages send 1.html | pages browser 1.html` + This could be given it's own keybinding. #### TODO - Finish vpn and networking stuff after ini script is finished, then make sure diff --git a/dwm-start b/dwm-start index bc7e216..9ffaf82 100755 --- a/dwm-start +++ b/dwm-start @@ -1,12 +1,13 @@ -#!/bin/sh +#!/bin/bash setxkbmap -option caps:swapescape +source ~/.profile picom -b ~/.fehbg xbindkeys -f $HOME/backups/configs/xbindkeysrc ( mru update; mru updatedirs ) & # relaunch DWM if the binary changes, otherwise bail -csum=$(sha1sum $(which dwm.winkey)) +csum=$(sha1sum $(which dwm)) new_csum="" while true do @@ -18,6 +19,6 @@ do else exit 0 fi - new_csum=$(sha1sum $(which dwm.winkey)) + new_csum=$(sha1sum $(which dwm)) sleep 0.5 done diff --git a/ewrap b/ewrap index a6eb365..5664a08 100755 --- a/ewrap +++ b/ewrap @@ -3,9 +3,11 @@ if ! { [ "$TERM" = "tmux-256color" ] && [ -n "$TMUX" ]; } then # Remove option --tab for new window - st -e vim $* + st -e vim "$@" else # tmux session running - vim $* #tmux -u split-window "vim \"$*\"" + # tmux -u split-window vim "$@" + # wait $! + vim "$@" fi diff --git a/mru b/mru index de2709c..1e7e9af 100755 --- a/mru +++ b/mru @@ -3,8 +3,6 @@ #To add more caches, add a newline to this string and follow the existing name:path format #Edit create_new to change find behaviour cache_info="home:$HOME" -HOME=/home/immanuel -XDG_CACHE_HOME="$HOME/.cache" init() { mkdir -p $XDG_CACHE_HOME/mru @@ -68,7 +66,8 @@ output() { file1="$XDG_CACHE_HOME/mru/$1.recent"; file2="$XDG_CACHE_HOME/mru/$1" fi - cat $file1; printf "\n"; cat $file2 + if [ -s $file1 ]; then cat $file1; printf "\n"; fi + cat $file2 } list() { diff --git a/music_player b/music_player new file mode 100755 index 0000000..e3ded42 --- /dev/null +++ b/music_player @@ -0,0 +1,14 @@ +#!/bin/sh + +for f in "$@"; do + # mpc insert $HOME/music/$f + mpc insert "$(realpath "$f")" +done + +if [ -z $(mpc current) ]; then + mpc play +else + mpc next +fi + +# mpc single on diff --git a/prompt b/prompt index a49dcb9..c7c7085 100755 --- a/prompt +++ b/prompt @@ -22,6 +22,7 @@ launch() { Page Go page Package info + Images Play clipboard Play downloads Processes" | tr -d '\t' | @@ -45,6 +46,7 @@ launch() { Browser) $browser_cmd;; 'Hidden browser') $browser_cmd --incognito;; Email) $browser_cmd mail.protonmail.com/login;; + Images) view_images;; 'Play clipboard') mpv "$(xclip -o -selection clipboard)";; 'Play downloads') mpv "$HOME/downloads/tmp/$(ls ~/downloads/tmp/ | dmenu -i -l 10 -p 'play')";; Processes) st -t "Processes" -e htop;; @@ -55,6 +57,7 @@ action() { action=$(printf "Toggle Music Pause Music Play Music + Single on Command Command to clipboard Select VPN @@ -76,7 +79,8 @@ action() { case $action in 'Play Music') mpc play ;; 'Pause Music') mpc pause ;; - 'Toggle Music') mpc toggle ;; + 'Toggle Music') mpc toggle;; + 'Single on') mpc toggle;; 'Rebind Keys') setup-xbindkeys;; 'Disable Bar') tmux set -g status off;; 'Enable Bar') tmux set -g status on;; @@ -129,19 +133,26 @@ do_search() { } download() { -youtube-dl --no-progress -o "$HOME/downloads/%(title)s.%(ext)s" "$(xclip -selection clipboard -o)" +youtube-dl --add-metadata --no-progress -o "$HOME/downloads/%(title)s.%(ext)s" "$(xclip -selection clipboard -o)" notify-send -u low -t 3000 "Download complete" } download_music() { - youtube-dl --no-progress -f bestaudio -o \ - "$HOME/downloads/music/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" + youtube-dl -x --add-metadata --no-progress --audio-format mp3 -o \ + "$HOME/music/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" if [ ! $? ]; then - youtube-dl --no-progress -f bestaudio -o \ - "$HOME/downloads/music/%(title)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" + youtube-dl -x --no-progress --audio-format mp3 -o \ + "$HOME/music/%(title)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" fi notify-send -u low -t 3000 "Download complete" } + +view_images() { + d=$(mru listdirs | dmenu -l 20 -i -p 'where?') + if [ -z "$d" ]; then exit; fi + sxiv -r "$d" +} + package() { type=$(printf "search\ninfo" | dmenu -p 'package') if [ -z "$type" ]; then diff --git a/screenshot.sh b/screenshot.sh deleted file mode 100755 index 8f38de5..0000000 --- a/screenshot.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -method=$(printf "clipboard\nfile\nboth" | dmenu -l 3) - -if test $method = "file"; then - scrot --note "-f 'LiterationSans Nerd Font Book/11' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'" -s ~/Pictures/screenshots/screenshot-%Y-%m-%d_$wx$h.png -fi diff --git a/syn.sh b/syn.sh deleted file mode 100755 index 600646b..0000000 --- a/syn.sh +++ /dev/null @@ -1,24 +0,0 @@ -REMOTE_USER="immanuel" -REMOTE_DIRECTORY="/home/immanuel/Dropoff/" -LOCAL_DIR=$HOME/Dropoff - -pull () { - rsync -aP "$REMOTE_USER@$1:$REMOTE_DIRECTORY " "$LOCAL_DIR" -} - -push () { - rsync -a "$LOCAL_DIR" "ssh://$REMOTE_USER@$1:$REMOTE_DIRECTORY" -} - -while getopts a:u: option -do - case "${option}" in - a) destination=$OPTARG - echo $destination - pull $destination;; - u) destination=$OPTARG - push $destination;; - - esac -done - diff --git a/text-opener b/text-opener deleted file mode 100755 index dc6a2ab..0000000 --- a/text-opener +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -st -t 'Editor' -e vim $* diff --git a/textopener b/textopener new file mode 100755 index 0000000..f11a7b4 --- /dev/null +++ b/textopener @@ -0,0 +1,8 @@ +#!/bin/sh + + +if [ "$TERM" = "tmux-256color" ]; then + tmux -u split-window vim "$@" +else + st -t "Editor" -e vim "$@" & +fi diff --git a/util b/util index 9e9ddcb..2ccd905 100755 --- a/util +++ b/util @@ -1,5 +1,5 @@ #!/bin/sh -BACKUPS_PATH=$HOME/Backups +#A file for managing git tar/git backups gitcmd() { #First arg should be the name of the subdirectory, second arg should be command check_args $# 2 diff --git a/util-audio b/util-audio deleted file mode 100644 index 13f4793..0000000 --- a/util-audio +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh - diff --git a/cvpn b/vpn similarity index 100% rename from cvpn rename to vpn