mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 03:33:03 +03:00
i3 scripts
This commit is contained in:
parent
958f363ca7
commit
7d7208ad03
8 changed files with 111 additions and 1 deletions
16
bin/scripts/dmenu-buku
Executable file
16
bin/scripts/dmenu-buku
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
COMMAND="buku -o %"
|
||||
if [[ $1 == '-e' ]]; then
|
||||
COMMAND="buku -w %"
|
||||
fi
|
||||
buku -f 5 -p | awk -F'\t' -v OFS='\t' '{
|
||||
split($3, tags, ",")
|
||||
joined = sep = ""
|
||||
for (i = 1; i in tags; i++) {
|
||||
joined = joined sep "[" tags[i] "]"
|
||||
sep = " "
|
||||
}
|
||||
if ($1 != "waiting for input") {
|
||||
printf "%-5s %-40s %s\n", $1, $2, joined
|
||||
}
|
||||
}' | dmenu -l 20 | cut -d ' ' -f 1 | xargs -I % $COMMAND
|
||||
51
bin/scripts/dmenu-explore
Executable file
51
bin/scripts/dmenu-explore
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
# Copyright [2019] andreasl
|
||||
# Copyright [2020] SqrtMinusOne
|
||||
|
||||
define_standard_settings() {
|
||||
selected_path="$HOME"
|
||||
history_file="${HOME}/.config/.edm_history"
|
||||
max_history_entries=3
|
||||
|
||||
choices=(
|
||||
'<open terminal here>'
|
||||
'.'
|
||||
'..'
|
||||
"$(ls "$selected_path")"
|
||||
"$(cat "$history_file")"
|
||||
)
|
||||
|
||||
open_command='xdg-open'
|
||||
open_terminal_command='setsid st'
|
||||
}
|
||||
define_standard_settings
|
||||
|
||||
write_selection_to_history_file() {
|
||||
sed -i "\:${selected_path}:d" "$history_file"
|
||||
printf '%s\n' "$selected_path" >> "$history_file"
|
||||
printf '%s\n' "$(tail -n "$max_history_entries" "$history_file")" > "$history_file"
|
||||
}
|
||||
|
||||
while : ; do
|
||||
dmenu_result="$(printf '%s\n' "${choices[@]}" | dmenu -p "$selected_path" -l 50)" || exit 1
|
||||
if [ "$dmenu_result" = '<open terminal here>' ]; then
|
||||
cd $selected_path && $open_terminal_command
|
||||
write_selection_to_history_file
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$dmenu_result" == "/"* ]]; then
|
||||
selected_path="${dmenu_result}"
|
||||
else
|
||||
selected_path="$(realpath "${selected_path}/${dmenu_result}")"
|
||||
fi
|
||||
if [ -f "$selected_path" ] || [ "$dmenu_result" = '.' ]; then
|
||||
$open_command "$selected_path"
|
||||
write_selection_to_history_file
|
||||
exit 0
|
||||
elif [ -d "$selected_path" ]; then
|
||||
choices=( '<open terminal here>' '.' '..' "$(ls "$selected_path")")
|
||||
else
|
||||
selected_path="$(dirname "$selected_path")"
|
||||
fi
|
||||
done
|
||||
5
bin/scripts/dmenu-man
Executable file
5
bin/scripts/dmenu-man
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
SELECTED=$(man -k . | dmenu -l 20 | awk '{print $1}')
|
||||
if [[ ! -z $SELECTED ]]; then
|
||||
man -Tpdf $SELECTED | zathura -
|
||||
fi
|
||||
9
bin/scripts/dropdown
Executable file
9
bin/scripts/dropdown
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
CLASSNAME="dropdown_tmux"
|
||||
COMMAND="st -n $CLASSNAME -e tmux new-session -s $CLASSNAME"
|
||||
pid=$(xdotool search --classname "dropdown_tmux")
|
||||
if [[ ! -z $pid ]]; then
|
||||
i3-msg scratchpad show
|
||||
else
|
||||
setsid -f ${COMMAND}
|
||||
fi
|
||||
2
bin/scripts/ncmpcpp_term
Executable file
2
bin/scripts/ncmpcpp_term
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
i3-msg "workspace 9: Music; exec 'i3-sensible-terminal -e ncmpcpp'"
|
||||
2
bin/scripts/start_logger
Executable file
2
bin/scripts/start_logger
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
/home/pavel/Programs/miniconda3/bin/python /home/pavel/Code/mpd-watcher/mpd-watcher/watcher.py
|
||||
8
bin/scripts/wallgif
Executable file
8
bin/scripts/wallgif
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
[ -z "$1" ] && exit
|
||||
killall xwinwrap
|
||||
|
||||
sleep 0.3
|
||||
|
||||
xwinwrap -ov -g 1368x768+0+0 -- mpv -wid WID "$1" --no-osc --no-osd-bar --loop-file --player-operation-mode=cplayer --no-audio --panscan=1.0 --no-keepaspect --no-input-default-bindings --hwdec&
|
||||
|
|
@ -130,6 +130,15 @@ bindsym $mod+Shift+r restart
|
|||
# exit i3 (logs you out of your X session)
|
||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
|
||||
|
||||
# Scratchpad
|
||||
for_window [instance="dropdown_*"] floating enable
|
||||
for_window [instance="dropdown_*"] move scratchpad
|
||||
for_window [instance="dropdown_*"] sticky enable
|
||||
for_window [instance="dropdown_*"] scratchpad show
|
||||
for_window [instance="dropdown_*"] move position center
|
||||
|
||||
bindsym $mod+u exec ~/bin/scripts/dropdown
|
||||
|
||||
# Gaps
|
||||
|
||||
set $default_inner 0
|
||||
|
|
@ -225,15 +234,20 @@ mode "move" {
|
|||
|
||||
# dmenu
|
||||
bindsym $mod+d exec i3-dmenu-desktop --dmenu="dmenu -l 10"
|
||||
bindsym $mod+x mode "dmenu"
|
||||
bindsym $mod+apostrophe mode "dmenu"
|
||||
|
||||
mode "dmenu" {
|
||||
bindsym d exec i3-dmenu-desktop --dmenu="dmenu -l 10"; mode default
|
||||
bindsym p exec dmenu_run -l 10; mode default
|
||||
bindsym m exec dmenu-man; mode default
|
||||
bindsym b exec dmenu-buku; mode default
|
||||
bindsym f exec dmenu-explore; mode default
|
||||
bindsym t exec dmenu-tmuxp; mode default
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+b exec --no-startup-id dmenu-buku
|
||||
|
||||
# Launch apps
|
||||
bindsym $mod+semicolon mode "apps"
|
||||
|
||||
|
|
@ -271,6 +285,7 @@ client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-colo
|
|||
# bar
|
||||
bar {
|
||||
status_command i3blocks -c ~/.config/i3/i3blocks.conf
|
||||
i3bar_command i3bar
|
||||
colors {
|
||||
background $bg-color
|
||||
separator #757575
|
||||
|
|
@ -306,7 +321,9 @@ bindsym --release Print exec "flameshot gui"
|
|||
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||
|
||||
# Wallpaper
|
||||
# fallback
|
||||
exec_always "feh --bg-fill ~/Pictures/wallpaper.jpg"
|
||||
exec_always "/home/pavel/bin/scripts/wallgif /home/pavel/Videos/OMSBG7.mov"
|
||||
|
||||
# Compton
|
||||
exec compton
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue