mirror of
https://github.com/Horhik/dotfiles.git
synced 2024-11-22 08:21:27 +00:00
add user scripts
This commit is contained in:
parent
aec58dae23
commit
c876995c2a
8
.local/bin/alacritty-colorscheme
Executable file
8
.local/bin/alacritty-colorscheme
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from alacritty_colorscheme.cli import main
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||||
|
sys.exit(main())
|
3
.local/bin/disable_main_display
Executable file
3
.local/bin/disable_main_display
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
xrandr --output eDP1 --off; bspc monitor HDMI1 -d 1 2 3 4 5 6 7 8 9 0 "#"
|
25
.local/bin/fullscreen-daemon
Executable file
25
.local/bin/fullscreen-daemon
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# depends on: xprop
|
||||||
|
# prevent certain window classes from being fullscreen in bspwm.
|
||||||
|
# define WM_CLASS blockers here:
|
||||||
|
blockers='chromium libreoffice firefox Firefox firefox-developer-edition MozillaWindowClass'
|
||||||
|
|
||||||
|
bspc subscribe node_state | while read msg monitorId desktopId nodeId state value; do
|
||||||
|
# only care about fullscreens
|
||||||
|
[ "$state $value" = "fullscreen on" ] || continue
|
||||||
|
|
||||||
|
# only act if the lock is off, also remove the lock if it exists.
|
||||||
|
if [ -f /tmp/bspcblock ]; then
|
||||||
|
rm /tmp/bspcblock
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get info
|
||||||
|
class=$(xprop -id $nodeId | grep "WM_CLASS" | sed 's/^[^=]*=//g')
|
||||||
|
|
||||||
|
# check all the blockers, toggle last state if encountered anywhere in WM_CLASS line.
|
||||||
|
IFS=' '
|
||||||
|
for check in $blockers; do
|
||||||
|
echo $class | grep -q "\"$check\"" && bspc node $nodeId -t ~fullscreen &
|
||||||
|
done
|
||||||
|
done
|
38
.local/bin/imgt
Normal file
38
.local/bin/imgt
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Based on script by z3bra -- 2014-01-21
|
||||||
|
|
||||||
|
W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay"
|
||||||
|
FONTH=15 # Size of one terminal row
|
||||||
|
FONTW=7 # Size of one terminal column
|
||||||
|
|
||||||
|
X=$1
|
||||||
|
Y=$2
|
||||||
|
COLUMNS=$3
|
||||||
|
LINES=$4
|
||||||
|
FILENAME=$5
|
||||||
|
|
||||||
|
read width height <<< `echo "5;$FILENAME" | $W3MIMGDISPLAY`
|
||||||
|
if [ -z "$width" -o -z "$height" ]; then
|
||||||
|
echo 'Error: Failed to obtain image size.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
x=$((FONTW * X))
|
||||||
|
y=$((FONTH * Y))
|
||||||
|
|
||||||
|
max_width=$((FONTW * COLUMNS))
|
||||||
|
max_height=$((FONTH * LINES))
|
||||||
|
|
||||||
|
if [ "$width" -gt "$max_width" ]; then
|
||||||
|
height=$((height * max_width / width))
|
||||||
|
width=$max_width
|
||||||
|
fi
|
||||||
|
if [ "$height" -gt "$max_height" ]; then
|
||||||
|
width=$((width * max_height / height))
|
||||||
|
height=$max_height
|
||||||
|
fi
|
||||||
|
|
||||||
|
w3m_command="0;1;$x;$y;$width;$height;;;;;$FILENAME\n4;\n3;"
|
||||||
|
|
||||||
|
echo -e "$w3m_command" | $W3MIMGDISPLAY
|
12
.local/bin/scratchpad.sh
Executable file
12
.local/bin/scratchpad.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
if [ -z $1 ]; then
|
||||||
|
echo "Usage: $0 <name of hidden scratchpad window>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pids=$(xdotool search --class ${1})
|
||||||
|
for pid in $pids; do
|
||||||
|
echo "Toggle $pid"
|
||||||
|
bspc node $pid --flag hidden -f
|
||||||
|
done
|
Loading…
Reference in a new issue