Skip to content

Commit

Permalink
Merge pull request #24 from nis65/develop
Browse files Browse the repository at this point in the history
feat: move window handling to toggle script
  • Loading branch information
nis65 authored Jul 19, 2023
2 parents fcabc0c + af6e5db commit 71ab9bb
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 10 deletions.
64 changes: 64 additions & 0 deletions files/usr/local/bin/toggle-wm
Original file line number Diff line number Diff line change
@@ -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 "['<Alt>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
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
10 changes: 0 additions & 10 deletions templates/etc/dconf/db/local.d/20_advanced_wm_settings.j2
Original file line number Diff line number Diff line change
@@ -1,15 +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
raise-on-click=false

[org/gnome/desktop/wm/keybindings]
raise-or-lower=['<Alt>1']

[org/gnome/desktop/peripherals/touchpad]
click-method='areas'
Expand Down

0 comments on commit 71ab9bb

Please sign in to comment.