瀏覽代碼

Handle xdg-open defaults more sensibly and remove junk files

master
= 3 年之前
父節點
當前提交
fe7c4d0658
共有 13 個文件被更改,包括 62 次插入56 次删除
  1. +12
    -5
      README.md
  2. +4
    -3
      dwm-start
  3. +4
    -2
      ewrap
  4. +2
    -3
      mru
  5. +14
    -0
      music_player
  6. +17
    -6
      prompt
  7. +0
    -7
      screenshot.sh
  8. +0
    -24
      syn.sh
  9. +0
    -3
      text-opener
  10. +8
    -0
      textopener
  11. +1
    -1
      util
  12. +0
    -2
      util-audio
  13. +0
    -0
      vpn

+ 12
- 5
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


+ 4
- 3
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

+ 4
- 2
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


+ 2
- 3
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() {


+ 14
- 0
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

+ 17
- 6
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


+ 0
- 7
screenshot.sh 查看文件

@@ -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

+ 0
- 24
syn.sh 查看文件

@@ -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


+ 0
- 3
text-opener 查看文件

@@ -1,3 +0,0 @@
#!/bin/sh

st -t 'Editor' -e vim $*

+ 8
- 0
textopener 查看文件

@@ -0,0 +1,8 @@
#!/bin/sh


if [ "$TERM" = "tmux-256color" ]; then
tmux -u split-window vim "$@"
else
st -t "Editor" -e vim "$@" &
fi

+ 1
- 1
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


+ 0
- 2
util-audio 查看文件

@@ -1,2 +0,0 @@
#!/bin/sh


cvpn → vpn 查看文件


Loading…
取消
儲存