Skip to content

Commit

Permalink
Merge cosmetic changes (#2)
Browse files Browse the repository at this point in the history
* Reorganize scripts and add mounting

* Add gitignore

* Color scheme, rofi and picom update
  • Loading branch information
ashenoy463 authored May 12, 2023
1 parent abe23d6 commit cd72a93
Show file tree
Hide file tree
Showing 28 changed files with 199 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
neovim/.config/nvim/autoload
error.log
25 changes: 16 additions & 9 deletions i3/.config/i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ bindsym $mod+x exec rofi -font "Roboto Mono Medium 10" -show window
bindsym $mod+o exec rofi -font "Roboto Mono Medium 10" -show filebrowser
#
## Lock screen
bindsym $mod+Ctrl+l exec ~/bin/lock.sh
bindsym $mod+Ctrl+l exec lock.sh
exec --no-startup-id xss-lock -- lock.sh
#
##
bindsym $mod+Ctrl+m exec mount.sh
bindsym $mod+Ctrl+Shift+m exec unmount.sh
#
## Notification Hotkeys
bindsym Ctrl+grave exec dunstctl history-pop
Expand All @@ -59,7 +64,7 @@ bindsym Ctrl+Shift+space exec dunstctl close-all
#TODO
#
## Clipboard
bindsym $mod+Ctrl+v exec ~/bin/showclip.sh
bindsym $mod+Ctrl+v exec showclip.sh
#
## Reload Config
bindsym $mod+Shift+c reload
Expand All @@ -68,17 +73,17 @@ bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
#
## Power Menu
bindsym $mod+Ctrl+e exec ~/bin/powermenu.sh
bindsym $mod+Ctrl+e exec powermenu.sh
#
#
# ANCILLARY KEYBINDS
#
## Start Applications
bindsym $mod+F2 exec firefox
bindsym $mod+F3 exec ranger
bindsym Print exec --no-startup-id bash ~/bin/screenshot.sh -s
bindsym $mod+Print --release exec --no-startup-id bash ~/bin/screenshot.sh -r
bindsym $mod+Shift+Print --release exec --no-startup-id bash ~/bin/screenshot.sh -r -t 5
bindsym Print exec --no-startup-id bash screenshot.sh -s
bindsym $mod+Print --release exec --no-startup-id bash screenshot.sh -r
bindsym $mod+Shift+Print --release exec --no-startup-id bash /screenshot.sh -r -t 5
bindsym $mod+Ctrl+x --release exec --no-startup-id xkill
#
## Move to scratchpad
Expand Down Expand Up @@ -176,6 +181,8 @@ bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
#assign [class="discord"] $ws4
assign [class="Code"] $ws4
assign [class="firefox"] $ws3
assign [class="Zathura"] $ws1
assign [class="Xournalpp"] $ws1
### Open specific applications in floating mode
for_window [title="alsamixer"] floating enable border pixel 1
for_window [class="calamares"] floating enable border normal
Expand Down Expand Up @@ -204,7 +211,7 @@ for_window [class="Skype"] floating enable border normal
for_window [class="Timeset-gui"] floating enable border normal
for_window [class="(?i)virtualbox"] floating enable border normal
for_window [class="Xfburn"] floating enable
for_window [class="sxiv"] floating enable
for_window [class="nsxiv"] floating enable
for_window [title="Picture-in-Picture"] floating enable sticky enable border pixel 1
for_window [class="Dwarf_Fortress"] floating enable border normal
for_window [class="Code"] border pixel 1
Expand Down Expand Up @@ -366,10 +373,10 @@ mode "resize" {
#
## System
exec_always --no-startup-id source ~/.profile
exec_always --no-startup-id bash ~/bin/i3start.sh
exec_always --no-startup-id bash i3start.sh
#
## Applications
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
#
## Workspace Setup
exec --no-startup-id bash ~/bin/i3setup.sh
exec --no-startup-id bash i3setup.sh
2 changes: 1 addition & 1 deletion misc/masalaprompt-ssh.zsh-theme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROMPT="%(?:%{$fg_bold[yellow]%}󰢹 %{$fg_bold[green]%}%n@%M :%{$fg_bold[red]%}%n@%M )"
PROMPT="%(?:%{$fg_bold[yellow]%}󰢹 %{$fg_bold[green]%}%n@%M :%{$fg_bold[yellow]%}󰢹 %{$fg_bold[red]%}%n@%M )"
PROMPT+='%{$fg[blue]%}%~%{$reset_color%} $(git_prompt_info)'

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}%{$fg[red]%} "
Expand Down
2 changes: 1 addition & 1 deletion misc/services/wacom.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PartOf=graphical-session.target

[Service]
Type=oneshot
ExecStart=/home/ayush/bin/wacomconfigure.sh
ExecStart=wacomconfigure.sh

[Install]
WantedBy=graphical-session.target
2 changes: 1 addition & 1 deletion ncmpcpp/.config/ncmpcpp/config
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)
## Note: Custom command that will be executed each time song changes. Useful for
## notifications etc.
##
execute_on_song_change = "~/bin/mpdnotify.sh"
execute_on_song_change = "mpdnotify.sh"
#
##
## Note: Custom command that will be executed each time player state
Expand Down
9 changes: 5 additions & 4 deletions picom/.config/picom/picom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fade-in-step = 0.03;
fade-out-step = 0.03;

# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
fade-delta = 5
fade-delta = 6

# Specify a list of conditions of windows that should not be faded.
# fade-exclude = []
Expand All @@ -109,7 +109,7 @@ fade-delta = 5
# no-fading-openclose = false

# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
no-fading-destroyed-argb = false


#################################
Expand Down Expand Up @@ -212,7 +212,7 @@ blur-background-exclude = [
# `xrender` is the default one.
#
# backend = 'glx'
backend = "xrender";
backend = "glx";

# Enable/disable VSync.
# vsync = false
Expand Down Expand Up @@ -305,7 +305,7 @@ detect-client-leader = true
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
# glx-no-stencil = false
glx-no-stencil = false

# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
Expand Down Expand Up @@ -416,4 +416,5 @@ wintypes:
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
normal = { full-shadow = true; };
};
26 changes: 13 additions & 13 deletions polybar/.config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ foreground = ${xrdb:color7:#222}
foreground-alt = ${xrdb:color7:#222}
primary = ${xrdb:color1:#222}
secondary = ${xrdb:color2:#222}
alert = ${xrdb:color3:#222}
alert = ${xrdb:color2:#222}


[bar/gibralbar]
Expand Down Expand Up @@ -79,6 +79,7 @@ label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-foreground = ${colors.background}
label-urgent-padding = 2

; Separator in between workspaces
Expand Down Expand Up @@ -109,20 +110,19 @@ bar-progress-empty = ‒
bar-progress-fill-foreground = "${colors.primary}
label-offline = <--/--mpd--/-->
;[module/eth]
;type = internal/network
;interface = enp4s0
;interval = 3.0
[module/eth]
type = internal/network
interface = enp4s0
interval = 3.0
;format-connected-underline = ${colors.primary}
;format-connected =  <label-connected>
;format-connected-prefix-foreground = ${colors.foreground}
;label-connected = %local_ip%
format-connected = 󰱔 <label-connected>
format-connected-prefix-foreground = ${colors.foreground}
label-connected = %local_ip%
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% DISCONNECTED
;label-disconnected-foreground = ${colors.foreground-alt}
format-disconnected = <label-disconnected>
format-disconnected-underline = ${self.format-connected-underline}
label-disconnected = %ifname% DISCONNECTED
label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pgrep -f urxvt\ -name\ drop_ | xargs kill
xrdb ~/.Xresources
# Start each scratchpad
urxvt -name drop_calc -hold -e bc -l &
urxvt -name drop_monitor -hold -e ~/bin/setupcadmenu.sh &
urxvt -name drop_monitor -hold -e setupcadmenu.sh &
urxvt -name drop_music -hold -e sh -c "ncmpcpp -q 2> /dev/null" &
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/bin/i3start.sh → scripts/.local/bin/i3start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pkill dunst; dunst &
~/.config/polybar/launch.sh

# Scratchpads
~/bin/i3scratchpads.sh
i3scratchpads.sh

# Update lockscreen image
betterlockscreen -u $RICE_WALLPAPER
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
114 changes: 114 additions & 0 deletions scripts/.local/bin/mount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/bin/bash

# Mounts Android Phones and USB drives (encrypted or not). This script will
# replace the older `dmenumount` which had extra steps and couldn't handle
# encrypted drives.
# TODO: Try decrypt for drives in crtypttab
# TODO: Add some support for connecting iPhones (although they are annoying).

IFS='
'
# Function for escaping cell-phone names.
escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g" ;}

# Check for phones.
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
# If there are already mounted phones, remove them from the list of mountables.
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
for mounted in $mountedphones; do
escphone="$(escape "$phone")"
[[ "$mounted" =~ "$escphone" ]] && break 1
done && continue 1
echo "$phone"
done)"

# Check for drives.
lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
# Get all LUKS drives
allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)"
# Get a list of the LUKS drive UUIDs already decrypted.
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
# Functioning for formatting drives correctly for dmenu:
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; }

# Get only LUKS drives that are not decrypted.
unopenedluks="$(for drive in $allluks; do
uuid="${drive%% *}"
uuid="${uuid//-}" # This is a bashism.
for open in $decrypted; do
[ "$uuid" = "$open" ] && break 1
done && continue 1
echo "🔒 $drive"
done | filter)"

# Get all normal, non-encrypted or decrypted partitions that are not mounted.
normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"

# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
$unopenedluks
$normalparts" | sed "/^$/d;s/ *$//")"

# Quit the script if a sequential command fails.
set -e

test -n "$alldrives"

# Feed all found drives to dmenu and get user choice.
chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)"

# Function for prompting user for a mountpoint.
getmount(){
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
test -n "$mp"
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}

attemptmount(){
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send "󰕓 Drive Mounted." "$chosen mounted."
exit
}

case "$chosen" in
💾*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "󰕓 Drive Mounted" "\n$chosen mounted to $mp."
;;

🔒*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num +1))")"
done

# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"

attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;

📱*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
;;
esac
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions scripts/.local/bin/unmount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# Unmount USB drives or Android phones. Replaces the older `dmenuumount`. Fewer
# prompt and also de-decrypts LUKS drives that are unmounted.

set -e

mounteddroids="$(grep simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
lsblkoutput="$(lsblk -nrpo "name,type,size,mountpoint")"
mounteddrives="$(echo "$lsblkoutput" | awk '($2=="part"||$2="crypt")&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "💾%s (%s)\n",$4,$3}')"

allunmountable="$(echo "$mounteddroids
$mounteddrives" | sed "/^$/d;s/ *$//")"
test -n "$allunmountable"

chosen="$(echo "$allunmountable" | dmenu -i -p "Unmount which drive?")"
chosen="${chosen%% *}"
test -n "$chosen"

sudo -A umount -l "/${chosen#*/}"
notify-send "Device unmounted." "$chosen has been unmounted."

# Close the chosen drive if decrypted.
cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")"
cryptid="${cryptid%% *}"
test -b /dev/mapper/"${cryptid##*/}"
sudo -A cryptsetup close "$cryptid"
notify-send "🔒Device dencryption closed." "Drive is now securely locked again."
File renamed without changes.
Loading

0 comments on commit cd72a93

Please sign in to comment.