i3 init
This commit is contained in:
44
bin/apptosink
Executable file
44
bin/apptosink
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Program list
|
||||
programs_name=$(pactl list sink-inputs | grep -Po 'binary = "\K[^"]*')
|
||||
|
||||
programs_index=$(pactl list sink-inputs | grep -Po '(?<=Sink Input #).*')
|
||||
|
||||
# Sink list
|
||||
sinks_name=$(pactl list sinks | grep -Po 'Description: \K.*')
|
||||
|
||||
sinks_index=$(pactl list sinks | grep -Po '(?<=Sink #).*')
|
||||
|
||||
# Format values n' what not
|
||||
IFS=$'\n' p_n_db=($programs_name)
|
||||
p_n_size=${#p_n_db[@]}+1
|
||||
|
||||
IFS=$'\n' p_i_db=($programs_index)
|
||||
p_i_count=${#p_i_db[@]}
|
||||
|
||||
IFS=$'\n' s_n_db=($sinks_name)
|
||||
s_n_size=${#s_n_db[@]}+1
|
||||
|
||||
IFS=$'\n' s_i_db=($sinks_index)
|
||||
s_i_count=${#s_i_db[@]}
|
||||
|
||||
ret_prog=$(printf '%s' "$programs_name" | rofi -dmenu -l $p_n_size)
|
||||
|
||||
ret_sink=$(printf '%s' "$sinks_name" | rofi -dmenu -l $s_n_size)
|
||||
|
||||
# Get indexes of ret_prog and ret_sink in *_name_db
|
||||
for (( i = 0; i < ${#p_n_db[@]}; i++ )); do
|
||||
if [ "${p_n_db[$i]}" = "${ret_prog}" ]; then
|
||||
index_prog=$i;
|
||||
fi
|
||||
done
|
||||
|
||||
for (( i = 0; i < ${#s_n_db[@]}; i++ )); do
|
||||
if [ "${s_n_db[$i]}" = "${ret_sink}" ]; then
|
||||
index_sink=$i;
|
||||
fi
|
||||
done
|
||||
|
||||
# Execute command
|
||||
ret=$(pactl move-sink-input ${p_i_db[$index_prog]} ${s_i_db[$index_sink]})
|
||||
3
bin/connectssh
Executable file
3
bin/connectssh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
rofi -show ssh
|
||||
17
bin/i3-shutdown.py
Executable file
17
bin/i3-shutdown.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import i3ipc
|
||||
import subprocess
|
||||
|
||||
def on_shutdown(conn=None):
|
||||
for ws in range(1, 4):
|
||||
file = open('/home/felix/.config/i3/workspace_' + str(ws) + '.json', 'w')
|
||||
bashCommand = 'i3-save-tree --workspace ' + str(ws)
|
||||
subprocess.Popen(bashCommand.split(), stdout=file)
|
||||
|
||||
on_shutdown()
|
||||
conn = i3ipc.Connection()
|
||||
|
||||
conn.on('ipc_shutdown', on_shutdown)
|
||||
|
||||
conn.main()
|
||||
14
bin/selectsink
Executable file
14
bin/selectsink
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# choose pulseaudio sink via rofi or dmenu
|
||||
# changes default sink and moves all streams to that sink
|
||||
|
||||
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
|
||||
# alternate version using dmenu:
|
||||
# sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|dmenu -p 'pulseaudio sink:'|grep -Po '[0-9]+(?=:)') &&
|
||||
|
||||
ponymix set-default -d $sink &&
|
||||
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
|
||||
echo "$input -> $sink"
|
||||
ponymix -t sink-input -d $input move $sink
|
||||
done
|
||||
4
bin/vpndown
Executable file
4
bin/vpndown
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
con=$(nmcli con | grep vpn | awk -F " " '{$0=$1}1' | rofi -dmenu -p 'connect vpn')
|
||||
nmcli con down $con
|
||||
Reference in New Issue
Block a user