Advertisement
keiaa070500

xfce-shine.sh

Dec 7th, 2024 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.51 KB | Source Code | 0 0
  1. #!/bin/sh
  2.  
  3. # function to install packages with apt
  4. install_apt() {
  5.   sudo apt update && \
  6.   sudo apt install -y yaru-theme-gtk
  7.   sudo apt install -y fonts-noto
  8.   sudo apt install -y elementary-xfce-icon-theme
  9.   sudo apt install -y xfce4-whiskermenu-plugin
  10.   sudo apt install -y xfce4-panel-profiles
  11.   sudo apt install -y python3-psutil
  12.  
  13.   if [ $? -ne 0 ]; then
  14.     echo "Failed to install prerequisites with apt"
  15.     exit 1
  16.   fi
  17. }
  18.  
  19. # function to install packages with dnf
  20. install_dnf() {
  21.   sudo dnf update -y && \
  22.   sudo dnf install -y yaru-gtk3-theme yaru-gtk2-theme elementary-xfce-icon-theme xfce4-whiskermenu-plugin
  23.   sudo dnf install -y yaru-gtk2-theme
  24.   sudo dnf install -y elementary-xfce-icon-theme
  25.   sudo dnf install -y xfce4-whiskermenu-plugin
  26.   sudo dnf install -y xfce4-panel-profiles
  27.   sudo dnf install -y python3-psutil
  28.  
  29.   if [ $? -ne 0 ]; then
  30.     echo "Failed to install prerequisites with dnf"
  31.     exit 1
  32.   fi
  33. }
  34.  
  35. # detect the package manager and call the appropriate function
  36. if command -v apt >/dev/null 2>&1; then
  37.   install_apt
  38. elif command -v dnf >/dev/null 2>&1; then
  39.   install_dnf
  40. else
  41.   echo "Neither apt nor dnf found. Cannot install prerequisites."
  42.   exit 1
  43. fi
  44.  
  45. # create a backup directory
  46. mkdir -p ~/.xfconf-backup
  47.  
  48. # backup current xfconf settings for xsettings
  49. xfconf-query -c xsettings -p /Net/IconThemeName -v > ~/.xfconf-backup/Net_IconThemeName.bak
  50. xfconf-query -c xsettings -p /Net/ThemeName -v > ~/.xfconf-backup/Net_ThemeName.bak
  51. xfconf-query -c xsettings -p /Gtk/FontName -v > ~/.xfconf-backup/Gtk_FontName.bak
  52. xfconf-query -c xsettings -p /Xfce/LastCustomDPI -v > ~/.xfconf-backup/Xfce_LastCustomDPI.bak
  53.  
  54. # backup current xfconf settings for xfwm4
  55. xfconf-query -c xfwm4 -p /general/theme -v > ~/.xfconf-backup/xfwm4_theme.bak
  56. xfconf-query -c xfwm4 -p /general/title_alignment -v > ~/.xfconf-backup/xfwm4_title_alignment.bak
  57. xfconf-query -c xfwm4 -p /general/title_font -v > ~/.xfconf-backup/xfwm4_title_font.bak
  58.  
  59. # backup current xfconf settings for whiskermenu
  60. xfconf-query -c xfce4-panel -p /plugins/plugin-1 -v > ~/.xfconf-backup/whiskermenu.bak
  61. xfconf-query -c xfce4-panel -p /plugins/plugin-1/hover-switch-category -v > ~/.xfconf-backup/hover_switch_category.bak
  62. xfconf-query -c xfce4-panel -p /plugins/plugin-1/position-commands-alternate -v > ~/.xfconf-backup/position_commands_alternate.bak
  63.  
  64. # applying new settings
  65. xfconf-query -c xsettings -p /Net/IconThemeName -s "elementary-xfce" || { echo 'Failed to set IconThemeName'; exit 1; }
  66. xfconf-query -c xsettings -p /Net/ThemeName -s "Yaru-blue" || { echo 'Failed to set ThemeName'; exit 1; }
  67. xfconf-query -c xsettings -p /Gtk/FontName -s "Noto Sans 9" || { echo 'Failed to set FontName'; exit 1; }
  68. xfconf-query -c xsettings -p /Xfce/LastCustomDPI -s 96 || { echo 'Failed to set LastCustomDPI'; exit 1; }
  69.  
  70. # xfconf entries for xfwm4
  71. xfconf-query -c xfwm4 -p /general/theme -s "Yaru" || { echo 'Failed to set xfwm4 theme'; exit 1; }
  72. xfconf-query -c xfwm4 -p /general/title_alignment -s "center" || { echo 'Failed to set title_alignment'; exit 1; }
  73. xfconf-query -c xfwm4 -p /general/title_font -s "Noto Sans Bold 9" || { echo 'Failed to set title_font'; exit 1; }
  74.  
  75. # xfconf entries for whiskermenu
  76. xfconf-query -c xfce4-panel -p /plugins/plugin-1 -s "whiskermenu" || { echo 'Failed to set whiskermenu'; exit 1; }
  77. xfconf-query -c xfce4-panel -p /plugins/plugin-1/hover-switch-category -s true || { echo 'Failed to set hover-switch-category'; exit 1; }
  78. xfconf-query -c xfce4-panel -p /plugins/plugin-1/position-commands-alternate -s true || { echo 'Failed to set position-commands-alternate'; exit 1; }
  79.  
  80. # simple customizations for whiskermenu
  81. mkdir -p ~/.config/gtk-3.0
  82. touch ~/.config/gtk-3.0/gtk.css
  83. echo "#whiskermenu-window treeview {
  84.  padding: 3px;
  85. }" >> ~/.config/gtk-3.0/gtk.css
  86.  
  87. # setup panel configurations
  88. wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Vnjt7ZhTRAzqOFbaVYSFz_e089ON1-Ea' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1Vnjt7ZhTRAzqOFbaVYSFz_e089ON1-Ea" -O Shine.tar.bz2 && rm -rf /tmp/cookies.txt || { echo 'Failed to fetch panel profile'; exit 1; }
  89. xfce4-panel-profiles save Backup || { echo 'Failed to save panel profile'; exit 1; }
  90. xfce4-panel-profiles load Shine.tar.bz2 || { echo 'Failed to set Shine panel profile'; exit 1; }
  91.  
  92. # finishing touches
  93. rm -rf Shine.tar.bz2
  94. xfce4-session-logout --logout --fast
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement