summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVon Random <von@vdrandom.org>2021-06-08 20:27:36 +0300
committerVon Random <von@vdrandom.org>2021-06-08 20:27:52 +0300
commite9243344a8c08382336d487184a80e519698f28d (patch)
tree486a346bd0beadc9567e959fec526bb9055aa088
parent5a634016cf218d279628620d89b247f0e1dbb9eb (diff)
minor tweaks and new tools
-rwxr-xr-xgdk_scale4
-rwxr-xr-xiphex (renamed from base256.py)4
-rwxr-xr-xpost-autorandr51
-rwxr-xr-xtermcompat1
-rwxr-xr-xxscreensaver-companion4
5 files changed, 60 insertions, 4 deletions
diff --git a/gdk_scale b/gdk_scale
new file mode 100755
index 0000000..da2a457
--- /dev/null
+++ b/gdk_scale
@@ -0,0 +1,4 @@
+#!/usr/bin/env zsh
+
+export GDK_SCALE=$1 GDK_DPI_SCALE=$(printf '%.1f' $((1.0/$1)))
+exec $2
diff --git a/base256.py b/iphex
index 1684bb1..1093aaa 100755
--- a/base256.py
+++ b/iphex
@@ -4,7 +4,7 @@
from sys import argv
def from_base256(number):
- num = int(number, 0)
+ num = int(number, 16)
addr = list()
for e in range(3, -1, -1):
multiplier = 256 ** e
@@ -20,7 +20,7 @@ def to_base256(addr):
for e in range(3, -1, -1):
num += int(addr[3-e]) * 256 ** e
- return str(num)
+ return '{0:08x}'.format(num)
try:
result = from_base256(argv[1])
diff --git a/post-autorandr b/post-autorandr
new file mode 100755
index 0000000..9ec7c5d
--- /dev/null
+++ b/post-autorandr
@@ -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"
diff --git a/termcompat b/termcompat
index 0681c66..ae5c9ff 100755
--- a/termcompat
+++ b/termcompat
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# run with more compatible TERM value
typeset -A terms=(
+ [alacritty]='xterm'
[xterm-kitty]='xterm'
[rxvt-unicode-256color]='rxvt-unicode'
[st-256color]='xterm-256color'
diff --git a/xscreensaver-companion b/xscreensaver-companion
index 929f48a..3d23176 100755
--- a/xscreensaver-companion
+++ b/xscreensaver-companion
@@ -35,13 +35,13 @@ function parse_actions
case $action in
(LOCK|BLANK)
setxkbmap us -option
- notify-send DUNST_COMMAND_PAUSE
+ dunstctl set-paused true
;;
(UNBLANK)
check_start gxkb
$HOME/git/mine/vscripts/mykblayouts
$HOME/.local/bin/touchpad-config
- notify-send DUNST_COMMAND_RESUME
+ dunstctl set-paused false
;;
esac
done