From ab45c633a723e652b4103efd7b2992b2ae029aef Mon Sep 17 00:00:00 2001 From: Nicolas Iselin Date: Tue, 18 Jul 2023 10:35:55 +0200 Subject: [PATCH 1/2] fix: leave raise-on-click at default --- templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 index a0d61ca..4e99102 100644 --- a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 +++ b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 @@ -6,7 +6,6 @@ [org/gnome/desktop/wm/preferences] focus-mode='sloppy' auto-raise=false -raise-on-click=false [org/gnome/desktop/wm/keybindings] raise-or-lower=['1'] From af6e5db645ab762940abfa7029ceebc6ae418cda Mon Sep 17 00:00:00 2001 From: Nicolas Iselin Date: Wed, 19 Jul 2023 08:26:35 +0200 Subject: [PATCH 2/2] feat: move focus handling to toggle script --- files/usr/local/bin/toggle-wm | 64 +++++++++++++++++++ tasks/main.yml | 6 ++ .../db/local.d/20_advanced_wm_settings.j2 | 9 --- 3 files changed, 70 insertions(+), 9 deletions(-) create mode 100755 files/usr/local/bin/toggle-wm diff --git a/files/usr/local/bin/toggle-wm b/files/usr/local/bin/toggle-wm new file mode 100755 index 0000000..690d31d --- /dev/null +++ b/files/usr/local/bin/toggle-wm @@ -0,0 +1,64 @@ +#!/bin/bash + +usage () { +echo "" +echo usage: +echo "$0 [-t|-e|-s]" +echo "" +echo "-t toggle current mode (default)" +echo "-e set expert mode" +echo "-s set standard mode" +echo "" +exit 1 +} + + +MODE=toggle + +while getopts tes option +do + case $option in + t) ;; + e) MODE=setexp + ;; + s) MODE=setstd + ;; + *) usage + ;; + esac +done + +do-std () { + echo setting std mode... + gsettings set org.gnome.desktop.wm.preferences focus-mode "'click'" + gsettings set org.gnome.desktop.wm.keybindings raise-or-lower "@as []" + gsettings set org.gnome.desktop.wm.preferences raise-on-click true +} + +do-exp () { + echo setting expert mode... + gsettings set org.gnome.desktop.wm.preferences focus-mode "'sloppy'" + gsettings set org.gnome.desktop.wm.keybindings raise-or-lower "['1']" + gsettings set org.gnome.desktop.wm.preferences raise-on-click false +} + +do-toggle () { + FOCUS=`gsettings get org.gnome.desktop.wm.preferences focus-mode` + if [[ $FOCUS == "'sloppy'" ]] + then + do-std + else + do-exp + fi +} + +echo MODE=$MODE + +case $MODE in + setexp) do-exp + ;; + setstd) do-std + ;; + toggle) do-toggle + ;; +esac diff --git a/tasks/main.yml b/tasks/main.yml index f0f084f..abc39be 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,3 +44,9 @@ dest: '/etc/dconf/profile/user' mode: '644' notify: 'Rebuild dconf database' + +- name: Install wm toggle script + ansible.builtin.copy: + src: 'usr/local/bin/toggle-wm' + dest: '/usr/local/bin/toggle-wm' + mode: '755' diff --git a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 index 4e99102..d676e58 100644 --- a/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 +++ b/templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2 @@ -1,14 +1,5 @@ # advanced settings for window manager {% if potos_dconf_20_advanced_wm_settings is defined and potos_dconf_20_advanced_wm_settings %} -# focus follows mouse, but no autoraise -# make alt1/alt2 keybindings - -[org/gnome/desktop/wm/preferences] -focus-mode='sloppy' -auto-raise=false - -[org/gnome/desktop/wm/keybindings] -raise-or-lower=['1'] [org/gnome/desktop/peripherals/touchpad] click-method='areas'