Remove HiDPI hacks for Sway

We now rely on HiDPI screens being the default, and lower DPI screens
must now have explicit `output ... scale 0.75` configuration given for
Sway to remain workable. This results in some blur, but allows for using
mixed HiDPI and LoDPI screens at the same time, a common use-case (for
me).
This commit is contained in:
Alex Palaistras 2022-04-06 23:27:42 +01:00
parent 7d8ff87442
commit da80376e77
11 changed files with 40 additions and 60 deletions

View File

@ -1,4 +1,4 @@
[org/gnome/desktop/interface]
document-font-name='IBM Plex Sans 12'
font-name='IBM Plex Sans 12'
monospace-font-name='IBM Plex Mono 12'
document-font-name='IBM Plex Sans 16'
font-name='IBM Plex Sans 16'
monospace-font-name='IBM Plex Mono 16'

View File

@ -20,11 +20,11 @@
doom-theme 'doom-monokai-pro
;; Font definitions.
doom-font (font-spec :family "Iosevka" :size (+custom/font-scale 18) :weight 'light)
doom-big-font (font-spec :family "Iosevka" :size (+custom/font-scale 22) :weight 'light)
doom-variable-pitch-font (font-spec :family "IBM Plex Sans" :size (+custom/font-scale 16) :weight 'light)
doom-serif-font (font-spec :family "IBM Plex Serif" :size (+custom/font-scale 16) :weight 'light)
doom-unicode-font (font-spec :family "Iosevka" :size (+custom/font-scale 18) :weight 'light)
doom-font (font-spec :family "Iosevka" :size 24 :weight 'light)
doom-big-font (font-spec :family "Iosevka" :size 28 :weight 'light)
doom-variable-pitch-font (font-spec :family "IBM Plex Sans" :size 20 :weight 'light)
doom-serif-font (font-spec :family "IBM Plex Serif" :size 20 :weight 'light)
doom-unicode-font (font-spec :family "Iosevka" :size 24 :weight 'light)
;; Column used as limit for various modes.
fill-column 100
@ -50,14 +50,13 @@
right-margin-width 1)
;; Set colors consistent with Base16-Eighties theme.
(add-hook! 'doom-load-theme-hook
(custom-set-faces
'(default ((t (:background "#2d2d2d"))))
'(hl-line ((t (:background "#323232"))))
'(mode-line ((t (:background "#282828"))))
'(vertical-border ((t (:background "#282828" :foreground "#282828"))))
'(solaire-default-face ((t (:background "#282828"))))
'(solaire-hl-line-face ((t (:background "#323232"))))))
(custom-set-faces!
'(default :background "#2d2d2d")
'(hl-line :background "#323232")
'(mode-line :background "#282828")
'(vertical-border :background "#282828" :foreground "#282828")
'(solaire-default-face :background "#282828")
'(solaire-hl-line-face :background "#323232"))
;;;
;;; Package-specific configuration.

View File

@ -56,11 +56,6 @@ to the `killed-buffer-list' when killing the buffer."
(call-interactively 'query-replace))
(goto-char orig-point)))
(defun +custom/font-scale (size)
"Scale font of given SIZE by the default font scale in the environment."
(let ((scaled (round (* size (string-to-number (getenv "GDK_DPI_SCALE"))))))
(if (floatp size) (float scaled) scaled)))
(defun +custom/copy-this-file (new-path &optional force-p)
"Copy current buffer's file to NEW-PATH, switching to the file immediately."
(interactive

View File

@ -75,5 +75,4 @@
(when noninteractive
;; Allow SSH-related environment variables to be set in persistent configuration.
(add-to-list 'doom-env-whitelist "^SSH_")
(add-to-list 'doom-env-blacklist "GDK_DPI_SCALE"))
(add-to-list 'doom-env-whitelist "^SSH_"))

View File

@ -8,8 +8,4 @@ MOZ_ENABLE_WAYLAND=1
# Application themeing.
GTK_THEME=Materia:dark
QT_QPA_PLATFORMTHEME=qt5ct
# HiDPI settings.
GDK_DPI_SCALE=$DISPLAY_SCALE_FACTOR
QT_SCALE_FACTOR=$DISPLAY_SCALE_FACTOR
QT_QPA_PLATFORMTHEME=gnome

View File

@ -1,22 +0,0 @@
#!/bin/sh
# Determine scale factor for active display.
for port in /sys/class/drm/*
do
if test -f "$port"/enabled && test "$(cat "$port"/enabled)" = "enabled"
then
mode="$(head -n 1 "$port"/modes)"
if test "$(echo "$mode" | cut -dx -f1)" -ge 2560 && \
test "$(echo "$mode" | cut -dx -f2)" -ge 1200
then
export DISPLAY_SCALE_FACTOR=1.45
break
fi
fi
done
# Set default scale factor if none was already set.
if test -z "$DISPLAY_SCALE_FACTOR"
then
export DISPLAY_SCALE_FACTOR=1
fi

View File

@ -212,6 +212,11 @@ bindsym --to-code {
$mod+Shift+p exec grim -g $(slurp -d) - | wl-copy --type image/png && notify-send "Screenshot Copied"
}
--whole-window --border {
$mod+button4 opacity minus 0.02
$mod+button5 opacity plus 0.02
}
# Modes.
$mod+r mode $resize
$mod+Shift+q mode $session
@ -223,7 +228,6 @@ bindsym --to-code {
# Default font.
font Iosevka 20
exec_always swaymsg font Iosevka $(echo 14 | awk '{printf "%.0f", $0 * ENVIRON["GDK_DPI_SCALE"]}')
# Wallpaper.
output * bg ~/.config/sway/default-bg fill

View File

@ -1,6 +1,6 @@
# Fonts.
font=Iosevka
font-size=18
font-size=20
# Colors and wallpaper.
image=~/.config/sway/default-bg

View File

@ -15,9 +15,12 @@
"max-length": 25
},
"clock": {
"format": "<span color='#585858' size='smaller'>time</span> {:%H:%M}",
"format-alt": "<span color='#585858' size='smaller'>date</span> {:%A, %d %B %H:%M}",
"tooltip-format": " <b>{:%d %B %Y}</b>\n{calendar}"
"format": "<span color='#585858' size='smaller'>time</span> {:%H:%M %Z}",
"format-alt": "<span color='#585858' size='smaller'>date</span> {:%A, %d %B %H:%M %Z}",
"tooltip-format": " <big>{:%d %B %Y}</big>\n{calendar}",
"today-format": "<span color='#ab4642'>{}</span>",
"timezones": ["", "America/New_York", "America/Los_Angeles"],
"smooth-scrolling-threshold": 20
},
"cpu": {
"interval": 10,

View File

@ -1,6 +1,11 @@
* {
font-family: Iosevka, Ionicons;
font-size: 1.15rem;
font-size: 1.25rem;
}
tooltip {
background-color: #282828;
color: #d8d8d8;
}
#waybar {
@ -33,7 +38,7 @@
box-shadow: none;
color: #585858;
text-shadow: none;
padding: 0.4rem;
padding: 0.4rem 0.6rem;
}
#workspaces button:not(.focused):hover {
@ -59,3 +64,7 @@
#battery.critical {
color: #ab4642;
}
#clock tooltip * {
color: #cc0000;
}

View File

@ -1,6 +1,3 @@
# Load additional profile components.
for src in "$HOME"/.config/profile.d/*; do . "$src"; done
# Import specific environment variables for user units.
systemctl --user import-environment PATH