From 2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 5 Nov 2018 17:51:24 -0500 Subject: [PATCH] scripts sorted --- .config/i3/config | 12 +- .config/i3/i3_guide.rmd | 53 ++- .profile | 2 +- .scripts/SCRIPTS.md | 390 +++++++++++++---------- .scripts/{ => cron}/cronbat | 0 .scripts/cron/crontog | 5 + .scripts/{ => cron}/newsup | 4 + .scripts/crontog | 5 - .scripts/dmenuarchwiki | 17 - .scripts/{ => i3cmds}/bottomleft | 0 .scripts/{ => i3cmds}/bottomright | 0 .scripts/{ => i3cmds}/camtoggle | 0 .scripts/{ => i3cmds}/ddspawn | 0 .scripts/{ => i3cmds}/displayselect | 0 .scripts/{ => i3cmds}/dmenumount | 0 .scripts/{ => i3cmds}/dmenurecord | 0 .scripts/{ => i3cmds}/dmenuumount | 0 .scripts/{ => i3cmds}/dmenuunicode | 0 .scripts/{ => i3cmds}/dropdowncalc | 0 .scripts/{ => i3cmds}/ducksearch | 0 .scripts/{ => i3cmds}/i3resize | 0 .scripts/{ => i3cmds}/killrecording | 0 .scripts/{ => i3cmds}/lockscreen | 2 +- .scripts/{ => i3cmds}/newspod | 0 .scripts/{ => i3cmds}/prompt | 0 .scripts/{ => i3cmds}/samedir | 0 .scripts/{ => i3cmds}/td-toggle | 6 +- .scripts/{ => i3cmds}/tmuxdd | 0 .scripts/{ => i3cmds}/toggletouchpad | 0 .scripts/{ => i3cmds}/tutorialvids | 0 .scripts/kb-lights.py | 35 -- .scripts/musstuff | 49 --- .scripts/{ => pix}/lock.png | Bin .scripts/polybar_launch | 16 - .scripts/showclip | 6 - .scripts/{ => statusbar}/i3battery | 0 .scripts/{ => statusbar}/i3mail | 0 .scripts/{ => statusbar}/i3mpd | 0 .scripts/{ => statusbar}/i3mpdupdate | 0 .scripts/{ => statusbar}/i3pacman | 0 .scripts/{ => statusbar}/i3torrent | 0 .scripts/{ => statusbar}/i3volume | 0 .scripts/{ => statusbar}/i3weather | 0 .scripts/{ => statusbar}/i3wifi | 0 .scripts/{ => statusbar}/popupgrade | 0 .scripts/{ => statusbar}/popweather | 0 .scripts/{ => tools}/compiler | 0 .scripts/{ => tools}/dmenuhandler | 0 .scripts/{ => tools}/ext | 0 .scripts/{ => tools}/extract | 0 .scripts/{ => tools}/getbib | 0 .scripts/{ => tools}/getkeys | 0 .scripts/{ => tools}/linkhandler | 0 .scripts/{ => tools}/lmc | 0 .scripts/{ => tools}/note | 0 .scripts/{ => tools}/opout | 0 .scripts/{ => tools}/pauseallmpv | 0 .scripts/{ => tools}/remaps | 0 .scripts/{ => tools}/shortcuts | 0 .scripts/{speedvid.sh => tools/speedvid} | 0 .scripts/{ => tools}/texclear | 0 .scripts/{ => tools}/tpb | 0 .scripts/{ => tools}/transadd | 0 .vimrc | 2 +- 64 files changed, 273 insertions(+), 331 deletions(-) rename .scripts/{ => cron}/cronbat (100%) create mode 100755 .scripts/cron/crontog rename .scripts/{ => cron}/newsup (60%) delete mode 100644 .scripts/crontog delete mode 100755 .scripts/dmenuarchwiki rename .scripts/{ => i3cmds}/bottomleft (100%) rename .scripts/{ => i3cmds}/bottomright (100%) rename .scripts/{ => i3cmds}/camtoggle (100%) rename .scripts/{ => i3cmds}/ddspawn (100%) rename .scripts/{ => i3cmds}/displayselect (100%) rename .scripts/{ => i3cmds}/dmenumount (100%) rename .scripts/{ => i3cmds}/dmenurecord (100%) rename .scripts/{ => i3cmds}/dmenuumount (100%) rename .scripts/{ => i3cmds}/dmenuunicode (100%) rename .scripts/{ => i3cmds}/dropdowncalc (100%) rename .scripts/{ => i3cmds}/ducksearch (100%) rename .scripts/{ => i3cmds}/i3resize (100%) rename .scripts/{ => i3cmds}/killrecording (100%) rename .scripts/{ => i3cmds}/lockscreen (86%) rename .scripts/{ => i3cmds}/newspod (100%) rename .scripts/{ => i3cmds}/prompt (100%) rename .scripts/{ => i3cmds}/samedir (100%) rename .scripts/{ => i3cmds}/td-toggle (64%) rename .scripts/{ => i3cmds}/tmuxdd (100%) rename .scripts/{ => i3cmds}/toggletouchpad (100%) rename .scripts/{ => i3cmds}/tutorialvids (100%) delete mode 100755 .scripts/kb-lights.py delete mode 100644 .scripts/musstuff rename .scripts/{ => pix}/lock.png (100%) delete mode 100755 .scripts/polybar_launch delete mode 100755 .scripts/showclip rename .scripts/{ => statusbar}/i3battery (100%) rename .scripts/{ => statusbar}/i3mail (100%) rename .scripts/{ => statusbar}/i3mpd (100%) rename .scripts/{ => statusbar}/i3mpdupdate (100%) rename .scripts/{ => statusbar}/i3pacman (100%) rename .scripts/{ => statusbar}/i3torrent (100%) rename .scripts/{ => statusbar}/i3volume (100%) rename .scripts/{ => statusbar}/i3weather (100%) rename .scripts/{ => statusbar}/i3wifi (100%) rename .scripts/{ => statusbar}/popupgrade (100%) rename .scripts/{ => statusbar}/popweather (100%) rename .scripts/{ => tools}/compiler (100%) rename .scripts/{ => tools}/dmenuhandler (100%) rename .scripts/{ => tools}/ext (100%) rename .scripts/{ => tools}/extract (100%) rename .scripts/{ => tools}/getbib (100%) rename .scripts/{ => tools}/getkeys (100%) rename .scripts/{ => tools}/linkhandler (100%) rename .scripts/{ => tools}/lmc (100%) rename .scripts/{ => tools}/note (100%) rename .scripts/{ => tools}/opout (100%) rename .scripts/{ => tools}/pauseallmpv (100%) rename .scripts/{ => tools}/remaps (100%) rename .scripts/{ => tools}/shortcuts (100%) rename .scripts/{speedvid.sh => tools/speedvid} (100%) rename .scripts/{ => tools}/texclear (100%) rename .scripts/{ => tools}/tpb (100%) rename .scripts/{ => tools}/transadd (100%) diff --git a/.config/i3/config b/.config/i3/config index b017fa8..19c5987 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -56,7 +56,7 @@ exec --no-startup-id dunst # Composite manager: exec --no-startup-id compton # Runs the key remapping scripts -exec --no-startup-id ~/.scripts/remaps +exec --no-startup-id remaps # Unclutter makes the mouse invisible after a brief period exec --no-startup-id unclutter # Run the script to update the mpd i3block on change. @@ -137,7 +137,7 @@ bindsym $mod+Shift+Insert exec --no-startup-id showclip bindsym $mod+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill -bindsym $mod+w exec --no-startup-id $BROWSER +bindsym $mod+w exec $term -e nmtui bindsym $mod+Shift+w exec --no-startup-id $BROWSER bindsym $mod+e exec $term -e neomutt @@ -201,8 +201,8 @@ bindsym $mod+Shift+z gaps outer current minus 5 bindsym $mod+x exec --no-startup-id lockscreen bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown" -bindsym $mod+c exec --no-startup-id camtoggle -##bindsym $mod+Shift+c +bindsym $mod+c exec --no-startup-id freealf +bindsym $mod+Shift+c exec --no-startup-id camtoggle bindsym $mod+v exec $term -e ncmpcpp -s visualizer bindsym $mod+Shift+v exec --no-startup-id projectM-pulseaudio @@ -410,8 +410,8 @@ bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15 bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp bindsym XF86Display exec --no-startup-id arandr #bindsym XF86KbdLightOnOff exec -bindsym XF86KbdBrightnessDown exec --no-startup-id python3.6 ~/.scripts/kb-lights.py - -bindsym XF86KbdBrightnessUp exec --no-startup-id python3.6 ~/.scripts/kb-lights.py + +#bindsym XF86KbdBrightnessDown exec +#bindsym XF86KbdBrightnessUp exec ##bindsym XF86Reply exec ##bindsym XF86MailForward exec ##bindsym XF86Save exec diff --git a/.config/i3/i3_guide.rmd b/.config/i3/i3_guide.rmd index a69ddcd..9c4c8e8 100644 --- a/.config/i3/i3_guide.rmd +++ b/.config/i3/i3_guide.rmd @@ -114,40 +114,40 @@ system will grow on you quick. ## Basic Programs *Note:* LARBS will install nearly all of these programs by default, but some -only come if you chose an extra option. Naturally, you can use `packer` to look +only come if you chose an extra option. Naturally, you can use `yay` to look for and install any you want to add. + `Mod+r` -- ranger (file browser/manager) + `Mod+e` -- mutt (email) + `Mod+m` -- ncmpcpp (music player) -+ `Mod+a` -- R/Python calculator (be sure to close with Mod+a for reusability) ++ `Mod+w` -- nmtui (for connecting to wireless internet) ++ `Mod+a` -- R/Python calculator (hide with `mod+a`) + `Mod+i` -- htop (system info) + `Mod+n` -- newsboat (RSS feed reader) + `Mod+y` -- calcurse (calendar and schedule) -+ `Mod+u` -- "Dropdown" terminal (close with Mod+u for reusability) ++ `Mod+u` -- "Dropdown" terminal (hide with `mod+u`) + `Mod+A` -- pulsemixer (audio system control) -+ `Mod+w/W` -- Web Browser ++ `Mod+W` -- Web Browser + `Mod+G` -- GIMP (for general image manipulation) ## System + `Mod+R` -- ranger as root user + `Mod+x` -- i3lock (Enter password to return) -+ `Mod+X` -- shutdown (will give a dmenu confirm prompt) -+ `Mod+Shift+Backspace` -- reboot (will give a dmenu confirm prompt) -+ `Mod+Shift+Escape` -- exit i3 (will give a dmenu confirm prompt) ++ `Mod+X` -- shutdown (will ask to confirm) ++ `Mod+Shift+Backspace` -- reboot (will ask to confirm) ++ `Mod+Shift+Escape` -- exit i3 (will ask to confirm) + `Mod+F1` -- Shows this document + `Mod+F2` -- Refresh i3 + `Mod+F3` -- Select screen/display to use -+ `Mod+F4` -- Hibernate ++ `Mod+F4` -- Hibernate (will ask to confirm) + `Mod+F5` -- Reset Network Manager, search for new networks + `Mod+F6` -- transmission torrent client (cli) + `Mod+F7` -- Toggle on/off transmission client via dmenu + `Mod+F8` -- Check mail, if [mutt-wizard](https://github.com/lukesmithxyz/mutt-wizard) is installed -+ `Mod+F9` -- Mount a drive/partition -+ `Mod+F10` -- Unmount a drive/partition (does not umount `/`, `/home` or - `/boot`) ++ `Mod+F9` -- Mount a USB drive/hard drive or Android ++ `Mod+F10` -- Unmount a non-essential drive or Android + `Mod+F11` -- Search term on DuckDuckGo + `Mod+F12` -- Wifi-menu for selecting the wireless internet source. @@ -188,43 +188,42 @@ additions. I use scrot and ffmpeg to make different recordings of the desktop and audio. All of these recording shortcuts will output into `~`, and will not overwrite -previous recordings. +previous recordings as their names are based on their exact times. + `PrintScreen` -- Take a scrot screenshot + `Shift+PrintScreen` -- Take a scrot screenshot of only selected window + `Mod+PrintScreen` -- Opens dmenu menu to select kind of audio/video recording ++ `Mod+Delete` -- Kills any recording started in the above way. + `Mod+ScrollLock` -- Turn on and off screenkey (if installed) for visual typing display -+ `Mod+Delete` -- kills ffmpeg, thus ending recordings - -Each of the recording scripts are located in `~/.scripts`. You can check them -out or modify them if needed. ++ `Mod+Shift+c` -- Toggles a webcam in the bottom right for screencasting. ## Other buttons I've mapped those extra buttons that some keyboards have (play and pause -buttons, email, webbrowsing buttons, etc.) to what you would expect. - +buttons, screen brightness, email, web browsing buttons, etc.) to what you +would expect. # Special traits of this system ## Easy config access -Open a terminal and type `cfc`. This will open a file where you will see -customizable pairs of key shortcuts and config files. Enter any of these -shortcuts in bash or ranger to immediately open the file in vim. +Open a terminal and type `bf`. This will open a file where you will see +customizable pairs of key shortcuts and config files and other important text +files. Enter any of these shortcuts in bash or ranger to immediately open the +file in vim. You may add new entries here and they will be refreshed when you save the file in vim. This will take effect immediately once you start a new instance of bash -or ranger. +or ranger or reload your previous sessions. ## Folder and config shortcuts -Open a terminal and type `cff`. This opens a file when you can keep and create -folder shortcuts. There are only a few here now, because I don't know what your -folder structure is going to look like, but on my machine, I have 109 and -growing. +Open a terminal and type `bd`. This opens a file when you can keep and create +directory/folder shortcuts. There are only a few here now, because I don't know +what your folder structure is going to look like, but on my machine, I have 109 +and growing. -Each line has a shortcut key/keys and its target. These can be used in serveral +Each line has a shortcut key/keys and its target. These can be used in several applications. In bash, simply press `d`, the shortcut for `~/Documents` and you will cd there (and automatically `ls -a`). diff --git a/.profile b/.profile index 73225da..2c0c9e8 100644 --- a/.profile +++ b/.profile @@ -2,7 +2,7 @@ # Profile file. Runs on login. -export PATH="$PATH:$HOME/.scripts" +export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH" export EDITOR="vim" export TERMINAL="st" export BROWSER="linkhandler" diff --git a/.scripts/SCRIPTS.md b/.scripts/SCRIPTS.md index cd16f20..6756039 100644 --- a/.scripts/SCRIPTS.md +++ b/.scripts/SCRIPTS.md @@ -1,146 +1,136 @@ # Directory of Scripts -## `audio` +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`: -The audio recording script run by `dmenurecord` (bound to `mod+Print`). +``` +export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH" +``` -## `bottomleft` +## `statusbar/` -Makes the currently selected window float in the bottom left of screen. Bound -to `mod+B`. +For modules used in i3blocks. -## `camtoggle` +### `i3battery` -Starts/kills /dev/video0 webcam. Placed in bottom right by default. +i3blocks module. Shows available power remaining with icon indicating battery +status. Colors indicate different levels of charge. -## `compiler` +### `i3mail` + +i3blocks module for use with mutt-wizard. Shows unread mail and if +`mailsync.sh` is running. + +### `i3mpd` + +i3blocks module. Shows current song; if paused, name will be grayed and italic. + +### `i3mpdupdate` + +A daemon running by default that will update the i3mpd block on mpd change. + +### `i3pacman` + +i3blocks module. Detects new installable upgrades. Only works if you use +cronjobs to automatically sync repositories. + +### `i3torrent` + +i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or +finished (🌱). + +### `i3volume` + +i3blocks module. Shows volume percentage or mute notification. + +### `i3weather` + +i3blocks module. Gets weather forcast from wttr.in and returns today's +precipitation chance (☔), daily low (❄️) and daily high (☀️). + +### `i3wifi` + +A modified version of the i3blocks wifi module. Clicked, it brings up wifi-menu +and also appears when there is no wifi connection. + +### `popupdate` + +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. + +### `popweather` + +The script called by clicking on the i3 weather module. Brings up the forecast +from `http://wttr.in` and will close on . + + +## `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. + +### `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. -## `crontog` - -Turns off/on all user cronjobs. - -## `displayselect` - -Select which displays to use. Bound to `mod+F3`. - -## `dmenuarchwiki` - -Bind this script to a key and it will give you a prompt to search for a term in -the Arch Wiki. Used to be binded to `mod+F11`, but has been replaced by -`ducksearch` there. - -## `dmenuhandler` +### `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. -## `dmenumount` - -Detect available partitions with `lsblk` and offer to mount them. 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. - -## `dmenuumount` - -Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing -if none are mounted. - -## `dropdowncalc` - -The command initially run in the `math` window (toggeable with `mod+a`). Runs -`r` if available, else `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. - -## `extract` +### `extract` Will detect file type of archive and run appropriate extraction command. -## `getbib` +### `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` +### `getkeys` Get the LARBS documentation on what bindings exist for main programs. -## `i3battery` - -i3blocks module. Shows available power remaining with icon indicating battery -status. Colors indicate different levels of charge. - -## `i3mail` - -i3blocks module for use with mutt-wizard. Shows unread mail and if -`mailsync.sh` is running. - -## `i3mpd` - -i3blocks module. Shows current song; if paused, name will be grayed and italic. - -## `i3mpdupdate` - -A daemon running by default that will update the i3mpd block on mpd change. - -## `i3pacman` - -i3blocks module. Detects new installable upgrades. Only works if you use -cronjobs to automatically sync repositories. - -## `i3resize` - -A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`. - -## `i3torrent` - -i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or -finished (🌱). - -## `i3volume` - -i3blocks module. Shows volume percentage or mute notification. - -## `i3weather` - -i3blocks module. Gets weather forcast from wttr.in and returns today's -precipitation chance (☔), daily low (❄️) and daily high (☀️). - -## `i3wifi` - -A modified version of the i3blocks wifi module. Clicked, it brings up wifi-menu -and also appears when there is no wifi connection. - -## `kb-lights.py` - -A Python 3 script which will increase or decrease keyboard lights when given -either a `+` or `-` argument. - -## `killrecording` - -End a recording started by `dmenurecord` the proper way. - -## `linkhandler` +### `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` +### `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 @@ -148,96 +138,166 @@ 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. -## `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. - -## `musstuff` - -Some old notes and commands on deleted music shortcuts. - -## `note` +### `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` +### `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` +### `pauseallmpv` Pauses all mpv instances by sending the `,` key to each. Used by several -scripts, but can be used alone as well. +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. -## `polybar_launch` - -For `polybar` users. Launches `polybar` on every screen. Should be run in the -i3 config. - -## `popweather` - -The script called by clicking on the i3 weather module. Brings up the forecast -from `http://wttr.in` and waits for input to prevent immediate closing of -spawned window. - -## `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`. - -## `remaps` +### `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. -## `samedir` +### `shortcuts` -Opens a terminal window in the same directory as the window currently -selection. Bound to `mod+shift+enter`. +For updating bash and ranger shortcuts. Reads `~/.key_directories` and +`~/.key_files` for pairs of keypresses and directories and files, then +autoproduces bash aliases and ranger shortcuts for them which output to +`~/.shortcuts` 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 +`~/.key_*` files. -## `screencast` +### `speedvid` -A script for `dmenurecord`. Records default audio and the screen. +Speed up a given video file (`$1`) by a given ammount (`$2`). -## `shortcuts.sh` +### `tpb` -For updating bash and ranger shortcuts. Reads `~/.scripts/folders` and -`~/.scripts/configs` for pairs of keypresses and directories and configfiles, -then autoproduces bash aliases and ranger shortcuts for them. See the -`README.md` at -[https://github.com/LukeSmithxyz/shortcu-sync](https://github.com/LukeSmithxyz/shortcu-sync) -for the specifics. +Search Pirate Bay for the certain search terms given as arguments. -## `texclear` +### `texclear` Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file. -## `tmuxinit` +### `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+Print Screen` by default. Should be kill 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` +### `toggletouchpad` As the name suggests, turns off TouchPad if on, and turns it on if off. -Requires `xf86-input-synaptics`. +Requires `xf86-input-synaptics`. If your laptop has a special button for this, +it will be mapped by default. -## `tpb` - -Search Pirate Bay for the certain search terms given as arguments. - -## `tutorialvids` +### `tutorialvids` A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`. - -## `video` - -A script for `dmenurecord`. Records the screen with no audio. diff --git a/.scripts/cronbat b/.scripts/cron/cronbat similarity index 100% rename from .scripts/cronbat rename to .scripts/cron/cronbat diff --git a/.scripts/cron/crontog b/.scripts/cron/crontog new file mode 100755 index 0000000..d5c61be --- /dev/null +++ b/.scripts/cron/crontog @@ -0,0 +1,5 @@ +#!/bin/sh +# Toggles all cronjobs off/on. +# Stores disabled crontabs in ~/.consaved until restored. + +([ -f ~/.cronsaved ] && crontab - < ~/.cronsaved && rm ~/.cronsaved && notify-send "Cronjobs have been re-enabled." && echo cronjobs re-enabled.) || ( crontab -l > ~/.cronsaved && crontab -r && echo cronjobs saved and disabled.;notify-send "Cronjobs have been saved and disabled.") diff --git a/.scripts/newsup b/.scripts/cron/newsup similarity index 60% rename from .scripts/newsup rename to .scripts/cron/newsup index ab4116e..ad7adc6 100755 --- a/.scripts/newsup +++ b/.scripts/cron/newsup @@ -1,5 +1,9 @@ #!/bin/sh +# Set as a cron job to check for new RSS entries for newsboat. +# Note that newsbot cannot be opened during the sync and this +# sync cannot run while another instance of newsboat is open. + ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit echo "📰 🔃" > ~/.newsup pkill -RTMIN+6 i3blocks diff --git a/.scripts/crontog b/.scripts/crontog deleted file mode 100644 index 1cb74ee..0000000 --- a/.scripts/crontog +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Toggles all cronjobs off/on. -# Stores disabled crontabs in ~/.consaved until restored. - -([[ -f ~/.cronsaved ]] && cat ~/.cronsaved | crontab - && rm ~/.cronsaved && notify-send "Cronjobs have been re-enabled." && echo cronjobs re-enabled.) || ( crontab -l > ~/.cronsaved && crontab -r && echo cronjobs saved and disabled.;notify-send "Cronjobs have been saved and disabled.") diff --git a/.scripts/dmenuarchwiki b/.scripts/dmenuarchwiki deleted file mode 100755 index 276b5eb..0000000 --- a/.scripts/dmenuarchwiki +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Gives a dmenu prompt to search the Arch Wiki in your preferred web browser -# Home goes to the home page of the Arch Wiki -# Anything else, it search it - -# Original idea/script by Github user @Caedis. Minor changes by Luke. - -pgrep -x dmenu && exit - -choice=$(echo "📖" | dmenu -i -p "Type ArchWiki page or search term:") || exit 1 - -if [ "$choice" = "📖" ]; then - $BROWSER "https://wiki.archlinux.org" -else - $BROWSER "https://wiki.archlinux.org/index.php?search=$choice" -fi diff --git a/.scripts/bottomleft b/.scripts/i3cmds/bottomleft similarity index 100% rename from .scripts/bottomleft rename to .scripts/i3cmds/bottomleft diff --git a/.scripts/bottomright b/.scripts/i3cmds/bottomright similarity index 100% rename from .scripts/bottomright rename to .scripts/i3cmds/bottomright diff --git a/.scripts/camtoggle b/.scripts/i3cmds/camtoggle similarity index 100% rename from .scripts/camtoggle rename to .scripts/i3cmds/camtoggle diff --git a/.scripts/ddspawn b/.scripts/i3cmds/ddspawn similarity index 100% rename from .scripts/ddspawn rename to .scripts/i3cmds/ddspawn diff --git a/.scripts/displayselect b/.scripts/i3cmds/displayselect similarity index 100% rename from .scripts/displayselect rename to .scripts/i3cmds/displayselect diff --git a/.scripts/dmenumount b/.scripts/i3cmds/dmenumount similarity index 100% rename from .scripts/dmenumount rename to .scripts/i3cmds/dmenumount diff --git a/.scripts/dmenurecord b/.scripts/i3cmds/dmenurecord similarity index 100% rename from .scripts/dmenurecord rename to .scripts/i3cmds/dmenurecord diff --git a/.scripts/dmenuumount b/.scripts/i3cmds/dmenuumount similarity index 100% rename from .scripts/dmenuumount rename to .scripts/i3cmds/dmenuumount diff --git a/.scripts/dmenuunicode b/.scripts/i3cmds/dmenuunicode similarity index 100% rename from .scripts/dmenuunicode rename to .scripts/i3cmds/dmenuunicode diff --git a/.scripts/dropdowncalc b/.scripts/i3cmds/dropdowncalc similarity index 100% rename from .scripts/dropdowncalc rename to .scripts/i3cmds/dropdowncalc diff --git a/.scripts/ducksearch b/.scripts/i3cmds/ducksearch similarity index 100% rename from .scripts/ducksearch rename to .scripts/i3cmds/ducksearch diff --git a/.scripts/i3resize b/.scripts/i3cmds/i3resize similarity index 100% rename from .scripts/i3resize rename to .scripts/i3cmds/i3resize diff --git a/.scripts/killrecording b/.scripts/i3cmds/killrecording similarity index 100% rename from .scripts/killrecording rename to .scripts/i3cmds/killrecording diff --git a/.scripts/lockscreen b/.scripts/i3cmds/lockscreen similarity index 86% rename from .scripts/lockscreen rename to .scripts/i3cmds/lockscreen index 817b8d0..b745a6a 100755 --- a/.scripts/lockscreen +++ b/.scripts/i3cmds/lockscreen @@ -5,7 +5,7 @@ rm -f /tmp/locked.png # If `imagemagick` is not installed, use a blank screen. [ -f /usr/bin/convert ] && scrot -m -z /tmp/base.png && -pgrep -x dunst && notify-send -i ~/.scripts/lock.png "Locking computer..." && +pgrep -x dunst && notify-send -i ~/.scripts/pix/lock.png "Locking computer..." && convert /tmp/base.png -blur 0x8 /tmp/locked.png # Pause music (mocp, mpd and send the pause key to all mpv videos): diff --git a/.scripts/newspod b/.scripts/i3cmds/newspod similarity index 100% rename from .scripts/newspod rename to .scripts/i3cmds/newspod diff --git a/.scripts/prompt b/.scripts/i3cmds/prompt similarity index 100% rename from .scripts/prompt rename to .scripts/i3cmds/prompt diff --git a/.scripts/samedir b/.scripts/i3cmds/samedir similarity index 100% rename from .scripts/samedir rename to .scripts/i3cmds/samedir diff --git a/.scripts/td-toggle b/.scripts/i3cmds/td-toggle similarity index 64% rename from .scripts/td-toggle rename to .scripts/i3cmds/td-toggle index 42b5f1f..4eb6652 100755 --- a/.scripts/td-toggle +++ b/.scripts/i3cmds/td-toggle @@ -2,10 +2,12 @@ # If transmission-daemon is running, will ask to kill, else will ask to start. -if pgrep -x transmission-da ; +[ ! -f /usr/bin/transmission-daemon ] && echo "Transmission not installed." && exit + +if pgrep -x transmission-da >/dev/null ; then yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?") - [ "$yn" = "Yes" ] && killall transmission-daemon + [ "$yn" = "Yes" ] && killall transmission-da else yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?") [ "$yn" = "Yes" ] && transmission-daemon diff --git a/.scripts/tmuxdd b/.scripts/i3cmds/tmuxdd similarity index 100% rename from .scripts/tmuxdd rename to .scripts/i3cmds/tmuxdd diff --git a/.scripts/toggletouchpad b/.scripts/i3cmds/toggletouchpad similarity index 100% rename from .scripts/toggletouchpad rename to .scripts/i3cmds/toggletouchpad diff --git a/.scripts/tutorialvids b/.scripts/i3cmds/tutorialvids similarity index 100% rename from .scripts/tutorialvids rename to .scripts/i3cmds/tutorialvids diff --git a/.scripts/kb-lights.py b/.scripts/kb-lights.py deleted file mode 100755 index f492de0..0000000 --- a/.scripts/kb-lights.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 -# coding: utf-8 - -from sys import argv -import dbus - - -def kb_light_set(delta): - bus = dbus.SystemBus() - kbd_backlight_proxy = bus.get_object('org.freedesktop.UPower', '/org/freedesktop/UPower/KbdBacklight') - kbd_backlight = dbus.Interface(kbd_backlight_proxy, 'org.freedesktop.UPower.KbdBacklight') - - current = kbd_backlight.GetBrightness() - maximum = kbd_backlight.GetMaxBrightness() - new = max(0, current + delta) - - if 0 <= new <= maximum: - current = new - kbd_backlight.SetBrightness(current) - - # Return current backlight level percentage - return 100 * current / maximum - -if __name__ == '__main__': - if len(argv[1:]) == 1: - if argv[1] == "--up" or argv[1] == "+": - # ./kb-light.py (+|--up) to increment - print(kb_light_set(1)) - elif argv[1] == "--down" or argv[1] == "-": - # ./kb-light.py (-|--down) to decrement - print(kb_light_set(-1)) - else: - print("Unknown argument:", argv[1]) - else: - print("Script takes exactly one argument.", len(argv[1:]), "arguments provided.") diff --git a/.scripts/musstuff b/.scripts/musstuff deleted file mode 100644 index 39428ab..0000000 --- a/.scripts/musstuff +++ /dev/null @@ -1,49 +0,0 @@ -These are some old lines from the i3 config. - -I now use the lmc script to change volume and music tracks, which makes i3blocks integration better. - -I deleted the alternative lines for audio commands from the i3 config. -Still, since they're a good reference for people who use ALSA, or people who use music players besides mpd, I've kept them in this file. - -You can replace the commands in the lmc script to get the setup you want. I might have the script autodecide the command later on. - -#FOR ALSA/AMIXER -#set $inc --no-startup-id amixer sset Master 2%+ -#set $biginc --no-startup-id amixer sset Master 5%+ -#set $dec --no-startup-id amixer sset Master 2%- -#set $bigdec --no-startup-id amixer sset Master 5%- -#set $mute --no-startup-id amixer sset Master toggle -#set $truemute --no-startup-id amixer sset Master mute - -##For spotify -#set $music spotify -#set $pause dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause -#set $trupause dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause -#set $play dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play -#set $next dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next -#set $prev dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous -#set $lilfor dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek -#set $bigfor dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek( - -# For moc: -#set $music --no-startup-id st -e mocp -#set $pause --no-startup-id mocp -G -#set $truepause --no-startup-id mocp -P -#set $next --no-startup-id mocp -f -#set $prev --no-startup-id mocp -r -#set $lilfor --no-startup-id mocp -k 10 -#set $bigfor --no-startup-id mocp -k 120 -#set $lilbak --no-startup-id mocp -k -10 -#set $bigbak --no-startup-id mocp -k -120 -#set $beg --no-startup-id mocp -j 0% - -# For cmus: -#set $music --no-startup-id st -e cmus -#set $pause --no-startup-id cmus-remote -u -#set $next --no-startup-id cmus-remote -n -#set $prev --no-startup-id cmus-remote -r -#set $lilfor --no-startup-id cmus-remote -k +10 -#set $bigfor --no-startup-id cmus-remote -k +120 -#set $lilbak --no-startup-id cmus-remote -k -10 -#set $bigbak --no-startup-id cmus-remote -k -120 -#set $beg --no-startup-id cmus-remote -k 00:00:00 diff --git a/.scripts/lock.png b/.scripts/pix/lock.png similarity index 100% rename from .scripts/lock.png rename to .scripts/pix/lock.png diff --git a/.scripts/polybar_launch b/.scripts/polybar_launch deleted file mode 100755 index 2af56ab..0000000 --- a/.scripts/polybar_launch +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -#!/usr/bin/env sh - -# Terminate already running bar instances -killall -q polybar - -# Wait until the processes have been shut down -while pgrep -x polybar >/dev/null; do sleep 1; done - -# Launch bar1 and bar2 -#polybar example & - -for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar example -c ~/.config/polybar/config & done -feh --bg-scale ~/.config/wall.png - -echo "Bars launched..." diff --git a/.scripts/showclip b/.scripts/showclip deleted file mode 100755 index 38be25a..0000000 --- a/.scripts/showclip +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Display contents of selection via dunst if running. -# Separate script for i3. - -pgrep -x dunst >/dev/null && notify-send "$(xclip -o -selection clipboard)" diff --git a/.scripts/i3battery b/.scripts/statusbar/i3battery similarity index 100% rename from .scripts/i3battery rename to .scripts/statusbar/i3battery diff --git a/.scripts/i3mail b/.scripts/statusbar/i3mail similarity index 100% rename from .scripts/i3mail rename to .scripts/statusbar/i3mail diff --git a/.scripts/i3mpd b/.scripts/statusbar/i3mpd similarity index 100% rename from .scripts/i3mpd rename to .scripts/statusbar/i3mpd diff --git a/.scripts/i3mpdupdate b/.scripts/statusbar/i3mpdupdate similarity index 100% rename from .scripts/i3mpdupdate rename to .scripts/statusbar/i3mpdupdate diff --git a/.scripts/i3pacman b/.scripts/statusbar/i3pacman similarity index 100% rename from .scripts/i3pacman rename to .scripts/statusbar/i3pacman diff --git a/.scripts/i3torrent b/.scripts/statusbar/i3torrent similarity index 100% rename from .scripts/i3torrent rename to .scripts/statusbar/i3torrent diff --git a/.scripts/i3volume b/.scripts/statusbar/i3volume similarity index 100% rename from .scripts/i3volume rename to .scripts/statusbar/i3volume diff --git a/.scripts/i3weather b/.scripts/statusbar/i3weather similarity index 100% rename from .scripts/i3weather rename to .scripts/statusbar/i3weather diff --git a/.scripts/i3wifi b/.scripts/statusbar/i3wifi similarity index 100% rename from .scripts/i3wifi rename to .scripts/statusbar/i3wifi diff --git a/.scripts/popupgrade b/.scripts/statusbar/popupgrade similarity index 100% rename from .scripts/popupgrade rename to .scripts/statusbar/popupgrade diff --git a/.scripts/popweather b/.scripts/statusbar/popweather similarity index 100% rename from .scripts/popweather rename to .scripts/statusbar/popweather diff --git a/.scripts/compiler b/.scripts/tools/compiler similarity index 100% rename from .scripts/compiler rename to .scripts/tools/compiler diff --git a/.scripts/dmenuhandler b/.scripts/tools/dmenuhandler similarity index 100% rename from .scripts/dmenuhandler rename to .scripts/tools/dmenuhandler diff --git a/.scripts/ext b/.scripts/tools/ext similarity index 100% rename from .scripts/ext rename to .scripts/tools/ext diff --git a/.scripts/extract b/.scripts/tools/extract similarity index 100% rename from .scripts/extract rename to .scripts/tools/extract diff --git a/.scripts/getbib b/.scripts/tools/getbib similarity index 100% rename from .scripts/getbib rename to .scripts/tools/getbib diff --git a/.scripts/getkeys b/.scripts/tools/getkeys similarity index 100% rename from .scripts/getkeys rename to .scripts/tools/getkeys diff --git a/.scripts/linkhandler b/.scripts/tools/linkhandler similarity index 100% rename from .scripts/linkhandler rename to .scripts/tools/linkhandler diff --git a/.scripts/lmc b/.scripts/tools/lmc similarity index 100% rename from .scripts/lmc rename to .scripts/tools/lmc diff --git a/.scripts/note b/.scripts/tools/note similarity index 100% rename from .scripts/note rename to .scripts/tools/note diff --git a/.scripts/opout b/.scripts/tools/opout similarity index 100% rename from .scripts/opout rename to .scripts/tools/opout diff --git a/.scripts/pauseallmpv b/.scripts/tools/pauseallmpv similarity index 100% rename from .scripts/pauseallmpv rename to .scripts/tools/pauseallmpv diff --git a/.scripts/remaps b/.scripts/tools/remaps similarity index 100% rename from .scripts/remaps rename to .scripts/tools/remaps diff --git a/.scripts/shortcuts b/.scripts/tools/shortcuts similarity index 100% rename from .scripts/shortcuts rename to .scripts/tools/shortcuts diff --git a/.scripts/speedvid.sh b/.scripts/tools/speedvid similarity index 100% rename from .scripts/speedvid.sh rename to .scripts/tools/speedvid diff --git a/.scripts/texclear b/.scripts/tools/texclear similarity index 100% rename from .scripts/texclear rename to .scripts/tools/texclear diff --git a/.scripts/tpb b/.scripts/tools/tpb similarity index 100% rename from .scripts/tpb rename to .scripts/tools/tpb diff --git a/.scripts/transadd b/.scripts/tools/transadd similarity index 100% rename from .scripts/transadd rename to .scripts/tools/transadd diff --git a/.vimrc b/.vimrc index cbe9adf..b9fcd5a 100644 --- a/.vimrc +++ b/.vimrc @@ -110,7 +110,7 @@ let mapleader =" " autocmd BufWritePre * %s/\s\+$//e " When shortcut files are updated, renew bash and ranger configs with new material: - autocmd BufWritePost ~/.scripts/folders,~/.scripts/configs !bash ~/.scripts/shortcuts.sh + autocmd BufWritePost ~/.key_directories,~/.key_files !bash ~/.scripts/tools/shortcuts " Runs a script that cleans out tex build files whenever I close out of a .tex file. autocmd VimLeave *.tex !texclear %