From 2dc5e822334a2d0fb6860f9b55f91b2e328a2ad6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 10 Apr 2018 17:43:40 -0700 Subject: [PATCH] dmenu recording, mounting and umounted added --- .config/i3/config | 34 +++++++++++----------------------- .scripts/dmenumount | 24 ++++++++++++++++++++++++ .scripts/dmenuumount | 14 ++++++++++++++ .scripts/record | 8 ++++++++ 4 files changed, 57 insertions(+), 23 deletions(-) create mode 100755 .scripts/dmenumount create mode 100755 .scripts/dmenuumount create mode 100755 .scripts/record diff --git a/.config/i3/config b/.config/i3/config index 09caf19..a14498b 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -23,7 +23,6 @@ gaps outer 15 font pango:mono 9 set $mod Mod4 set $term --no-startup-id st -set $video --no-startup-id bash video.sh set $stoprec --no-startup-id killall ffmpeg # #---Starting External Scripts---# # @@ -33,8 +32,6 @@ exec --no-startup-id xset r rate 300 50 exec --no-startup-id mpd #Torrent daemon: exec --no-startup-id transmission-daemon -#Mount other drives: -exec --no-startup-id sudo mount -a #Composite manager: exec --no-startup-id compton --xrender-sync-fence #Try to load VGA screen if available: @@ -118,8 +115,6 @@ set $beg --no-startup-id mpc seek 0% #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 -#set $screencast --no-startup-id bash screencast_alsa.sh -#set $audio --no-startup-id bash audio_alsa.sh #For PULSEAUDIO/PAMIXER set $inc --no-startup-id pamixer --allow-boost -i 5 @@ -129,8 +124,6 @@ set $bigdec --no-startup-id pamixer --allow-boost -d 15 set $mute --no-startup-id pamixer --allow-boost -t set $micmute --no-startup-id pamixer --allow-boost -t set $truemute --no-startup-id pamixer -m -set $screencast --no-startup-id bash screencast_pulse.sh -set $audio --no-startup-id bash audio_pulse.sh # #---Basic Bindings---# # bindsym $mod+Return exec $term @@ -145,7 +138,7 @@ bindsym $mod+Shift+Escape exec prompt "Are you sure you want to leave i3?" "i3- # bindsym $mod+BackSpace bindsym $mod+Shift+BackSpace exec prompt "Are you sure you want to reboot?" "$reboot" -# bindsym $mod+grave +## bindsym $mod+grave ##bindsym $mod+asciitilde #STOP/HIDE EVERYTHING: @@ -188,7 +181,7 @@ bindsym $mod+Shift+a exec $term -e ncpamixer bindsym $mod+s gaps inner current plus 5 bindsym $mod+Shift+s gaps inner current minus 5 -bindsym $mod+d exec dmenu_run +bindsym $mod+d exec --no-startup-id dmenu_run bindsym $mod+Shift+d gaps inner current set 0; gaps outer current set 0 bindsym $mod+f fullscreen toggle @@ -216,7 +209,7 @@ bindsym $mod+x exec --no-startup-id ~/.config/i3/lock.sh bindsym $mod+Shift+x exec prompt "Are you sure you want to shutdown?" "$shutdown" bindsym $mod+c exec --no-startup-id camtoggle -#bindsym $mod+Shift+c +##bindsym $mod+Shift+c bindsym $mod+v exec $term -e ncmpcpp -s visualizer bindsym $mod+Shift+v exec projectM-pulseaudio @@ -336,10 +329,10 @@ bindsym $mod+F5 exec --no-startup-id $netrefresh bindsym $mod+F6 exec --no-startup-id $term -e transmission-remote-cli ##bindsym $mod+F7 ##bindsym $mod+F8 -bindsym $mod+F9 exec --no-startup-id sudo mount -a -#bindsym $mod+F10 -#bindsym $mod+F11 -#bindsym $mod+F12 +bindsym $mod+F9 exec --no-startup-id dmenumount +bindsym $mod+F10 exec --no-startup-id dmenuumount +##bindsym $mod+F11 +##bindsym $mod+F12 # #---Arrow Keys---# # @@ -371,16 +364,11 @@ bindsym $mod+Shift+bracketleft exec $bigbak bindsym $mod+bracketright exec $lilfor bindsym $mod+Shift+bracketright exec $bigfor -# Print screen takes a screenshot. -# With shift, it takes one only of the given window. +# For screenshots and recording bindsym Print exec --no-startup-id scrot bindsym Shift+Print exec --no-startup-id scrot -u - -# For recording audio/video or stop recording. Also toggle screenkey for visual typing. -bindsym $mod+Print exec --no-startup-id "killall screenkey || screenkey" -bindsym $mod+Scroll_Lock exec $audio -bindsym $mod+Insert exec $screencast -bindsym $mod+Pause exec $video +bindsym $mod+Print exec --no-startup-id record +bindsym $mod+Scroll_Lock exec --no-startup-id "killall screenkey || screenkey" bindsym $mod+Delete exec $stoprec bindsym XF86Launch1 exec $stoprec & xset dpms force off @@ -415,7 +403,7 @@ bindsym XF86AudioNext exec $next bindsym XF86AudioPlay exec $pause bindsym XF86AudioPrev exec $prev bindsym XF86AudioStop exec $pause -bindsym XF86AudioRecord exec $audio +##bindsym XF86AudioRecord bindsym XF86AudioRewind exec $lilbak bindsym XF86AudioForward exec $lilfor ##bindsym XF86Phone exec diff --git a/.scripts/dmenumount b/.scripts/dmenumount new file mode 100755 index 0000000..451bfdf --- /dev/null +++ b/.scripts/dmenumount @@ -0,0 +1,24 @@ +#!/bin/sh + +# Should be run with sudo. + +# Gives a dmenu prompt to mount unmounted drives. +# If they're in /etc/fstab, they'll be mounted automatically. +# Otherwise, you'll be prompted to give a mountpoint from already existsing directories. +# If you input a novel directory, it will prompt you to create that directory. + +pgrep -x dmenu && exit + +mountable=$(lsblk -lp | grep part | grep -v "t /" | awk '{print $1, "(" $4 ")"}') +[[ "$mountable" = "" ]] && exit 1 +chosen=$(echo "$mountable" | dmenu -i -p "Mount which drive?" | awk '{print $1}') +[[ "$chosen" = "" ]] && exit 1 +mount "$chosen" && exit 0 +dirs=$(find / -type d | grep -v denied) +mountpoint=$(echo "$dirs" | dmenu -i -p "Type in mount point.") +[[ "$mountpoint" = "" ]] && exit 1 +if [[ ! -d "$mountpoint" ]]; then + mkdiryn=$(echo -e "No\nYes" | dmenu -i -p "$mountpoint does not exist. Create it?") + [[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint" +fi +sudo mount "$chosen" "$mountpoint" diff --git a/.scripts/dmenuumount b/.scripts/dmenuumount new file mode 100755 index 0000000..5a26677 --- /dev/null +++ b/.scripts/dmenuumount @@ -0,0 +1,14 @@ +#!/bin/sh + +# A dmenu prompt to unmount drives. +# Provides you with mounted partitions, select one to unmount. + +# Drives mounted at /, /boot and /home will not be options to unmount. +# This can be changed by modifying $exclusionregex. + +exclusionregex="\(/boot\|/home\|/\)$" +drives=$(lsblk -lp | grep "t /" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}') +[[ "$drives" = "" ]] && exit +chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') +[[ "$chosen" = "" ]] && exit +sudo umount $chosen diff --git a/.scripts/record b/.scripts/record new file mode 100755 index 0000000..2c941b9 --- /dev/null +++ b/.scripts/record @@ -0,0 +1,8 @@ +#!/bin/bash +# A dmenu recording prompt for my different + +case $(echo -e "Screencast\nVideo only\nAudio only" | dmenu -i -p "Select recording style:") in + Screencast) (pgrep -x pulse audio && screencast_pulse.sh) || screencast_alsa.sh ;; + "Audio only") (pgrep -x pulse audio && audio_pulse.sh) || audio_alsa.sh ;; + "Video only") video.sh ;; +esac