diff --git a/.config/X11/dwm-xinit b/.config/X11/dwm-xinit index fb57f59..39d574c 100644 --- a/.config/X11/dwm-xinit +++ b/.config/X11/dwm-xinit @@ -24,6 +24,7 @@ exec dstartup & exec xephyr-helper & exec xhost +si:localuser:"$USER" & no-hdmi-port.sh && with-hdmi-port.sh & +exec unclutter & # relaunch DWM if the binary changes, otherwise bail csum="" new_csum=$(sha1sum $(which dwm)) diff --git a/.config/newsboat/cache.db b/.config/newsboat/cache.db deleted file mode 100644 index 887d549..0000000 Binary files a/.config/newsboat/cache.db and /dev/null differ diff --git a/.config/newsboat/urls b/.config/newsboat/urls index f17b6c7..1f8a97e 100644 --- a/.config/newsboat/urls +++ b/.config/newsboat/urls @@ -16,6 +16,32 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCJLLl6AraX1POemgLfhirwg bit https://www.youtube.com/feeds/videos.xml?channel_id=UCAD-xOOaUI6N7Uq9laOVbcw more-bits-inside-by-rene-rebe https://www.youtube.com/feeds/videos.xml?channel_id=UCaTznQhurW5AaiYPbhEA-KA molly-rocket +"-----------------" +"---- Blogs" +"-----------------" +https://unixsheikh.com/feed.rss unixshekh +https://drewdevault.com/blog/index.xml drewdevault +http://feeds.feedburner.com/LinuxHatersBlog/?format=xml linux-hatred-deserverd-joke-i-love-linux +https://k1sslinux.org/blog/blog.xml KISS-Linux +https://cosmic.voyage/rss.xml comsic-voyage + +"-----------------" +"---- Podcasts" +"-----------------" +https://anchor.fm/s/149fd51c/podcast/rss TechOverTea +https://www.youtube.com/feeds/videos.xml?channel_id=UCLwNTXWEjVd2qIHLcXxQWxA timcast right-center commentary +https://www.youtube.com/feeds/videos.xml?channel_id=UCMMCy1le81jHY8rwcaqQrtA thedrip right-center left-center commentary finance +https://chinaunscripted.libsyn.com/rss china-unscripted + +"-----------------" +"---- Luke Smith chad" +"-----------------" +https://lukesmith.xyz/rss.xml luke-smith blog +https://notrelated.xyz/rss luke-smith notrelated +https://videos.lukesmith.xyz/feeds/videos.xml luke-smith videos +https://based.cooking/rss.xml luke-smith based-cooking +https://odysee.com/$/rss/@Luke/70 luke-smith videos odysee + "-----------------" "---- Youtube-Philosphy" "-----------------" @@ -53,38 +79,8 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCAL3JXZSzSm8AlZyD3nQdBA pri https://www.youtube.com/feeds/videos.xml?channel_id=UC2SMpy2oZV6BoyJEYShw9bw ta-outdoors https://www.youtube.com/feeds/videos.xml?channel_id=UCrI3dm4qgAEV67Jc6797WIA random-hands -"-----------------" -"---- Fake News" -"-----------------" -https://www.theonion.com/rss theonion fake-news -https://babylonbee.com/feed babylonbee fake-news - -"-----------------" -"---- Blogs" -"-----------------" -https://unixsheikh.com/feed.rss unixshekh -https://drewdevault.com/blog/index.xml drewdevault -http://feeds.feedburner.com/LinuxHatersBlog/?format=xml linux-hatred-deserverd-joke-i-love-linux -https://k1sslinux.org/blog/blog.xml KISS-Linux - -"-----------------" -"---- Podcasts" -"-----------------" -https://anchor.fm/s/149fd51c/podcast/rss TechOverTea -https://www.youtube.com/feeds/videos.xml?channel_id=UCLwNTXWEjVd2qIHLcXxQWxA timcast right-center commentary -https://www.youtube.com/feeds/videos.xml?channel_id=UCMMCy1le81jHY8rwcaqQrtA thedrip right-center left-center commentary finance -https://chinaunscripted.libsyn.com/rss china-unscripted - "-----------------" "---- Pentesting" "-----------------" https://www.darknet.org.uk/feed darknet https://www.youtube.com/feeds/videos.xml?channel_id=UClcE-kVhqyiHCcjYwcpfj9w liveoverflow - -"-----------------" -"---- Luke Smith chad" -"-----------------" -https://lukesmith.xyz/rss.xml luke-smith blog -https://notrelated.xyz/rss luke-smith notrelated -https://videos.lukesmith.xyz/feeds/videos.xml luke-smith videos -https://based.cooking/rss.xml luke-smith based-cooking diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 5fdd2bb..5e511e2 100755 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -6,7 +6,6 @@ Plug 'mhinz/vim-startify' Plug 'liuchengxu/vim-which-key' Plug 'dylanaraps/wal.vim' Plug 'morhetz/gruvbox' -Plug 'karb94/neoscroll.nvim' Plug 'folke/twilight.nvim' Plug 'folke/zen-mode.nvim' Plug 'hoob3rt/lualine.nvim' @@ -82,11 +81,11 @@ nmap dcbp VimspectorToggleConditionalBreakpoint lua require("altffour") " Setup theme. -"set t_Co=256 +set t_Co=256 "let g:gruvbox_termcolors=16 "set g:gruvbox_contrast_light="hard" "set background=light -"colorscheme gruvbox +colorscheme wal "set termguicolors "hi Pmenu ctermbg=gray "hi PmenuSel ctermbg=white @@ -135,16 +134,34 @@ set ttyfast " airline let g:airline#extensions#tabline#enabled = 1 -" Leader keys -let mapleader = " " -map e :bufdo e! -nnoremap :WhichKey '' " Telescope nnoremap ff :Telescope find_files nnoremap fg :Telescope live_grep nnoremap fb :Telescope buffers nnoremap fh :Telescope help_tags +" Keymaps +nnoremap Y y$ +nnoremap n nzzzv +nnoremap N nzzzv +nnoremap J mzJ`z +inoremap , ,u +inoremap . .u +inoremap ! !u +inoremap ? ?u + +vnoremap J :m '>+1gv=gv +vnoremap K :m '<-1gv=gv +vnoremap :m .+1== +nnoremap j :m .+1== +vnoremap :m .-1== +nnoremap k :m .-1== + +" Leader keys +let mapleader = " " +map e :bufdo e! +nnoremap :WhichKey '' + " Custom settings. set mouse=a set encoding=utf-8 diff --git a/.config/nvim/lua/altffour/init.lua b/.config/nvim/lua/altffour/init.lua index 5660bb3..53c7833 100644 --- a/.config/nvim/lua/altffour/init.lua +++ b/.config/nvim/lua/altffour/init.lua @@ -16,11 +16,6 @@ if pcall(require, 'plenary') then end end -require('neoscroll').setup({ - use_local_scrolloff = false, - espect_scrolloff = false, -}) - require('twilight').setup() require('zen-mode').setup() require('lualine').setup({ diff --git a/.gitignore b/.gitignore index b070a26..fbf022f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .config/nvim/plugged +.config/newsboat/cache.db diff --git a/.local/bin/dbrowsel b/.local/bin/dbrowsel index ee3daca..f927812 100755 --- a/.local/bin/dbrowsel +++ b/.local/bin/dbrowsel @@ -1,20 +1,16 @@ -#!/usr/bin/env sh +#!/bin/bash # Dmenu for selecting which browser to open. -Browsers='1. AC -2. ACB -3. CB -4. O' +Browsers='1. firefox +2. surf-open' Chosen=$(printf '%s' "$Browsers" \ | dmenu -i -l 20 -p 'Select browser:') [ -z "$Chosen" ] && exit 1 case $Chosen in - '1. AC') firefox -P AC "$@";; - '2. ACB') firefox -P ACB "$@";; - '3. CB') firefox -P CB "$@";; - '4. O') firefox -P O "$@";; + '1. firefox') firefox "$@";; + '2. surf-open') surf-open "$@";; *) eval "$Chosen" "$@";; esac diff --git a/.local/bin/ddiropen b/.local/bin/ddiropen deleted file mode 100755 index 2eb9645..0000000 --- a/.local/bin/ddiropen +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for opening a program with a specific directory. - -# MIT License -# -# Copyright (c) 2020 Alexander Chaplin Braz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -ScriptName=${0##*/} -Version=1.0.0 - -# Set default bookmark if there is none: -BlankMark='---' - -# Compose the help message: -HelpMessage="$ScriptName - Version: $Version -Creator: Alexander Chaplin Braz (https://alexchaplinbraz.com) -License: MIT - -Usage: $ScriptName {dirpath | filepath} {programs} [mark] - -This script lets the user open a directory with a program -using dmenu to select them. For this, it requires two arguments. - -The first one can either be a directory from which it will find all the -subdirectories, or a file that holds a list of directories acting as bookmarks. -It's highly recommended to use absolute paths, but relative paths also work. - -The second one has to be a comma separated list of programs which can be -unquoted, but quoting it gives the user the ability to specify options -for the programs. - -An optional third argument lets the user change the default bookmark name -when no bookmark name was set in the bookmark file. Default: $BlankMark - -The bookmark file must have a format where the path is at the start of a line. -One optional bookmark name can be set after the path by separating them with a -tab. Nothing from column 3+ is parsed. So you can use it freely to add comments -or whatever. You can also comment out lines with any character (other than \"), -thus breaking the path, so it won't show up as an option. - -In the case where there's only one program and/or directory, they will be -selected automatically. - -Usage examples: - $ScriptName \$HOME vifm,lf,sxiv - $ScriptName \ ranger,vifm - $ScriptName \"\$HOME/Pictures\" \"sxiv -t,sxiv -arf\" - $ScriptName \"\$HOME/Documents/dir-bookmarks.txt\" lf - $ScriptName \"\$HOME/Documents/dir-bookmarks.txt\" lf ### - -Example bookmarks file (keep in mind the tab separation): - -\$HOME HM -\"\$HOME/Pictures/Art References\" AR -\"\$XDG_CONFIG_HOME\" CNF -#\$COMMENT CM COMMENT: this can be whatever since it's not parsed. -/mnt MNT -/etc ETC -/backup BU -" - -suggest_help_and_exit() { - printf "Try '%s --help' for more information.\n" "$ScriptName" - exit 1 -} - -case $1 in - '') printf '%s' "$HelpMessage"; exit 1;; - -h|--help) printf '%s' "$HelpMessage"; exit 0;; - -v|--version) printf '%s - Version: %s\n' "$ScriptName" "$Version"; exit 0;; -esac - -# Set custom blank mark if it was set by the user: -[ "$3" ] && BlankMark=$3 - -# Set a location for the temporary file that holds the found directories: -TempFile="/tmp/$ScriptName-dirs" - -# Set up a function that can be called to run in the background: -find_directories() { - find "$1" -type d 2>/dev/null > "$TempFile" - printf '%s' "$ScriptName ENDofSEARCH" >> "$TempFile" -} - -# Parse the passed programs: -Parsed=$(printf '%s' "$2" | tr -s ',' '\n') - -# Count the amount of programs: -ProgramAmount=$(printf '%s\n' "$Parsed" | wc -l) - -# Determine whether the first argument is a directory or a file: -if [ -d "$1" ]; then - Directory=$1 -elif [ "$(file -i "$1" | awk '{printf $2}')" = 'text/plain;' ]; then - cat "$1" | while IFS= read -r line; do - line=$(printf '%s' "$line" \ - | awk -F '\t' -v blank=$BlankMark \ - '{print match($2, /[^ ]/) ? $2 : blank, $1}' OFS='\t') - path=$(printf '%s' "$line" | awk -F '\t' '{printf $2}') - eval [ -d "$path" ] 2>/dev/null \ - && printf '%s\n' "$line" >> "$TempFile" - done - if [ ! -s "$TempFile" ]; then - printf 'ERROR: no valid directories in the specified file.\n' - suggest_help_and_exit - fi - [ $ProgramAmount = 1 ] && pn="[$Parsed] " - Directory=$(printf '%s' "$(cat "$TempFile")" \ - | dmenu -i -l 30 -p "${pn}Select parent directory:" \ - | awk -F '\t' '{printf $2}') -else - printf 'ERROR: invalid first argument.\n' - suggest_help_and_exit -fi - -# Delete the temporary file: -rm "$TempFile" 2>/dev/null - -# Exit if no directory was selected: -[ -z "$Directory" ] && exit 1 - -# Do the directory search in the background: -eval find_directories "$Directory" & - -# If there's only one program, skip selecting it: -if [ $ProgramAmount = 1 ]; then - Program=$Parsed -# Else, select the program first to hide the time taken to find the directories: -else - Program=$(printf '%s' "$Parsed" \ - | dmenu -i -l 30 -p 'Select program:') - [ -z "$Program" ] && exit 1 -fi - -# Wait until all directories have been found: -until [ "$(tail -n 1 "$TempFile")" = "$ScriptName ENDofSEARCH" ]; do - sleep 0.1 -done - -# If there's only the result of the directory itself, select it: -if [ $(wc -l "$TempFile" | awk '{printf $1}') = 1 ]; then - Chosen=$(sed '$d' "$TempFile") -# Else, choose a directory: -else - Chosen=$(sed '$d' "$TempFile" \ - | dmenu -i -l 30 -p "[$Program] Select directory:") -fi - -# Delete the temporary file: -rm "$TempFile" 2>/dev/null - -# Exit if no directory was chosen: -[ -z "$Chosen" ] && exit 1 - -# Launch the selected program with the selected directory: -eval "$Program" \""$Chosen"\" diff --git a/.local/bin/dedit b/.local/bin/dedit deleted file mode 100755 index 6de7677..0000000 --- a/.local/bin/dedit +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for quickly finding and opening files to edit. -# If '-r' is passed, it will search root relevant files and edit as root. - -# Find the files to be displayed: -case $1 in - -r|--root) Files=$(sudo find '/etc' -type f) - AsRoot=' as root';; - *) Files1=$(find "$LBIN" -type l) - Files2=$(find "$HOME" "$LSHARE" -maxdepth 1 -type f) - Files3=$(find "$XDG_DOCUMENTS_DIR/notes" "$XDG_CONFIG_HOME" "$LBIN" -type f) - # Exclude some paths: - Files=$(printf "%s\n%s\n%s" "$Files1" "$Files2" "$Files3" | grep -Ev \ - '.tdb|.sql|dump|eb26f4|google-chrome|VirtualBox|BraveSoftware|.config/cargo');; -esac - -# Choose the file to open: -Prompt="Select a file to edit${AsRoot}:" -Chosen=$(printf '%s' "$Files" | dmenu -i -l 30 -p "$Prompt") -[ -z "$Chosen" ] && exit 1 - -# Open the editor with the selected file: -if [ "$1" = '-r' ]; then - ### If `$EDITOR` is a GUI, permissions will likely get quite messed up. - sudo $EDITOR "$Chosen" -else - $EDITOR "$Chosen" -fi diff --git a/.local/bin/dkeys b/.local/bin/dkeys deleted file mode 100755 index d93e2cb..0000000 --- a/.local/bin/dkeys +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for disabling/enabling keyboard keys. - -ScriptName=${0##*/} -Version=1.0.0 - -SuperLDisable='Disable Super_L' -SuperLEnable='Enable Super_L' -SuperRDisable='Disable Super_R' -SuperREnable='Enable Super_R' - -KeyState=$(printf '%s\n%s\n%s\n%s' \ - "$SuperLDisable" \ - "$SuperLEnable" \ - "$SuperRDisable" \ - "$SuperREnable" \ - | dmenu -i -l 10 -p "$ScriptName") - -case $KeyState in - "$SuperLDisable") Keycode='keycode 133 = 0x0000';; - "$SuperLEnable") Keycode='keycode 133 = 0xffeb';; - "$SuperRDisable") Keycode='keycode 134 = 0x0000';; - "$SuperREnable") Keycode='keycode 134 = 0xffec';; - *) exit 1;; -esac - -xmodmap -e "$Keycode" diff --git a/.local/bin/dlocate b/.local/bin/dlocate deleted file mode 100755 index 92c0700..0000000 --- a/.local/bin/dlocate +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for locating and opening paths. - -# MIT License -# -# Copyright (c) 2020 Alexander Chaplin Braz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -ScriptName=${0##*/} -Version=1.0.0 - -# Compose the help message: -HelpMessage="$ScriptName - Version: $Version -Creator: Alexander Chaplin Braz (https://alexchaplinbraz.com) -License: MIT - -Usage: $ScriptName {'programs'} - -Quickly find files and directories using 'locate', select one of the results -and then select a program to open that path with. - -This script requires one argument of comma separated programs, which can be -unquoted, but quoting it gives the user the ability to specify options -for the programs. - -As it depends on 'locate', the database needs to be updated frequently for -this script to be useful. It's recommended to have a cron job running -'updatedb' every 15 or 30 minutes. - -At the program selection point it's also possible to simply write a -non-specified program with arguments. If one of the dmenu options is still -selected, SHIFT+ENTER will ignore it and select exactly what you typed. - -Examples: - $ScriptName vim,vifm,lf,sxiv - $ScriptName 'nvim,lf,vifm,sxiv -ta,sxiv -arf' -" - -# Notify user of how to use the script: -case $1 in - '') printf '%s' "$HelpMessage"; exit 1;; - -h|--help) printf '%s' "$HelpMessage"; exit 0;; - -f|--version) printf '%s' "$Version"; exit 0;; -esac - -# Prompt user what to locate: -LocateTarget=$(printf '' | dmenu -p "$ScriptName:") - -# Exit if nothing was selected: -[ -z "$LocateTarget" ] && exit 1 - -# Do the search: -Located=$(locate "$LocateTarget") - -# Prompt user to select one of the results: -Path=$(printf '%s' "$Located" | dmenu -i -l 30 -p 'Select path:') - -# Exit if nothing was selected: -[ -z "$Path" ] && exit 1 - -# Parse the passed programs: -Parsed=$(printf '%s' "$1" | tr -s ',' '\n') - -# If there's only one program, skip selecting it: -if [ $(printf '%s\n' "$Parsed" | wc -l) -eq 1 ]; then - Program=$Parsed -else # Else, choose one: - Program=$(printf '%s' "$Parsed" | dmenu -i -l 10 -p 'Select program:') -fi - -# Exit if nothing was selected: -[ -z "$Program" ] && exit 1 - -# Launch the selected program with the selected path: -eval "$Program" \""$Path"\" diff --git a/.local/bin/dman b/.local/bin/dman deleted file mode 100755 index a123a6b..0000000 --- a/.local/bin/dman +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for easily finding a manual to open from a list of all manuals. - -# Set a character width for this script if needed: -#export MANWIDTH=80 - -man $(apropos --long . | dmenu -i -l 30 | awk '{print $2, $1}' | tr -d '()') - -# Probably the most useful script ever. - -# There are some manuals that have the same name but different sections denoted -# with what's inside (), one useful section to know is the POSIX version of the -# manuals which are #p or #posix, so adding that to the search shows you the -# POSIX version of the manual if it exists. For more information read the -# initial part of the man-pages manual and search 'intro' with this script. -# -# Keep in mind that newly installed programs with man pages tend not to appear -# right away because the manual database hasn't been updated yet (though you -# can simply write the name of the package if you know it). Depending on the -# system, it may be updated with a cron job, during boot, etc. If you want -# to update it manually, run: -# -# sudo mandb -# -# Ideally it would run every time a program is installed/uninstalled, but it -# seems a pain to set it up. It takes a few seconds to finish, which is a -# bummer, because I would have just put it at the start of this script. I could -# also just make a wrapper script for pacman that runs "sudo mandb" quietly if -# the un/installation was completed successfully. diff --git a/.local/bin/dmarks b/.local/bin/dmarks deleted file mode 100755 index 1d99dd4..0000000 --- a/.local/bin/dmarks +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu plain text URL bookmark manager. - -# MIT License -# -# Copyright (c) 2020 Alexander Chaplin Braz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -ScriptName=${0##*/} -Version=1.0.0 - -# Compose the help message: -HelpMessage="$ScriptName - Version: $Version -Creator: Alexander Chaplin Braz (https://alexchaplinbraz.com) -License: MIT - -Usage: $ScriptName {bookmark} - -This script is a simple plain text URL bookmark manager that lets the user -copy, add, edit and delete bookmark entries. It requires one argument, -the path to the bookmark file. The URLs are opened with \$BROWSER. - -The format of the bookmark file is: -One bookmark per line with three tab separated fields: URL, title and tags. -The tags are comma separated and can have spaces. -" - -case $1 in - '') printf '%s' "$HelpMessage"; exit 1;; - -h|--help) printf '%s' "$HelpMessage"; exit 0;; - -v|--version) printf '%s' "$Version"; exit 0;; -esac - -# Temporary file location -TempFile="/tmp/$ScriptName" - -# Load and format the bookmarks: -Bookmarks=$(cat "$1" | nl -n ln) -FormattedBookmarks=$(printf '%s' "$Bookmarks" \ - | sed 's/\t\t/\tBLANK\t/' \ - | awk -F '\t' '{print $1, $3, "("$4")", $5, "["$2"]"}') - ### For some reason setting OFS='\t' makes dmenu lag. - -# Set menu options: -MenuOpen='1. Open a bookmark.' -MenuCreate='2. Create new bookmark.' -MenuEdit='3. Edit a bookmark.' -MenuDelete='4. Delete a bookmark.' - -# Prompt user to choose action: -ChosenMenu=$(printf '%s\n%s\n%s\n%s' \ - "$MenuOpen" "$MenuCreate" "$MenuEdit" "$MenuDelete" \ - | dmenu -i -l 10 -p "$ScriptName:") - -# Open bookmark: -if [ "$ChosenMenu" = "$MenuOpen" ]; then - # Prompt user for bookmark: - Chosen=$(printf '%s' "$FormattedBookmarks" \ - | dmenu -i -l 30 -p 'Open:' \ - | awk '{printf $1}') - Chosen=$(printf '%s' "$Bookmarks" \ - | grep -w ^$Chosen \ - | awk '{printf $2}') - [ -z "$Chosen" ] && exit 1 - - # Open browser with selected URL. - $BROWSER "$Chosen" - -# Create bookmark: -elif [ "$ChosenMenu" = "$MenuCreate" ]; then - # Get the name of the active window: - ActiveWindow=$(ps -p "$(xdotool getwindowfocus getwindowpid)" -o comm=) - - # Set the name if the active window is a chromium based browser: - printf '%s' "$ActiveWindow" | grep -Eq 'chromium|chrome|brave' \ - && ActiveWindow='chromium-based' - ### Haven't actually checked whether Chromium's window name is chromium. - - # Get URL/title based on browser: - if [ "$ActiveWindow" = 'qutebrowser' ]; then - xdotool search --name qutebrowser key --clearmodifiers y P - sleep 0.1 - URL=$(xclip -o) - sleep 0.1 - xdotool search --name qutebrowser key --clearmodifiers y T - sleep 0.1 - Title=$(xclip -o) - elif [ "$ActiveWindow" = 'chromium-based' ]; then - xdotool key --clearmodifiers ctrl+l - sleep 0.1 - xdotool key --clearmodifiers ctrl+c - sleep 0.1 - URL=$(xclip -o) - sleep 0.1 - ### Maybe write it to a file in the background to speed it up. - ### Doesn't work for some generated sites. - Title=$(curl -s "$URL" \ - | awk -F '|' '{for(i=2;i<=NF;i+=2){print $i}}' \ - RS='' \ - | recode html) - fi - - # Check if URL already exists. - if [ "$URL" ] && grep -q "$URL" "$1" ;then - printf '' | dmenu -p 'ERROR: URL already bookmarked.' - exit 1 - fi - - # Prompt user to edit the URL: - EditedURL=$(printf '%s' "$URL" | dmenu -l 1 -p 'Edit URL:') - [ "$EditedURL" ] && URL=$EditedURL - - # Prompt user to edit the title: - EditedTitle=$(printf '%s' "$Title" | dmenu -l 1 -p 'Edit title:') - [ "$EditedTitle" ] && Title=$EditedTitle - - # Prompt the user to pick tags for the bookmark: - AllTags=$(printf '%s' "$Bookmarks" \ - | awk -F '\t' '{print $4}' \ - | tr ',' '\n' \ - | sort \ - | uniq) - while true; do - SelectedTag=$(printf '%s' "$AllTags" \ - | dmenu -i -l 30 \ - -p "Add tags. SHIFT+ENTER to create a new tag. $Tags") - [ -z "$SelectedTag" ] && break - Tags="$Tags$SelectedTag," - done - Tags=${Tags%?} - - # Create a preview for the user to see their input: - Confirmation=$(printf '%s\nURL: %s\nTitle: %s\nTags: %s' \ - 'This is a preview. Press ENTER to confirm or ESCAPE to cancel.' \ - "$URL" "$Title" "$Tags" \ - | dmenu -i -l 10) - - # If the user pressed ENTER, create the bookmark: - [ "$Confirmation" ] && \ - printf '%s\t%s\t%s' \ - "$URL" "$Title" "$Tags" >> "$1" - -# Edit bookmark: -elif [ "$ChosenMenu" = "$MenuEdit" ]; then - # Prompt user for bookmark: - Chosen=$(printf '%s' "$FormattedBookmarks" \ - | dmenu -i -l 30 -p "Edit:" \ - | awk '{printf $1}') - Chosen=$(printf '%s' "$Bookmarks" \ - | grep -w ^$Chosen \ - | awk '{printf $2}') - [ -z "$Chosen" ] && exit 1 - - # Get the bookmark information: - Mark=$(grep "$Chosen" "$1") - OldURL=$(printf '%s' "$Mark" | awk -F '\t' '{printf $1}') - OldTitle=$(printf '%s' "$Mark" | awk -F '\t' '{printf $2}') - OldTags=$(printf '%s' "$Mark" | awk -F '\t' '{printf $3}') - - # Prompt user to edit the URL: - EditedURL=$(printf '%s' "$OldURL" | dmenu -l 1 -p 'Edit URL:') - [ "$EditedURL" ] && URL=$EditedURL - - # Prompt user to edit the title: - EditedTitle=$(printf '%s' "$OldTitle" | dmenu -l 1 -p 'Edit title:') - [ "$EditedTitle" ] && Title=$EditedTitle - - # Prompt the user to pick tags for the bookmark: - AllTags=$(printf '%s' "$Bookmarks" \ - | awk -F '\t' '{print $4}' \ - | tr ',' '\n' \ - | sort \ - | uniq) - while true; do - SelectedTag=$(printf '%s' "$AllTags" \ - | dmenu -i -l 30 \ - -p "Old: $OldTags | New: $Tags") - [ -z "$SelectedTag" ] && break - Tags="$Tags$SelectedTag," - done - Tags=${Tags%,} - - # Create a preview for the user to see their input: - Confirmation=$(printf \ - '%s\nNew URL: %s\nOld URL: %s\nNew title: %s\nOld title: %s\ - \nNew tags: %s\nOld tags: %s' \ - 'This is a preview. Press ENTER to confirm or ESCAPE to cancel.' \ - "$URL" "$OldURL" "$Title" "$OldTitle" "$Tags" "$OldTags" \ - | dmenu -i -l 10) - - # If the user pressed ENTER, edit the bookmark: - if [ "$Confirmation" ]; then - sed "\|$Chosen|d" "$1" > "$TempFile" - mv "$TempFile" "$1" - printf '%s\t%s\t%s' "$URL" "$Title" "$Tags" >> "$1" - else - exit 1 - fi - -# Delete bookmark: -elif [ "$ChosenMenu" = "$MenuDelete" ]; then - # Prompt user for bookmark: - Chosen=$(printf '%s' "$FormattedBookmarks" \ - | dmenu -i -l 30 -p 'Delete:' \ - | awk '{printf $1}') - Chosen=$(printf '%s' "$Bookmarks" \ - | grep -w ^$Chosen \ - | awk '{printf $2}') - [ -z "$Chosen" ] && exit 1 - - # Delete selected bookmark from file: - sed "\|$Chosen|d" "$1" > "$TempFile" - mv "$TempFile" "$1" - -elif [ -z "$ChosenMenu" ]; then - exit 1 -else - printf 'ERROR: invalid selection.\n' - exit 1 -fi diff --git a/.local/bin/dmnt b/.local/bin/dmnt deleted file mode 100755 index 4d39cbe..0000000 --- a/.local/bin/dmnt +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu to mount/unmount partitions. - -ScriptName=${0##*/} -Version=1.0.0 - -# Set menu options: -MenuMount='1. Mount a partition.' -MenuUnmount='2. Unmount a partition.' - -ChosenMenu=$(printf '%s\n%s' \ - "$MenuMount" "$MenuUnmount" \ - | dmenu -i -l 10 -p "$ScriptName:") - -# Mount a partition: -if [ "$ChosenMenu" = "$MenuMount" ]; then - Mountable=$(lsblk -lp \ - | grep "part $" \ - | awk '{print $1, "(" $4 ")"}') - [ -z "$Mountable" ] && exit 1 - - Chosen=$(printf '%s' "$Mountable" \ - | dmenu -i -l 10 -p 'Mount which drive?' \ - | awk '{print $1}') - [ -z "$Chosen" ] && exit 1 - - # Try to mount directly based on fstab: - sudo mount "$Chosen" && exit 0 - # Otherwise ask for directory. - - ### Implement a way to exclude already mounted locations. - - Directories=$(find /mnt -maxdepth 1 -type d 2>/dev/null) - MountPoint=$(printf '%s' "$Directories" \ - | dmenu -i -l 10 -p 'Type in mount point:') - [ -z "$MountPoint" ] && exit 1 - - if [ ! -d "$MountPoint" ]; then - mkdirprompt=$(printf 'No\\nYes' \ - | dmenu -i -p "$MountPoint does not exist. Create it?") - [ "$mkdirprompt" = 'Yes' ] && sudo mkdir -p "$MountPoint" - fi - - sudo mount "$Chosen" "$MountPoint" - -# Unmount a partition: -elif [ "$ChosenMenu" = "$MenuUnmount" ]; then - ExclusionRegex='\(/boot\|/home\|/\|/backup\|/backup/extra\)$' - - Drives=$(lsblk -lp \ - | grep "part /" \ - | grep -v "$ExclusionRegex" \ - | awk '{print $1, "(" $4 ")", "on", $7}') - [ -z "$Drives" ] && exit 1 - - Chosen=$(printf '%s' "$Drives" \ - | dmenu -i -l 10 -p 'Unmount which drive?' \ - | awk '{print $1}') - [ -z "$Chosen" ] && exit 1 - - sudo umount "$Chosen" -elif [ -z "$ChosenMenu" ]; then - exit 1 -else - printf 'ERROR: invalid selection.\n' - exit 1 -fi diff --git a/.local/bin/dnewsh b/.local/bin/dnewsh deleted file mode 100755 index 6271ef9..0000000 --- a/.local/bin/dnewsh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -# Quickly start creating a new script. - -Directory=$(find "$HOME/proj" -maxdepth 2 -type d \ - | dmenu -i -l 30 -p 'Select directory for new script:') -[ -z "$Directory" ] && exit 1 - -Name=$(printf '' | dmenu -p 'Name the script:') -[ -z "$Name" ] && exit 1 - -Script="$Directory/$Name" -touch "$Script" -chmod +x "$Script" -ln -sf "$Script" "$LBIN" -printf '%s\n\n# ' '#!/usr/bin/env sh' > "$Script" - -$EDITOR "$Script" diff --git a/.local/bin/dpass b/.local/bin/dpass deleted file mode 100755 index 92c0ae0..0000000 --- a/.local/bin/dpass +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for managing passwords. - -# MIT License -# -# Copyright (c) 2020 Alexander Chaplin Braz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -ScriptName=${0##*/} -Version=1.1.0 - -HelpMessage="$ScriptName - Version: $Version -Creator: Alexander Chaplin Braz (https://alexchaplinbraz.com) -License: MIT - -Usage: $ScriptName ['genrepass arguments'] - -This script lets the user copy, add, edit and delete pass entries through a -series of dmenu prompts. - -The script itself requires no arguments, but does require the user to have the -complimentary genrepass utility by the same creator for password generation. -In the case of its absense, the password generation simply won't work and the -user will have to input them manually. - -The default argument for genrepass is just to look for text files in the XGD -environment variable for documents \$XDG_DOCUMENTS_DIR without any options, -but the user can override that by passing them as the first argument. Do make -sure to quote the whole block of options and arguments that you would normally -pass to genrepass with single quotes. - -Another way to set the options is to export an environment variable named -DPASS_OPTS, which takes the same format. This way you can simply run -$ScriptName without any options. Directly passed arguments still take -preference though. - -IMPORTANT: avoid using the '-c' for copying to clipboard because this script - is set up in a way that pipes the stdout of genrepass into dmenu for - you to see. - -Keep in mind the pinentry program used for entering your passphrase to decrypt -your .gpg files. If it's set to a terminal one, this script won't work properly. -I personally recommend pinentry-dmenu to keep with the dmenu theme. - -The editor is taken from \$EDITOR as used by pass. - -Examples: - $ScriptName '-C \"\$HOME/Documents/Journal-2020.md\"' - $ScriptName '-L30-50 -n10 \"\$HOME/Documents/notes/\"' - export DPASS_OPTS='-C \"\$HOME/Documents/notes\"' -" - -error() { printf 'ERROR: %s\n' "$1" 1>&2; } - -suggest_help_and_exit() { - printf "Try '%s --help' for more information.\n" "$ScriptName"; - exit 1 -} - -case $1 in - -h|--help) printf '%s' "$HelpMessage"; exit 0;; - -v|--version) printf '%s - Version: %s\n' "$ScriptName" "$Version"; exit 0;; -esac - -# Get the location of the password store: -PWStore=$PASSWORD_STORE_DIR -[ -z "$PWStore" ] && PWStore="$HOME/.password-store" - -# Get a list of all entries: -PassList=$(find $PWStore -name '*.gpg' | sed "s/\.gpg$//; s|$PWStore/||g") - -# Set menu options: -MenuCopy='1. Copy entry to clipboard.' -MenuCreate='2. Create new entry/Edit existing entry.' -MenuEdit="3. Edit entry with $EDITOR." -MenuDelete='4. Delete an entry.' -FullMenu="$MenuCopy\n$MenuCreate\n$MenuEdit\n$MenuDelete" - -# Prompt user to choose action: -ChosenMenu=$(printf '%b' "$FullMenu" | dmenu -i -l 10 -p "$ScriptName:") - -# Copy selected entry to clipboard: -if [ "$ChosenMenu" = "$MenuCopy" ]; then - ChosenPass=$( - printf '%s' "$PassList" | dmenu -i -l 30 -p 'Select entry to copy:' - ) - - pass show -c "$ChosenPass" - -# Create new entry/Edit existing entry: -elif [ "$ChosenMenu" = "$MenuCreate" ]; then - ChosenName=$( - printf '%s' "$PassList" | dmenu -i -l 30 -p 'Input entry name:' - ) - - [ -z "$ChosenName" ] && exit 1 - - if ! command -v genrepass 1> /dev/null 2>&1; then - GenrepassNotFound="ERROR: 'genrepass' not found in PATH." - fi - - # Set menu options: - TypeSingleLine='1. Write a single line of content.' - TypeGenrepass="2. Generate password with genrepass. $GenrepassNotFound" - - # Prompt user to choose content type: - ChosenType=$( - printf '%s\n%s' "$TypeSingleLine" "$TypeGenrepass" \ - | dmenu -i -l 10 -p 'Select content type:' - ) - - # Generate password with genrepass: - if [ "$ChosenType" = "$TypeGenrepass" ];then - - # Set genrepass options: - if [ -z "$1" ]; then - if [ -n "$DPASS_OPTS" ]; then - GRPargs=$DPASS_OPTS - else - GRPargs=$XDG_DOCUMENTS_DIR - fi - else - GRPargs=$1 - fi - - if [ -z "$GenrepassNotFound" ]; then - - # Keep generating passwords until one is selected: - while [ -z "$Content" ]; do - Content=$( - eval genrepass "$GRPargs" | dmenu -l 10 \ - -p 'ENTER to select, ESCAPE to generate new password:' - ) - done - else - Content=$(printf '' | dmenu -p 'Input content:') - fi - - # Input custom single line content: - elif [ "$ChosenType" = "$TypeSingleLine" ];then - Content=$(printf '' | dmenu -p 'Input content:') - - elif [ -z "$ChosenType" ];then - exit 1 - else - error 'Invalid selection.' - suggest_help_and_exit - fi - - # Create a preview for the user to see their input: - Confirmation=$( - printf '%s\nEntry: %s\nContent: %s' \ - 'This is a preview. Press ENTER to confirm or ESCAPE to cancel.' \ - "$ChosenName" "$Content" | dmenu -i -l 10 - ) - - # If the user pressed ENTER, create/edit the entry: - if [ "$Confirmation" ]; then - printf '%s' "$Content" | pass add --echo --force "$ChosenName" - fi - -# Open entry with $EDITOR: -elif [ "$ChosenMenu" = "$MenuEdit" ]; then - ChosenPass=$( - printf '%s' "$PassList" | dmenu -i -l 30 -p "Select entry to edit:" - ) - - $TERMINAL -e pass edit "$ChosenPass" - -# Delete an entry: -elif [ "$ChosenMenu" = "$MenuDelete" ]; then - ChosenPass=$( - printf '%s' "$PassList" | dmenu -i -l 30 -p 'Select entry to delete:' - ) - - pass delete --force "$ChosenPass" - -elif [ -z "$ChosenMenu" ]; then - exit 1 -else - error 'Invalid selection.' - suggest_help_and_exit -fi diff --git a/.local/bin/dpower b/.local/bin/dpower deleted file mode 100755 index e265034..0000000 --- a/.local/bin/dpower +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu power menu. -# Uses dprompt for confirmation. - -Menu='Hybrid-sleep -Power Off -Reboot -Suspend -Hibernate' - -Chosen=$(printf "$Menu" | dmenu -i -l 10 -p 'dpower') - -if [ "$Chosen" = 'Hybrid-sleep' ]; then - dprompt "Confirm $Chosen?" 'systemctl hybrid-sleep' -elif [ "$Chosen" = 'Power Off' ]; then - dprompt "Confirm $Chosen?" 'poweroff' -elif [ "$Chosen" = 'Restart' ]; then - dprompt "Confirm $Chosen?" 'reboot' -elif [ "$Chosen" = 'Suspend' ]; then - dprompt "Confirm $Chosen?" 'systemctl suspend' -elif [ "$Chosen" = 'Hibernate' ]; then - dprompt "Confirm $Chosen?" 'systemctl hibernate' -else - exit 1 -fi diff --git a/.local/bin/dprompt b/.local/bin/dprompt deleted file mode 100755 index 8e955f3..0000000 --- a/.local/bin/dprompt +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu binary prompt. -# Gives a dmenu prompt labled with $1 to perform command $2. -# Example: dprompt "Suspend?" "sudo systemctl suspend" - -[ "$(printf 'No\nYes' \ - | dmenu -p "$1" \ - -i -nb darkred -sb red -sf black -nf gray)" = 'Yes' ] && $2 diff --git a/.local/bin/dstartup b/.local/bin/dstartup index b22c429..19885fd 100755 --- a/.local/bin/dstartup +++ b/.local/bin/dstartup @@ -21,7 +21,7 @@ if [ "$ChosenMenu" = "$NormalApps" ]; then fi if [ "$ChosenMenu" = "$DevApps" ]; then - input=$(dmenu -i -p "Working Environment ~/:") + input=$(ehco | dmenu -i -p "Working Environment ~/:") Environment="$HOME/$input" alacritty -t "code0" --working-directory $Environment & diff --git a/.local/bin/dtimer b/.local/bin/dtimer deleted file mode 100755 index 43ecebd..0000000 --- a/.local/bin/dtimer +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for starting a timer. -# Takes one optional argument for a WAV file sound alert. -# Requires a monospace font for dmenu to display the TIME'S UP text correctly. - -Duration=$(printf '' | dmenu -i -l 30 -p "Current time: $(date +"%H:%M - %A %Y/%m/%d") | Timer duration:") -[ -z "$Duration" ] && exit 1 - -Name=$(printf '' | dmenu -p 'Name your timer:') - -TimesUpMessage="Name: $Name Duration: $Duration - '''''' -TTTTTTTTTTTTTTTTTTTTTTTIIIIIIIIIIMMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE '::::' SSSSSSSSSSSSSSS UUUUUUUU UUUUUUUUPPPPPPPPPPPPPPPPP -T:::::::::::::::::::::TI::::::::IM:::::::M M:::::::ME::::::::::::::::::::E '::::' SS:::::::::::::::S U::::::U U::::::UP::::::::::::::::P -T:::::::::::::::::::::TI::::::::IM::::::::M M::::::::ME::::::::::::::::::::E ':::''S:::::SSSSSS::::::S U::::::U U::::::UP::::::PPPPPP:::::P -T:::::TT:::::::TT:::::TII::::::IIM:::::::::M M:::::::::MEE::::::EEEEEEEEE::::E':::' S:::::S SSSSSSS UU:::::U U:::::UUPP:::::P P:::::P -TTTTTT T:::::T TTTTTT I::::I M::::::::::M M::::::::::M E:::::E EEEEEE'''' S:::::S U:::::U U:::::U P::::P P:::::P - T:::::T I::::I M:::::::::::M M:::::::::::M E:::::E S:::::S U:::::D D:::::U P::::P P:::::P - T:::::T I::::I M:::::::M::::M M::::M:::::::M E::::::EEEEEEEEEE S::::SSSS U:::::D D:::::U P::::PPPPPP:::::P - T:::::T I::::I M::::::M M::::M M::::M M::::::M E:::::::::::::::E SS::::::SSSSS U:::::D D:::::U P:::::::::::::PP - T:::::T I::::I M::::::M M::::M::::M M::::::M E:::::::::::::::E SSS::::::::SS U:::::D D:::::U P::::PPPPPPPPP - T:::::T I::::I M::::::M M:::::::M M::::::M E::::::EEEEEEEEEE SSSSSS::::S U:::::D D:::::U P::::P - T:::::T I::::I M::::::M M:::::M M::::::M E:::::E S:::::S U:::::D D:::::U P::::P - T:::::T I::::I M::::::M MMMMM M::::::M E:::::E EEEEEE S:::::S U::::::U U::::::U P::::P - TT:::::::TT II::::::IIM::::::M M::::::MEE::::::EEEEEEEE:::::E SSSSSSS S:::::S U:::::::UUU:::::::U PP::::::PP - T:::::::::T I::::::::IM::::::M M::::::ME::::::::::::::::::::E S::::::SSSSSS:::::S UU:::::::::::::UU P::::::::P - T:::::::::T I::::::::IM::::::M M::::::ME::::::::::::::::::::E S:::::::::::::::SS UU:::::::::UU P::::::::P - TTTTTTTTTTT IIIIIIIIIIMMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE SSSSSSSSSSSSSSS UUUUUUUUU PPPPPPPPPP -" - -if Error=$(sleep $Duration 2>&1); then - [ "${1##*.}" = 'wav' ] && aplay "$1" & - printf '%s' "$TimesUpMessage" | dmenu -l 30 -else - printf '%s' "$Error" | dmenu -l 30 -p 'ERROR:' -fi diff --git a/.local/bin/dweb b/.local/bin/dweb index 6485f0d..52ea309 100755 --- a/.local/bin/dweb +++ b/.local/bin/dweb @@ -6,7 +6,7 @@ ScriptName=${0##*/} Version=1.0.0 #browser='firefox' # firefox -browser='surf-open' # firefox +browser='dbrowsel' # firefox search_engine='https://duckduckgo.com/?q=' # Set menu options: diff --git a/.local/bin/dwine b/.local/bin/dwine deleted file mode 100755 index b0a37d9..0000000 --- a/.local/bin/dwine +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for choosing which wine bottle to open a program with. - -if [ "$2" = 'wg32' ]; then - export WINEARCH='win32' - export WINEPREFIX='/home/alex/.local/wine/wg32' - exec wine "$1" - exit 0 -fi - -Chosen=$(printf '1. Run with WG32\n2. Run with WG64\n3. winetricks WG32\n4. winetricks WG64\n5. winecfg WG32\n6. winecfg WG64' \ - | dmenu -i -l 10 -p 'dwine:') - -if [ "$Chosen" = '1. Run with WG32' ]; then - export WINEARCH='win32' - export WINEPREFIX='/home/alex/.local/wine/wg32' - exec wine "$1" -elif [ "$Chosen" = '2. Run with WG64' ]; then - export WINEARCH='win64' - export WINEPREFIX='/home/alex/.local/wine/wg64' - exec wine "$1" -elif [ "$Chosen" = '3. winetricks WG32' ]; then - export WINEARCH='win32' - export WINEPREFIX='/home/alex/.local/wine/wg32' - exec winetricks -elif [ "$Chosen" = '4. winetricks WG64' ]; then - export WINEARCH='win64' - export WINEPREFIX='/home/alex/.local/wine/wg64' - exec winetricks -elif [ "$Chosen" = '5. winecfg WG32' ]; then - export WINEARCH='win32' - export WINEPREFIX='/home/alex/.local/wine/wg32' - exec winecfg -elif [ "$Chosen" = '6. winecfg WG64' ]; then - export WINEARCH='win64' - export WINEPREFIX='/home/alex/.local/wine/wg64' - exec winecfg -else - exit 1 -fi diff --git a/.local/bin/dyt b/.local/bin/dyt deleted file mode 100755 index ad5c555..0000000 --- a/.local/bin/dyt +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env sh - -# Dmenu for opening videos with youtube-viewer. -# MUST HAVE the *ID* at the end of custom_layout_format in youtube-viewer.conf. -# Example: -# custom_layout_format => "*TITLE* (*AUTHOR*) [*TIME*] *ID*" - -# MIT License -# -# Copyright (c) 2020 Alexander Chaplin Braz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -### Add subscription system with sxiv for looking through video thumbnails -### and managing the videos. -### Set youtube-viewer arguments as variables to be able to select them like -### tags for a custom search. -### Implement search history for quickly searching again. - -ScriptName=${0##*/} -Version=0.0.1 - -# Compose the help message: -HelpMessage="$ScriptName - Version: $Version -Creator: Alexander Chaplin Braz (https://alexchaplinbraz.com) -License: MIT - -Usage: $ScriptName - -MUST HAVE the *ID* at the end of custom_layout_format in youtube-viewer.conf. -Example: -custom_layout_format => \"*TITLE* (*AUTHOR*) [*TIME*] *ID*\" -" - -case $1 in - -h|--help) printf '%s' "$HelpMessage"; exit 0;; - -v|--version) printf '%s - Version: %s\n' "$ScriptName" "$Version"; exit 0;; -esac - -error() { printf 'ERROR: %s\n' "$1" 1>&2; } - -suggest_help_and_exit() { - printf "Try '%s --help' for more information.\n" "$ScriptName" 1>&2 - exit 1 -} - -YTURL='https://www.youtube.com/watch?v=' - -MenuSimple='1. Simple search.' -MenuHistory='2. History.' -MenuPlaylist='3. Playlist search.' -MenuChannel='4. Channel search.' - -ChosenMenu=$(printf '%s\n%s\n%s\n%s' \ - "$MenuSimple" \ - "$MenuHistory" \ - "$MenuPlaylist" \ - "$MenuChannel" \ - | dmenu -i -l 10 -p "$ScriptName:") - -if [ "$ChosenMenu" = "$MenuSimple" ]; then - Search=$(printf '' | dmenu -p 'Simple search:') - [ -z "$Search" ] && exit 1 - - printf '%s\n' "$Search" >> "$LSHARE/dytsearchhistory" - - YTID=$(youtube-viewer --no-interactive "$Search" \ - | sed '/^$/d' \ - | nl -n ln \ - | dmenu -i -l 30 -p 'Select video:') - [ -z "$YTID" ] && exit 1 - - printf '%s\n' "$YTID" >> "$LSHARE/dytvideohistory" - - mpv "$YTURL${YTID##* }" - -elif [ "$ChosenMenu" = "$MenuHistory" ]; then - HistoryMenu=$(printf '1. Search history.\n2. Video history.' \ - | dmenu -i -l 10 -p 'Which history?') - - if [ "$HistoryMenu" = '1. Search history.' ]; then - Search=$(cat "$LSHARE/dytsearchhistory" \ - | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' \ - | dmenu -i -l 30 -p 'Select previous search:') - [ -z "$Search" ] && exit 1 - - printf '%s\n' "$Search" >> "$LSHARE/dytsearchhistory" - - YTID=$(youtube-viewer --no-interactive "$Search" \ - | sed '/^$/d' \ - | nl -n ln \ - | dmenu -i -l 30 -p 'Select video:') - - printf '%s\n' "$YTID" >> "$LSHARE/dytvideohistory" - - elif [ "$HistoryMenu" = '2. Video history.' ]; then - YTID=$(cat "$LSHARE/dytvideohistory" \ - | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' \ - | dmenu -i -l 30 -p 'Select previous video:') - - else - exit 1 - fi - [ -z "$YTID" ] && exit 1 - - mpv "$YTURL${YTID##* }" - -elif [ "$ChosenMenu" = "$MenuPlaylist" ]; then - ### Can't find how to change the format for anything other than video list - ### so it's broken. Can parse it in another way, but it's ugly. - ### Can also just open youtube-viewer as intended. - exit 1 - - Search=$(printf '' | dmenu -p 'Playlist search:') - [ -z "$Search" ] && exit 1 - - YTID=$(youtube-viewer --no-interactive -sp "$Search" \ - | sed '/^$/d' \ - | dmenu -i -l 30 -p 'Select playlist:') - [ -z "$YTID" ] && exit 1 - - mpv "$YTURL${YTID##* }" - -elif [ "$ChosenMenu" = "$MenuChannel" ]; then - exit 1 - -elif [ -z "$ChosenMenu" ]; then - exit 1 -else - error 'invalid selection.' - suggest_help_and_exit -fi -nn diff --git a/.local/bin/f2py b/.local/bin/f2py deleted file mode 100755 index 40ce6f8..0000000 --- a/.local/bin/f2py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -import re -import sys -from numpy.f2py.f2py2e import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/.local/bin/f2py3 b/.local/bin/f2py3 deleted file mode 100755 index 40ce6f8..0000000 --- a/.local/bin/f2py3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -import re -import sys -from numpy.f2py.f2py2e import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/.local/bin/f2py3.8 b/.local/bin/f2py3.8 deleted file mode 100755 index 40ce6f8..0000000 --- a/.local/bin/f2py3.8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -import re -import sys -from numpy.f2py.f2py2e import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/.local/bin/genzathurarc b/.local/bin/genzathurarc deleted file mode 120000 index aa1ab82..0000000 --- a/.local/bin/genzathurarc +++ /dev/null @@ -1 +0,0 @@ -/home/dizzy/dox/opt/Zathura-Pywal/genzathurarc \ No newline at end of file diff --git a/.local/bin/qutebrowser_reload.py b/.local/bin/qutebrowser_reload.py deleted file mode 100755 index 1415a26..0000000 --- a/.local/bin/qutebrowser_reload.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -""" -Small Python script to reload qutebrowser themes. - -""" -try: - from qutebrowser import qutebrowser, app - from qutebrowser.misc import ipc -except ImportError: - print("error: qutebrowser missing.") - exit(1) - - -def qute_reload(): - """Send config-source command to qutebrowsers ipc server.""" - args = qutebrowser.get_argparser().parse_args() - app.standarddir.init(args) - socket = ipc._get_socketname(args.basedir) - ipc.send_to_running_instance(socket, [":config-source"], args.target) - -qute_reload() diff --git a/.local/bin/toggle_touchpad b/.local/bin/toggle_touchpad index f3635a1..b10ee24 100755 --- a/.local/bin/toggle_touchpad +++ b/.local/bin/toggle_touchpad @@ -1,10 +1,10 @@ #!/bin/sh device=12 -state=$(xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$") +state=$(xinput list-props "ETPS/2 Elantech Touchpad" | grep "Device Enabled" | grep -o "[01]$") if [ $state == '1' ];then - xinput --disable "$device" + xinput --disable "ETPS/2 Elantech Touchpad" else - xinput --enable "$device" + xinput --enable "ETPS/2 Elantech Touchpad" fi diff --git a/.local/bin/wal-discord b/.local/bin/wal-discord deleted file mode 120000 index afb8bff..0000000 --- a/.local/bin/wal-discord +++ /dev/null @@ -1 +0,0 @@ -/home/dizzy/proj/wal-discord/wal-discord \ No newline at end of file diff --git a/.local/bin/yt b/.local/bin/yt deleted file mode 100755 index 35bee1c..0000000 --- a/.local/bin/yt +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# dependencies: mpv youtube-dl fzf rofi/dmenu -# search videos and playlists on youtube and play them in mpv, without an API -# usage: -# yt asks for input in stdin, prompts using fzf -# yt search query takes input from the passed arg, prompts using fzf -# yt -r takes input and prompts using rofi ($guicmd) - -defcmd="fzf" -#guicmd="rofi -dmenu -i" #uncomment next line for dmenu -guicmd="dmenu -i -l 15" -promptcmd="$defcmd" -if [ -z "$*" ]; then - echo -n "Search YouTube: " - read -r query -else - case "$1" in - -r) query=$(echo | $guicmd -p "Search YouTube: ") - promptcmd="$guicmd -p Video:";; - *) query="$*";; - esac -fi -if [ -z "$query" ]; then exit; fi -# sanitise the query -query=$(sed \ - -e 's|+|%2B|g'\ - -e 's|#|%23|g'\ - -e 's|&|%26|g'\ - -e 's| |+|g'\ - <<< "$query") -# fetch the results with the $query and -# delete all escaped characters -response="$(curl -s "https://www.youtube.com/results?search_query=$query" |\ - sed 's|\\.||g')" -# if unable to fetch the youtube results page, inform and exit -if ! grep -q "script" <<< "$response"; then echo "unable to fetch yt"; exit 1; fi -# regex expression to match video and playlist entries from yt result page -vgrep='"videoRenderer":{"videoId":"\K.{11}".+?"text":".+?[^\\](?=")' -pgrep='"playlistRenderer":{"playlistId":"\K.{34}?","title":{"simpleText":".+?[^\"](?=")' -# grep the id and title -# return them in format id (type) title -getresults() { - grep -oP "$1" <<< "$response" |\ - awk -F\" -v p="$2" '{ print $1 "\t" p " " $NF}' -} -# get the list of videos/playlists and their ids in videoids and playlistids -videoids=$(getresults "$vgrep") -playlistids=$(getresults "$pgrep" "(playlist)") -# if there are playlists or videos, append them to list -[ -n "$playlistids" ] && ids="$playlistids\n" -[ -n "$videoids" ] && ids="$ids$videoids" -# url prefix for videos and playlists -videolink="https://youtu.be/" -playlink="https://youtube.com/playlist?list=" -# prompt the results to user infinitely until they exit (escape) -while true; do - echo "Choose Video/Playlist to play: " - choice=$(echo -e "$ids" | cut -d' ' -f2 | $promptcmd) # dont show id - if [ -z "$choice" ]; then exit; fi # if esc-ed then exit - id=$(echo -e "$ids" | grep -Fwm1 "$choice" | cut -d' ' -f1) # get id of choice - echo -e "$choice\t($id)" - case $id in - # 11 digit id = video - ???????????) mpv "$videolink$id";; - # 34 digit id = playlist - ??????????????????????????????????) mpv "$playlink$id";; - *) exit ;; - esac -done