minor tweaks and new tools

This commit is contained in:
Von Random 2021-06-08 20:27:36 +03:00
parent 5a634016cf
commit e9243344a8
5 changed files with 60 additions and 4 deletions

4
gdk_scale Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
export GDK_SCALE=$1 GDK_DPI_SCALE=$(printf '%.1f' $((1.0/$1)))
exec $2

View file

@ -4,7 +4,7 @@
from sys import argv from sys import argv
def from_base256(number): def from_base256(number):
num = int(number, 0) num = int(number, 16)
addr = list() addr = list()
for e in range(3, -1, -1): for e in range(3, -1, -1):
multiplier = 256 ** e multiplier = 256 ** e
@ -20,7 +20,7 @@ def to_base256(addr):
for e in range(3, -1, -1): for e in range(3, -1, -1):
num += int(addr[3-e]) * 256 ** e num += int(addr[3-e]) * 256 ** e
return str(num) return '{0:08x}'.format(num)
try: try:
result = from_base256(argv[1]) result = from_base256(argv[1])

51
post-autorandr Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env zsh
#------------------------------------------------------------------------------
# xsettingsd systemd unit:
# --
# [Unit]
# Description=xsettingsd magic
#
# [Service]
# ExecStart=/usr/bin/xsettingsd
# ExecReload=/bin/kill -HUP $MAINPID
#
# [Install]
# WantedBy=default.target
# --
XSETTINGSD_TEMPLATE='Xft/Hinting 1\nXft/HintStyle "hintslight"\nXft/Antialias 1\nXft/RGBA "rgb"\nXft/DPI %s\n'
XSETTINGSD_CONFIG=/run/user/$UID/xsettingsd-config
XKB_OPTS='grp:win_space_toggle,compose:menu'
XKB_LAYOUTS='us(altgr-intl),ru(typewriter)'
WALLPAPER=$HOME/.wallpaper
TOUCHPAD_DEV='SynPS/2 Synaptics TouchPad'
DPI=${1:-96}
#------------------------------------------------------------------------------
# reset xkbmap, set xkbmap
setxkbmap us -option
setxkbmap $XKB_LAYOUTS -option $XKB_OPTS
# configure touchpad
xinput set-prop $TOUCHPAD_DEV 'libinput Click Method Enabled' 0 1
xinput set-prop $TOUCHPAD_DEV 'libinput Middle Emulation Enabled' 1
# background
feh --bg-fill $WALLPAPER
# dpi - xsettignsd, has to be started here because config is absent on boot
printf $XSETTINGSD_TEMPLATE $(($DPI * 1024)) > $XSETTINGSD_CONFIG
systemctl --quiet --user is-active xsettingsd || systemctl --user start xsettingsd
systemctl --user reload xsettingsd.service
# dpi - other
xrdb -merge <(echo "Xft.dpi: $DPI")
xrandr --dpi $DPI
i3-msg restart
# report
current_config=$(autorandr --current)
notify-send "$current_config config applied"

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# run with more compatible TERM value # run with more compatible TERM value
typeset -A terms=( typeset -A terms=(
[alacritty]='xterm'
[xterm-kitty]='xterm' [xterm-kitty]='xterm'
[rxvt-unicode-256color]='rxvt-unicode' [rxvt-unicode-256color]='rxvt-unicode'
[st-256color]='xterm-256color' [st-256color]='xterm-256color'

View file

@ -35,13 +35,13 @@ function parse_actions
case $action in case $action in
(LOCK|BLANK) (LOCK|BLANK)
setxkbmap us -option setxkbmap us -option
notify-send DUNST_COMMAND_PAUSE dunstctl set-paused true
;; ;;
(UNBLANK) (UNBLANK)
check_start gxkb check_start gxkb
$HOME/git/mine/vscripts/mykblayouts $HOME/git/mine/vscripts/mykblayouts
$HOME/.local/bin/touchpad-config $HOME/.local/bin/touchpad-config
notify-send DUNST_COMMAND_RESUME dunstctl set-paused false
;; ;;
esac esac
done done