diff options
| -rw-r--r-- | .config/i3/config | 56 | ||||
| -rw-r--r-- | .config/i3/i3_guide.rmd | 2 | ||||
| -rw-r--r-- | .scripts/SCRIPTS.md | 12 | ||||
| -rwxr-xr-x | .scripts/compiler | 33 | ||||
| -rwxr-xr-x | .scripts/ddspawn | 26 | ||||
| -rwxr-xr-x | .scripts/dropdowncalc | 2 | ||||
| -rwxr-xr-x | .scripts/ducksearch | 15 | ||||
| -rwxr-xr-x | .scripts/i3pacman | 2 | ||||
| -rwxr-xr-x | .scripts/i3volume | 20 | ||||
| -rwxr-xr-x | .scripts/i3wifi | 14 | ||||
| -rwxr-xr-x | .scripts/lmc | 47 | ||||
| -rwxr-xr-x | .scripts/newsup | 1 | ||||
| -rwxr-xr-x | .scripts/tmuxdd (renamed from .scripts/tmuxinit) | 2 | ||||
| -rwxr-xr-x | .scripts/tutorialvids | 2 |
14 files changed, 171 insertions, 63 deletions
diff --git a/.config/i3/config b/.config/i3/config index 072d748..2d099fb 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -30,9 +30,25 @@ set $reboot sudo -A reboot set $netrefresh --no-startup-id sudo -A systemctl restart NetworkManager set $hibernate sudo -A systemctl suspend +# #---Dropdown Windows---# # + +# First I have a tmux window used for background scripts. +# I'll later bind this to mod+u. +for_window [instance="tmuxdd"] floating enable +for_window [instance="tmuxdd"] resize set 625 400 +for_window [instance="tmuxdd"] move scratchpad +for_window [instance="tmuxdd"] border pixel 3 + +# Then I have a window running R I use for basic arithmetic +# I'll later bind this to mod+a. +for_window [instance="dropdowncalc"] floating enable +for_window [instance="dropdowncalc"] resize set 800 300 +for_window [instance="dropdowncalc"] move scratchpad +for_window [instance="dropdowncalc"] border pixel 2 + # #---Starting External Scripts---# # # Setting the background and colorscheme: -exec --no-startup-id wal -i ~/.config/wall.png >/dev/null +exec --no-startup-id wal -Ri ~/.config/wall.png >/dev/null # Starts dunst for notifications: exec --no-startup-id dunst # Composite manager: @@ -101,10 +117,10 @@ bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle bindsym $mod+Escape workspace prev -bindsym $mod+Shift+Escape exec --no-startup-id prompt "Are you sure you want to leave i3?" "i3-msg exit" +bindsym $mod+Shift+Escape exec --no-startup-id prompt "Exit i3?" "i3-msg exit" # bindsym $mod+BackSpace -bindsym $mod+Shift+BackSpace exec --no-startup-id prompt "Are you sure you want to reboot?" "$reboot" +bindsym $mod+Shift+BackSpace exec --no-startup-id prompt "Reboot computer?" "$reboot" ##bindsym $mod+grave ##bindsym $mod+asciitilde @@ -113,8 +129,8 @@ bindsym $mod+Shift+BackSpace exec --no-startup-id prompt "Are you sure you want bindsym $mod+Shift+Delete exec --no-startup-id lmc truemute ; exec $truepause ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e ranger # #---Letter Key Bindings---# # -bindsym $mod+q [con_id="__focused__" instance="^(?!math|dropdown).*$"] kill -bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!math|dropdown).*$"] kill +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+Shift+w exec --no-startup-id $BROWSER @@ -131,7 +147,7 @@ bindsym $mod+Shift+t gaps inner current set 15; gaps outer current set 15 bindsym $mod+y exec $term -e calcurse bindsym $mod+Shift+y exec --no-startup-id "bash ~/.scripts/i3resize left" -bindsym $mod+u [instance="dropdown"] scratchpad show; [instance="dropdown"] move position center +bindsym $mod+u exec --no-startup-id ddspawn tmuxdd bindsym $mod+Shift+u exec --no-startup-id "bash ~/.scripts/i3resize down" bindsym $mod+i exec $term -e htop @@ -143,7 +159,7 @@ bindsym $mod+Shift+o exec --no-startup-id "bash ~/.scripts/i3resize right" bindsym $mod+p exec --no-startup-id lmc toggle bindsym $mod+Shift+p exec --no-startup-id lmc pause -bindsym $mod+a [instance="math"] scratchpad show; [instance="math"] move position center +bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 bindsym $mod+Shift+a exec $term -e pulsemixer bindsym $mod+s gaps inner current plus 5 @@ -178,7 +194,7 @@ bindsym $mod+z gaps outer current plus 5 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 "Are you sure you want to shutdown?" "$shutdown" +bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown" bindsym $mod+c exec --no-startup-id camtoggle ##bindsym $mod+Shift+c @@ -259,24 +275,6 @@ for_window [class="Gimp"] move workspace $ws5 for_window [window_role="GtkFileChooserDialog"] resize shrink height 10 px for_window [title="Default - Wine desktop"] floating enable -# First I have a tmux window used for background scripts. -# I'll later bind this to mod+u. -for_window [instance="dropdown"] floating enable -for_window [instance="dropdown"] resize set 625 400 -for_window [instance="dropdown"] move scratchpad -for_window [instance="dropdown"] border pixel 3 -# Runs the tmuxinit script, which searches for an earlier tmux instance, -# otherwise starts a new one (to prevent multiple dropdown sessions). -exec --no-startup-id $term -n dropdown -e tmuxinit - -# Then I have a window running R I use for basic arithmetic -# I'll later bind this to mod+a. -for_window [instance="math"] floating enable -for_window [instance="math"] resize set 800 300 -for_window [instance="math"] move scratchpad -for_window [instance="math"] border pixel 2 -exec --no-startup-id $term -n math -f mono:pixelsize=24 -e dropdowncalc - # Bindings to make the webcam float and stick. for_window [title="mpvfloat"] floating enable for_window [title="mpvfloat"] sticky enable @@ -287,14 +285,14 @@ no_focus [title="mpvfloat"] bindsym $mod+F1 exec --no-startup-id zathura ~/.config/i3/i3_guide.pdf bindsym $mod+F2 restart bindsym $mod+F3 exec --no-startup-id displayselect -bindsym $mod+F4 exec --no-startup-id $hibernate +bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate" bindsym $mod+F5 exec --no-startup-id $netrefresh bindsym $mod+F6 exec --no-startup-id $term -e transmission-remote-cli bindsym $mod+F7 exec --no-startup-id td-toggle bindsym $mod+F8 exec --no-startup-id ~/.config/mutt/etc/mailsync.sh bindsym $mod+F9 exec --no-startup-id dmenumount bindsym $mod+F10 exec --no-startup-id dmenuumount -bindsym $mod+F11 exec --no-startup-id dmenuarchwiki +bindsym $mod+F11 exec --no-startup-id ducksearch bindsym $mod+F12 exec $term -e sudo -A wifi-menu # #---Arrow Keys---# # @@ -342,7 +340,7 @@ bindsym Control+XF86AudioLowerVolume exec --no-startup-id lmc down 1 bindsym XF86AudioRaiseVolume exec --no-startup-id lmc up 5 bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id lmc up 10 bindsym Control+XF86AudioRaiseVolume exec --no-startup-id lmc up 1 -bindsym XF86PowerOff exec --no-startup-id prompt "Are you sure you want to shutdown?" "$shutdown" +bindsym XF86PowerOff exec --no-startup-id prompt "Shutdown computer?" "$shutdown" ##bindsym XF86Copy exec ##bindsym XF86Open exec ##bindsym XF86Paste exec diff --git a/.config/i3/i3_guide.rmd b/.config/i3/i3_guide.rmd index be026ec..a69ddcd 100644 --- a/.config/i3/i3_guide.rmd +++ b/.config/i3/i3_guide.rmd @@ -148,7 +148,7 @@ for and install any you want to add. + `Mod+F9` -- Mount a drive/partition + `Mod+F10` -- Unmount a drive/partition (does not umount `/`, `/home` or `/boot`) -+ `Mod+F11` -- Search term in the Arch Wiki ++ `Mod+F11` -- Search term on DuckDuckGo + `Mod+F12` -- Wifi-menu for selecting the wireless internet source. ## Audio diff --git a/.scripts/SCRIPTS.md b/.scripts/SCRIPTS.md index 7e794c1..cd16f20 100644 --- a/.scripts/SCRIPTS.md +++ b/.scripts/SCRIPTS.md @@ -28,6 +28,12 @@ Turns off/on all user cronjobs. 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` Give this script a url and it will offer dmenu options for opening it. Used by @@ -53,6 +59,12 @@ if none are mounted. 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` Will detect file type of archive and run appropriate extraction command. diff --git a/.scripts/compiler b/.scripts/compiler index cb47638..7338d30 100755 --- a/.scripts/compiler +++ b/.scripts/compiler @@ -1,20 +1,27 @@ #!/bin/sh # This script will compile or run another finishing operation on a document. I -# have this script run via vim. +# have this script run via vim/emacs. # # tex files: Compiles to pdf, including bibliography if necessary # md files: Compiles to pdf via pandoc # rmd files: Compiles via R Markdown +# c files: Compiles via whatever compiler is set to cc. Usually gcc. +# py files: runs via python command +# go files: compiles and runs with "go run" # config.h files: (For suckless utils) recompiles and installs program. # all others: run `sent` to show a presentation + oridir=$(pwd) file=$(readlink -f "$1") dir=$(dirname "$file") base="${file%.*}" -cd "$dir" || exit +shebang=$(sed -n 1p $file) + +cd $dir + textype() { \ command="pdflatex" @@ -26,11 +33,27 @@ textype() { \ $command --output-directory="$dir" "$base" } +shebangtest() { + case "$shebang" in + \#\!*) "$file" ;; + *) sent "$file" 2>/dev/null & ;; + esac +} + + case "$file" in - *\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla ;; + *\.rmd) echo "require(rmarkdown); render('$file')" | R --vanilla && mv "$base".pdf "$dir"/pdfs;; *\.tex) textype "$file" ;; *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; *config.h) make && sudo make install ;; - *) sent "$file" 2>/dev/null & ;; + *\.c) cc "$file" -o "$base" && "$base" ;; + *\.py) python "$file" ;; + *\.go) go run "$file" ;; + + + + *) shebangtest ;; + esac -cd "$oridir" || exit +cd $oridir + diff --git a/.scripts/ddspawn b/.scripts/ddspawn new file mode 100755 index 0000000..aedcd18 --- /dev/null +++ b/.scripts/ddspawn @@ -0,0 +1,26 @@ +#!/bin/sh + +# This script simplifies dropdown windows in i3. +# Shows/hides a scratchpad of a given name, if it doesn't exist, creates it. +# Usage: +# argument 1: script to run in dropdown window +# all other args are interpreted as options for your terminal +# My usage: +# ddpawn +# bindsym $mod+u exec --no-startup-id ddspawn tmuxdd +# Will hide/show window running the `tmuxdd` script when I press mod+u in i3 +# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 +# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font) + + +[ -z "$1" ] && exit + +if xwininfo -tree -root | grep "(\"$1\" "; +then + echo "Window detected." +else + echo "Window not detected... spawning." + i3 "exec --no-startup-id $TERMINAL -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" + sleep .25 # This sleep is my laziness, will fix later (needed for immediate appearance after spawn). +fi +i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" diff --git a/.scripts/dropdowncalc b/.scripts/dropdowncalc index 7c4dbff..fee8f07 100755 --- a/.scripts/dropdowncalc +++ b/.scripts/dropdowncalc @@ -2,4 +2,4 @@ # This script ensures that i3 will spawn a calculator. # If R is installed, it will run R, otherwise it will run # Python. -([[ -e /usr/bin/R ]] && R -q) || python -q +([ -e /usr/bin/R ] && R -q --no-save) || python -q diff --git a/.scripts/ducksearch b/.scripts/ducksearch new file mode 100755 index 0000000..13a1e19 --- /dev/null +++ b/.scripts/ducksearch @@ -0,0 +1,15 @@ +#!/bin/sh + +# Gives a dmenu prompt to search DuckDuckGo. +# Without input, will open DuckDuckGo.com. +# Anything else, it search it. + +pgrep -x dmenu && exit + +choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1 + +if [ "$choice" = "🦆" ]; then + $BROWSER "https://duckduckgo.com" +else + $BROWSER "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" +fi diff --git a/.scripts/i3pacman b/.scripts/i3pacman index acf69c1..6825b92 100755 --- a/.scripts/i3pacman +++ b/.scripts/i3pacman @@ -10,4 +10,4 @@ case $BLOCK_BUTTON in 1) $TERMINAL -e "popupgrade" ;; esac -yay -Qu | wc -l | sed -e "s/^0$//g" +yay -Qu | sed -e '/^Get/d' | wc -l | sed -e "s/^0$//g" diff --git a/.scripts/i3volume b/.scripts/i3volume index 6dc72cd..9492906 100755 --- a/.scripts/i3volume +++ b/.scripts/i3volume @@ -1,12 +1,22 @@ -#!/bin/bash +#!/bin/sh case $BLOCK_BUTTON in - 1) $TERMINAL -e pulsemixer & disown ;; + 1) setsid "$TERMINAL" -e pulsemixer & ;; 3) pulsemixer --toggle-mute ;; 4) pulsemixer --change-volume +5 ;; 5) pulsemixer --change-volume -5 ;; esac -printpastatus() { [[ $(pulsemixer --get-mute) = 1 ]] && echo -n 🔇 " " && exit -echo 🔊 $(pulsemixer --get-volume | sed -e "s/\s[0-9][0-9]*//g")% ;} -printpastatus +[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit + +vol=$(pulsemixer --get-volume | awk '{print $1}') + +if [ "$vol" -gt "70" ]; then + icon="🔊" +elif [ "$vol" -lt "30" ]; then + icon="🔈" +else + icon="🔉" +fi + +printf "%s %s%%\\n" "$icon" "$vol" diff --git a/.scripts/i3wifi b/.scripts/i3wifi index 3fe5fb0..b9f79ec 100755 --- a/.scripts/i3wifi +++ b/.scripts/i3wifi @@ -8,18 +8,18 @@ INTERFACE="${BLOCK_INSTANCE:-wlan0}" [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && echo 📡 && exit -QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }') +QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70 - 1) }') echo 📶 $QUALITY% echo 📶 $QUALITY% # color if [[ $QUALITY -ge 80 ]]; then - echo "#00FF00" -elif [[ $QUALITY -lt 80 ]]; then - echo "#FFF600" -elif [[ $QUALITY -lt 60 ]]; then - echo "#FFAE00" + echo "#00FF00" elif [[ $QUALITY -lt 40 ]]; then - echo "#FF0000" + echo "#FF0000" +elif [[ $QUALITY -lt 60 ]]; then + echo "#FF8000" +elif [[ $QUALITY -lt 80 ]]; then + echo "#FFF600" fi diff --git a/.scripts/lmc b/.scripts/lmc index f506e9a..9c92f3f 100755 --- a/.scripts/lmc +++ b/.scripts/lmc @@ -3,18 +3,41 @@ # A general audio interface for LARBS. newvol="pkill -RTMIN+10 i3blocks" -# Uncomment if i3mpdupdate isn't running: + +[ -z "$2" ] && num="2" || num="$2" case "$1" in - "up") pulsemixer --change-volume +"$2" ; $newvol ;; - "down") pulsemixer --change-volume -"$2" ; $newvol ;; - "mute") pulsemixer --toggle-mute ; $newvol ;; - "truemute") pulsemixer --mute ; $newvol ;; - "toggle") mpc toggle ;; - "pause") mpc pause ; pauseallmpv ;; - "forward") mpc seek +"$2" ;; - "back") mpc seek -"$2" ;; - "next") mpc next ;; - "prev") mpc prev ;; - "replay") mpc seek 0% ;; + u*) pulsemixer --change-volume +"$num" ; $newvol ;; + d*) pulsemixer --change-volume -"$num" ; $newvol ;; + m*) pulsemixer --toggle-mute ; $newvol ;; + truemute) pulsemixer --mute ; $newvol ;; + play) mpc play ;; + n*) mpc next ;; + prev) mpc prev ;; + t*) mpc toggle ;; + p*) mpc pause ; pauseallmpv ;; + f*) mpc seek +"$num" ;; + b*) mpc seek -"$num" ;; + r*) mpc seek 0\% ;; + *) cat << EOF +lmc: cli music interface for mpd and pulse for those with divine intellect too +grand to remember the mpc/pamixer commands. + +Allowed options: + up NUM Increase volume (2 secs default) + down NUM Decrease volume (2 secs default) + mute Toggle mute + truemute Mute + next Next track + prev Previous track + toggle Toggle pause + truepause Pause + foward NUM Seek foward in song (2 secs default) + back NUM Seek back in song (2 secs default) + restart Restart current song + all else Print this message + +All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated, +i.e. \`lmc r\` for \`lmc restart\`. +EOF esac diff --git a/.scripts/newsup b/.scripts/newsup index 986524a..ab4116e 100755 --- a/.scripts/newsup +++ b/.scripts/newsup @@ -1,5 +1,6 @@ #!/bin/sh +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 printf "Loading new RSS entries for newsboat...\\n" diff --git a/.scripts/tmuxinit b/.scripts/tmuxdd index 68a4b86..c194ff1 100755 --- a/.scripts/tmuxinit +++ b/.scripts/tmuxdd @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # This is the script that i3 runs to either start tmux in # the dropdown terminal or log into a previous session. tmux a || tmux diff --git a/.scripts/tutorialvids b/.scripts/tutorialvids index ed607fd..f248253 100755 --- a/.scripts/tutorialvids +++ b/.scripts/tutorialvids @@ -14,4 +14,4 @@ urlview https://www.youtube.com/watch?v=IgzpAjFgbCw vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E " -mpv $(grep -P "^$(grep https: <<< $vidlist | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 5)\t" <<<$vidlist | sed 's/.*\t//') +mpv "$(echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 5)\\t" | sed 's/.*\t//')" |
