dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 4cdbd06a81f72cad6be432c49b2a8cc048957863
parent 6a905f6c6868df88dcf6a7fa487c8355766b41db
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 30 Sep 2020 14:44:15 +0200

surf-open.sh: adjust zoom level based on screen resolution

Diffstat:
M.local/bin/surf-open.sh | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/.local/bin/surf-open.sh b/.local/bin/surf-open.sh @@ -11,14 +11,25 @@ uri="" if command -v surf-clean-cookies >/dev/null 2>&1; then surf-clean-cookies fi - + +screen_resolution() { + xrandr -q | awk ' + { + if (printline) { gsub(/x.*/,"", $0); print $1; exit } + if (match($0, / connected/)) { printline=1 } + }' +} runtabbed() { echo "starting tabbed" nohup tabbed -c -dn tabbed-surf -r 2 >"$xidfile" 2>/dev/null & sleep 2 } opensurf() { - nohup $prefix surf -e "$xid" -u 'Mozilla/5.0 (X11; OpenBSD amd64; rv:76.0) Gecko/20100101 Firefox/76.0' "$uri" >/dev/null 2>&1 & + zoomlevel="1.0" + if [ "$(screen_resolution)" -gt 3000 ]; then + zoomlevel="2.5" + fi + nohup $prefix surf -z "$zoomlevel" -e "$xid" -u 'Mozilla/5.0 (X11; OpenBSD amd64; rv:76.0) Gecko/20100101 Firefox/76.0' "$uri" >/dev/null 2>&1 & } [ ! -r "$xidfile" ] && runtabbed