From 54920103c2843f5a3620effbccaceaee7f6885c1 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 18 May 2019 00:07:32 -0400 Subject: scripts moved to ~/.local/bin --- .config/bmdirs | 2 +- .config/i3blocks/config | 2 +- .local/bin/SCRIPTS.md | 87 +++++++++++++++++++++++++++++++ .local/bin/cron/IMPORTANT_NOTE.md | 11 ++++ .local/bin/cron/checkup | 18 +++++++ .local/bin/cron/cronbat | 8 +++ .local/bin/cron/crontog | 5 ++ .local/bin/cron/newsup | 16 ++++++ .local/bin/i3cmds/cabl | 26 ++++++++++ .local/bin/i3cmds/camtoggle | 2 + .local/bin/i3cmds/ddspawn | 19 +++++++ .local/bin/i3cmds/displayselect | 73 ++++++++++++++++++++++++++ .local/bin/i3cmds/dmenumount | 59 +++++++++++++++++++++ .local/bin/i3cmds/dmenurecord | 105 ++++++++++++++++++++++++++++++++++++++ .local/bin/i3cmds/dmenuumount | 41 +++++++++++++++ .local/bin/i3cmds/dmenuunicode | 18 +++++++ .local/bin/i3cmds/dropdowncalc | 2 + .local/bin/i3cmds/ducksearch | 20 ++++++++ .local/bin/i3cmds/hover | 14 +++++ .local/bin/i3cmds/i3resize | 27 ++++++++++ .local/bin/i3cmds/killrecording | 7 +++ .local/bin/i3cmds/maimpick | 9 ++++ .local/bin/i3cmds/prompt | 7 +++ .local/bin/i3cmds/samedir | 5 ++ .local/bin/i3cmds/showclip | 10 ++++ .local/bin/i3cmds/td-toggle | 10 ++++ .local/bin/i3cmds/tmuxdd | 4 ++ .local/bin/i3cmds/toggletouchpad | 4 ++ .local/bin/i3cmds/torwrap | 6 +++ .local/bin/i3cmds/tutorialvids | 18 +++++++ .local/bin/i3cmds/winresize | 2 + .local/bin/larbs.png | Bin 0 -> 47351 bytes .local/bin/statusbar/battery | 32 ++++++++++++ .local/bin/statusbar/clock | 10 ++++ .local/bin/statusbar/cpu | 10 ++++ .local/bin/statusbar/disk | 18 +++++++ .local/bin/statusbar/help | 7 +++ .local/bin/statusbar/internet | 17 ++++++ .local/bin/statusbar/iplocate | 9 ++++ .local/bin/statusbar/mailbox | 16 ++++++ .local/bin/statusbar/memory | 9 ++++ .local/bin/statusbar/mpdupdate | 8 +++ .local/bin/statusbar/music | 18 +++++++ .local/bin/statusbar/news | 17 ++++++ .local/bin/statusbar/pacpackages | 18 +++++++ .local/bin/statusbar/popupgrade | 9 ++++ .local/bin/statusbar/torrent | 28 ++++++++++ .local/bin/statusbar/volume | 25 +++++++++ .local/bin/statusbar/weather | 23 +++++++++ .local/bin/tools/compiler | 37 ++++++++++++++ .local/bin/tools/dmenuhandler | 15 ++++++ .local/bin/tools/dmenupass | 2 + .local/bin/tools/ext | 1 + .local/bin/tools/extract | 41 +++++++++++++++ .local/bin/tools/getbib | 14 +++++ .local/bin/tools/getkeys | 4 ++ .local/bin/tools/ifinstalled | 3 ++ .local/bin/tools/linkhandler | 22 ++++++++ .local/bin/tools/lmc | 42 +++++++++++++++ .local/bin/tools/opout | 11 ++++ .local/bin/tools/pauseallmpv | 4 ++ .local/bin/tools/podentr | 6 +++ .local/bin/tools/qndl | 11 ++++ .local/bin/tools/queueandnotify | 13 +++++ .local/bin/tools/remaps | 10 ++++ .local/bin/tools/rotdir | 4 ++ .local/bin/tools/rssadd | 9 ++++ .local/bin/tools/setbg | 4 ++ .local/bin/tools/shortcuts | 26 ++++++++++ .local/bin/tools/texclear | 14 +++++ .local/bin/tools/transadd | 9 ++++ .local/bin/tools/vifmimg | 13 +++++ .local/bin/tools/vu | 15 ++++++ .local/bin/ttymaps.kmap | 2 + .local/bin/unix | 25 +++++++++ .local/share/larbs/readme.mom | 8 +-- .profile | 6 +-- .scripts/SCRIPTS.md | 87 ------------------------------- .scripts/cron/IMPORTANT_NOTE.md | 11 ---- .scripts/cron/checkup | 18 ------- .scripts/cron/cronbat | 8 --- .scripts/cron/crontog | 5 -- .scripts/cron/newsup | 16 ------ .scripts/i3cmds/cabl | 26 ---------- .scripts/i3cmds/camtoggle | 2 - .scripts/i3cmds/ddspawn | 19 ------- .scripts/i3cmds/displayselect | 73 -------------------------- .scripts/i3cmds/dmenumount | 59 --------------------- .scripts/i3cmds/dmenurecord | 105 -------------------------------------- .scripts/i3cmds/dmenuumount | 41 --------------- .scripts/i3cmds/dmenuunicode | 18 ------- .scripts/i3cmds/dropdowncalc | 2 - .scripts/i3cmds/ducksearch | 20 -------- .scripts/i3cmds/hover | 14 ----- .scripts/i3cmds/i3resize | 27 ---------- .scripts/i3cmds/killrecording | 7 --- .scripts/i3cmds/maimpick | 9 ---- .scripts/i3cmds/prompt | 7 --- .scripts/i3cmds/samedir | 5 -- .scripts/i3cmds/showclip | 10 ---- .scripts/i3cmds/td-toggle | 10 ---- .scripts/i3cmds/tmuxdd | 4 -- .scripts/i3cmds/toggletouchpad | 4 -- .scripts/i3cmds/torwrap | 6 --- .scripts/i3cmds/tutorialvids | 18 ------- .scripts/i3cmds/winresize | 2 - .scripts/larbs.png | Bin 47351 -> 0 bytes .scripts/statusbar/battery | 32 ------------ .scripts/statusbar/clock | 10 ---- .scripts/statusbar/cpu | 10 ---- .scripts/statusbar/disk | 18 ------- .scripts/statusbar/help | 7 --- .scripts/statusbar/internet | 17 ------ .scripts/statusbar/iplocate | 9 ---- .scripts/statusbar/mailbox | 16 ------ .scripts/statusbar/memory | 9 ---- .scripts/statusbar/mpdupdate | 8 --- .scripts/statusbar/music | 18 ------- .scripts/statusbar/news | 17 ------ .scripts/statusbar/pacpackages | 18 ------- .scripts/statusbar/popupgrade | 9 ---- .scripts/statusbar/torrent | 28 ---------- .scripts/statusbar/volume | 25 --------- .scripts/statusbar/weather | 23 --------- .scripts/tools/compiler | 37 -------------- .scripts/tools/dmenuhandler | 15 ------ .scripts/tools/dmenupass | 2 - .scripts/tools/ext | 1 - .scripts/tools/extract | 41 --------------- .scripts/tools/getbib | 14 ----- .scripts/tools/getkeys | 4 -- .scripts/tools/ifinstalled | 3 -- .scripts/tools/linkhandler | 22 -------- .scripts/tools/lmc | 42 --------------- .scripts/tools/opout | 11 ---- .scripts/tools/pauseallmpv | 4 -- .scripts/tools/podentr | 6 --- .scripts/tools/qndl | 11 ---- .scripts/tools/queueandnotify | 13 ----- .scripts/tools/remaps | 10 ---- .scripts/tools/rotdir | 4 -- .scripts/tools/rssadd | 9 ---- .scripts/tools/setbg | 4 -- .scripts/tools/shortcuts | 26 ---------- .scripts/tools/texclear | 14 ----- .scripts/tools/transadd | 9 ---- .scripts/tools/vifmimg | 13 ----- .scripts/tools/vu | 15 ------ .scripts/ttymaps.kmap | 2 - .scripts/unix | 25 --------- README.md | 2 +- 151 files changed, 1274 insertions(+), 1274 deletions(-) create mode 100644 .local/bin/SCRIPTS.md create mode 100644 .local/bin/cron/IMPORTANT_NOTE.md create mode 100755 .local/bin/cron/checkup create mode 100755 .local/bin/cron/cronbat create mode 100755 .local/bin/cron/crontog create mode 100755 .local/bin/cron/newsup create mode 100755 .local/bin/i3cmds/cabl create mode 100755 .local/bin/i3cmds/camtoggle create mode 100755 .local/bin/i3cmds/ddspawn create mode 100755 .local/bin/i3cmds/displayselect create mode 100755 .local/bin/i3cmds/dmenumount create mode 100755 .local/bin/i3cmds/dmenurecord create mode 100755 .local/bin/i3cmds/dmenuumount create mode 100755 .local/bin/i3cmds/dmenuunicode create mode 100755 .local/bin/i3cmds/dropdowncalc create mode 100755 .local/bin/i3cmds/ducksearch create mode 100755 .local/bin/i3cmds/hover create mode 100755 .local/bin/i3cmds/i3resize create mode 100755 .local/bin/i3cmds/killrecording create mode 100755 .local/bin/i3cmds/maimpick create mode 100755 .local/bin/i3cmds/prompt create mode 100755 .local/bin/i3cmds/samedir create mode 100755 .local/bin/i3cmds/showclip create mode 100755 .local/bin/i3cmds/td-toggle create mode 100755 .local/bin/i3cmds/tmuxdd create mode 100755 .local/bin/i3cmds/toggletouchpad create mode 100755 .local/bin/i3cmds/torwrap create mode 100755 .local/bin/i3cmds/tutorialvids create mode 100755 .local/bin/i3cmds/winresize create mode 100644 .local/bin/larbs.png create mode 100755 .local/bin/statusbar/battery create mode 100755 .local/bin/statusbar/clock create mode 100755 .local/bin/statusbar/cpu create mode 100755 .local/bin/statusbar/disk create mode 100755 .local/bin/statusbar/help create mode 100755 .local/bin/statusbar/internet create mode 100755 .local/bin/statusbar/iplocate create mode 100755 .local/bin/statusbar/mailbox create mode 100755 .local/bin/statusbar/memory create mode 100755 .local/bin/statusbar/mpdupdate create mode 100755 .local/bin/statusbar/music create mode 100755 .local/bin/statusbar/news create mode 100755 .local/bin/statusbar/pacpackages create mode 100755 .local/bin/statusbar/popupgrade create mode 100755 .local/bin/statusbar/torrent create mode 100755 .local/bin/statusbar/volume create mode 100755 .local/bin/statusbar/weather create mode 100755 .local/bin/tools/compiler create mode 100755 .local/bin/tools/dmenuhandler create mode 100755 .local/bin/tools/dmenupass create mode 120000 .local/bin/tools/ext create mode 100755 .local/bin/tools/extract create mode 100755 .local/bin/tools/getbib create mode 100755 .local/bin/tools/getkeys create mode 100755 .local/bin/tools/ifinstalled create mode 100755 .local/bin/tools/linkhandler create mode 100755 .local/bin/tools/lmc create mode 100755 .local/bin/tools/opout create mode 100755 .local/bin/tools/pauseallmpv create mode 100755 .local/bin/tools/podentr create mode 100755 .local/bin/tools/qndl create mode 100755 .local/bin/tools/queueandnotify create mode 100755 .local/bin/tools/remaps create mode 100755 .local/bin/tools/rotdir create mode 100755 .local/bin/tools/rssadd create mode 100755 .local/bin/tools/setbg create mode 100755 .local/bin/tools/shortcuts create mode 100755 .local/bin/tools/texclear create mode 100755 .local/bin/tools/transadd create mode 100755 .local/bin/tools/vifmimg create mode 100755 .local/bin/tools/vu create mode 100644 .local/bin/ttymaps.kmap create mode 100755 .local/bin/unix delete mode 100644 .scripts/SCRIPTS.md delete mode 100644 .scripts/cron/IMPORTANT_NOTE.md delete mode 100755 .scripts/cron/checkup delete mode 100755 .scripts/cron/cronbat delete mode 100755 .scripts/cron/crontog delete mode 100755 .scripts/cron/newsup delete mode 100755 .scripts/i3cmds/cabl delete mode 100755 .scripts/i3cmds/camtoggle delete mode 100755 .scripts/i3cmds/ddspawn delete mode 100755 .scripts/i3cmds/displayselect delete mode 100755 .scripts/i3cmds/dmenumount delete mode 100755 .scripts/i3cmds/dmenurecord delete mode 100755 .scripts/i3cmds/dmenuumount delete mode 100755 .scripts/i3cmds/dmenuunicode delete mode 100755 .scripts/i3cmds/dropdowncalc delete mode 100755 .scripts/i3cmds/ducksearch delete mode 100755 .scripts/i3cmds/hover delete mode 100755 .scripts/i3cmds/i3resize delete mode 100755 .scripts/i3cmds/killrecording delete mode 100755 .scripts/i3cmds/maimpick delete mode 100755 .scripts/i3cmds/prompt delete mode 100755 .scripts/i3cmds/samedir delete mode 100755 .scripts/i3cmds/showclip delete mode 100755 .scripts/i3cmds/td-toggle delete mode 100755 .scripts/i3cmds/tmuxdd delete mode 100755 .scripts/i3cmds/toggletouchpad delete mode 100755 .scripts/i3cmds/torwrap delete mode 100755 .scripts/i3cmds/tutorialvids delete mode 100755 .scripts/i3cmds/winresize delete mode 100644 .scripts/larbs.png delete mode 100755 .scripts/statusbar/battery delete mode 100755 .scripts/statusbar/clock delete mode 100755 .scripts/statusbar/cpu delete mode 100755 .scripts/statusbar/disk delete mode 100755 .scripts/statusbar/help delete mode 100755 .scripts/statusbar/internet delete mode 100755 .scripts/statusbar/iplocate delete mode 100755 .scripts/statusbar/mailbox delete mode 100755 .scripts/statusbar/memory delete mode 100755 .scripts/statusbar/mpdupdate delete mode 100755 .scripts/statusbar/music delete mode 100755 .scripts/statusbar/news delete mode 100755 .scripts/statusbar/pacpackages delete mode 100755 .scripts/statusbar/popupgrade delete mode 100755 .scripts/statusbar/torrent delete mode 100755 .scripts/statusbar/volume delete mode 100755 .scripts/statusbar/weather delete mode 100755 .scripts/tools/compiler delete mode 100755 .scripts/tools/dmenuhandler delete mode 100755 .scripts/tools/dmenupass delete mode 120000 .scripts/tools/ext delete mode 100755 .scripts/tools/extract delete mode 100755 .scripts/tools/getbib delete mode 100755 .scripts/tools/getkeys delete mode 100755 .scripts/tools/ifinstalled delete mode 100755 .scripts/tools/linkhandler delete mode 100755 .scripts/tools/lmc delete mode 100755 .scripts/tools/opout delete mode 100755 .scripts/tools/pauseallmpv delete mode 100755 .scripts/tools/podentr delete mode 100755 .scripts/tools/qndl delete mode 100755 .scripts/tools/queueandnotify delete mode 100755 .scripts/tools/remaps delete mode 100755 .scripts/tools/rotdir delete mode 100755 .scripts/tools/rssadd delete mode 100755 .scripts/tools/setbg delete mode 100755 .scripts/tools/shortcuts delete mode 100755 .scripts/tools/texclear delete mode 100755 .scripts/tools/transadd delete mode 100755 .scripts/tools/vifmimg delete mode 100755 .scripts/tools/vu delete mode 100644 .scripts/ttymaps.kmap delete mode 100755 .scripts/unix diff --git a/.config/bmdirs b/.config/bmdirs index f3e29be..24bdd21 100644 --- a/.config/bmdirs +++ b/.config/bmdirs @@ -6,5 +6,5 @@ m ~/Music pp ~/Pictures vv ~/Videos cf ~/.config -sc ~/.scripts +sc ~/.local/bin mn /mnt diff --git a/.config/i3blocks/config b/.config/i3blocks/config index 06edb86..393ea86 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -1,4 +1,4 @@ -command=~/.scripts/statusbar/$BLOCK_NAME +command=~/.local/bin/statusbar/$BLOCK_NAME separator_block_width=15 markup=pango diff --git a/.local/bin/SCRIPTS.md b/.local/bin/SCRIPTS.md new file mode 100644 index 0000000..08bca91 --- /dev/null +++ b/.local/bin/SCRIPTS.md @@ -0,0 +1,87 @@ +# Directory of Scripts + +I keep all my user-created scripts here in `~/.local/bin/`. Scripts are sorted +into sub-directories for easy management, and all are seamlessly added to +`$PATH` with the command below in `~/.profile`: + +``` +export PATH="$(du $HOME/.local/bin/ | cut -f2 | tr '\n' ':')$PATH" +``` + +## `statusbar/` + +For modules used in i3blocks. + +- `battery` -- i3blocks module. Shows available power remaining with icon indicating battery status. Colors indicate different levels of charge. +- `clock` -- Shows time and date. If clicked, brings up calender or coming calcuse events. +- `cpu` -- Shows CPU temperature. If clicked, shows most processor-intensive processes. +- `help` -- Module which appears as a question mark. Brings up readme if clicked. +- `internet` -- Shows whether machine is connected to wifi and ethernet. If clicked, brings up `nmtui`. +- `mailbox` -- i3blocks module for use with mutt-wizard. Shows unread mail and if `mailsync.sh` is running. +- `mem` -- Shows memory usage. If clicked, shows most memory-intensive processes. +- `music` -- i3blocks module. Shows current song; if paused, name will be grayed and italic. +- `mpdupdate` -- A daemon running by default that will update the i3mpd block on mpd change. +- `news` -- Shows unread newsboat articles. Brings up newsboat or refreshes RSS feeds. +- `pacpackages` -- i3blocks module. Detects new installable upgrades. Only works if you use cronjobs to automatically sync repositories. +- `popupgrade` -- Called by clicking on the update icon if there are new packages. Spawns a `yay` upgrade of the main Arch repos and AUR packages, updates the i3blocks module once complete. +- `torrent` -- i3blocks module. Shows torrents idle (βŒ›οΈ), downloading (⬇️) or finished (🌱). +- `volume` -- i3blocks module. Shows volume percentage or mute notification. +- `weather` -- i3blocks module. Gets weather forcast from wttr.in and returns today's precipitation chance (β˜”), daily low (❄️) and daily high (β˜€οΈ). + +## `cron/` + +For scripts meant to be cronjobs. None are active by default on LARBS. + +- `checkup` -- If connected to internet, syncs package repositories and downloads (but does not install) any potential updates. Gives `notify-send` notifications of when it is active since other `pacman` install commands cannot be run simultaneously. You may need to grant your user the ability to run `pacman -Syyuw --noconfirm` without a password (done in `/etc/sudoers`). +- `cronbat` -- Gives a dunst notification if the battery is less than 25%. +- `crontog` -- Not actually a cronjob, but just turns off/on all user cronjobs. +- `getforecast` -- Updates the weather forecast. This is automatically run by `weather` if there hasn't been a new forecast today. +- `newsup` -- Updates newsboat RSS feeds if connected to internet. Will also display a newspaper update icon on i3blocks if it has not be user disabled. + +## `tools/` + +Scripts intended to be run either manually by the user or linked to a shortcut +in vim or another program. + +- `compiler` -- Compiles a markdown, R markdown or LaTeX document with the approriate command. Will also run `make && sudo make install` if in a `config.h` file. Otherwise it will create a sent presentation. This can be thought of a general output handler. I have it bound to `c` in vim. +- `dmenuhandler` -- Give this script a url and it will offer dmenu options for opening it. Used by `newsboat` and some other programs as a link handler. +- `extract` -- Will detect file type of archive and run appropriate extraction command. +- `getbib` -- Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to search for the .pdf's DOI. Returns nothing if none detected. +- `getkeys` -- Get the LARBS documentation on what bindings exist for main programs. +- `linkhandler` -- The automatic link handler used by `newsboat` and other programs. Urls of video sites or of video files are opened in `mpv`, images are downloaded/opened in `feh`, music files are downloaded with `wget` and all other urls are opened in the default browser. +- `lmc` -- A music controller that simplifies music/audio management and improves the interface with i3blocks. Check inside to see what it does. This is what i3 audio/music commands run by default. If you use a difference music system or ALSA, you can change this script rather than changing all the shortcuts in different places. +- `note` -- Give this script some text/a message as an argument. It will print it to the terminal, and if `dunst` is running, display a notification. +- `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `p` in my vim config to reveal typical output. +- `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition. +- `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine. +- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files. +- `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`). +- `tpb` -- Search Pirate Bay for the certain search terms given as arguments. +- `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file. +- `transadd` -- The mimeapp default script for handling torrent magnet links. Starts `transmission-daemon` if not running and adds the link. + +## `i3cmds` + +These are scripts linked to bindings in i3. They typically perform +user-interface actions or involve dmenu. + +- `bottomleft` and `bottomright` -- Makes the currently selected window float in one of the bottom corners of the screen. `bottomleft` is bound to `mod+B` by default. +- `camtoggle` -- Starts/kills /dev/video0 webcam. Placed in bottom right by default. +- `ddspawn` -- This is the script called to create, show and hide the dropdown tmux terminal mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the script an argument that is a script the window will run. If a window does not already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its visibility. The the script itself for usage. +- `displayselect` -- Select which displays to use. Bound to `mod+F3`. +- `dmenumount` -- Gives a dmenu prompt for mounting USB drives or Android devices. Bound to `mod+F9`. Will do nothing if none are available. +- `dmenurecord` -- Gives a list of recording commands: `audio`, `video` and `screencast` (both) in dmenu for selection. Bound to `mod+PrintScreen` by default. Should be killed by `killrecording`. +- `dmenuumount` -- Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing if none are mounted. It will not try to unmount essential system partitions. +- `dmenuunicode` -- Shows a searchable dmenu prompt of emoji characters. The selected emoji is copied to the system clipboard, while its character code is copied to primary selection (middle mouse button). +- `dropdowncalc` -- The dropdown calculator script called by `ddspawn` and bound to `mod+a` by default. Will run an R calculator if installed, otherwise python. +- `ducksearch` -- Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc. +- `i3resize` -- A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`. +- `killrecording` -- End a recording started by `dmenurecord` the proper way without file trucation or lingering background processes, mapped to `mod+Delete` by default. +- `lockscreen` -- The screen locker. Gives a confirm prompt and if user says yes, all audio will be paused and the screen will be distorted and locked and screen will soon time out. User must insert password to unlock. Mapped to `mod+x` by default. +- `newspod` -- A silly line that has a script all to itself due to i3's idiosyncracies. Starts `newsboat`, if `newsboat` cannot open because of another instance being open, opens `podboat`. +- `prompt` -- Gives a Yes/No prompt to a question given as an argument. Used by numerous bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`. +- `samedir` -- Opens a terminal window in the same directory as the window currently selection. Bound to `mod+shift+enter`. +- `td-toggle` -- Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill it if it is. Obviously you need `transmission-cli` installed for this to work. Mapped to `mod+F7` by default. +- `tmuxdd` -- The startup script for the dropdown terminal (toggleable with `mod+u`). Either attaches to an existing tmux session or begins a new one. +- `toggletouchpad` -- As the name suggests, turns off TouchPad if on, and turns it on if off. Requires `xf86-input-synaptics`. If your laptop has a special button for this, it will be mapped by default. +- `tutorialvids` -- A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`. diff --git a/.local/bin/cron/IMPORTANT_NOTE.md b/.local/bin/cron/IMPORTANT_NOTE.md new file mode 100644 index 0000000..4568a77 --- /dev/null +++ b/.local/bin/cron/IMPORTANT_NOTE.md @@ -0,0 +1,11 @@ +# Important Note + +These cronjobs have components that require information about your current display to display notifications correctly. + +When you add them as cronjobs, I recommend you precede the command with commands as those below: + +``` +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.profile; then_command_goes_here +``` + +This ensures that notifications will display, xdotool commands will function and environmental varialbes will work as well. diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup new file mode 100755 index 0000000..0bda098 --- /dev/null +++ b/.local/bin/cron/checkup @@ -0,0 +1,18 @@ +#!/bin/sh +# Syncs repositories and downloads updates, meant to be run as a cronjob. + +ping -q -c 1 1.1.1.1 > /dev/null || exit + +notify-send "πŸ“¦ Repository Sync" "Checking for package updates..." + +sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. + +Check your internet connection, if pacman is already running, or run update manually to see errors." +pkill -RTMIN+8 i3blocks + +if pacman -Qu | grep -v "\[ignored\]" +then + notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (πŸ“¦) for update." +else + notify-send "πŸ“¦ Repository Sync" "Sync complete. No new packages for update." +fi diff --git a/.local/bin/cron/cronbat b/.local/bin/cron/cronbat new file mode 100755 index 0000000..c09ff42 --- /dev/null +++ b/.local/bin/cron/cronbat @@ -0,0 +1,8 @@ +#!/bin/sh +# Notify me with notify-send if my battery is below 25%. +# You can set this to run via cron. + +[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit +[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus && +notify-send -u critical "Battery critically low." diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog new file mode 100755 index 0000000..93c2d30 --- /dev/null +++ b/.local/bin/cron/crontog @@ -0,0 +1,5 @@ +#!/bin/sh +# Toggles all cronjobs off/on. +# Stores disabled crontabs in ~/.consaved until restored. + +([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "πŸ•“ Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "πŸ•“ Cronjobs saved and disabled.") diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup new file mode 100755 index 0000000..f894927 --- /dev/null +++ b/.local/bin/cron/newsup @@ -0,0 +1,16 @@ +#!/bin/sh +# Set as a cron job to check for new RSS entries for newsboat. +# If newsboat is open, sends it an "R" key to refresh. + +ping -q -c 1 1.1.1.1 > /dev/null || exit + +/usr/bin/notify-send "πŸ“° Updating RSS feeds..." + +pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit + +echo πŸ”ƒ > /tmp/newsupdate +pkill -RTMIN+6 i3blocks +/usr/bin/newsboat -x reload +rm -f /tmp/newsupdate +pkill -RTMIN+6 i3blocks +/usr/bin/notify-send "πŸ“° RSS feed update complete." diff --git a/.local/bin/i3cmds/cabl b/.local/bin/i3cmds/cabl new file mode 100755 index 0000000..b5b1b3f --- /dev/null +++ b/.local/bin/i3cmds/cabl @@ -0,0 +1,26 @@ +#!/bin/bash +# Dependencies are xclip and xorg-xprop. +# qrencode required for qrcode generation. +# groff/zathura required for man pages. +prim="$(xclip -o)"; [ -z "$prim" ] && exit + +PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) +PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') +cd "$(readlink /proc/"$PID"/cwd)" +[ -f "$prim" ] && xdg-open "$prim" && exit +[ -d "$prim" ] && "$TERMINAL" "$prim" && exit + +websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;} +wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;} +wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;} +maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;} +ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;} + +echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;} +echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;} +command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;} +man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;} + +func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)" + +[ -z "$func" ] || "$func" "$prim" diff --git a/.local/bin/i3cmds/camtoggle b/.local/bin/i3cmds/camtoggle new file mode 100755 index 0000000..05679c0 --- /dev/null +++ b/.local/bin/i3cmds/camtoggle @@ -0,0 +1,2 @@ +#!/bin/sh +pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0 diff --git a/.local/bin/i3cmds/ddspawn b/.local/bin/i3cmds/ddspawn new file mode 100755 index 0000000..d4a4034 --- /dev/null +++ b/.local/bin/i3cmds/ddspawn @@ -0,0 +1,19 @@ +#!/bin/sh + +# Toggle floating dropdown terminal in i3, or start if non-existing. +# $1 is the script run in the terminal. +# All other args are terminal settings. +# Terminal names are in dropdown_* to allow easily setting i3 settings. + +[ -z "$1" ] && exit + +script=$1 +shift +if xwininfo -tree -root | grep "(\"dropdown_$script\" "; +then + echo "Window detected." + i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center" +else + echo "Window not detected... spawning." + i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script" +fi diff --git a/.local/bin/i3cmds/displayselect b/.local/bin/i3cmds/displayselect new file mode 100755 index 0000000..e526014 --- /dev/null +++ b/.local/bin/i3cmds/displayselect @@ -0,0 +1,73 @@ +#!/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. +# I plan on adding a routine from multi-monitor setups later. + +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 + 1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; + 2) twoscreen ;; + *) morescreen ;; + esac ;} + +# Get all possible displays +allposs=$(xrandr -q | grep "connected") + +# Get all connected screens. +screens=$(echo "$allposs" | grep " connected" | awk '{print $1}') + +# 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 ;; + *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; +esac + +setbg # Fix background if screen size/arangement has changed. +remaps # Re-remap keys if keyboard added (for laptop bases) +pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen diff --git a/.local/bin/i3cmds/dmenumount b/.local/bin/i3cmds/dmenumount new file mode 100755 index 0000000..9129643 --- /dev/null +++ b/.local/bin/i3cmds/dmenumount @@ -0,0 +1,59 @@ +#!/bin/sh +# Gives a dmenu prompt to mount unmounted drives. +# If they're in /etc/fstab, they'll be mounted automatically. +# Otherwise, you'll be prompted to give a mountpoint from already existsing directories. +# If you input a novel directory, it will prompt you to create that directory. + +getmount() { \ + [ -z "$chosen" ] && exit 1 + mp="$(find $1 | dmenu -i -p "Type in mount point.")" + [ "$mp" = "" ] && exit 1 + 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 + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" + sudo -A mount "$chosen" && notify-send "πŸ’» USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";; + esac + notify-send "πŸ’» USB mounting" "$chosen mounted to $mp." + } + +mountandroid() { \ + chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1) + getmount "$HOME -maxdepth 3 -type d" + simple-mtpfs --device "$chosen" "$mp" + notify-send "πŸ€– Android Mounting" "Android device mounted to $mp." + } + +asktype() { \ + case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in + USB) mountusb ;; + Android) mountandroid ;; + esac + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')" + +if [ -z "$usbdrives" ]; then + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/.local/bin/i3cmds/dmenurecord b/.local/bin/i3cmds/dmenurecord new file mode 100755 index 0000000..0047e7a --- /dev/null +++ b/.local/bin/i3cmds/dmenurecord @@ -0,0 +1,105 @@ +#!/bin/sh + +# Usage: +# `record`: Ask for recording type via dmenu +# `record screencast`: Record both audio and screen +# `record video`: Record only screen +# `record audio`: Record only audio +# `record kill`: Kill existing recording +# +# If there is already a running instance, user will be prompted to end it. + +updateicon() { \ + echo "$1" > /tmp/recordingicon + pkill -RTMIN+9 i3blocks + } + +killrecording() { + recpid="$(cat /tmp/recordingpid)" + # kill with SIGTERM, allowing finishing touches. + kill -15 "$recpid" + rm -f /tmp/recordingpid + updateicon "" + pkill -RTMIN+9 i3blocks + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + kill -9 "$recpid" + exit + } + +screencast() { \ + ffmpeg -y \ + -f x11grab \ + -framerate 60 \ + -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ + -i :0.0 \ + -f alsa -i default \ + -r 30 \ + -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ + "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "βΊοΈπŸŽ™οΈ" + } + +video() { ffmpeg \ + -f x11grab \ + -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ + -i :0.0 \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "⏺️" + } + +webcamhidef() { ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 1920x1080 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "πŸŽ₯" + } + +webcam() { ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 640x480 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "πŸŽ₯" + } + + +audio() { \ + ffmpeg \ + -f alsa -i default \ + -c:a flac \ + "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & + echo $! > /tmp/recordingpid + updateicon "πŸŽ™οΈ" + } + +askrecording() { \ + choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") + case "$choice" in + screencast) screencast;; + audio) audio;; + video) video;; + webcam) webcam;; + "webcam (hi-def)") webcamhidef;; + esac + } + +asktoend() { \ + response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && + [ "$response" = "Yes" ] && killrecording + } + + +case "$1" in + screencast) screencast;; + audio) audio;; + video) video;; + kill) killrecording;; + *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; +esac diff --git a/.local/bin/i3cmds/dmenuumount b/.local/bin/i3cmds/dmenuumount new file mode 100755 index 0000000..dee53e7 --- /dev/null +++ b/.local/bin/i3cmds/dmenuumount @@ -0,0 +1,41 @@ +#!/bin/sh +# A dmenu prompt to unmount drives. +# 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?" | awk '{print $1}') + [ -z "$chosen" ] && exit + 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?") + [ -z "$chosen" ] && exit + sudo -A umount -l "$chosen" && notify-send "πŸ€– Android unmounting" "$chosen unmounted." + } + +asktype() { \ + case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in + USB) unmountusb ;; + Android) unmountandroid ;; + esac + } + +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') + +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 diff --git a/.local/bin/i3cmds/dmenuunicode b/.local/bin/i3cmds/dmenuunicode new file mode 100755 index 0000000..4abf202 --- /dev/null +++ b/.local/bin/i3cmds/dmenuunicode @@ -0,0 +1,18 @@ +#!/bin/sh +# Give dmenu list of all unicode characters to copy. +# Shows the selected character in dunst if running. + +# Must have xclip installed to even show menu. +xclip -h >/dev/null || exit + +chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18) + +[ "$chosen" != "" ] || exit + +c=$(echo "$chosen" | sed "s/ .*//") +echo "$c" | tr -d '\n' | xclip -selection clipboard +notify-send "'$c' copied to clipboard." & + +s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}') +echo "$s" | tr -d '\n' | xclip +notify-send "'$s' copied to primary." & diff --git a/.local/bin/i3cmds/dropdowncalc b/.local/bin/i3cmds/dropdowncalc new file mode 100755 index 0000000..4d41f88 --- /dev/null +++ b/.local/bin/i3cmds/dropdowncalc @@ -0,0 +1,2 @@ +#!/bin/sh +ifinstalled bc && echo "Welcome to the Calculator." && bc -lq diff --git a/.local/bin/i3cmds/ducksearch b/.local/bin/i3cmds/ducksearch new file mode 100755 index 0000000..7b5bca6 --- /dev/null +++ b/.local/bin/i3cmds/ducksearch @@ -0,0 +1,20 @@ +#!/bin/sh +# Gives a dmenu prompt to search DuckDuckGo. +# Without input, will open DuckDuckGo.com. +# URLs will be directly handed to the browser. +# Anything else, it search it. +browser=${BROWSER:-firefox} + +pgrep -x dmenu && exit + +choice=$(echo "πŸ¦†" | dmenu -i -p "Search DuckDuckGo:") || exit 1 + +if [ "$choice" = "πŸ¦†" ]; then + $browser "https://duckduckgo.com" +else + if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then + $browser "$choice" + else + $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" + fi +fi diff --git a/.local/bin/i3cmds/hover b/.local/bin/i3cmds/hover new file mode 100755 index 0000000..8d03a99 --- /dev/null +++ b/.local/bin/i3cmds/hover @@ -0,0 +1,14 @@ +#!/bin/sh +[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right +current=$(xdotool getwindowfocus) +newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) +newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) +xdotool windowsize "$current" $newheight $newwidth +newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') +newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") + +case "$1" in + left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; + right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; +esac +xdotool windowmove "$current" $horizontal $vertical diff --git a/.local/bin/i3cmds/i3resize b/.local/bin/i3cmds/i3resize new file mode 100755 index 0000000..11b0992 --- /dev/null +++ b/.local/bin/i3cmds/i3resize @@ -0,0 +1,27 @@ +#!/bin/sh +# This script was made by `goferito` on Github. +# Some cleanup by Luke. + +[ -z "$1" ] && echo "No direction provided" && exit 1 +distanceStr="2 px or 2 ppt" + +moveChoice() { + i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \ + i3-msg resize "$3" "$4" "$distanceStr" +} + +case $1 in + up) + moveChoice grow up shrink down + ;; + down) + moveChoice shrink up grow down + ;; + left) + moveChoice shrink right grow left + ;; + right) + moveChoice grow right shrink left + ;; +esac + diff --git a/.local/bin/i3cmds/killrecording b/.local/bin/i3cmds/killrecording new file mode 100755 index 0000000..ec9a698 --- /dev/null +++ b/.local/bin/i3cmds/killrecording @@ -0,0 +1,7 @@ +#!/bin/sh + +kill -9 "$(cat ~/.recordingpid)" + +# Update i3bar. +echo "" > ~/.recordingicon +pkill -RTMIN+9 i3blocks diff --git a/.local/bin/i3cmds/maimpick b/.local/bin/i3cmds/maimpick new file mode 100755 index 0000000..07d032f --- /dev/null +++ b/.local/bin/i3cmds/maimpick @@ -0,0 +1,9 @@ +#!/bin/sh +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 pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; + "current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; + "full screen") maim 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 ;; +esac diff --git a/.local/bin/i3cmds/prompt b/.local/bin/i3cmds/prompt new file mode 100755 index 0000000..56de2f8 --- /dev/null +++ b/.local/bin/i3cmds/prompt @@ -0,0 +1,7 @@ +#!/bin/sh +# A dmenu binary prompt script. +# Gives a dmenu prompt labeled with $1 to perform command $2. +# For example: +# `./prompt "Do you want to shutdown?" "shutdown -h now"` + +[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 diff --git a/.local/bin/i3cmds/samedir b/.local/bin/i3cmds/samedir new file mode 100755 index 0000000..88845fc --- /dev/null +++ b/.local/bin/i3cmds/samedir @@ -0,0 +1,5 @@ +#!/bin/sh +PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) +PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') +cd "$(readlink /proc/"$PID"/cwd)" +"$TERMINAL" diff --git a/.local/bin/i3cmds/showclip b/.local/bin/i3cmds/showclip new file mode 100755 index 0000000..d2faff8 --- /dev/null +++ b/.local/bin/i3cmds/showclip @@ -0,0 +1,10 @@ +#!/bin/sh + +# Display contents of selection via dunst if running. +# Separate script for i3. + +clip=$(xclip -o -selection clipboard) +prim=$(xclip -o -selection primary) + +[ -n "$clip" ] && notify-send "Clipboard:" "$clip" +[ -n "$prim" ] && notify-send "Primary:" "$prim" diff --git a/.local/bin/i3cmds/td-toggle b/.local/bin/i3cmds/td-toggle new file mode 100755 index 0000000..dc727b9 --- /dev/null +++ b/.local/bin/i3cmds/td-toggle @@ -0,0 +1,10 @@ +#!/bin/sh +# If transmission-daemon is running, will ask to kill, else will ask to start. +if pgrep -x transmission-da >/dev/null ; +then + [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed." +else + ifinstalled transmission-cli || exit + [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started." +fi +sleep 3 && pkill -RTMIN+7 i3blocks diff --git a/.local/bin/i3cmds/tmuxdd b/.local/bin/i3cmds/tmuxdd new file mode 100755 index 0000000..c194ff1 --- /dev/null +++ b/.local/bin/i3cmds/tmuxdd @@ -0,0 +1,4 @@ +#!/bin/sh +# This is the script that i3 runs to either start tmux in +# the dropdown terminal or log into a previous session. +tmux a || tmux diff --git a/.local/bin/i3cmds/toggletouchpad b/.local/bin/i3cmds/toggletouchpad new file mode 100755 index 0000000..6d8c9c8 --- /dev/null +++ b/.local/bin/i3cmds/toggletouchpad @@ -0,0 +1,4 @@ +#!/bin/sh +# Toggle touchpad. Requires xf86-input-synaptics. +(synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0)>/dev/null && echo "TouchPad reactivated." && exit +synclient TouchpadOff=1 && echo "TouchPad deactivated." diff --git a/.local/bin/i3cmds/torwrap b/.local/bin/i3cmds/torwrap new file mode 100755 index 0000000..04e7a51 --- /dev/null +++ b/.local/bin/i3cmds/torwrap @@ -0,0 +1,6 @@ +#!/bin/sh +ifinstalled transmission-remote-cli transmission-cli || exit + +! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks + +$TERMINAL -e transmission-remote-cli diff --git a/.local/bin/i3cmds/tutorialvids b/.local/bin/i3cmds/tutorialvids new file mode 100755 index 0000000..f1357eb --- /dev/null +++ b/.local/bin/i3cmds/tutorialvids @@ -0,0 +1,18 @@ +#!/bin/sh +vidlist=" +status bar https://www.youtube.com/watch?v=gKumet6b-WY +sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs +st (terminal) https://www.youtube.com/watch?v=9H75enWM22k +i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI +pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs +mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A +ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U +newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w +zathura (pdf viewer) https://www.youtube.com/watch?v=V_Iz4zdyRM4 +gpg keys https://www.youtube.com/watch?v=DMGIlj7u7Eo +calcurse (calendar) https://www.youtube.com/watch?v=hvc-pHjbhdE +urlview https://www.youtube.com/watch?v=IgzpAjFgbCw +colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE +vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E +" +echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv diff --git a/.local/bin/i3cmds/winresize b/.local/bin/i3cmds/winresize new file mode 100755 index 0000000..090bbf3 --- /dev/null +++ b/.local/bin/i3cmds/winresize @@ -0,0 +1,2 @@ +#!/bin/sh +echo "πŸ“" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)" diff --git a/.local/bin/larbs.png b/.local/bin/larbs.png new file mode 100644 index 0000000..0dbc687 Binary files /dev/null and b/.local/bin/larbs.png differ diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery new file mode 100755 index 0000000..25c9269 --- /dev/null +++ b/.local/bin/statusbar/battery @@ -0,0 +1,32 @@ +#!/bin/sh +# Give a battery name (e.g. BAT0) as an argument. + +case $BLOCK_BUTTON in + 3) pgrep -x dunst >/dev/null && notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging +πŸ›‘: not charging +β™»: stagnant charge +πŸ”Œ: charging +⚑: charged +❗: battery very low! +- Text color reflects charge left" ;; +esac + +capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit +status=$(cat /sys/class/power_supply/"$1"/status) + +if [ "$capacity" -ge 75 ]; then + color="#00ff00" +elif [ "$capacity" -ge 50 ]; then + color="#ffffff" +elif [ "$capacity" -ge 25 ]; then + color="#ffff00" +else + color="#ff0000" + warn="❗" +fi + +[ -z $warn ] && warn=" " + +[ "$status" = "Charging" ] && color="#ffffff" + +printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/πŸ”‹/;s/Not Charging/πŸ›‘/;s/Charging/πŸ”Œ/;s/Unknown/♻️/;s/Full/⚑/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock new file mode 100755 index 0000000..d6d54ef --- /dev/null +++ b/.local/bin/statusbar/clock @@ -0,0 +1,10 @@ +#!/bin/sh + +date '+%Y %b %d (%a) %I:%M%p' + +case $BLOCK_BUTTON in + 1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; + 2) "$TERMINAL" -e calcurse -D ~/.config/calcurse ;; + 3) pgrep -x dunst >/dev/null && notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" ;; +esac diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu new file mode 100755 index 0000000..3b1394a --- /dev/null +++ b/.local/bin/statusbar/cpu @@ -0,0 +1,10 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "πŸ–₯ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)" ;; + 3) notify-send "πŸ–₯ CPU module " "\- Shows CPU temperature. +- Click to show intensive processes. +- % is of single core." ;; +esac + +sensors | awk '/Core 0/ {print $3}' diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk new file mode 100755 index 0000000..d3dd07d --- /dev/null +++ b/.local/bin/statusbar/disk @@ -0,0 +1,18 @@ +#!/bin/sh + +# Status bar module for disk space +# $1 should be drive mountpoint +# $2 is optional icon, otherwise mountpoint will displayed + +[ -z "$1" ] && exit + +icon="$2" +[ -z "$2" ] && icon="$1" + +case $BLOCK_BUTTON in + 1) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk space" "$(df -h --output=target,used,size)" ;; + 3) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk module" "\- Shows used hard drive space. +- Click to show all disk info." ;; +esac + +printf "%s: %s" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.local/bin/statusbar/help b/.local/bin/statusbar/help new file mode 100755 index 0000000..4916d5c --- /dev/null +++ b/.local/bin/statusbar/help @@ -0,0 +1,7 @@ +#!/bin/sh +case $BLOCK_BUTTON in + 1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;; + 2) i3 restart ;; + 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide. +- Middle click to refresh i3.";; +esac; echo "❓" diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet new file mode 100755 index 0000000..1d2f2e8 --- /dev/null +++ b/.local/bin/statusbar/internet @@ -0,0 +1,17 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) $TERMINAL -e nmtui ;; + 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect +πŸ“‘: no wifi connection +πŸ“Ά: wifi connection with quality +❎: no ethernet +🌐: ethernet working +" ;; +esac + +[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="πŸ“‘" + +[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "πŸ“Ά", int($3 * 100 / 70) "%" }') + +printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate new file mode 100755 index 0000000..4ca4f10 --- /dev/null +++ b/.local/bin/statusbar/iplocate @@ -0,0 +1,9 @@ +#!/bin/sh + +# Gets your public ip address checks which country you are in and +# displays that information in the statusbar +# +# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ +ifinstalled "geoiplookup" || exit +addr="$(curl ifconfig.me 2>/dev/null)" || exit +grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox new file mode 100755 index 0000000..21c85ab --- /dev/null +++ b/.local/bin/statusbar/mailbox @@ -0,0 +1,16 @@ +#!/bin/sh + +# i3blocks mail module. +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e neomutt ;; + 2) setsid mailsync >/dev/null & ;; + 3) pgrep -x dunst >/dev/null && notify-send "πŸ“¬ Mail module" "\- Shows unread mail +- Shows πŸ”ƒ if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; +esac + +echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)" diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory new file mode 100755 index 0000000..dfd3d7b --- /dev/null +++ b/.local/bin/statusbar/memory @@ -0,0 +1,9 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs." ;; +esac + +free -h | awk '/^Mem:/ {print $3 "/" $2}' diff --git a/.local/bin/statusbar/mpdupdate b/.local/bin/statusbar/mpdupdate new file mode 100755 index 0000000..afe11bb --- /dev/null +++ b/.local/bin/statusbar/mpdupdate @@ -0,0 +1,8 @@ +#!/bin/sh +# Whenever the mpd state changes, update the mpd i3 module. +kill -0 "$(cat /tmp/mpdupdate)" 2>/dev/null && exit || echo $$ > /tmp/mpdupdate + +sleep 5 && while : ; do + pkill -RTMIN+11 i3blocks + mpc idle >/dev/null || exit +done diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music new file mode 100755 index 0000000..93c2c9c --- /dev/null +++ b/.local/bin/statusbar/music @@ -0,0 +1,18 @@ +#!/bin/sh + +filter() { + sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/g" + } + +case $BLOCK_BUTTON in + 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause + 2) mpc toggle | filter ;; # right click, pause/unpause + 3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "🎡 Music module" "\- Shows mpd song playing. +- Italic when paused. +- Left click opens ncmpcpp. +- Middle click pauses. +- Scroll changes track.";; # right click, pause/unpause + 4) mpc prev | filter ;; # scroll up, previous + 5) mpc next | filter ;; # scroll down, next + *) mpc status | filter ;; +esac; exit diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news new file mode 100755 index 0000000..b7ca1a7 --- /dev/null +++ b/.local/bin/statusbar/news @@ -0,0 +1,17 @@ +#!/bin/sh + +# i3blocks newsboat module. +# Displays number of unread news items and an loading icon if updating. +# When clicked, brings up `newsboat`. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e newsboat ;; + 2) setsid newsup >/dev/null & exit ;; + 3) pgrep -x dunst >/dev/null && notify-send "πŸ“° News module" "\- Shows unread news items +- Shows πŸ”ƒ if updating with \`newsup\` +- Left click opens newsboat +- Middle click syncs RSS feeds +Note: Only one instance of newsboat (including updates) may be running at a time." ;; +esac + + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages new file mode 100755 index 0000000..418bc2d --- /dev/null +++ b/.local/bin/statusbar/pacpackages @@ -0,0 +1,18 @@ +#!/bin/sh + +# i3blocks module for pacman upgrades. +# Displays number of upgradeable packages. +# For this to work, have a `pacman -Sy` command run in the background as a +# cronjob every so often as root. This script will then read those packages. +# When clicked, it will run an upgrade via pacman. + +case $BLOCK_BUTTON in + 1) $TERMINAL -e popupgrade ;; + 2) notify-send "$(/usr/bin/pacman -Qu)" ;; + 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "πŸ“¦: number of upgradable packages +- Left click to upgrade packages +- Middle click to show upgradable packages" ;; +esac + + +pacman -Qu | grep -v "\[ignored\]" | wc -l | sed -e "s/^0$//g" diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade new file mode 100755 index 0000000..83035c3 --- /dev/null +++ b/.local/bin/statusbar/popupgrade @@ -0,0 +1,9 @@ +#!/bin/sh + +printf "Beginning upgrade.\\n" + +yay -Syu +pkill -RTMIN+8 i3blocks + +printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" +read -r diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent new file mode 100755 index 0000000..0ab811c --- /dev/null +++ b/.local/bin/statusbar/torrent @@ -0,0 +1,28 @@ +#!/bin/sh + +transmission-remote -l | grep % | + sed " # This first sed command is to ensure a desirable order with sort + s/.*Stopped.*/A/g; + s/.*Seeding.*/Z/g; + s/.*100%.*/N/g; + s/.*Idle.*/B/g; + s/.*Uploading.*/L/g; + s/.*%.*/M/g" | + sort -h | uniq -c | sed " # Now we replace the standin letters with icons. + s/A/πŸ›‘/g; + s/B/βŒ›οΈ/g; + s/L/πŸ”Ό/g; + s/M/πŸ”½/g; + s/N/βœ…/g; + s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g" + +case $BLOCK_BUTTON in + 1) $TERMINAL -e transmission-remote-cli ;; + 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "πŸ›‘: paused +⏳: idle (seeds needed) +πŸ”Ό: uploading (unfinished) +πŸ”½: downloading +βœ…: done +🌱: done and seeding" ;; +esac + diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume new file mode 100755 index 0000000..3bbb32b --- /dev/null +++ b/.local/bin/statusbar/volume @@ -0,0 +1,25 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e pulsemixer & ;; + 2) pulsemixer --toggle-mute ;; + 4) pulsemixer --change-volume +5 ;; + 5) pulsemixer --change-volume -5 ;; + 3) pgrep -x dunst >/dev/null && notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. +- Middle click to mute. +- Scroll to change." +esac + +[ "$(pulsemixer --get-mute)" = "1" ] && printf "πŸ”‡\\n" && exit + +vol=$(pulsemixer --get-volume | awk '{print $1}') + +if [ "$vol" -gt "70" ]; then + icon="πŸ”Š" +elif [ "$vol" -lt "30" ]; then + icon="πŸ”ˆ" +else + icon="πŸ”‰" +fi + +printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather new file mode 100755 index 0000000..e4de680 --- /dev/null +++ b/.local/bin/statusbar/weather @@ -0,0 +1,23 @@ +#!/bin/sh +location="$1"; [ -z "$location" ] || { location="$location+" && rm -f "$HOME/.local/share/weatherreport" ;} + +getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 +curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" || exit 1 ;} + +showweather() { printf "%s" "$(sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/β˜” /g" | tr -d '\n')" +sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "Β°","🌞",$2 "Β°"}' ;} + +case $BLOCK_BUTTON in + 1) $TERMINAL -e less -S "$HOME/.local/share/weatherreport" ;; + 2) getforecast && showweather ;; + 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +β˜”: Chance of rain/snow +❄: Daily low +🌞: Daily high" ;; +esac + +if [ "$(stat -c %y "$HOME/.local/share/weatherreport" >/dev/null 2>&1 | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] + then getforecast && showweather + else showweather +fi diff --git a/.local/bin/tools/compiler b/.local/bin/tools/compiler new file mode 100755 index 0000000..7d3bf1d --- /dev/null +++ b/.local/bin/tools/compiler @@ -0,0 +1,37 @@ +#!/bin/sh +# This script will compile or run another finishing operation on a document. I +# have this script run via vim. +# +# Compiles .tex. groff (.mom, .ms), .rmd, .md. +# Opens .sent files as sent presentations. +# Runs scripts based on extention or shebang + +file=$(readlink -f "$1") +dir=$(dirname "$file") +base="${file%.*}" + +cd "$dir" || exit + +textype() { \ + command="pdflatex" + ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" + $command --output-directory="$dir" "$base" && + grep -i addbibresource "$file" >/dev/null && + biber --input-directory "$dir" "$base" && + $command --output-directory="$dir" "$base" && + $command --output-directory="$dir" "$base" + } + +case "$file" in + *\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; + *\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;; + *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;; + *\.tex) textype "$file" ;; + *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; + *config.h) sudo make install ;; + *\.c) cc "$file" -o "$base" && "$base" ;; + *\.py) python "$file" ;; + *\.go) go run "$file" ;; + *\.sent) setsid sent "$file" 2>/dev/null & ;; + *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; +esac diff --git a/.local/bin/tools/dmenuhandler b/.local/bin/tools/dmenuhandler new file mode 100755 index 0000000..391bdc1 --- /dev/null +++ b/.local/bin/tools/dmenuhandler @@ -0,0 +1,15 @@ +#!/bin/sh +# Feed this script a link and it will give dmenu +# some choice programs to use to open it. + +case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in + "copy url") echo "$1" | xclip -selection clipboard ;; + mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; + "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;; + "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; + "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; + browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; + feh) setsid feh "$1" >/dev/null 2>&1 & ;; + w3m) w3m "$1" >/dev/null 2>&1 ;; + "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; +esac diff --git a/.local/bin/tools/dmenupass b/.local/bin/tools/dmenupass new file mode 100755 index 0000000..4fc464f --- /dev/null +++ b/.local/bin/tools/dmenupass @@ -0,0 +1,2 @@ +#!/bin/sh +dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo diff --git a/.local/bin/tools/ext b/.local/bin/tools/ext new file mode 120000 index 0000000..562d2b3 --- /dev/null +++ b/.local/bin/tools/ext @@ -0,0 +1 @@ +extract \ No newline at end of file diff --git a/.local/bin/tools/extract b/.local/bin/tools/extract new file mode 100755 index 0000000..a63ab10 --- /dev/null +++ b/.local/bin/tools/extract @@ -0,0 +1,41 @@ +#!/bin/sh +# A general, all-purpose extraction script. +# +# Default behavior: Extract archive into new directory +# Behavior with `-c` option: Extract contents into current directory + +while getopts "hc" o; do case "${o}" in + c) extracthere="True" ;; + *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;; +esac done + +if [ -z "$extracthere" ]; then + archive="$(readlink -f "$*")" && + directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && + mkdir -p "$directory" && + cd "$directory" || exit +else + archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")" +fi + +[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit + +if [ -f "$archive" ] ; then + case "$archive" in + *.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;; + *.tar.gz|*.tgz) tar xvzf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac +else + printf "File \"%s\" not found.\\n" "$archive" +fi diff --git a/.local/bin/tools/getbib b/.local/bin/tools/getbib new file mode 100755 index 0000000..ed441c5 --- /dev/null +++ b/.local/bin/tools/getbib @@ -0,0 +1,14 @@ +#!/bin/sh +[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit + +if [ -f "$1" ]; then + # Try to get DOI from pdfinfo or pdftotext output. + doi=$(pdfinfo "$1" | grep -io "doi:.*") || + doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) || + exit 1 +else + doi="$1" +fi + +# Check crossref.org for the bib citation. +curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" diff --git a/.local/bin/tools/getkeys b/.local/bin/tools/getkeys new file mode 100755 index 0000000..444f4c0 --- /dev/null +++ b/.local/bin/tools/getkeys @@ -0,0 +1,4 @@ +#!/bin/sh +cat ~/.config/getkeys/"$1" 2>/dev/null && exit +echo "Run command with one of the following arguments for info about that program:" +ls ~/.config/getkeys diff --git a/.local/bin/tools/ifinstalled b/.local/bin/tools/ifinstalled new file mode 100755 index 0000000..b0d23e5 --- /dev/null +++ b/.local/bin/tools/ifinstalled @@ -0,0 +1,3 @@ +#!/bin/sh +# If $1 command is not available, error code and notify. +command -v "$1" >/dev/null || { notify-send "πŸ“¦ $1" "must be installed for this function." && exit 1 ;} diff --git a/.local/bin/tools/linkhandler b/.local/bin/tools/linkhandler new file mode 100755 index 0000000..c616d04 --- /dev/null +++ b/.local/bin/tools/linkhandler @@ -0,0 +1,22 @@ +#!/bin/sh + +# Feed script a url or file location. +# If an image, it will view in sxiv, +# if a video or gif, it will view in mpv +# 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; } + +case "$1" in + *mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*) + setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;; + *png|*jpg|*jpe|*jpeg|*gif) + curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; + *mp3|*flac|*opus|*mp3?source*) + setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; + *) + if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" + else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;; +esac diff --git a/.local/bin/tools/lmc b/.local/bin/tools/lmc new file mode 100755 index 0000000..18cf2c2 --- /dev/null +++ b/.local/bin/tools/lmc @@ -0,0 +1,42 @@ +#!/bin/sh +# A general audio interface for LARBS. + +[ -z "$2" ] && num="2" || num="$2" + +case "$1" in + u*) pulsemixer --change-volume +"$num" ;; + d*) pulsemixer --change-volume -"$num" ;; + m*) pulsemixer --toggle-mute ;; + truemute) pulsemixer --mute ;; + play) mpc play ;; + n*) mpc next ;; + prev) mpc prev ;; + t*) mpc toggle ;; + p*) mpc pause ; pauseallmpv ;; + f*) mpc seek +"$num" ;; + b*) mpc seek -"$num" ;; + r*) mpc seek 0% ;; + *) cat << EOF +lmc: cli music interface for mpd and pulse for those with divine intellect too +grand to remember the mpc/pamixer commands. + +Allowed options: + up NUM Increase volume (2 secs default) + down NUM Decrease volume (2 secs default) + mute Toggle mute + truemute Mute + next Next track + prev Previous track + toggle Toggle pause + truepause Pause + foward NUM Seek foward in song (2 secs default) + back NUM Seek back in song (2 secs default) + restart Restart current song + all else Print this message + +All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated, +i.e. \`lmc r\` for \`lmc restart\`. +EOF +esac + +pkill -RTMIN+10 i3blocks diff --git a/.local/bin/tools/opout b/.local/bin/tools/opout new file mode 100755 index 0000000..c742aa9 --- /dev/null +++ b/.local/bin/tools/opout @@ -0,0 +1,11 @@ +#!/bin/sh +# opout: "open output": A general handler for opening a file's intended output. +# I find this useful especially running from vim. + +basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" + +case "$1" in + *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;; + *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;; + *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; +esac diff --git a/.local/bin/tools/pauseallmpv b/.local/bin/tools/pauseallmpv new file mode 100755 index 0000000..c5da220 --- /dev/null +++ b/.local/bin/tools/pauseallmpv @@ -0,0 +1,4 @@ +#!/bin/sh +for i in $(ls /tmp/mpvsoc*); do + echo '{ "command": ["set_property", "pause", true] }' | socat - $i; +done diff --git a/.local/bin/tools/podentr b/.local/bin/tools/podentr new file mode 100755 index 0000000..13ab4a8 --- /dev/null +++ b/.local/bin/tools/podentr @@ -0,0 +1,6 @@ +#!/bin/sh +# entr command to run `queueandnotify` when newsboat queue is changed + +[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit + +echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null diff --git a/.local/bin/tools/qndl b/.local/bin/tools/qndl new file mode 100755 index 0000000..a99d37e --- /dev/null +++ b/.local/bin/tools/qndl @@ -0,0 +1,11 @@ +#!/bin/sh +# $1 is a url; $2 is a command +[ -z "$1" ] && exit +base="$(basename "$1")" +notify-send "⏳ Queuing $base..." +cmd="$2" +[ -z "$cmd" ] && cmd="youtube-dl --add-metadata" +idnum="$(tsp $cmd "$1")" +realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" +tsp -D "$idnum" mv "$base" "$realname" +tsp -D "$idnum" notify-send "πŸ‘ $realname done." diff --git a/.local/bin/tools/queueandnotify b/.local/bin/tools/queueandnotify new file mode 100755 index 0000000..a1417ec --- /dev/null +++ b/.local/bin/tools/queueandnotify @@ -0,0 +1,13 @@ +#!/bin/sh +# Podboat sucks. This script replaces it. +# It reads the newsboat queue, queuing downloads with taskspooler. +# It also removes the junk from extentions. +queuefile="$HOME/.local/share/newsboat/queue" + +while read -r line; do + [ -z "$line" ] && continue + url="$(echo "$line" | awk '{print $1}')" + qndl "$url" "curl -LO" +done < "$queuefile" + +echo > "$queuefile" diff --git a/.local/bin/tools/remaps b/.local/bin/tools/remaps new file mode 100755 index 0000000..df7d6c9 --- /dev/null +++ b/.local/bin/tools/remaps @@ -0,0 +1,10 @@ +#!/bin/sh +# This script is called by i3 on startup to remap keys. +# Increase key speed via a rate change +xset r rate 300 50 +# Map the caps lock key to super... +setxkbmap -option caps:super +# But when it is pressed only once, treat it as escape. +killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' +# Map the menu button to right super as well. +xmodmap -e 'keycode 135 = Super_R' diff --git a/.local/bin/tools/rotdir b/.local/bin/tools/rotdir new file mode 100755 index 0000000..e7103db --- /dev/null +++ b/.local/bin/tools/rotdir @@ -0,0 +1,4 @@ +#!/bin/sh +[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 +base="$(basename $1)" + ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }" diff --git a/.local/bin/tools/rssadd b/.local/bin/tools/rssadd new file mode 100755 index 0000000..8822fc5 --- /dev/null +++ b/.local/bin/tools/rssadd @@ -0,0 +1,9 @@ +#!/bin/sh +! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null && + notify-send "That doesn't look like a full URL." && exit +RSSFILE="$HOME/.config/newsboat/urls" +if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then + notify-send "You already have this RSS feed." +else + echo "$1" >> "$RSSFILE" && notify-send "RSS feed added." +fi diff --git a/.local/bin/tools/setbg b/.local/bin/tools/setbg new file mode 100755 index 0000000..950ae7c --- /dev/null +++ b/.local/bin/tools/setbg @@ -0,0 +1,4 @@ +#!/bin/sh +# Sets the background. If given an argument, will set file as background. +[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." +xwallpaper --zoom ~/.config/wall.png diff --git a/.local/bin/tools/shortcuts b/.local/bin/tools/shortcuts new file mode 100755 index 0000000..1c4f278 --- /dev/null +++ b/.local/bin/tools/shortcuts @@ -0,0 +1,26 @@ +#!/bin/bash +# Output locations. Unactivated progs should go to /dev/null. +shell_shortcuts="$HOME/.config/shortcutrc" +ranger_shortcuts="/dev/null" +qute_shortcuts="/dev/null" +fish_shortcuts="/dev/null" +vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts" + +# Remove, prepare files +rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null +printf "# vim: filetype=sh\\n" > "$fish_shortcuts" +printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" +printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" + +# Format the `bmdirs` file in the correct syntax and sent it to all three configs. +sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ + >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ + >(awk '{print "map g" $1, ":cd", $2 "\nmap t" $1, ":cd", $2 "\nmap M" $1, ":cd", $2 ":mo\nmap Y" $1, ":cd", $2 ":co" }' >> "$vifm_shortcuts") \ + >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \ + | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" + +# Format the `configs` file in the correct syntax and sent it to both configs. +sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ + >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ + >(awk '{print "map", $1, ":e", $2 "" }' >> "$vifm_shortcuts") \ + | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" diff --git a/.local/bin/tools/texclear b/.local/bin/tools/texclear new file mode 100755 index 0000000..f6a5062 --- /dev/null +++ b/.local/bin/tools/texclear @@ -0,0 +1,14 @@ +#!/bin/sh + +# Clears the build files of a LaTeX/XeLaTeX build. +# I have vim run this file whenever I exit a .tex file. + +case "$1" in + *.tex) + file=$(readlink -f "$1") + dir=$(dirname "$file") + base="${file%.*}" + find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;; + *) printf "Give .tex file as argument.\\n" ;; +esac + diff --git a/.local/bin/tools/transadd b/.local/bin/tools/transadd new file mode 100755 index 0000000..ad2ee7f --- /dev/null +++ b/.local/bin/tools/transadd @@ -0,0 +1,9 @@ +#!/bin/sh + +# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. + +# transmission-daemon sometimes fails to take remote requests in its first moments. + +pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks) + +transmission-remote -a "$@" && notify-send "πŸ”½ Torrent added." diff --git a/.local/bin/tools/vifmimg b/.local/bin/tools/vifmimg new file mode 100755 index 0000000..1569962 --- /dev/null +++ b/.local/bin/tools/vifmimg @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +[ -z "$FIFO_UEBERZUG" ] && exit + +readonly ID_PREVIEW="preview" + +if [ "$1" = "draw" ]; then + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG" +elif [ "$1" = "videopreview" ]; then + [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 && + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG" +else + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG" +fi diff --git a/.local/bin/tools/vu b/.local/bin/tools/vu new file mode 100755 index 0000000..778835a --- /dev/null +++ b/.local/bin/tools/vu @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" + +cleanup() { + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ 2>/dev/null +} + +rm "$FIFO_UEBERZUG" 2>/dev/null +mkfifo "$FIFO_UEBERZUG" +trap cleanup EXIT +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & + +vifm +cleanup diff --git a/.local/bin/ttymaps.kmap b/.local/bin/ttymaps.kmap new file mode 100644 index 0000000..51a7042 --- /dev/null +++ b/.local/bin/ttymaps.kmap @@ -0,0 +1,2 @@ +keycode 1 = Caps_Lock +keycode 58 = Escape diff --git a/.local/bin/unix b/.local/bin/unix new file mode 100755 index 0000000..14d7ef0 --- /dev/null +++ b/.local/bin/unix @@ -0,0 +1,25 @@ +#!/bin/sh +#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes +#converted to shell by #nixers @ irc.unix.chat + +cat << 'eof' + ,_ ,_==β–„β–‚ + , β–‚β–ƒβ–„β–„β–…β–…β–…β–‚β–…ΒΎ. / / + β–„β–†<Β΄ "Β»β–“β–“β–“%\ / / / / + ,β–…7" Β΄>β–“β–“β–“% / / > / >/% + ▐ΒΆβ–“ ,Β»β–“β–“ΒΎΒ΄ /> %/%// / / + β–“β–ƒβ–…β–…β–…β–ƒ,,β–„β–…β–…β–…Γ†\// ///>// />/ / + V║«¼.;β†’ β•‘<Β«.,`=// />//%/% / / + //β• <Β΄ -Β²,)(β–“~"-╝/ΒΎ/ %/>/ /> + / / / ▐% -./β–„β–ƒβ–„β–…▐, /7//;//% / / + / ////`β–Œ▐ %zWv xXβ–“β–‡β–Œ//&;% / / + / / / %//%/ΒΎΒ½Β΄β–Œβ–ƒβ–„β–„β–„β–„β–ƒβ–ƒ▐ΒΆ\/& / + </ /)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A + / /</ //<///<_/%\β–“ V%W%Β£)XY _/%β€Ύ\_, GENIUS TO UNDERSTAND ITS SIMPLICITY + / / //%/_,=--^/%/%%\ΒΎ%ΒΆ%%} /%%%%%%;\, + %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ + / / %%%%%%;, \%%l%%;// _/%;, dmr + / %%%;, <;\-=-/ / + ;, l +eof \ No newline at end of file diff --git a/.local/share/larbs/readme.mom b/.local/share/larbs/readme.mom index 9ba7452..62bc06e 100644 --- a/.local/share/larbs/readme.mom +++ b/.local/share/larbs/readme.mom @@ -70,7 +70,7 @@ but you can also hold it down and it will act as another Windows/super/mod key. The menu button (usually between the right Alt and Ctrl) is an alternative Super/Mod button. This is to make one-handing on laptops easier. .LIST OFF -If you'd like to change any of these keyboard changes, you need only open and change \f(CW~/.scripts/tools/remaps\fP. +If you'd like to change any of these keyboard changes, you need only open and change \f(CW~/.local/bin/tools/remaps\fP. Actually, this should go without saying, but \fIeverything\fP here can easily be changed. .PP Additionally, while this isn't a part of i3, the default editing mode in the shell is using vi bindings. @@ -91,8 +91,8 @@ If you just want black and white icons, you should actually just be able to unin .PP The i3blocks config is \f(CW~/.config/i3blocks/config\fP, which you can access by the terminal shortcut \f(CWcfB\fP. Notice that the config file refers to several module -scripts in the \f(CW~/.scripts/\fP directory. You can read a summary of all of these -scripts in the file \f(CW~/.scripts/SCRIPTS.md\fP. +scripts in the \f(CW~/.local/bin/\fP directory. You can read a summary of all of these +scripts in the file \f(CW~/.local/bin/SCRIPTS.md\fP. .HEADING 2 "Deeper Tutorials" .PP In addition to this guide and reading the dotfiles of programs manually, you @@ -338,7 +338,7 @@ Note that it is your responsibility to ensure that none of the bindings you add .HEADING 1 "Frequently Asked Questions (FAQs)" .HEADING 2 "My keyboard isn't working as expected!" .PP -LARBS runs some custom keyboard settings in \f(CW~/.scripts/tools/remaps\fP. +LARBS runs some custom keyboard settings in \f(CW~/.local/bin/tools/remaps\fP. These settings may override your preferred settings, so you should open this file and comment out troublesome lines if you have issues. .HEADING 2 "My audio isn't working!" .PP diff --git a/.profile b/.profile index de47a18..dde6b15 100644 --- a/.profile +++ b/.profile @@ -2,7 +2,7 @@ # Profile file. Runs on login. # Adds `~/.scripts` and all subdirectories to $PATH -export PATH="$PATH:$(du "$HOME/.scripts/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" +export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')" export EDITOR="nvim" export TERMINAL="st" export BROWSER="firefox" @@ -10,7 +10,7 @@ export READER="zathura" export FILE="vifm" export BIB="$HOME/Documents/LaTeX/uni.bib" export REFER="$HOME/Documents/referbib" -export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass" +export SUDO_ASKPASS="$HOME/.local/bin/tools/dmenupass" export NOTMUCH_CONFIG="$HOME/.config/notmuch-config" export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" @@ -32,4 +32,4 @@ echo "$0" | grep "bash$" >/dev/null && [ -f ~/.bashrc ] && source "$HOME/.bashrc [ "$(tty)" = "/dev/tty1" ] && ! pgrep -x i3 >/dev/null && exec startx # Switch escape and caps if tty: -sudo -n loadkeys ~/.scripts/ttymaps.kmap 2>/dev/null +sudo -n loadkeys ~/.local/bin/ttymaps.kmap 2>/dev/null diff --git a/.scripts/SCRIPTS.md b/.scripts/SCRIPTS.md deleted file mode 100644 index a99e35e..0000000 --- a/.scripts/SCRIPTS.md +++ /dev/null @@ -1,87 +0,0 @@ -# Directory of Scripts - -I keep all my user-created scripts here in `~/.scripts/`. Scripts are sorted -into sub-directories for easy management, and all are seamlessly added to -`$PATH` with the command below in `~/.profile`: - -``` -export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH" -``` - -## `statusbar/` - -For modules used in i3blocks. - -- `battery` -- i3blocks module. Shows available power remaining with icon indicating battery status. Colors indicate different levels of charge. -- `clock` -- Shows time and date. If clicked, brings up calender or coming calcuse events. -- `cpu` -- Shows CPU temperature. If clicked, shows most processor-intensive processes. -- `help` -- Module which appears as a question mark. Brings up readme if clicked. -- `internet` -- Shows whether machine is connected to wifi and ethernet. If clicked, brings up `nmtui`. -- `mailbox` -- i3blocks module for use with mutt-wizard. Shows unread mail and if `mailsync.sh` is running. -- `mem` -- Shows memory usage. If clicked, shows most memory-intensive processes. -- `music` -- i3blocks module. Shows current song; if paused, name will be grayed and italic. -- `mpdupdate` -- A daemon running by default that will update the i3mpd block on mpd change. -- `news` -- Shows unread newsboat articles. Brings up newsboat or refreshes RSS feeds. -- `pacpackages` -- i3blocks module. Detects new installable upgrades. Only works if you use cronjobs to automatically sync repositories. -- `popupgrade` -- Called by clicking on the update icon if there are new packages. Spawns a `yay` upgrade of the main Arch repos and AUR packages, updates the i3blocks module once complete. -- `torrent` -- i3blocks module. Shows torrents idle (βŒ›οΈ), downloading (⬇️) or finished (🌱). -- `volume` -- i3blocks module. Shows volume percentage or mute notification. -- `weather` -- i3blocks module. Gets weather forcast from wttr.in and returns today's precipitation chance (β˜”), daily low (❄️) and daily high (β˜€οΈ). - -## `cron/` - -For scripts meant to be cronjobs. None are active by default on LARBS. - -- `checkup` -- If connected to internet, syncs package repositories and downloads (but does not install) any potential updates. Gives `notify-send` notifications of when it is active since other `pacman` install commands cannot be run simultaneously. You may need to grant your user the ability to run `pacman -Syyuw --noconfirm` without a password (done in `/etc/sudoers`). -- `cronbat` -- Gives a dunst notification if the battery is less than 25%. -- `crontog` -- Not actually a cronjob, but just turns off/on all user cronjobs. -- `getforecast` -- Updates the weather forecast. This is automatically run by `weather` if there hasn't been a new forecast today. -- `newsup` -- Updates newsboat RSS feeds if connected to internet. Will also display a newspaper update icon on i3blocks if it has not be user disabled. - -## `tools/` - -Scripts intended to be run either manually by the user or linked to a shortcut -in vim or another program. - -- `compiler` -- Compiles a markdown, R markdown or LaTeX document with the approriate command. Will also run `make && sudo make install` if in a `config.h` file. Otherwise it will create a sent presentation. This can be thought of a general output handler. I have it bound to `c` in vim. -- `dmenuhandler` -- Give this script a url and it will offer dmenu options for opening it. Used by `newsboat` and some other programs as a link handler. -- `extract` -- Will detect file type of archive and run appropriate extraction command. -- `getbib` -- Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to search for the .pdf's DOI. Returns nothing if none detected. -- `getkeys` -- Get the LARBS documentation on what bindings exist for main programs. -- `linkhandler` -- The automatic link handler used by `newsboat` and other programs. Urls of video sites or of video files are opened in `mpv`, images are downloaded/opened in `feh`, music files are downloaded with `wget` and all other urls are opened in the default browser. -- `lmc` -- A music controller that simplifies music/audio management and improves the interface with i3blocks. Check inside to see what it does. This is what i3 audio/music commands run by default. If you use a difference music system or ALSA, you can change this script rather than changing all the shortcuts in different places. -- `note` -- Give this script some text/a message as an argument. It will print it to the terminal, and if `dunst` is running, display a notification. -- `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `p` in my vim config to reveal typical output. -- `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition. -- `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine. -- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files. -- `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`). -- `tpb` -- Search Pirate Bay for the certain search terms given as arguments. -- `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file. -- `transadd` -- The mimeapp default script for handling torrent magnet links. Starts `transmission-daemon` if not running and adds the link. - -## `i3cmds` - -These are scripts linked to bindings in i3. They typically perform -user-interface actions or involve dmenu. - -- `bottomleft` and `bottomright` -- Makes the currently selected window float in one of the bottom corners of the screen. `bottomleft` is bound to `mod+B` by default. -- `camtoggle` -- Starts/kills /dev/video0 webcam. Placed in bottom right by default. -- `ddspawn` -- This is the script called to create, show and hide the dropdown tmux terminal mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the script an argument that is a script the window will run. If a window does not already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its visibility. The the script itself for usage. -- `displayselect` -- Select which displays to use. Bound to `mod+F3`. -- `dmenumount` -- Gives a dmenu prompt for mounting USB drives or Android devices. Bound to `mod+F9`. Will do nothing if none are available. -- `dmenurecord` -- Gives a list of recording commands: `audio`, `video` and `screencast` (both) in dmenu for selection. Bound to `mod+PrintScreen` by default. Should be killed by `killrecording`. -- `dmenuumount` -- Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing if none are mounted. It will not try to unmount essential system partitions. -- `dmenuunicode` -- Shows a searchable dmenu prompt of emoji characters. The selected emoji is copied to the system clipboard, while its character code is copied to primary selection (middle mouse button). -- `dropdowncalc` -- The dropdown calculator script called by `ddspawn` and bound to `mod+a` by default. Will run an R calculator if installed, otherwise python. -- `ducksearch` -- Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc. -- `i3resize` -- A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`. -- `killrecording` -- End a recording started by `dmenurecord` the proper way without file trucation or lingering background processes, mapped to `mod+Delete` by default. -- `lockscreen` -- The screen locker. Gives a confirm prompt and if user says yes, all audio will be paused and the screen will be distorted and locked and screen will soon time out. User must insert password to unlock. Mapped to `mod+x` by default. -- `newspod` -- A silly line that has a script all to itself due to i3's idiosyncracies. Starts `newsboat`, if `newsboat` cannot open because of another instance being open, opens `podboat`. -- `prompt` -- Gives a Yes/No prompt to a question given as an argument. Used by numerous bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`. -- `samedir` -- Opens a terminal window in the same directory as the window currently selection. Bound to `mod+shift+enter`. -- `td-toggle` -- Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill it if it is. Obviously you need `transmission-cli` installed for this to work. Mapped to `mod+F7` by default. -- `tmuxdd` -- The startup script for the dropdown terminal (toggleable with `mod+u`). Either attaches to an existing tmux session or begins a new one. -- `toggletouchpad` -- As the name suggests, turns off TouchPad if on, and turns it on if off. Requires `xf86-input-synaptics`. If your laptop has a special button for this, it will be mapped by default. -- `tutorialvids` -- A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`. diff --git a/.scripts/cron/IMPORTANT_NOTE.md b/.scripts/cron/IMPORTANT_NOTE.md deleted file mode 100644 index 4568a77..0000000 --- a/.scripts/cron/IMPORTANT_NOTE.md +++ /dev/null @@ -1,11 +0,0 @@ -# Important Note - -These cronjobs have components that require information about your current display to display notifications correctly. - -When you add them as cronjobs, I recommend you precede the command with commands as those below: - -``` -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.profile; then_command_goes_here -``` - -This ensures that notifications will display, xdotool commands will function and environmental varialbes will work as well. diff --git a/.scripts/cron/checkup b/.scripts/cron/checkup deleted file mode 100755 index 0bda098..0000000 --- a/.scripts/cron/checkup +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Syncs repositories and downloads updates, meant to be run as a cronjob. - -ping -q -c 1 1.1.1.1 > /dev/null || exit - -notify-send "πŸ“¦ Repository Sync" "Checking for package updates..." - -sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. - -Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 i3blocks - -if pacman -Qu | grep -v "\[ignored\]" -then - notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (πŸ“¦) for update." -else - notify-send "πŸ“¦ Repository Sync" "Sync complete. No new packages for update." -fi diff --git a/.scripts/cron/cronbat b/.scripts/cron/cronbat deleted file mode 100755 index c09ff42..0000000 --- a/.scripts/cron/cronbat +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Notify me with notify-send if my battery is below 25%. -# You can set this to run via cron. - -[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit -[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus && -notify-send -u critical "Battery critically low." diff --git a/.scripts/cron/crontog b/.scripts/cron/crontog deleted file mode 100755 index 93c2d30..0000000 --- a/.scripts/cron/crontog +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Toggles all cronjobs off/on. -# Stores disabled crontabs in ~/.consaved until restored. - -([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "πŸ•“ Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "πŸ•“ Cronjobs saved and disabled.") diff --git a/.scripts/cron/newsup b/.scripts/cron/newsup deleted file mode 100755 index f894927..0000000 --- a/.scripts/cron/newsup +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Set as a cron job to check for new RSS entries for newsboat. -# If newsboat is open, sends it an "R" key to refresh. - -ping -q -c 1 1.1.1.1 > /dev/null || exit - -/usr/bin/notify-send "πŸ“° Updating RSS feeds..." - -pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit - -echo πŸ”ƒ > /tmp/newsupdate -pkill -RTMIN+6 i3blocks -/usr/bin/newsboat -x reload -rm -f /tmp/newsupdate -pkill -RTMIN+6 i3blocks -/usr/bin/notify-send "πŸ“° RSS feed update complete." diff --git a/.scripts/i3cmds/cabl b/.scripts/i3cmds/cabl deleted file mode 100755 index b5b1b3f..0000000 --- a/.scripts/i3cmds/cabl +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Dependencies are xclip and xorg-xprop. -# qrencode required for qrcode generation. -# groff/zathura required for man pages. -prim="$(xclip -o)"; [ -z "$prim" ] && exit - -PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') -cd "$(readlink /proc/"$PID"/cwd)" -[ -f "$prim" ] && xdg-open "$prim" && exit -[ -d "$prim" ] && "$TERMINAL" "$prim" && exit - -websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;} -wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;} -wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;} -maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;} -ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;} - -echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;} -echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;} -command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;} -man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;} - -func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)" - -[ -z "$func" ] || "$func" "$prim" diff --git a/.scripts/i3cmds/camtoggle b/.scripts/i3cmds/camtoggle deleted file mode 100755 index 05679c0..0000000 --- a/.scripts/i3cmds/camtoggle +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0 diff --git a/.scripts/i3cmds/ddspawn b/.scripts/i3cmds/ddspawn deleted file mode 100755 index d4a4034..0000000 --- a/.scripts/i3cmds/ddspawn +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# Toggle floating dropdown terminal in i3, or start if non-existing. -# $1 is the script run in the terminal. -# All other args are terminal settings. -# Terminal names are in dropdown_* to allow easily setting i3 settings. - -[ -z "$1" ] && exit - -script=$1 -shift -if xwininfo -tree -root | grep "(\"dropdown_$script\" "; -then - echo "Window detected." - i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center" -else - echo "Window not detected... spawning." - i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script" -fi diff --git a/.scripts/i3cmds/displayselect b/.scripts/i3cmds/displayselect deleted file mode 100755 index e526014..0000000 --- a/.scripts/i3cmds/displayselect +++ /dev/null @@ -1,73 +0,0 @@ -#!/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. -# I plan on adding a routine from multi-monitor setups later. - -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 - 1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; - 2) twoscreen ;; - *) morescreen ;; - esac ;} - -# Get all possible displays -allposs=$(xrandr -q | grep "connected") - -# Get all connected screens. -screens=$(echo "$allposs" | grep " connected" | awk '{print $1}') - -# 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 ;; - *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; -esac - -setbg # Fix background if screen size/arangement has changed. -remaps # Re-remap keys if keyboard added (for laptop bases) -pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen diff --git a/.scripts/i3cmds/dmenumount b/.scripts/i3cmds/dmenumount deleted file mode 100755 index 9129643..0000000 --- a/.scripts/i3cmds/dmenumount +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# Gives a dmenu prompt to mount unmounted drives. -# If they're in /etc/fstab, they'll be mounted automatically. -# Otherwise, you'll be prompted to give a mountpoint from already existsing directories. -# If you input a novel directory, it will prompt you to create that directory. - -getmount() { \ - [ -z "$chosen" ] && exit 1 - mp="$(find $1 | dmenu -i -p "Type in mount point.")" - [ "$mp" = "" ] && exit 1 - 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 - } - -mountusb() { \ - chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" - sudo -A mount "$chosen" && notify-send "πŸ’» USB mounting" "$chosen mounted." && exit 0 - alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}') - getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" - partitiontype="$(lsblk -no "fstype" "$chosen")" - case "$partitiontype" in - "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; - *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";; - esac - notify-send "πŸ’» USB mounting" "$chosen mounted to $mp." - } - -mountandroid() { \ - chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1) - getmount "$HOME -maxdepth 3 -type d" - simple-mtpfs --device "$chosen" "$mp" - notify-send "πŸ€– Android Mounting" "Android device mounted to $mp." - } - -asktype() { \ - case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in - USB) mountusb ;; - Android) mountandroid ;; - esac - } - -anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')" - -if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid -else - if [ -z "$anddrives" ]; then - echo "USB drive(s) detected." - mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/.scripts/i3cmds/dmenurecord b/.scripts/i3cmds/dmenurecord deleted file mode 100755 index 0047e7a..0000000 --- a/.scripts/i3cmds/dmenurecord +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh - -# Usage: -# `record`: Ask for recording type via dmenu -# `record screencast`: Record both audio and screen -# `record video`: Record only screen -# `record audio`: Record only audio -# `record kill`: Kill existing recording -# -# If there is already a running instance, user will be prompted to end it. - -updateicon() { \ - echo "$1" > /tmp/recordingicon - pkill -RTMIN+9 i3blocks - } - -killrecording() { - recpid="$(cat /tmp/recordingpid)" - # kill with SIGTERM, allowing finishing touches. - kill -15 "$recpid" - rm -f /tmp/recordingpid - updateicon "" - pkill -RTMIN+9 i3blocks - # even after SIGTERM, ffmpeg may still run, so SIGKILL it. - sleep 3 - kill -9 "$recpid" - exit - } - -screencast() { \ - ffmpeg -y \ - -f x11grab \ - -framerate 60 \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ - -i :0.0 \ - -f alsa -i default \ - -r 30 \ - -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ - "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "βΊοΈπŸŽ™οΈ" - } - -video() { ffmpeg \ - -f x11grab \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ - -i :0.0 \ - -c:v libx264 -qp 0 -r 30 \ - "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "⏺️" - } - -webcamhidef() { ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 1920x1080 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "πŸŽ₯" - } - -webcam() { ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 640x480 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > /tmp/recordingpid - updateicon "πŸŽ₯" - } - - -audio() { \ - ffmpeg \ - -f alsa -i default \ - -c:a flac \ - "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & - echo $! > /tmp/recordingpid - updateicon "πŸŽ™οΈ" - } - -askrecording() { \ - choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") - case "$choice" in - screencast) screencast;; - audio) audio;; - video) video;; - webcam) webcam;; - "webcam (hi-def)") webcamhidef;; - esac - } - -asktoend() { \ - response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && - [ "$response" = "Yes" ] && killrecording - } - - -case "$1" in - screencast) screencast;; - audio) audio;; - video) video;; - kill) killrecording;; - *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; -esac diff --git a/.scripts/i3cmds/dmenuumount b/.scripts/i3cmds/dmenuumount deleted file mode 100755 index dee53e7..0000000 --- a/.scripts/i3cmds/dmenuumount +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# A dmenu prompt to unmount drives. -# 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?" | awk '{print $1}') - [ -z "$chosen" ] && exit - 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?") - [ -z "$chosen" ] && exit - sudo -A umount -l "$chosen" && notify-send "πŸ€– Android unmounting" "$chosen unmounted." - } - -asktype() { \ - case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in - USB) unmountusb ;; - Android) unmountandroid ;; - esac - } - -drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') - -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 diff --git a/.scripts/i3cmds/dmenuunicode b/.scripts/i3cmds/dmenuunicode deleted file mode 100755 index 4abf202..0000000 --- a/.scripts/i3cmds/dmenuunicode +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Give dmenu list of all unicode characters to copy. -# Shows the selected character in dunst if running. - -# Must have xclip installed to even show menu. -xclip -h >/dev/null || exit - -chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18) - -[ "$chosen" != "" ] || exit - -c=$(echo "$chosen" | sed "s/ .*//") -echo "$c" | tr -d '\n' | xclip -selection clipboard -notify-send "'$c' copied to clipboard." & - -s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}') -echo "$s" | tr -d '\n' | xclip -notify-send "'$s' copied to primary." & diff --git a/.scripts/i3cmds/dropdowncalc b/.scripts/i3cmds/dropdowncalc deleted file mode 100755 index 4d41f88..0000000 --- a/.scripts/i3cmds/dropdowncalc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ifinstalled bc && echo "Welcome to the Calculator." && bc -lq diff --git a/.scripts/i3cmds/ducksearch b/.scripts/i3cmds/ducksearch deleted file mode 100755 index 7b5bca6..0000000 --- a/.scripts/i3cmds/ducksearch +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# Gives a dmenu prompt to search DuckDuckGo. -# Without input, will open DuckDuckGo.com. -# URLs will be directly handed to the browser. -# Anything else, it search it. -browser=${BROWSER:-firefox} - -pgrep -x dmenu && exit - -choice=$(echo "πŸ¦†" | dmenu -i -p "Search DuckDuckGo:") || exit 1 - -if [ "$choice" = "πŸ¦†" ]; then - $browser "https://duckduckgo.com" -else - if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then - $browser "$choice" - else - $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" - fi -fi diff --git a/.scripts/i3cmds/hover b/.scripts/i3cmds/hover deleted file mode 100755 index 8d03a99..0000000 --- a/.scripts/i3cmds/hover +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right -current=$(xdotool getwindowfocus) -newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) -newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) -xdotool windowsize "$current" $newheight $newwidth -newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') -newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") - -case "$1" in - left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; - right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; -esac -xdotool windowmove "$current" $horizontal $vertical diff --git a/.scripts/i3cmds/i3resize b/.scripts/i3cmds/i3resize deleted file mode 100755 index 11b0992..0000000 --- a/.scripts/i3cmds/i3resize +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# This script was made by `goferito` on Github. -# Some cleanup by Luke. - -[ -z "$1" ] && echo "No direction provided" && exit 1 -distanceStr="2 px or 2 ppt" - -moveChoice() { - i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \ - i3-msg resize "$3" "$4" "$distanceStr" -} - -case $1 in - up) - moveChoice grow up shrink down - ;; - down) - moveChoice shrink up grow down - ;; - left) - moveChoice shrink right grow left - ;; - right) - moveChoice grow right shrink left - ;; -esac - diff --git a/.scripts/i3cmds/killrecording b/.scripts/i3cmds/killrecording deleted file mode 100755 index ec9a698..0000000 --- a/.scripts/i3cmds/killrecording +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -kill -9 "$(cat ~/.recordingpid)" - -# Update i3bar. -echo "" > ~/.recordingicon -pkill -RTMIN+9 i3blocks diff --git a/.scripts/i3cmds/maimpick b/.scripts/i3cmds/maimpick deleted file mode 100755 index 07d032f..0000000 --- a/.scripts/i3cmds/maimpick +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -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 pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; - "current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; - "full screen") maim 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 ;; -esac diff --git a/.scripts/i3cmds/prompt b/.scripts/i3cmds/prompt deleted file mode 100755 index 56de2f8..0000000 --- a/.scripts/i3cmds/prompt +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# A dmenu binary prompt script. -# Gives a dmenu prompt labeled with $1 to perform command $2. -# For example: -# `./prompt "Do you want to shutdown?" "shutdown -h now"` - -[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 diff --git a/.scripts/i3cmds/samedir b/.scripts/i3cmds/samedir deleted file mode 100755 index 88845fc..0000000 --- a/.scripts/i3cmds/samedir +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') -cd "$(readlink /proc/"$PID"/cwd)" -"$TERMINAL" diff --git a/.scripts/i3cmds/showclip b/.scripts/i3cmds/showclip deleted file mode 100755 index d2faff8..0000000 --- a/.scripts/i3cmds/showclip +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Display contents of selection via dunst if running. -# Separate script for i3. - -clip=$(xclip -o -selection clipboard) -prim=$(xclip -o -selection primary) - -[ -n "$clip" ] && notify-send "Clipboard:" "$clip" -[ -n "$prim" ] && notify-send "Primary:" "$prim" diff --git a/.scripts/i3cmds/td-toggle b/.scripts/i3cmds/td-toggle deleted file mode 100755 index dc727b9..0000000 --- a/.scripts/i3cmds/td-toggle +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# If transmission-daemon is running, will ask to kill, else will ask to start. -if pgrep -x transmission-da >/dev/null ; -then - [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed." -else - ifinstalled transmission-cli || exit - [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started." -fi -sleep 3 && pkill -RTMIN+7 i3blocks diff --git a/.scripts/i3cmds/tmuxdd b/.scripts/i3cmds/tmuxdd deleted file mode 100755 index c194ff1..0000000 --- a/.scripts/i3cmds/tmuxdd +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# This is the script that i3 runs to either start tmux in -# the dropdown terminal or log into a previous session. -tmux a || tmux diff --git a/.scripts/i3cmds/toggletouchpad b/.scripts/i3cmds/toggletouchpad deleted file mode 100755 index 6d8c9c8..0000000 --- a/.scripts/i3cmds/toggletouchpad +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Toggle touchpad. Requires xf86-input-synaptics. -(synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0)>/dev/null && echo "TouchPad reactivated." && exit -synclient TouchpadOff=1 && echo "TouchPad deactivated." diff --git a/.scripts/i3cmds/torwrap b/.scripts/i3cmds/torwrap deleted file mode 100755 index 04e7a51..0000000 --- a/.scripts/i3cmds/torwrap +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ifinstalled transmission-remote-cli transmission-cli || exit - -! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks - -$TERMINAL -e transmission-remote-cli diff --git a/.scripts/i3cmds/tutorialvids b/.scripts/i3cmds/tutorialvids deleted file mode 100755 index f1357eb..0000000 --- a/.scripts/i3cmds/tutorialvids +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -vidlist=" -status bar https://www.youtube.com/watch?v=gKumet6b-WY -sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs -st (terminal) https://www.youtube.com/watch?v=9H75enWM22k -i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI -pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs -mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A -ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U -newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w -zathura (pdf viewer) https://www.youtube.com/watch?v=V_Iz4zdyRM4 -gpg keys https://www.youtube.com/watch?v=DMGIlj7u7Eo -calcurse (calendar) https://www.youtube.com/watch?v=hvc-pHjbhdE -urlview https://www.youtube.com/watch?v=IgzpAjFgbCw -colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE -vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E -" -echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv diff --git a/.scripts/i3cmds/winresize b/.scripts/i3cmds/winresize deleted file mode 100755 index 090bbf3..0000000 --- a/.scripts/i3cmds/winresize +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "πŸ“" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)" diff --git a/.scripts/larbs.png b/.scripts/larbs.png deleted file mode 100644 index 0dbc687..0000000 Binary files a/.scripts/larbs.png and /dev/null differ diff --git a/.scripts/statusbar/battery b/.scripts/statusbar/battery deleted file mode 100755 index 25c9269..0000000 --- a/.scripts/statusbar/battery +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Give a battery name (e.g. BAT0) as an argument. - -case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging -πŸ›‘: not charging -β™»: stagnant charge -πŸ”Œ: charging -⚑: charged -❗: battery very low! -- Text color reflects charge left" ;; -esac - -capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit -status=$(cat /sys/class/power_supply/"$1"/status) - -if [ "$capacity" -ge 75 ]; then - color="#00ff00" -elif [ "$capacity" -ge 50 ]; then - color="#ffffff" -elif [ "$capacity" -ge 25 ]; then - color="#ffff00" -else - color="#ff0000" - warn="❗" -fi - -[ -z $warn ] && warn=" " - -[ "$status" = "Charging" ] && color="#ffffff" - -printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/πŸ”‹/;s/Not Charging/πŸ›‘/;s/Charging/πŸ”Œ/;s/Unknown/♻️/;s/Full/⚑/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" diff --git a/.scripts/statusbar/clock b/.scripts/statusbar/clock deleted file mode 100755 index d6d54ef..0000000 --- a/.scripts/statusbar/clock +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -date '+%Y %b %d (%a) %I:%M%p' - -case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; - 2) "$TERMINAL" -e calcurse -D ~/.config/calcurse ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` -- Middle click opens calcurse if installed" ;; -esac diff --git a/.scripts/statusbar/cpu b/.scripts/statusbar/cpu deleted file mode 100755 index 3b1394a..0000000 --- a/.scripts/statusbar/cpu +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "πŸ–₯ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)" ;; - 3) notify-send "πŸ–₯ CPU module " "\- Shows CPU temperature. -- Click to show intensive processes. -- % is of single core." ;; -esac - -sensors | awk '/Core 0/ {print $3}' diff --git a/.scripts/statusbar/disk b/.scripts/statusbar/disk deleted file mode 100755 index d3dd07d..0000000 --- a/.scripts/statusbar/disk +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Status bar module for disk space -# $1 should be drive mountpoint -# $2 is optional icon, otherwise mountpoint will displayed - -[ -z "$1" ] && exit - -icon="$2" -[ -z "$2" ] && icon="$1" - -case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk space" "$(df -h --output=target,used,size)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk module" "\- Shows used hard drive space. -- Click to show all disk info." ;; -esac - -printf "%s: %s" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.scripts/statusbar/help b/.scripts/statusbar/help deleted file mode 100755 index 1374769..0000000 --- a/.scripts/statusbar/help +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -case $BLOCK_BUTTON in - 1) groff -mom ~/.readme.mom -Tpdf | zathura - ;; - 2) i3 restart ;; - 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide. -- Middle click to refresh i3.";; -esac; echo "❓" diff --git a/.scripts/statusbar/internet b/.scripts/statusbar/internet deleted file mode 100755 index 1d2f2e8..0000000 --- a/.scripts/statusbar/internet +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) $TERMINAL -e nmtui ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect -πŸ“‘: no wifi connection -πŸ“Ά: wifi connection with quality -❎: no ethernet -🌐: ethernet working -" ;; -esac - -[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="πŸ“‘" - -[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "πŸ“Ά", int($3 * 100 / 70) "%" }') - -printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.scripts/statusbar/iplocate b/.scripts/statusbar/iplocate deleted file mode 100755 index 4ca4f10..0000000 --- a/.scripts/statusbar/iplocate +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Gets your public ip address checks which country you are in and -# displays that information in the statusbar -# -# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoiplookup" || exit -addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.scripts/statusbar/mailbox b/.scripts/statusbar/mailbox deleted file mode 100755 index 21c85ab..0000000 --- a/.scripts/statusbar/mailbox +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# i3blocks mail module. -# Displays number of unread mail and an loading icon if updating. -# When clicked, brings up `neomutt`. - -case $BLOCK_BUTTON in - 1) "$TERMINAL" -e neomutt ;; - 2) setsid mailsync >/dev/null & ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“¬ Mail module" "\- Shows unread mail -- Shows πŸ”ƒ if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; -esac - -echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)" diff --git a/.scripts/statusbar/memory b/.scripts/statusbar/memory deleted file mode 100755 index dfd3d7b..0000000 --- a/.scripts/statusbar/memory +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; - 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. -- Click to show memory hogs." ;; -esac - -free -h | awk '/^Mem:/ {print $3 "/" $2}' diff --git a/.scripts/statusbar/mpdupdate b/.scripts/statusbar/mpdupdate deleted file mode 100755 index afe11bb..0000000 --- a/.scripts/statusbar/mpdupdate +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Whenever the mpd state changes, update the mpd i3 module. -kill -0 "$(cat /tmp/mpdupdate)" 2>/dev/null && exit || echo $$ > /tmp/mpdupdate - -sleep 5 && while : ; do - pkill -RTMIN+11 i3blocks - mpc idle >/dev/null || exit -done diff --git a/.scripts/statusbar/music b/.scripts/statusbar/music deleted file mode 100755 index 93c2c9c..0000000 --- a/.scripts/statusbar/music +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/g" - } - -case $BLOCK_BUTTON in - 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause - 2) mpc toggle | filter ;; # right click, pause/unpause - 3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "🎡 Music module" "\- Shows mpd song playing. -- Italic when paused. -- Left click opens ncmpcpp. -- Middle click pauses. -- Scroll changes track.";; # right click, pause/unpause - 4) mpc prev | filter ;; # scroll up, previous - 5) mpc next | filter ;; # scroll down, next - *) mpc status | filter ;; -esac; exit diff --git a/.scripts/statusbar/news b/.scripts/statusbar/news deleted file mode 100755 index b7ca1a7..0000000 --- a/.scripts/statusbar/news +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# i3blocks newsboat module. -# Displays number of unread news items and an loading icon if updating. -# When clicked, brings up `newsboat`. - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid newsup >/dev/null & exit ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“° News module" "\- Shows unread news items -- Shows πŸ”ƒ if updating with \`newsup\` -- Left click opens newsboat -- Middle click syncs RSS feeds -Note: Only one instance of newsboat (including updates) may be running at a time." ;; -esac - - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)" diff --git a/.scripts/statusbar/pacpackages b/.scripts/statusbar/pacpackages deleted file mode 100755 index 418bc2d..0000000 --- a/.scripts/statusbar/pacpackages +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# i3blocks module for pacman upgrades. -# Displays number of upgradeable packages. -# For this to work, have a `pacman -Sy` command run in the background as a -# cronjob every so often as root. This script will then read those packages. -# When clicked, it will run an upgrade via pacman. - -case $BLOCK_BUTTON in - 1) $TERMINAL -e popupgrade ;; - 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "πŸ“¦: number of upgradable packages -- Left click to upgrade packages -- Middle click to show upgradable packages" ;; -esac - - -pacman -Qu | grep -v "\[ignored\]" | wc -l | sed -e "s/^0$//g" diff --git a/.scripts/statusbar/popupgrade b/.scripts/statusbar/popupgrade deleted file mode 100755 index 83035c3..0000000 --- a/.scripts/statusbar/popupgrade +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -printf "Beginning upgrade.\\n" - -yay -Syu -pkill -RTMIN+8 i3blocks - -printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" -read -r diff --git a/.scripts/statusbar/torrent b/.scripts/statusbar/torrent deleted file mode 100755 index 0ab811c..0000000 --- a/.scripts/statusbar/torrent +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -transmission-remote -l | grep % | - sed " # This first sed command is to ensure a desirable order with sort - s/.*Stopped.*/A/g; - s/.*Seeding.*/Z/g; - s/.*100%.*/N/g; - s/.*Idle.*/B/g; - s/.*Uploading.*/L/g; - s/.*%.*/M/g" | - sort -h | uniq -c | sed " # Now we replace the standin letters with icons. - s/A/πŸ›‘/g; - s/B/βŒ›οΈ/g; - s/L/πŸ”Ό/g; - s/M/πŸ”½/g; - s/N/βœ…/g; - s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g" - -case $BLOCK_BUTTON in - 1) $TERMINAL -e transmission-remote-cli ;; - 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "πŸ›‘: paused -⏳: idle (seeds needed) -πŸ”Ό: uploading (unfinished) -πŸ”½: downloading -βœ…: done -🌱: done and seeding" ;; -esac - diff --git a/.scripts/statusbar/volume b/.scripts/statusbar/volume deleted file mode 100755 index 3bbb32b..0000000 --- a/.scripts/statusbar/volume +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e pulsemixer & ;; - 2) pulsemixer --toggle-mute ;; - 4) pulsemixer --change-volume +5 ;; - 5) pulsemixer --change-volume -5 ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. -- Middle click to mute. -- Scroll to change." -esac - -[ "$(pulsemixer --get-mute)" = "1" ] && printf "πŸ”‡\\n" && exit - -vol=$(pulsemixer --get-volume | awk '{print $1}') - -if [ "$vol" -gt "70" ]; then - icon="πŸ”Š" -elif [ "$vol" -lt "30" ]; then - icon="πŸ”ˆ" -else - icon="πŸ”‰" -fi - -printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.scripts/statusbar/weather b/.scripts/statusbar/weather deleted file mode 100755 index e4de680..0000000 --- a/.scripts/statusbar/weather +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -location="$1"; [ -z "$location" ] || { location="$location+" && rm -f "$HOME/.local/share/weatherreport" ;} - -getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 -curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" || exit 1 ;} - -showweather() { printf "%s" "$(sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/β˜” /g" | tr -d '\n')" -sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "Β°","🌞",$2 "Β°"}' ;} - -case $BLOCK_BUTTON in - 1) $TERMINAL -e less -S "$HOME/.local/share/weatherreport" ;; - 2) getforecast && showweather ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. -- Middle click to update forecast. -β˜”: Chance of rain/snow -❄: Daily low -🌞: Daily high" ;; -esac - -if [ "$(stat -c %y "$HOME/.local/share/weatherreport" >/dev/null 2>&1 | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] - then getforecast && showweather - else showweather -fi diff --git a/.scripts/tools/compiler b/.scripts/tools/compiler deleted file mode 100755 index 7d3bf1d..0000000 --- a/.scripts/tools/compiler +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# This script will compile or run another finishing operation on a document. I -# have this script run via vim. -# -# Compiles .tex. groff (.mom, .ms), .rmd, .md. -# Opens .sent files as sent presentations. -# Runs scripts based on extention or shebang - -file=$(readlink -f "$1") -dir=$(dirname "$file") -base="${file%.*}" - -cd "$dir" || exit - -textype() { \ - command="pdflatex" - ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" - $command --output-directory="$dir" "$base" && - grep -i addbibresource "$file" >/dev/null && - biber --input-directory "$dir" "$base" && - $command --output-directory="$dir" "$base" && - $command --output-directory="$dir" "$base" - } - -case "$file" in - *\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;; - *\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;; - *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;; - *\.tex) textype "$file" ;; - *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; - *config.h) sudo make install ;; - *\.c) cc "$file" -o "$base" && "$base" ;; - *\.py) python "$file" ;; - *\.go) go run "$file" ;; - *\.sent) setsid sent "$file" 2>/dev/null & ;; - *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; -esac diff --git a/.scripts/tools/dmenuhandler b/.scripts/tools/dmenuhandler deleted file mode 100755 index 391bdc1..0000000 --- a/.scripts/tools/dmenuhandler +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Feed this script a link and it will give dmenu -# some choice programs to use to open it. - -case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in - "copy url") echo "$1" | xclip -selection clipboard ;; - mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; - "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;; - "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; - "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; - browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; - feh) setsid feh "$1" >/dev/null 2>&1 & ;; - w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; -esac diff --git a/.scripts/tools/dmenupass b/.scripts/tools/dmenupass deleted file mode 100755 index 4fc464f..0000000 --- a/.scripts/tools/dmenupass +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo diff --git a/.scripts/tools/ext b/.scripts/tools/ext deleted file mode 120000 index 562d2b3..0000000 --- a/.scripts/tools/ext +++ /dev/null @@ -1 +0,0 @@ -extract \ No newline at end of file diff --git a/.scripts/tools/extract b/.scripts/tools/extract deleted file mode 100755 index a63ab10..0000000 --- a/.scripts/tools/extract +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# A general, all-purpose extraction script. -# -# Default behavior: Extract archive into new directory -# Behavior with `-c` option: Extract contents into current directory - -while getopts "hc" o; do case "${o}" in - c) extracthere="True" ;; - *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;; -esac done - -if [ -z "$extracthere" ]; then - archive="$(readlink -f "$*")" && - directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && - mkdir -p "$directory" && - cd "$directory" || exit -else - archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")" -fi - -[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit - -if [ -f "$archive" ] ; then - case "$archive" in - *.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;; - *.tar.gz|*.tgz) tar xvzf "$archive" ;; - *.lzma) unlzma "$archive" ;; - *.bz2) bunzip2 "$archive" ;; - *.rar) unrar x -ad "$archive" ;; - *.gz) gunzip "$archive" ;; - *.tar) tar xvf "$archive" ;; - *.zip) unzip "$archive" ;; - *.Z) uncompress "$archive" ;; - *.7z) 7z x "$archive" ;; - *.xz) unxz "$archive" ;; - *.exe) cabextract "$archive" ;; - *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; - esac -else - printf "File \"%s\" not found.\\n" "$archive" -fi diff --git a/.scripts/tools/getbib b/.scripts/tools/getbib deleted file mode 100755 index ed441c5..0000000 --- a/.scripts/tools/getbib +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit - -if [ -f "$1" ]; then - # Try to get DOI from pdfinfo or pdftotext output. - doi=$(pdfinfo "$1" | grep -io "doi:.*") || - doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) || - exit 1 -else - doi="$1" -fi - -# Check crossref.org for the bib citation. -curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" diff --git a/.scripts/tools/getkeys b/.scripts/tools/getkeys deleted file mode 100755 index 444f4c0..0000000 --- a/.scripts/tools/getkeys +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -cat ~/.config/getkeys/"$1" 2>/dev/null && exit -echo "Run command with one of the following arguments for info about that program:" -ls ~/.config/getkeys diff --git a/.scripts/tools/ifinstalled b/.scripts/tools/ifinstalled deleted file mode 100755 index b0d23e5..0000000 --- a/.scripts/tools/ifinstalled +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# If $1 command is not available, error code and notify. -command -v "$1" >/dev/null || { notify-send "πŸ“¦ $1" "must be installed for this function." && exit 1 ;} diff --git a/.scripts/tools/linkhandler b/.scripts/tools/linkhandler deleted file mode 100755 index c616d04..0000000 --- a/.scripts/tools/linkhandler +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Feed script a url or file location. -# If an image, it will view in sxiv, -# if a video or gif, it will view in mpv -# 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; } - -case "$1" in - *mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*) - setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;; - *png|*jpg|*jpe|*jpeg|*gif) - curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; - *mp3|*flac|*opus|*mp3?source*) - setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; - *) - if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" - else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;; -esac diff --git a/.scripts/tools/lmc b/.scripts/tools/lmc deleted file mode 100755 index 18cf2c2..0000000 --- a/.scripts/tools/lmc +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# A general audio interface for LARBS. - -[ -z "$2" ] && num="2" || num="$2" - -case "$1" in - u*) pulsemixer --change-volume +"$num" ;; - d*) pulsemixer --change-volume -"$num" ;; - m*) pulsemixer --toggle-mute ;; - truemute) pulsemixer --mute ;; - play) mpc play ;; - n*) mpc next ;; - prev) mpc prev ;; - t*) mpc toggle ;; - p*) mpc pause ; pauseallmpv ;; - f*) mpc seek +"$num" ;; - b*) mpc seek -"$num" ;; - r*) mpc seek 0% ;; - *) cat << EOF -lmc: cli music interface for mpd and pulse for those with divine intellect too -grand to remember the mpc/pamixer commands. - -Allowed options: - up NUM Increase volume (2 secs default) - down NUM Decrease volume (2 secs default) - mute Toggle mute - truemute Mute - next Next track - prev Previous track - toggle Toggle pause - truepause Pause - foward NUM Seek foward in song (2 secs default) - back NUM Seek back in song (2 secs default) - restart Restart current song - all else Print this message - -All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated, -i.e. \`lmc r\` for \`lmc restart\`. -EOF -esac - -pkill -RTMIN+10 i3blocks diff --git a/.scripts/tools/opout b/.scripts/tools/opout deleted file mode 100755 index c742aa9..0000000 --- a/.scripts/tools/opout +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# opout: "open output": A general handler for opening a file's intended output. -# I find this useful especially running from vim. - -basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" - -case "$1" in - *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;; - *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;; - *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; -esac diff --git a/.scripts/tools/pauseallmpv b/.scripts/tools/pauseallmpv deleted file mode 100755 index c5da220..0000000 --- a/.scripts/tools/pauseallmpv +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -for i in $(ls /tmp/mpvsoc*); do - echo '{ "command": ["set_property", "pause", true] }' | socat - $i; -done diff --git a/.scripts/tools/podentr b/.scripts/tools/podentr deleted file mode 100755 index 13ab4a8..0000000 --- a/.scripts/tools/podentr +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# entr command to run `queueandnotify` when newsboat queue is changed - -[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit - -echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null diff --git a/.scripts/tools/qndl b/.scripts/tools/qndl deleted file mode 100755 index a99d37e..0000000 --- a/.scripts/tools/qndl +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# $1 is a url; $2 is a command -[ -z "$1" ] && exit -base="$(basename "$1")" -notify-send "⏳ Queuing $base..." -cmd="$2" -[ -z "$cmd" ] && cmd="youtube-dl --add-metadata" -idnum="$(tsp $cmd "$1")" -realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" -tsp -D "$idnum" mv "$base" "$realname" -tsp -D "$idnum" notify-send "πŸ‘ $realname done." diff --git a/.scripts/tools/queueandnotify b/.scripts/tools/queueandnotify deleted file mode 100755 index a1417ec..0000000 --- a/.scripts/tools/queueandnotify +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Podboat sucks. This script replaces it. -# It reads the newsboat queue, queuing downloads with taskspooler. -# It also removes the junk from extentions. -queuefile="$HOME/.local/share/newsboat/queue" - -while read -r line; do - [ -z "$line" ] && continue - url="$(echo "$line" | awk '{print $1}')" - qndl "$url" "curl -LO" -done < "$queuefile" - -echo > "$queuefile" diff --git a/.scripts/tools/remaps b/.scripts/tools/remaps deleted file mode 100755 index df7d6c9..0000000 --- a/.scripts/tools/remaps +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# This script is called by i3 on startup to remap keys. -# Increase key speed via a rate change -xset r rate 300 50 -# Map the caps lock key to super... -setxkbmap -option caps:super -# But when it is pressed only once, treat it as escape. -killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' -# Map the menu button to right super as well. -xmodmap -e 'keycode 135 = Super_R' diff --git a/.scripts/tools/rotdir b/.scripts/tools/rotdir deleted file mode 100755 index e7103db..0000000 --- a/.scripts/tools/rotdir +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 -base="$(basename $1)" - ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }" diff --git a/.scripts/tools/rssadd b/.scripts/tools/rssadd deleted file mode 100755 index 8822fc5..0000000 --- a/.scripts/tools/rssadd +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null && - notify-send "That doesn't look like a full URL." && exit -RSSFILE="$HOME/.config/newsboat/urls" -if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then - notify-send "You already have this RSS feed." -else - echo "$1" >> "$RSSFILE" && notify-send "RSS feed added." -fi diff --git a/.scripts/tools/setbg b/.scripts/tools/setbg deleted file mode 100755 index 950ae7c..0000000 --- a/.scripts/tools/setbg +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Sets the background. If given an argument, will set file as background. -[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." -xwallpaper --zoom ~/.config/wall.png diff --git a/.scripts/tools/shortcuts b/.scripts/tools/shortcuts deleted file mode 100755 index 1c4f278..0000000 --- a/.scripts/tools/shortcuts +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Output locations. Unactivated progs should go to /dev/null. -shell_shortcuts="$HOME/.config/shortcutrc" -ranger_shortcuts="/dev/null" -qute_shortcuts="/dev/null" -fish_shortcuts="/dev/null" -vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts" - -# Remove, prepare files -rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null -printf "# vim: filetype=sh\\n" > "$fish_shortcuts" -printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" -printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" - -# Format the `bmdirs` file in the correct syntax and sent it to all three configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ - >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ - >(awk '{print "map g" $1, ":cd", $2 "\nmap t" $1, ":cd", $2 "\nmap M" $1, ":cd", $2 ":mo\nmap Y" $1, ":cd", $2 ":co" }' >> "$vifm_shortcuts") \ - >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \ - | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" - -# Format the `configs` file in the correct syntax and sent it to both configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ - >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ - >(awk '{print "map", $1, ":e", $2 "" }' >> "$vifm_shortcuts") \ - | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" diff --git a/.scripts/tools/texclear b/.scripts/tools/texclear deleted file mode 100755 index f6a5062..0000000 --- a/.scripts/tools/texclear +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Clears the build files of a LaTeX/XeLaTeX build. -# I have vim run this file whenever I exit a .tex file. - -case "$1" in - *.tex) - file=$(readlink -f "$1") - dir=$(dirname "$file") - base="${file%.*}" - find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;; - *) printf "Give .tex file as argument.\\n" ;; -esac - diff --git a/.scripts/tools/transadd b/.scripts/tools/transadd deleted file mode 100755 index ad2ee7f..0000000 --- a/.scripts/tools/transadd +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. - -# transmission-daemon sometimes fails to take remote requests in its first moments. - -pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks) - -transmission-remote -a "$@" && notify-send "πŸ”½ Torrent added." diff --git a/.scripts/tools/vifmimg b/.scripts/tools/vifmimg deleted file mode 100755 index 1569962..0000000 --- a/.scripts/tools/vifmimg +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -[ -z "$FIFO_UEBERZUG" ] && exit - -readonly ID_PREVIEW="preview" - -if [ "$1" = "draw" ]; then - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG" -elif [ "$1" = "videopreview" ]; then - [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 && - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG" -else - declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG" -fi diff --git a/.scripts/tools/vu b/.scripts/tools/vu deleted file mode 100755 index 778835a..0000000 --- a/.scripts/tools/vu +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" - -cleanup() { - rm "$FIFO_UEBERZUG" 2>/dev/null - pkill -P $$ 2>/dev/null -} - -rm "$FIFO_UEBERZUG" 2>/dev/null -mkfifo "$FIFO_UEBERZUG" -trap cleanup EXIT -tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & - -vifm -cleanup diff --git a/.scripts/ttymaps.kmap b/.scripts/ttymaps.kmap deleted file mode 100644 index 51a7042..0000000 --- a/.scripts/ttymaps.kmap +++ /dev/null @@ -1,2 +0,0 @@ -keycode 1 = Caps_Lock -keycode 58 = Escape diff --git a/.scripts/unix b/.scripts/unix deleted file mode 100755 index 14d7ef0..0000000 --- a/.scripts/unix +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes -#converted to shell by #nixers @ irc.unix.chat - -cat << 'eof' - ,_ ,_==β–„β–‚ - , β–‚β–ƒβ–„β–„β–…β–…β–…β–‚β–…ΒΎ. / / - β–„β–†<Β΄ "Β»β–“β–“β–“%\ / / / / - ,β–…7" Β΄>β–“β–“β–“% / / > / >/% - ▐ΒΆβ–“ ,Β»β–“β–“ΒΎΒ΄ /> %/%// / / - β–“β–ƒβ–…β–…β–…β–ƒ,,β–„β–…β–…β–…Γ†\// ///>// />/ / - V║«¼.;β†’ β•‘<Β«.,`=// />//%/% / / - //β• <Β΄ -Β²,)(β–“~"-╝/ΒΎ/ %/>/ /> - / / / ▐% -./β–„β–ƒβ–„β–…▐, /7//;//% / / - / ////`β–Œ▐ %zWv xXβ–“β–‡β–Œ//&;% / / - / / / %//%/ΒΎΒ½Β΄β–Œβ–ƒβ–„β–„β–„β–„β–ƒβ–ƒ▐ΒΆ\/& / - </ /)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A - / /</ //<///<_/%\β–“ V%W%Β£)XY _/%β€Ύ\_, GENIUS TO UNDERSTAND ITS SIMPLICITY - / / //%/_,=--^/%/%%\ΒΎ%ΒΆ%%} /%%%%%%;\, - %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ - / / %%%%%%;, \%%l%%;// _/%;, dmr - / %%%;, <;\-=-/ / - ;, l -eof \ No newline at end of file diff --git a/README.md b/README.md index 8d4c5a9..7918366 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ These are my dotfiles! The name of the repo, "voidrice", came from the fact they + calcurse + ncmpcpp and mpd (my main music player) + mpv -+ And many little scripts I use filed in the `~/.scripts/` directory ++ And many little scripts I use filed in the `~/.local/bin/` directory ## More documentation -- cgit v1.3.1