I got a little crazy here. a lot of laptop poop
This commit is contained in:
parent
263d10c080
commit
fab3b36dec
47 changed files with 3726 additions and 189 deletions
32
scripts/emacslof
Executable file
32
scripts/emacslof
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Check to see if an emacsclient is running
|
||||
if [ $(pgrep -c emacsclient) -gt 0 ]; then
|
||||
|
||||
if [ $XDG_SESSION_TYPE = "x11" ]; then
|
||||
#X11
|
||||
emacsrg=$(wmctrl -lx | rg emacs | rg -v org-agenda | awk '{print $1}')
|
||||
echo $emacsrg
|
||||
|
||||
if [ -z $emacsrg ]; then
|
||||
emacsclient -c
|
||||
exit
|
||||
else
|
||||
wmctrl -ia $emacsrg
|
||||
exit
|
||||
fi
|
||||
|
||||
else
|
||||
# WAYLAND
|
||||
emacsrg=$(wlrctl window list | rg -v 'emacs:\sorg-agenda' | rg 'emacs:')
|
||||
|
||||
emacswin=$(echo $emacsrg | sed 's/.*\: //')
|
||||
echo $emacswin
|
||||
|
||||
wlrctl toplevel focus title:"$emacswin"
|
||||
exit
|
||||
fi
|
||||
|
||||
else
|
||||
emacsclient -c
|
||||
fi
|
30
scripts/fflof
Executable file
30
scripts/fflof
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Check to see if firefox is running
|
||||
if [ $(pgrep -c firefox) -gt 0 ]; then
|
||||
|
||||
if [ $XDG_SESSION_TYPE = "x11" ]; then
|
||||
#X11
|
||||
ffrg=$(wmctrl -lx | rg firefox | awk '{print $1}')
|
||||
# echo $emacsrg
|
||||
|
||||
if [ -z $ffrg ]; then
|
||||
firefox
|
||||
exit
|
||||
else
|
||||
wmctrl -ia $ffrg
|
||||
exit
|
||||
fi
|
||||
else
|
||||
# WAYLAND
|
||||
ffrg=$(wlrctl window list | rg firefox)
|
||||
|
||||
ffwin=$(echo $ffrg | sed 's/.*\: //')
|
||||
# echo $ffwin
|
||||
|
||||
wlrctl toplevel focus title:"$ffwin"
|
||||
exit
|
||||
fi
|
||||
else
|
||||
firefox
|
||||
fi
|
|
@ -1,15 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $(hostname) = "syl" ]; then
|
||||
if [ $WAYLAND_DISPLAY = "wayland-0" ]; then
|
||||
style="desktop"
|
||||
else
|
||||
style="desktop"
|
||||
#echo "this is hidpi"
|
||||
fi
|
||||
style="laptop"
|
||||
else
|
||||
style="desktop"
|
||||
#echo "this is not hidpi"
|
||||
fi
|
||||
|
||||
lolcate | rofi -dmenu -p "File Search:" -i -matching regex | xargs -r0 xdg-open
|
||||
lolcate | rofi -dmenu -p "File Search:" -i -matching regex -theme ~/.config/rofi/launchers-git/$style-rbw.rasi | xargs -r0 xdg-open
|
||||
|
|
12
scripts/plasma-startup.sh
Executable file
12
scripts/plasma-startup.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec ydotoold &
|
||||
exec libinput-gestures-setup start service &
|
||||
|
||||
sleep 2
|
||||
|
||||
killall mako
|
||||
|
||||
sleep 1
|
||||
|
||||
latte-restart
|
30
scripts/qblof
Executable file
30
scripts/qblof
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Check to see if firefox is running
|
||||
if [ $(pgrep -c qutebrowser) -gt 0 ]; then
|
||||
|
||||
if [ $XDG_SESSION_TYPE = "x11" ]; then
|
||||
#X11
|
||||
qbrg=$(wmctrl -lx | rg qutebrowser | awk '{print $1}')
|
||||
# echo $emacsrg
|
||||
|
||||
if [ -z $qbrg ]; then
|
||||
qutebrowser
|
||||
exit
|
||||
else
|
||||
wmctrl -ia $qbrg
|
||||
exit
|
||||
fi
|
||||
else
|
||||
# WAYLAND
|
||||
qbrg=$(wlrctl window list | rg qutebrowser)
|
||||
|
||||
qbwin=$(echo $qbrg | sed 's/.*\: //')
|
||||
# echo $ffwin
|
||||
|
||||
wlrctl toplevel focus title:"$qbwin"
|
||||
exit
|
||||
fi
|
||||
else
|
||||
qutebrowser
|
||||
fi
|
|
@ -1,5 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
# Very basic interface for pass using rofi
|
||||
# Very basic interface for rbw using rofi
|
||||
|
||||
if [ $(hostname) = "syl" ]; then
|
||||
style="laptop-rbw"
|
||||
#echo "this is hidpi"
|
||||
else
|
||||
style="desktop-rbw"
|
||||
#echo "this is not hidpi"
|
||||
fi
|
||||
|
||||
# Get all password files and create an array
|
||||
root=~/.password-store
|
||||
|
@ -16,7 +24,7 @@ list_passwords() {
|
|||
passwords=$(rbw list)
|
||||
|
||||
prompt='search for passwords...'
|
||||
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu)
|
||||
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi)
|
||||
|
||||
# Ask whether pass, user or both are required
|
||||
|
||||
|
@ -26,7 +34,7 @@ options=("Password" \
|
|||
"QR-Code" \
|
||||
"OTP")
|
||||
|
||||
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...")
|
||||
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="..." -theme ~/.config/rofi/launchers-git/$style.rasi)
|
||||
|
||||
echo $option
|
||||
|
||||
|
|
3
scripts/wintitle
Executable file
3
scripts/wintitle
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
wlrctl window list state:active
|
|
@ -1,16 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# Very basic interface for rbw using rofi
|
||||
if [ $(hostname) = "syl" ]; then
|
||||
style="laptop-rbw"
|
||||
#echo "this is hidpi"
|
||||
else
|
||||
style="desktop-rbw"
|
||||
#echo "this is not hidpi"
|
||||
fi
|
||||
|
||||
# Get all password files and create an array
|
||||
root=~/.password-store
|
||||
CACHE=~/.local/tmp/pass_rofi
|
||||
seat=seat0
|
||||
|
||||
rbw sync
|
||||
rbw list
|
||||
|
||||
list_passwords() {
|
||||
rbw list
|
||||
}
|
||||
|
||||
passwords=$(rbw list)
|
||||
|
||||
prompt='search for passwords...'
|
||||
SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu)
|
||||
SECRET=$(list_passwords | wofi -i -p"${prompt}" -d)
|
||||
|
||||
# Ask whether pass, user or both are required
|
||||
options=("Password" \
|
||||
|
@ -19,22 +32,22 @@ options=("Password" \
|
|||
"QR-Code" \
|
||||
"OTP")
|
||||
|
||||
option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...")
|
||||
option=$(printf '%s\n' "${options[@]%}" | wofi -id -W 400 -H 150 -p"...")
|
||||
|
||||
# echo $option
|
||||
|
||||
case ${option} in
|
||||
Password )
|
||||
# echo "${SECRET}"
|
||||
wtype $(rbw get "${SECRET}")
|
||||
ydotool type $(rbw get "${SECRET}")
|
||||
;;
|
||||
User )
|
||||
wtype $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
|
||||
ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
|
||||
;;
|
||||
"User and password" )
|
||||
wtype $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
|
||||
wtype -k TAB
|
||||
wtype $(rbw get "${SECRET}")
|
||||
ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}')
|
||||
ydotool key TAB
|
||||
ydotool type $(rbw get "${SECRET}")
|
||||
;;
|
||||
"QR-Code" )
|
||||
if [[ $SECRET =~ wifi$ ]]; then
|
||||
|
@ -49,7 +62,7 @@ case ${option} in
|
|||
fi
|
||||
;;
|
||||
"OTP" )
|
||||
wtype $(rbw code ${SECRET})
|
||||
ydotool type $(rbw code ${SECRET})
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
20
scripts/wofi-window
Normal file → Executable file
20
scripts/wofi-window
Normal file → Executable file
|
@ -1,9 +1,11 @@
|
|||
!#/bin/bash
|
||||
swaymsg -t get_tree |
|
||||
jq -r '.nodes[].nodes[] | if .nodes then [recurse(.nodes[])] else []
|
||||
end + .floating_nodes | .[] | select(.nodes==[]) | ((.id | tostring) +
|
||||
"" + .name)' |
|
||||
wofi --show dmenu | {
|
||||
read -r id name
|
||||
swaymsg "[con_id=$id]" focus
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
list_windows() (
|
||||
wlrctl window list
|
||||
)
|
||||
|
||||
window=$(list_windows | wofi -H 20% -id -p "select window..." | awk '{print $1}' | sed 's/://')
|
||||
|
||||
echo $window
|
||||
|
||||
wlrctl window focus $window
|
||||
|
|
120
scripts/ww
Executable file
120
scripts/ww
Executable file
|
@ -0,0 +1,120 @@
|
|||
#!/bin/bash
|
||||
# Usage: ww -f "window class filter" -c "run if not found"
|
||||
# Usage: ww -fa "window title filter" -c "run if not found"
|
||||
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-c | --command)
|
||||
COMMAND="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-f | --filter)
|
||||
FILTERBY="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-fa | --filter-alternative)
|
||||
FILTERALT="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-h | --help)
|
||||
HELP="1"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
*) # unknown option
|
||||
POSITIONAL+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -- "${POSITIONAL[@]}" # restore positional parameters
|
||||
|
||||
if [ -n "$HELP" ]; then
|
||||
cat <<EOF
|
||||
ww. Utility to raise or jump an applications in KDE. It interacts with KWin using KWin scripts and it is compatible with X11 and Wayland
|
||||
Paramaters:
|
||||
-h --help show this help
|
||||
-f --filter filter by window class
|
||||
-fa --filter-alternative filter by window title (caption)
|
||||
-c --command command to check if running and run if no process is found
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SCRIPT_TEMPLATE=$(
|
||||
cat <<EOF
|
||||
function kwinactivateclient(clientClass, clientCaption) {
|
||||
var clients = workspace.clientList();
|
||||
var compareToCaption = new RegExp(clientCaption || '', 'i');
|
||||
var compareToClass = clientClass;
|
||||
var isCompareToClass = clientClass.length > 0
|
||||
for (var i=0; i<clients.length; i++) {
|
||||
var client = clients[i];
|
||||
if (isCompareToClass && client.resourceClass == compareToClass) {
|
||||
workspace.activeClient = client;
|
||||
break;
|
||||
} else if (!isCompareToClass && compareToCaption.exec(client.caption)) {
|
||||
workspace.activeClient = client;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
kwinactivateclient('CLASS_NAME', 'CAPTION_NAME');
|
||||
EOF
|
||||
)
|
||||
|
||||
CURRENT_SCRIPT_NAME=$(basename $0)
|
||||
|
||||
# ensure the script file exists
|
||||
function ensure_script {
|
||||
if [ ! -f SCRIPT_PATH ]; then
|
||||
if [ ! -d "$SCRIPT_FOLDER" ]; then
|
||||
mkdir -p "$SCRIPT_FOLDER"
|
||||
fi
|
||||
SCRIPT_CONTENT=${SCRIPT_TEMPLATE/CLASS_NAME/$1}
|
||||
SCRIPT_CONTENT=${SCRIPT_CONTENT/CAPTION_NAME/$2}
|
||||
#if [ "$1" == "class" ]; then
|
||||
#SCRIPT_CONTENT=${SCRIPT_CLASS_NAME/REPLACE_ME/$2}
|
||||
#else
|
||||
#SCRIPT_CONTENT=${SCRIPT_CAPTION/REPLACE_ME/$2}
|
||||
#fi
|
||||
echo "$SCRIPT_CONTENT" >"$SCRIPT_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$FILTERBY" ] && [ -z "$FILTERALT" ]; then
|
||||
echo You need to specify a window filter. Either by class -f or by title -fa
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IS_RUNNING=$(pgrep -o -a -f "$COMMAND" | grep -v "$CURRENT_SCRIPT_NAME")
|
||||
|
||||
if [ -n "$IS_RUNNING" ] || [ -n "$FILTERALT" ]; then
|
||||
SCRIPT_FOLDER="$HOME/.wwscripts/"
|
||||
SCRIPT_NAME=$(echo "$FILTERBY$FILTERALT" | md5sum | head -c 32)
|
||||
SCRIPT_PATH="$SCRIPT_FOLDER$SCRIPT_NAME"
|
||||
ensure_script "$FILTERBY" "$FILTERALT"
|
||||
|
||||
SCRIPT_NAME="ww$RANDOM"
|
||||
#SCRIPT_NAME=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||
|
||||
# install the script
|
||||
ID=$(dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.loadScript "string:$SCRIPT_PATH" "string:$SCRIPT_NAME" | awk '{print $2}')
|
||||
# run it - some KDEs version use Script.run others Scripting.run
|
||||
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.run >/dev/null 2>&1
|
||||
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.run >/dev/null 2>&1
|
||||
# stop it - some KDEs version use Script.run others Scripting.run
|
||||
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.stop >/dev/null 2>&1
|
||||
dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.stop >/dev/null 2>&1
|
||||
# uninstall it
|
||||
dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.unloadScript "string:$SCRIPT_NAME" >/dev/null 2>&1
|
||||
elif [ -n "$COMMAND" ]; then
|
||||
$COMMAND &
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue