2022-08-22 14:16:10 +00:00
#!/bin/sh
2021-02-24 17:12:09 +00:00
test -x /usr/bin/gsettings || ( echo "gsettings not found" && exit 1)
set_favorites_bar ( ) {
2023-03-18 19:52:34 +00:00
local firefox
if [ -r /usr/share/applications/firefox-esr.desktop ] && [ ! -r /usr/share/applications/firefox.desktop ]
then
firefox = firefox-esr
else
firefox = firefox
fi
2022-12-01 21:12:46 +00:00
if [ -r " ${ XDG_CONFIG_HOME :- $HOME /.config } /favorite-apps.conf " ]
then
gsettings set org.gnome.shell favorite-apps " $( cat " ${ XDG_CONFIG_HOME :- $HOME /.config } /favorite-apps.conf " ) "
else
2023-03-18 19:52:34 +00:00
gsettings set org.gnome.shell favorite-apps " ['org.gnome.Terminal.desktop', 'org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop', ' $firefox .desktop', 'org.keepassxc.KeePassXC.desktop'] "
2022-12-01 21:12:46 +00:00
fi
2021-02-24 17:12:09 +00:00
}
set_favorites_bar
set_keyboard_and_language ( ) {
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.desktop.input-sources show-all-sources true
2024-01-15 15:44:52 +00:00
gsettings set org.gnome.desktop.input-sources xkb-options "['compose:rctrl']"
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "['<Shift><Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "['<Shift><Alt>Tab']"
2024-03-08 09:37:54 +00:00
# https://github.com/acperkins/keyboard
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'acp'), ('xkb', 'acp+us')]"
2023-04-21 18:04:20 +00:00
2023-10-30 08:38:10 +00:00
# Set the thumb button on the Logitech MX Master mouse to 'toggle-overview'. Defaults are:
# gsettings set org.gnome.desktop.wm.keybindings switch-panels "['<Control><Alt>Tab']"
# gsettings set org.gnome.desktop.wm.keybindings switch-panels-backward "['<Shift><Control><Alt>Tab']"
# gsettings set org.gnome.shell.keybindings toggle-overview "['<Super>s']"
gsettings set org.gnome.desktop.wm.keybindings switch-panels "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-panels-backward "['']"
gsettings set org.gnome.shell.keybindings toggle-overview "['<Super>s', '<Control><Alt>Tab']"
2022-12-01 21:12:46 +00:00
# Set custom keybindings.
if [ -x /usr/bin/kgx ] && ! [ -x /usr/bin/gnome-terminal ]
then
_acp_term = /usr/bin/kgx
else
_acp_term = /usr/bin/gnome-terminal
fi
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-terminal/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-terminal/ command " $_acp_term "
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-terminal/ name 'Launch Terminal'
2023-01-19 09:13:31 +00:00
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-terminal/ binding '<Super>Return'
2022-12-01 21:12:46 +00:00
unset _acp_term
2021-02-24 17:12:09 +00:00
}
set_keyboard_and_language
set_nautilus_preferences ( ) {
2023-04-10 11:22:40 +00:00
gsettings set org.gnome.nautilus.list-view default-zoom-level 'small'
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'
gsettings set org.gtk.Settings.FileChooser sort-directories-first true
2023-02-10 20:39:29 +00:00
gsettings set org.gtk.gtk4.Settings.FileChooser sort-directories-first true
2021-02-24 17:12:09 +00:00
}
set_nautilus_preferences
2021-02-25 19:06:23 +00:00
set_gnome_terminal_preferences ( ) {
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.Terminal.Legacy.Settings menu-accelerator-enabled false
gsettings set org.gnome.Terminal.Legacy.Settings shortcuts-enabled false
gsettings set org.gnome.Terminal.Legacy.Settings theme-variant 'dark'
defaultprofile = " org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/: $( gsettings get org.gnome.Terminal.ProfilesList default | tr -d \' ) / "
2023-02-16 21:26:44 +00:00
gsettings set " $defaultprofile " audible-bell false
2022-12-01 21:12:46 +00:00
gsettings set " $defaultprofile " background-color '#101010'
gsettings set " $defaultprofile " default-size-columns 132
gsettings set " $defaultprofile " default-size-rows 24
gsettings set " $defaultprofile " foreground-color '#C0C0C0'
gsettings set " $defaultprofile " palette " [
2023-02-13 09:34:56 +00:00
'#2E3436' , '#CC0000' , '#4E9A06' , '#C4A000' , '#3465A4' , '#75507B' , '#06989A' , '#D3D7CF' ,
'#555753' , '#EF2929' , '#8AE234' , '#FCE94F' , '#729FCF' , '#AD7FA8' , '#34E2E2' , '#EEEEEC'
2022-12-01 21:12:46 +00:00
] "
2023-10-17 20:59:00 +00:00
gsettings set " $defaultprofile " preserve-working-directory 'always'
2022-12-01 21:12:46 +00:00
gsettings set " $defaultprofile " use-theme-colors false
2021-02-25 19:06:23 +00:00
}
set_gnome_terminal_preferences
2022-11-16 22:08:16 +00:00
set_gnome_text_editor_preferences ( ) {
2022-12-01 21:12:46 +00:00
if gsettings list-schemas | grep '^org.gnome.TextEditor$' > /dev/null
then
gsettings set org.gnome.TextEditor restore-session false
fi
2022-11-16 22:08:16 +00:00
}
set_gnome_text_editor_preferences
2021-11-21 23:11:59 +00:00
set_gnome_extensions ( ) {
2022-12-01 21:12:46 +00:00
gnomeextcmd = /usr/bin/gnome-extensions
if ! [ -x $gnomeextcmd ]
then
# gnome-extensions not installed.
return
fi
# Disable all extensions.
2022-12-14 23:55:16 +00:00
for ext in $( $gnomeextcmd list --enabled)
2022-12-01 21:12:46 +00:00
do
$gnomeextcmd disable -q $ext
done
2021-11-21 23:11:59 +00:00
}
set_gnome_extensions
2021-02-25 19:06:23 +00:00
set_misc_preferences ( ) {
2022-12-01 21:12:46 +00:00
# Disable alert sounds.
gsettings set org.gnome.desktop.sound event-sounds false
2021-02-25 19:06:23 +00:00
2022-12-01 21:12:46 +00:00
# Turn on natural scrolling.
gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true
2021-03-11 11:30:46 +00:00
2023-09-09 15:34:59 +00:00
# Enable Tap to Click.
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click 'true'
2022-12-01 21:12:46 +00:00
# Configure the top bar and calendar.
2023-01-19 10:13:40 +00:00
gsettings set org.gnome.desktop.interface clock-format '24h'
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-show-seconds false
2023-01-19 10:13:40 +00:00
gsettings set org.gnome.desktop.interface clock-show-weekday true
2022-12-01 21:12:46 +00:00
gsettings set org.gnome.desktop.interface show-battery-percentage true
gsettings set org.gnome.desktop.calendar show-weekdate false
2021-03-11 11:30:46 +00:00
2022-12-01 21:12:46 +00:00
# Remove minimise and maximise buttons from the window title bars.
2023-10-10 09:31:23 +00:00
gsettings set org.gnome.desktop.wm.preferences button-layout 'appmenu:minimize,maximize,close'
2021-03-11 11:30:46 +00:00
2022-12-01 21:12:46 +00:00
# Stop dialogue boxes from 'sticking' to their parent windows.
gsettings set org.gnome.mutter attach-modal-dialogs false
2021-11-14 13:41:49 +00:00
2022-12-01 21:12:46 +00:00
# Disable hot-corners.
gsettings set org.gnome.desktop.interface enable-hot-corners false
2021-11-16 16:01:34 +00:00
2022-12-01 21:12:46 +00:00
# Configure fonts.
2023-11-20 16:05:26 +00:00
gsettings set org.gnome.desktop.interface document-font-name 'Sans 10'
gsettings set org.gnome.desktop.interface font-name 'Sans 10'
2023-11-19 21:57:17 +00:00
gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace 10'
2023-11-20 16:05:26 +00:00
gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Sans Bold 10'
2021-12-31 14:50:35 +00:00
2022-12-01 21:12:46 +00:00
# Always show the Accessibility menu.
gsettings set org.gnome.desktop.a11y always-show-universal-access-status true
2023-01-19 10:27:57 +00:00
# Set Gnome Clocks locations.
2023-05-03 07:04:29 +00:00
# America/New_York; America/Halifax; Europe/London; Europe/Paris.
gsettings set org.gnome.clocks world-clocks "[{'location': <(uint32 2, <('New York', 'KNYC', true, [(0.71180344078725644, -1.2909618758762367)], [(0.71059804659265924, -1.2916478949920254)])>)>}, {'location': <(uint32 2, <('Halifax', 'CYHZ', true, [(0.78336194011902394, -1.1082840750163994)], [(0.77928951101546806, -1.1100294042683936)])>)>}, {'location': <(uint32 2, <('London', 'EGWU', false, [(0.89971722940307675, -0.007272211034407213)], [(0.89971722940307675, -0.007272211034407213)])>)>}, {'location': <(uint32 2, <('Paris', 'LFPB', true, [(0.85462956287765413, 0.042760566673861078)], [(0.8528842336256599, 0.040724343395436846)])>)>}]"
2023-09-09 15:34:59 +00:00
# Enable Night Light.
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled 'true'
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic 'true'
2023-09-15 14:20:59 +00:00
# Remove the wallpaper.
2023-09-17 20:55:55 +00:00
gsettings set org.gnome.desktop.background color-shading-type 'solid'
2023-10-17 11:46:30 +00:00
gsettings set org.gnome.desktop.background picture-options 'zoom'
gsettings set org.gnome.desktop.background picture-uri " file:// $XDG_DATA_HOME /wallpaper.svg "
gsettings set org.gnome.desktop.background picture-uri-dark " file:// $XDG_DATA_HOME /wallpaper.svg "
2023-09-25 07:19:39 +00:00
gsettings set org.gnome.desktop.background primary-color '#101010'
gsettings set org.gnome.desktop.background secondary-color '#101010'
2023-09-15 14:20:59 +00:00
2023-09-21 07:51:28 +00:00
# Prefer the dark theme.
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
2023-09-22 08:31:12 +00:00
2023-12-14 09:41:54 +00:00
# Put the screen to sleep early without a password (to avoid image
# retention on this crappy laptop screen).
gsettings set org.gnome.desktop.session idle-delay 'uint32 60'
gsettings set org.gnome.desktop.screensaver lock-enabled false
2023-09-22 08:31:12 +00:00
# Reset the app picker layout. Will take effect after a gnome-shell restart
# (log off and on again).
gsettings reset org.gnome.shell app-picker-layout
2021-02-25 19:06:23 +00:00
}
set_misc_preferences
2021-05-10 10:58:00 +00:00
2022-03-17 12:10:58 +00:00
if [ -r " ${ XDG_CONFIG_HOME :- $HOME /.config } /reset-gnome-setup.local " ]
2021-05-10 10:58:00 +00:00
then
2022-12-01 21:12:46 +00:00
. " ${ XDG_CONFIG_HOME :- $HOME /.config } /reset-gnome-setup.local "
2021-05-10 10:58:00 +00:00
fi