DotHub/xfce/setup.sh

222 lines
8.8 KiB
Bash
Raw Normal View History

#!/bin/bash
# A Bash script for setup up XFCE on openSUSE
clear
echo "This script will reconfigure your XFCE Desktop Environment."
echo "You probably don't want this unless you're me!"
echo
echo "Press Ctrl-C to cancel or Enter to continue."
read
# Get the script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Symlink gtk.css to $XDG_CONFIG_HOME/gtk-3.0/gtk.css
echo
echo "Symlinking $SCRIPT_DIR/gtk.css to $XDG_CONFIG_HOME/gtk-3.0/gtk.css"
ln -sf $SCRIPT_DIR/gtk.css $XDG_CONFIG_HOME/gtk-3.0/gtk.css
# Symlink xfce4-panel.xml to $XDG_CONFIG_HOME/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
echo
echo "Symlinking $SCRIPT_DIR/xfce4-panel.xml to $XDG_CONFIG_HOME/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml"
2025-01-09 05:23:41 +01:00
xfce4-panel --quit
sleep 10
ln -sf $SCRIPT_DIR/xfce4-panel.xml $XDG_CONFIG_HOME/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
sleep 1
2025-01-09 05:23:41 +01:00
xfce4-panel &
2025-01-09 07:26:36 +01:00
# Screensaver and Screen Blanking
# The screensaver cannot be blocked by applications, so set a high timeout
# Screen blanking can be blocked by lots of things, like sound and applications
echo
2025-01-09 07:26:36 +01:00
echo "Enabling the screensaver and setting a timeout of 120 minutes (2 hours)"
xfconf-query -c xfce4-screensaver -p /saver/idle-activation/enabled --create --type bool -s true
2025-01-09 07:26:36 +01:00
xfconf-query -c xfce4-screensaver -p /saver/idle-activation/delay --create --type int -s 120
# Set the screensaver to Matrix
echo
echo "Setting the screensaver to Matrix"
xfconf-query -c xfce4-screensaver -p /saver/mode --create --type int -s 2
xfconf-query -c xfce4-screensaver -p /saver/themes/list --create --force-array --type string -s "screensavers-glmatrix"
# Lock the screen after 1 minute of screensaving
echo
echo "Locking the screen after 1 minute of screensaving"
xfconf-query -c xfce4-screensaver -p /lock/saver-activation/delay --create --type int -s 1
2025-01-09 07:26:36 +01:00
# Enable Display Power Management
echo
echo "Setting machine power profile to performance on AC"
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/profile-on-ac --create --type string -s "performance"
echo "Enabling Display Power Management"
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled --create --type bool -s true
echo "Setting the display to power off after 15 minutes on AC"
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-sleep --create --type int -s 15
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-off --create --type int -s 16
echo "Setting the display to power off after 5 minutes on battery"
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-battery-sleep --create --type int -s 5
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-battery-off --create --type int -s 6
echo "Setting machine to Hibernate after 30 minutes on AC"
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-sleep-mode-on-ac --create --type int -s 2
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-on-ac --create --type int -s 30
# Dracula theme
echo
echo "Setting the Dracula theme"
xfconf-query -c xfwm4 -p /general/theme -s "Dracula"
xfconf-query -c xsettings -p /Net/ThemeName -s "Dracula"
# Icon theme
echo
echo "Setting the Vimix-dark icon theme"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Vimix-dark"
# Fonts
echo
echo "Setting fonts"
xfconf-query -c xfwm4 -p /general/title_font -s "Segoe UI Variable Static Small Bold 11.75"
2025-01-09 06:04:20 +01:00
xfconf-query -c xsettings -p /Gtk/FontName -s "Segoe UI Variable Static Text Regular 11.5"
xfconf-query -c xsettings -p /Gtk/MonospaceFontName -s "Hack 12"
gsettings set org.gnome.desktop.interface monospace-font-name 'Hack 12'
gsettings set org.gnome.desktop.interface font-name 'Segoe UI Variable Regular 11.5'
2025-01-09 05:04:14 +01:00
# Font sub-pixel order
# Depends on the monitor?
echo
echo "Disabling sub-pixel order"
xfconf-query -c xsettings -p /Xft/RGBA -s "none"
# DPI
echo
echo "Setting DPI to 96"
xfconf-query -c xsettings -p /Xft/DPI --create --type int -s 96
# Window button layout
echo
echo "Setting the window button layout"
xfconf-query -c xfwm4 -p /general/button_layout -s "|HC"
xfconf-query -c xsettings -p /Gtk/DecorationLayout -s "icon,menu:minimize,close"
# Mouse cursor
echo
echo "Setting the mouse cursor"
xfconf-query -c xsettings -p /Gtk/CursorThemeName -s "Adwaita"
xfconf-query -c xsettings -p /Gtk/CursorThemeSize -s 16
# Reclaim the Super key
echo
echo "Reclaiming the Super key"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/Super_L" --reset
# Easy dragging/resize windows with Super key
echo
echo "Setting easy dragging/resize windows with Super key"
xfconf-query -c xfwm4 -p /general/easy_click -s "Super"
# Remove Alt Space menu
echo
echo "Removing Alt+Space menu"
xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Alt>space" --reset
# Set Ctrl Alt Delte to start the task manager
echo
echo "Setting Ctrl+Alt+Delete and Ctrl+Escape to start the task manager"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Primary><Alt>Delete" --create --type string -s "xfce4-taskmanager"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Primary><Shift>Escape" --create --type string -s "xfce4-taskmanager"
# Remove size margins when maximizing
echo
echo "Removing size margins when maximizing"
xfconf-query -c xfwm4 -p /general/margin_left --create --type int -s 0
xfconf-query -c xfwm4 -p /general/margin_right --create --type int -s 0
# No confusing shade when scrolling on titlebar
echo
echo "Disabling shade when scrolling on titlebar"
xfconf-query -c xfwm4 -p /general/mousewheel_rollup -s false
# Center most windows
echo
echo "Setting placement ratio to center most windows"
xfconf-query -c xfwm4 -p /general/placement_ratio -s 90
# Transparency on popups
echo
echo "Setting popup opacity to 98"
xfconf-query -c xfwm4 -p /general/popup_opacity -s 98
# Only raise windows when clicking on them
echo
echo "Only raising windows when clicking on them (not when scrolling)"
xfconf-query -c xfwm4 -p /general/raise_with_any_button -s false
# Disable workspaces
# (think this one over)
echo
echo "Disabling workspaces"
xfconf-query -c xfwm4 -p /general/workspace_count -s 1
# Disable button & menu icons
echo
echo "Disabling button and menu icons"
xfconf-query -c xsettings -p /Gtk/ButtonImages -s false
xfconf-query -c xsettings -p /Gtk/ButtonImages -s false
# Thunar location buttons
echo
echo "Enabling Thunar location buttons"
xfconf-query -c thunar -p /last-location-bar -s "ThunarLocationButtons"
# Launch file explorer on Super E
echo
echo "Setting Super+E and Ctrl+Alt+E to launch the file explorer"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Super>e" --create --type string -s "exo-open --launch FileManager"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Ctrl><Alt>e" --create --type string -s "exo-open --launch FileManager"
# Lock the computer with Super L
echo
echo "Setting Super+L to lock the computer"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Super>l" --create --type string -s "xflock4"
# Disable Middle Click Pasting
echo
echo "Disabling middle click pasting"
gsettings set org.gnome.desktop.interface gtk-enable-primary-paste false
# Clipboard history on Super V
echo
echo "Setting Super+V to launch the clipboard history"
xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Super>v" --create --type string -s "xfce4-popup-clipman"
# Clipboard history settings
echo
echo "Setting clipboard history settings"
xfconf-query -c xfce4-panel -p /plugins/clipman/settings/add-primary-clipboard --create --type bool -s false
xfconf-query -c xfce4-panel -p /plugins/clipman/tweaks/popup-at-pointer --create --type bool -s true
# Desktop display
echo
echo "Setting desktop display settings"
xfconf-query -c xfce4-desktop -p /desktop-icons/confirm-sorting --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/gravity --create --type int -s 2
xfconf-query -c xfce4-desktop -p /desktop-icons/icon-size --create --type int -s 82
xfconf-query -c xfce4-desktop -p /desktop-icons/primary --create --type bool -s true
xfconf-query -c xfce4-desktop -p /desktop-icons/show-hidden-files --create --type bool -s true
xfconf-query -c xfce4-desktop -p /desktop-icons/show-tooltips --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/file-icons/show-device-fixed --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/file-icons/show-filesystem --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/file-icons/home --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/file-icons/trash --create --type bool -s false
xfconf-query -c xfce4-desktop -p /desktop-icons/file-icons/show-unknown-removable --create --type bool -s true
# Tell the user we're done
echo
echo "All done!"
echo "You must reboot your system, otherwise things will not work as expected."
exit 0