summary refs log tree commit diff
diff options
context:
space:
mode:
authorSophie <sophie@yoga>2023-10-14 19:50:26 +0400
committerSophie <sophie@yoga>2023-10-14 19:50:26 +0400
commit7647a5745c257f6bfbd19b3e75f36923fce06a29 (patch)
treeb0e4372b2505e72df856e92aa94d0db345d2b527
parentbb3cfbc180e98fa2b8cb92795492d74c96b5d465 (diff)
Update gnome tweaks natural scroll and titlebar placement feature/gnome-tweaks
This change updates .chezmoi.toml.tmpl to make natural mouse scrolling
optional. It allows for title bar button placements to also be
configurable either left or right.
-rw-r--r--.chezmoi.toml.tmpl10
-rwxr-xr-xrun_gnome_tweaks.sh.tmpl10
2 files changed, 15 insertions, 5 deletions
diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl
index d14b190..db5a9a4 100644
--- a/.chezmoi.toml.tmpl
+++ b/.chezmoi.toml.tmpl
@@ -5,6 +5,8 @@
 {{- $defaultUsername := .chezmoi.username | replaceAllRegex "^[^\\\\]+\\\\" "" }}
 {{- $defaultName := $defaultUsername | title -}}
 {{- $defaultEmail := printf "%s@%s" $defaultUsername .chezmoi.hostname -}}
+{{- $defaultTitlebarPlacement := "right" -}}
+{{- $titlebarPlacementChoices := list "left" "right" -}}
 
 [diff]
     pager = {{ promptString "chezmoi pager" $defaultPager | quote }}
@@ -23,10 +25,12 @@
 [data.ssh]
     user = {{ promptString "SSH default user" $defaultUsername | quote }}
 
-{{ if lookPath "dconf" -}}
+{{ if lookPath "dconf" }}
 [data.gnome]
-    buttonLayout = {{ promptString "GNOME WM button layout" "close,appmenu:" | quote }}
-{{- end }}
+    buttonLayout = {{ promptString "GNOME WM button layout" "close,appmenu" | quote }}
+    naturalScroll = {{ promptBool "GNOME mouse natural scroll" true }}
+    titlebarButtonPlacement = {{ promptChoice "GNOME titlebar button placement" $titlebarPlacementChoices $defaultTitlebarPlacement | quote }}
+{{ end }}
 
 [data.nano]
     config = "dot_config/nano/alen.json"
diff --git a/run_gnome_tweaks.sh.tmpl b/run_gnome_tweaks.sh.tmpl
index b5d440e..4bf0ed0 100755
--- a/run_gnome_tweaks.sh.tmpl
+++ b/run_gnome_tweaks.sh.tmpl
@@ -3,7 +3,13 @@
 set -e
 
 dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
-dconf write /org/gnome/desktop/wm/preferences/button-layout "'{{ .gnome.buttonLayout }}'"
+
+# Title bar positioning is indicated relative to colon :<rightPlacement> or <leftPlacement>:
+{{ if eq .gnome.titlebarButtonPlacement "left" }}
+dconf write /org/gnome/desktop/wm/preferences/button-layout "'{{ .gnome.buttonLayout }}:'"
+{{ else }}
+dconf write /org/gnome/desktop/wm/preferences/button-layout "':{{ .gnome.buttonLayout }}'"
+{{ end }}
 
 if systemd-detect-virt &>/dev/null; then
   dconf write /org/gnome/desktop/session/idle-delay "uint32 0"
@@ -11,6 +17,6 @@ if systemd-detect-virt &>/dev/null; then
 fi
 
 if [[ "$(hostnamectl chassis 2>/dev/null)" =~ ^(vm|laptop)$ ]]; then
-  dconf write /org/gnome/desktop/peripherals/mouse/natural-scroll "true"
+  dconf write /org/gnome/desktop/peripherals/mouse/natural-scroll "'{{ .gnome.naturalScroll }}'"
   dconf write /org/gnome/desktop/peripherals/touchpad/two-finger-scrolling-enabled "true"
 fi