├── bin ├── bmenu ├── system-menu ├── system-settings ├── fastcompress-tui ├── bcups ├── initmenu ├── mhwd-tui ├── diagnosis-menu ├── xinput_tui ├── releasecompare ├── system-setup ├── toolbox └── appearance-menu ├── toolbox.png ├── README.md ├── PKGBUILD ├── toolbox.desktop └── LICENSE /bin/bmenu: -------------------------------------------------------------------------------- 1 | /usr/bin/toolbox -------------------------------------------------------------------------------- /toolbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puxplaying/toolbox/HEAD/toolbox.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ToolBox 2 | Bash scripts providing a collection of terminal applications in a simple UI for Manjaro and Arch based systems (Bash TUI). 3 | - https://archived.forum.manjaro.org/t/manjaro-cli-menu/129017 4 | - https://github.com/Chrysostomus/bmenu 5 | 6 | How to install: 7 | 8 | This package is available on [Manjaro](https://packages.manjaro.org/?query=bmenu). 9 | 10 | From source: 11 | - ```sudo pacman -Syu base-devel git``` 12 | - ```git clone https://github.com/puxplaying/toolbox.git``` 13 | - ```cd toolbox``` 14 | - ```makepkg -srci``` 15 | 16 | How to use: 17 | - click on the *ToolBox* icon in the menu 18 | 19 | toolbox 20 | 21 | - or run it via ```bmenu``` 22 | 23 | --- 24 | 25 | ![1](https://github.com/puxplaying/toolbox/assets/28549766/3fd23f57-17c7-4868-86fb-05216bcf4c1f) 26 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Georg Wagner 2 | # Maintainer: Mark Wagie 3 | # Contributor: Chrysostomus 4 | # Contributor: konung-yaropolk 5 | 6 | pkgname=bmenu 7 | pkgver=0.26 8 | pkgrel=1 9 | pkgdesc="Bash scripts providing a collection of terminal applications in a simple UI" 10 | arch=('any') 11 | url="https://github.com/puxplaying/toolbox/" 12 | license=('GPL-3.0-or-later') 13 | depends=( 14 | 'bash' 15 | 'btop' 16 | 'cmus' 17 | 'cpupower' 18 | 'curl' 19 | 'dialog' 20 | 'dmidecode' 21 | 'expac' 22 | 'fzf' 23 | 'gawk' 24 | 'inxi' 25 | 'lm_sensors' 26 | 'lshw' 27 | 'ncdu' 28 | 'pacman-contrib' 29 | 'powertop' 30 | 'sed' 31 | 'sudo' 32 | 'wget' 33 | 'xorg-xinput' 34 | ) 35 | optdepends=( 36 | 'cmatrix: Enter The Matrix' 37 | 'cups: Manage printers' 38 | 'sane: Manage scanners' 39 | 'meld: Diff operations' 40 | 'mhwd: Manjaro Linux Hardware Detection' 41 | 'pacui: Package Manager UI' 42 | 'p7zip: Fast 7z file compression with password protection' 43 | 'ranger: File manager operations' 44 | 'tar: Fast Tar file compression' 45 | 'zstd: Fast Zstd file comression' 46 | ) 47 | source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz") 48 | sha256sums=('c952483cf855ca305abc94153885b0cf6670ce626d78c00c5872b390c48577bb') 49 | 50 | prepare() { 51 | cd "toolbox-$pkgver" 52 | 53 | # toolbox script conflicts with Arch extra toolbox package 54 | mv -f bin/toolbox "bin/$pkgname" 55 | sed -i "s/Exec=toolbox/Exec=$pkgname/g" toolbox.desktop 56 | } 57 | 58 | package () { 59 | cd "toolbox-$pkgver" 60 | install -Dm755 bin/* -t "$pkgdir/usr/bin/" 61 | install -Dm644 toolbox.desktop -t "$pkgdir/usr/share/applications/" 62 | install -Dm644 toolbox.png -t "$pkgdir/usr/share/pixmaps/" 63 | } 64 | -------------------------------------------------------------------------------- /toolbox.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Version=1.0 4 | Name=ToolBox 5 | GenericName=Terminal Applications 6 | GenericName[ca]=Aplicaciones de terminal 7 | GenericName[de]=Terminalanwendungen 8 | GenericName[en_GB]=Terminal Applications 9 | GenericName[es]=Aplicaciones de terminal 10 | GenericName[fi]=Päätesovellukset 11 | GenericName[fr]=Applications de terminal 12 | GenericName[gl]=Aplicaciones de terminal 13 | GenericName[it]=Applicazioni terminali 14 | GenericName[ko]=터미널 어플리케이션 15 | GenericName[nb]=Terminal applikasjoner 16 | GenericName[nl]=Terminal-toepassingen 17 | GenericName[nn]=Terminal applikasjoner 18 | GenericName[pl]=Aplikacje terminalowe 19 | GenericName[pt]=Aplicações terminais 20 | GenericName[pt_BR]=Aplicações terminais 21 | GenericName[ru]=Терминальные приложения 22 | GenericName[sk]=Terminálne aplikácie 23 | GenericName[sl]=Terminalne aplikacije 24 | GenericName[sr@ijekavian]=Терминал Апплицатионс 25 | GenericName[sr]=Терминал Апплицатионс 26 | GenericName[sv]=Terminalapplikationer 27 | GenericName[tr]=Terminal Uygulamaları 28 | GenericName[uk]=Термінальні програми 29 | GenericName[zh_CN]=终端应用 30 | GenericName[zh_TW]=終端應用 31 | Comment=Collection Of Terminal Applications In A Simple UI 32 | Comment[ca]=Col·lecció d'aplicacions del terminal en una interfície d'interès simple 33 | Comment[de]=Sammlung von Terminalanwendungen in einer einfachen Benutzeroberfläche 34 | Comment[en_GB]=Collection Of Terminal Applications In A Simple UI 35 | Comment[es]=Colección de aplicaciones de terminal en una interfaz de usuario simple 36 | Comment[fi]=Kokoelma päätesovelluksia yksinkertaisessa käyttöliittymässä 37 | Comment[fr]=Collection d'applications de terminaux dans une interface utilisateur simple 38 | Comment[gl]=Colección de aplicacións de terminais nunha interface de usuario sinxela 39 | Comment[it]=Raccolta di applicazioni terminali in una semplice interfaccia utente 40 | Comment[ko]=간단한 UI에서 터미널 응용 프로그램 모음 41 | Comment[nb]=Innsamling av terminalapplikasjoner i et enkelt brukergrensesnitt 42 | Comment[nl]=Verzameling van terminaltoepassingen in een eenvoudige gebruikersinterface 43 | Comment[nn]=Innsamling av terminalapplikasjoner i et enkelt brukergrensesnitt 44 | Comment[pl]=Zbiór aplikacji terminalowych w prostym interfejsie użytkownika 45 | Comment[pt]=Coleção de aplicativos de terminal em uma interface simples 46 | Comment[pt_BR]=Coleção de aplicativos de terminal em uma interface simples 47 | Comment[ru]=Коллекция терминальных приложений в простом интерфейсе 48 | Comment[sk]=Zbierka terminálových aplikácií v jednoduchom používateľskom rozhraní 49 | Comment[sl]=Zbirka aplikacij terminalov v preprostem uporabniškem vmesniku 50 | Comment[sr@ijekavian]=Колекција терминалних апликација у једноставном корисничком сучељу 51 | Comment[sr]=Колекција терминалних апликација у једноставном корисничком сучељу 52 | Comment[sv]=Samling av terminalapplikationer i ett enkelt användargränssnitt 53 | Comment[tr]=Basit Bir Kullanıcı Arabiriminde Terminal Uygulamalarının Toplanması 54 | Comment[uk]=Колекція додатків терміналів у простому інтерфейсі 55 | Comment[zh_CN]=在简单的UI中收集终端应用程序 56 | Comment[zh_TW]=在簡單的UI中收集終端應用程序 57 | Icon=toolbox 58 | Exec=toolbox 59 | Terminal=true 60 | Categories=System;Monitor;ConsoleOnly; 61 | Keywords=system;process;task 62 | 63 | -------------------------------------------------------------------------------- /bin/system-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | # ======================= 11 | # Service messages section 12 | # Wrong Option 13 | ERRORMSG="$RED Wrong option $NC" 14 | TRYAGAINMSG=" Please try again..." 15 | # 16 | if [ "$(cat /proc/1/comm)" = "systemd" ]; then 17 | systemctl status NetworkManager.service 2>/dev/null | grep -q " active " && netcommand="nmtui" 18 | systemctl status Netctl.service 2>/dev/null | grep -q " active " && netcommand="sudo wifi-menu" 19 | systemctl status systemd-networkd 2>/dev/null | grep -q " active " && netcommand="wpa_tui" 20 | else 21 | rc-status | grep -q "NetworkManager" && netcommand="nmtui" 22 | rc-status | grep -q "Netctl" && netcommand="sudo wifi-menu" 23 | fi 24 | 25 | function init_settings() { 26 | if [ "$(cat /proc/1/comm)" = "systemd" ]; then 27 | initmenu 28 | else 29 | initmenu-openrc 30 | fi 31 | } 32 | 33 | # Startmenu for releasecompare 34 | function releasecompare_startmenu() { 35 | echo "" 36 | echo -e "$TC This tool will compare the release package list of Manjaro, $NC" 37 | echo -e "$TC or any Arch based distro to the local system. $NC" 38 | echo "" 39 | echo " 1) Compare only" 40 | echo " 2) Installation Options" 41 | echo " 0) Quit" 42 | read -r -n 1 -e choice 43 | case "$choice" in 44 | 1) 45 | echo "you chose to compare only" 46 | releasecompare 47 | ;; 48 | 2) 49 | echo "you chose Installation Options" 50 | releasecompare install 51 | ;; 52 | 0 | 3 | q | quit) 53 | # 54 | ;; 55 | *) # do this, if $choice variable contains anything else not offered above 56 | echo -e "$ERRORMSG" 57 | sleep 2 58 | ;; 59 | esac 60 | } 61 | 62 | function main() { 63 | # Run infinite loop for UI / menu, till the user quits using the "quit" option or CTRL+C. 64 | while true; do 65 | 66 | # Define Menu entries which will be run with the echo command 67 | E0="\e[1mQ\e[0muit" 68 | E1="\e[1mA\e[0mppearance" 69 | E2="\e[1mN\e[0metwork" 70 | E3="System \e[1mC\e[0monfiguration" 71 | E4="\e[1mI\e[0mnit-System" 72 | E5="\e[1mR\e[0melease Comparison" 73 | 74 | printf '\33[H\33[2J' # Use this instead of the clear command 75 | 76 | echo 77 | echo -e " $BG$TC System & Settings $NC" 78 | echo -e " $TC+----------------------------------------------------------------+$NC" 79 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 80 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 81 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 82 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 83 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $TC|$NC" 84 | echo -e " $TC+----------------------------------------------------------------+$NC" 85 | echo "" 86 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 87 | 88 | # save entered number/letter in variable "choice" 89 | read -r -n 1 -e choice 90 | 91 | # test, whether "choice" fits any of the following numbers or letters 92 | case "$choice" in 93 | 94 | 1 | A | a) 95 | echo 96 | appearance-menu 97 | echo "" 98 | ;; 99 | 2 | N | n) 100 | echo 101 | $netcommand 102 | echo "" 103 | ;; 104 | 3 | C | c) 105 | echo 106 | system-settings 107 | echo "" 108 | ;; 109 | 4 | I | i) 110 | echo 111 | init_settings 112 | echo "" 113 | ;; 114 | 5 | R | r) 115 | printf '\33[H\33[2J' 116 | releasecompare_startmenu 117 | cd || exit 118 | echo 119 | echo -e " $RED Displaying Releasecompare. To return to System & Settings press ENTER $NC" 120 | # wait for input, e.g. by pressing ENTER: 121 | read -r 122 | ;; 123 | 0 | Q | q) 124 | printf '\33[H\33[2J' && exit 125 | ;; 126 | *) # do this, if $choice variable contains anything else not offered above 127 | echo -e "$ERRORMSG" 128 | echo -e "$TRYAGAINMSG" 129 | sleep 2 130 | ;; 131 | esac 132 | done 133 | } 134 | 135 | main 136 | -------------------------------------------------------------------------------- /bin/system-settings: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | # ======================= 11 | # Service messages section 12 | # Wrong Option 13 | ERRORMSG="$RED Wrong option $NC" 14 | TRYAGAINMSG=" Please try again..." 15 | # 16 | PS3SYSSETTMSG="Select bootloader to configure: " 17 | CONTINMSG="$RED To return press ENTER $NC" 18 | USINGNANOFOREDITMSG="Using nano for edit..." 19 | 20 | function pressanykeyrequest() { 21 | echo -e "$CONTINMSG" 22 | read -r 23 | STATUSVAR=1 24 | } 25 | 26 | function bootloader_configuration() { 27 | PS3="$PS3SYSSETTMSG" 28 | # Gather the results in an array. 29 | dms=("grub" "refind" "systemdboot" "syslinux" "cancel") 30 | 31 | select pick in "${dms[@]}"; do 32 | case $pick in 33 | grub) 34 | sudo "$TEXTEDITOR" /etc/default/grub 35 | sudo update-grub 36 | break 37 | ;; 38 | refind) 39 | sudo "$TEXTEDITOR" /boot/refind_linux.conf 40 | sudo "$TEXTEDITOR" /boot/EFI/refind/refind.conf 41 | break 42 | ;; 43 | systemdboot) 44 | sudo "$TEXTEDITOR" /boot/loader/entries/manjaro.conf 45 | break 46 | ;; 47 | syslinux) 48 | sudo "$TEXTEDITOR" /boot/syslinux/syslinux.cfg 49 | break 50 | ;; 51 | cancel) 52 | break 53 | ;; 54 | esac 55 | done 56 | } 57 | 58 | function tryvisudo() { 59 | visudoerrormsggrep="" 60 | visudoerrormsggrep=$(sudo visudo 2>&1 | grep "no editor found") 61 | if [ "$visudoerrormsggrep" != "" ]; then 62 | echo "$USINGNANOFOREDITMSG" 63 | sudo EDITOR=nano visudo 64 | return 0 65 | else 66 | pressanykeyrequest 67 | fi 68 | return 1 69 | } 70 | 71 | function main() { 72 | 73 | # Define Menu entries which will be run with the echo command 74 | E0="\e[1mQ\e[0muit" 75 | E1="Pacman Settings" 76 | E2="Mkinitcpio" 77 | E3="Fstab" 78 | E4="Sudoers" 79 | E5="Logind" 80 | E6="Bootloader" 81 | E7="Udevil Settings" 82 | E8="Xinitrc" 83 | E9="Setup" 84 | 85 | while true; do 86 | printf '\33[H\33[2J' # Use this instead of the clear command 87 | 88 | echo 89 | echo -e " $BG$TC Configuration $NC" 90 | echo -e " $TC+----------------------------------------------------------------+$NC" 91 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 92 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 93 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 94 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 95 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 96 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 97 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 98 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 99 | echo -e " $TC|$NC $BG 9 $NC $E9 $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $TC|$NC" 100 | echo -e " $TC+----------------------------------------------------------------+$NC" 101 | echo "" 102 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 103 | 104 | # save entered number/letter in variable "choice" 105 | read -r -n 1 -e choice 106 | 107 | # test, whether "choice" fits any of the following numbers or letters 108 | case "$choice" in 109 | 1) 110 | echo 111 | sudo "$TEXTEDITOR" /etc/pacman.conf 112 | echo "" 113 | ;; 114 | 2) 115 | echo 116 | sudo "$TEXTEDITOR" /etc/mkinitcpio.conf 117 | echo "" 118 | ;; 119 | 3) 120 | echo 121 | sudo "$TEXTEDITOR" /etc/fstab 122 | echo "" 123 | ;; 124 | 4) 125 | echo 126 | sudo echo "" 127 | STATUSVAR=$? 128 | if [ $STATUSVAR -eq 1 ]; then 129 | echo "" 130 | else 131 | sudo visudo 132 | STATUSVAR=$? 133 | if [ $STATUSVAR -eq 1 ]; then 134 | tryvisudo 135 | STATUSVAR=$? 136 | if [ $STATUSVAR -eq 0 ]; then 137 | pressanykeyrequest 138 | fi 139 | else 140 | pressanykeyrequest 141 | fi 142 | fi 143 | echo "" 144 | ;; 145 | 5) 146 | echo 147 | sudo "$TEXTEDITOR" /etc/systemd/logind.conf 148 | echo "" 149 | ;; 150 | 6) 151 | echo 152 | bootloader_configuration 153 | echo "" 154 | ;; 155 | 7) 156 | echo 157 | sudo "$TEXTEDITOR" /etc/udevil/udevil.conf 158 | echo "" 159 | ;; 160 | 8) 161 | echo 162 | $TEXTEDITOR ~/.xinitrc 163 | echo "" 164 | ;; 165 | 9) 166 | echo 167 | system-setup 168 | echo "" 169 | ;; 170 | 0 | Q | q) 171 | printf '\33[H\33[2J' && exit 172 | ;; 173 | *) 174 | echo -e "$ERRORMSG" 175 | echo -e "$TRYAGAINMSG" 176 | sleep 2 177 | ;; 178 | esac 179 | done 180 | } 181 | main 182 | -------------------------------------------------------------------------------- /bin/fastcompress-tui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Dialog UI - main function 4 | function main() { 5 | 6 | # Messages Main UI 7 | BACKTITLE="Press SPACE For Auto Completion / ESC To Quit" 8 | TITEL1="Select Source File Or Folder For $compression Compression" 9 | TITEL2="Select Destiantion And Name" 10 | MSGBOX1="Compression With $compression Was Successful!" 11 | MSGBOX2="Compression With $compression Failed!" 12 | MSGBOX3="Please Install $compression First!" 13 | 14 | # Dialog UI - Source folder or file selection which will be saved inside the "$source_dir" variable 15 | source_dir=$(dialog --begin 2 30 --backtitle "$BACKTITLE" \ 16 | --stdout --title "$TITEL1" --fselect "$HOME/" 10 50) # Create UI which shows "$BACKTITLE" and "$TITEL1" 17 | if [ -z "$source_dir" ]; then # If variable is empty, go back 18 | return 19 | fi 20 | 21 | # Dialog UI - Destination folder and filename selection which will be saved inside the "$destination_dir" variable 22 | destination_dir=$(dialog --begin 2 30 --backtitle "$BACKTITLE" \ 23 | --stdout --title "$TITEL2" --fselect "$HOME/" 10 50) # Create UI which shows "$BACKTITLE" and "$TITEL2" 24 | if [ -z "$destination_dir" ]; then # If variable is empty, go back 25 | return 26 | fi 27 | 28 | # Dialog UI - 7z PASSWD + No List + No Compression 29 | if [ "$compression" == "7z" ]; then 30 | if [ -x "$(command -v 7za)" ]; then # If 7z is installed 31 | printf '\33[H\33[2J' 32 | if time 7za u -m0=Copy -mhe -p "$destination_dir".7z "$source_dir"; then # Start and time the compression 33 | dialog --msgbox "$MSGBOX1" 6 45 # Display success message 34 | exit 35 | else 36 | echo "" 37 | dialog --msgbox "$MSGBOX2" 6 45 # Dispaly error message if compression failed 38 | exit 1 39 | fi 40 | else 41 | dialog --msgbox "$MSGBOX3" 6 45 # Display info to install missing compression tool 42 | exit 2 43 | fi 44 | fi 45 | 46 | # Dialog UI - Fast tar with no compression and progress bar 47 | if [ "$compression" == "tar" ]; then 48 | if [ -x "$(command -v tar)" ]; then 49 | printf '\33[H\33[2J' 50 | if compr=$(tar -c "$source_dir" | pv -s $(($(du -sk "$source_dir" | awk '{print $1}') * 1024)) >"$destination_dir".tar); then 51 | time $compr # Start and time the compression 52 | dialog --msgbox "$MSGBOX1" 6 45 # Display success message 53 | exit 54 | else 55 | echo "" 56 | dialog --msgbox "$MSGBOX2" 6 45 # Dispaly error message if compression failed 57 | exit 1 58 | fi 59 | else 60 | dialog --msgbox "$MSGBOX3" 6 45 # Display info to install missing compression tool 61 | exit 2 62 | fi 63 | fi 64 | 65 | # Dialog UI - Fast zstd compression 66 | if [ "$compression" == "zstd" ]; then 67 | if [ -x "$(command -v zstd)" ]; then 68 | printf '\33[H\33[2J' 69 | if time tar --zstd -vcf "$destination_dir".tar.zst "$source_dir"; then # Start and time the compression 70 | dialog --msgbox "$MSGBOX1" 6 45 # Display success message 71 | exit 72 | else 73 | echo "" 74 | dialog --msgbox "$MSGBOX2" 6 45 # Dispaly error message if compression failed 75 | exit 1 76 | fi 77 | else 78 | dialog --msgbox "$MSGBOX3" 6 45 # Display info to install missing compression tool 79 | exit 2 80 | fi 81 | fi 82 | } 83 | 84 | # Dialog UI - Startmenu 85 | function selectmenu() { 86 | 87 | # Messages Startmenu 88 | TITEL="The Quickest File Compressor" 89 | MENU="Please Select The Compression" 90 | # Items Startmenu 91 | SEVENZ="<7z> No Compression + PASSWD (Slowest)" 92 | TAR=" No Compression (Fastest)" 93 | ZSTD=" Fast Compression (Best Compromise)" 94 | 95 | items=(1 "$SEVENZ" 96 | 2 "$TAR" 97 | 3 "$ZSTD") 98 | 99 | # Create UI which shows "$TITLE" and "$MENU" 100 | while choice=$( 101 | dialog --title "$TITEL" \ 102 | --menu "$MENU" 10 55 3 "${items[@]}" \ 103 | 2>&1 >/dev/tty 104 | ); do 105 | # Select method and save choise in the "$compression" variable 106 | case $choice in 107 | 1) 108 | compression=7z 109 | main 110 | ;; 111 | 2) 112 | compression=tar 113 | main 114 | ;; 115 | 3) 116 | compression=zstd 117 | main 118 | ;; 119 | *) ;; # some action on other 120 | esac 121 | done 122 | #clear # clear after user pressed Cancel 123 | } 124 | 125 | selectmenu 126 | -------------------------------------------------------------------------------- /bin/bcups: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | browser='elinks' 11 | printers=$(lpstat -p -d | awk '/printer/ {print $2}') 12 | enabled_printers=$(lpstat -p -d | awk '/enabled/ {print $2}') 13 | STATUSVAR=1 14 | 15 | # ======================= 16 | # Service messages section 17 | # Wrong Option 18 | ERRORMSG="$RED Wrong option $NC" 19 | TRYAGAINMSG=" Please try again..." 20 | # 21 | CONTINMSG="$RED To return press ENTER $NC" 22 | XSANEINSTMSG="Xsane is not installed and pacman seems to be in use" 23 | SELECTDEFAULTPRINTERMSG="Select new default printer" 24 | DEFAULTPRINTERSETMSG="The new default printer has been set" 25 | SELECTFILESFORPRINTMSG="Select the files to print (use TAB to mark files for printing)" 26 | SELECTPRINTERTOUSEMSG="Select the printer to use" 27 | SELECTFILESFORPRINTINGMSG="Select the files to print (use TAB to mark files for printing)" 28 | PRINTINGMSG="Printing now" 29 | SEARCHINGSCANNERSMSG="Searching for scanners... Select one" 30 | SELECTDEFAULTSCANNERMSG="Searching for scanners... Select new default" 31 | IMGFILETYPECHOOSEMSG="Which filetype should be used? " 32 | NAMEFORSCANNEDFILEMSG="What name shall be given to the scanned file?" 33 | 34 | # ======================= 35 | # Pacman installation 36 | INSTALLPKGS="sudo pacman -Syu" 37 | 38 | function pressanykeyrequest() { 39 | echo -e "$CONTINMSG" 40 | read -r 41 | STATUSVAR=1 42 | } 43 | 44 | function scanner_interface() { 45 | if [ -e /usr/bin/xsane ]; then 46 | xsane 47 | STATUSVAR=$? 48 | else 49 | if [ -e /var/lib/pacman/db.lck ]; then 50 | echo "$XSANEINSTMSG" 51 | STATUSVAR=$? 52 | else 53 | $INSTALLPKGS xsane && xsane 54 | STATUSVAR=$? 55 | fi 56 | fi 57 | return $STATUSVAR 58 | } 59 | 60 | function webinterface() { 61 | $browser http://localhost:631 62 | STATUSVAR=$? 63 | return $STATUSVAR 64 | } 65 | 66 | function set_default_printer() { 67 | lpoptions -d $(echo $printers | fzf -e --reverse --prompt="$SELECTDEFAULTPRINTERMSG >") 68 | STATUSVAR=$? 69 | if [ $STATUSVAR -eq 0 ]; then 70 | echo "" 71 | echo "" 72 | echo "$DEFAULTPRINTERSETMSG" 73 | fi 74 | return $STATUSVAR 75 | } 76 | 77 | function print_file() { 78 | grep -q "Default" ~/.cups/lpoptions && 79 | lpr $(fzf -m --reverse --prompt=" $SELECTFILESFORPRINTMSG >") || 80 | lpr -P $(echo $printers | fzf -e --reverse --prompt="$SELECTPRINTERTOUSEMSG >") $(fzf -m --reverse --prompt="$SELECTFILESFORPRINTINGMSG >") 81 | STATUSVAR=$? 82 | if [ $STATUSVAR -eq 0 ]; then 83 | echo "" 84 | echo "" 85 | echo "$PRINTINGMSG" 86 | sleep 3 87 | fi 88 | return $STATUSVAR 89 | } 90 | 91 | function select_scanner() { 92 | scanimage -L 2>/dev/null | fzf -e --reverse --prompt="$SEARCHINGSCANNERSMSG >" | awk '{print substr($2, 2, length($2) - 2)}' 93 | STATUSVAR=$? 94 | return $STATUSVAR 95 | } 96 | 97 | function set_default_scanner() { 98 | default_scanner=$(scanimage -L 2>/dev/null | 99 | fzf -e --reverse --prompt="$SELECTDEFAULTSCANNERMSG >" | 100 | awk '{print $2} {print substr($2, 2, length($2) - 2)}') 101 | STATUSVAR=$? 102 | if [ $STATUSVAR -eq 0 ] && [ "$default_scanner" != "" ]; then 103 | echo "export SANE_DEFAULT_DEVICE=$default_scanner" >>$HOME/.profile 104 | SANE_DEFAULT_DEVICE="$default_scanner" 105 | fi 106 | return $STATUSVAR 107 | } 108 | 109 | function select_filetype() { 110 | PS3="$IMGFILETYPECHOOSEMSG" 111 | # Gather the results in an array. 112 | filetypes=("pnm" "tiff" "png" "jpeg") 113 | 114 | select pick in "${filetypes[@]}"; do 115 | case $pick in 116 | *) 117 | echo $pick 118 | break 119 | ;; 120 | esac 121 | done 122 | } 123 | 124 | function scan() { 125 | echo "$NAMEFORSCANNEDFILEMSG" 126 | read filename 127 | # check file name function needs 128 | if [ "$filename" != "" ]; then 129 | eval filetype=$(select_filetype) 130 | if [ "$filetype" != "" ]; then 131 | scanner=$(select_scanner) 132 | if [ "$scanner" != "" ]; then 133 | scanimage -p -d $scanner --format=$filetype >$filename.$filetype 134 | STATUSVAR=$? 135 | else 136 | STATUSVAR=1 137 | fi 138 | else 139 | STATUSVAR=1 140 | fi 141 | else 142 | STATUSVAR=1 143 | fi 144 | return $STATUSVAR 145 | } 146 | 147 | function default_scan() { 148 | echo "$NAMEFORSCANNEDFILEMSG" 149 | read filename 150 | # check file name function needs 151 | if [ "$filename" != "" ]; then 152 | eval filetype=$(select_filetype) 153 | if [ "$filetype" != "" ]; then 154 | scanimage -p --format=$filetype >$filename.$filetype 155 | STATUSVAR=$? 156 | else 157 | STATUSVAR=1 158 | fi 159 | else 160 | STATUSVAR=1 161 | fi 162 | return $STATUSVAR 163 | } 164 | 165 | function main() { 166 | 167 | # Define Menu entries which will be run with the echo command 168 | E0="\e[1mQ\e[0muit" 169 | E1="Manage Printers" 170 | E2="Print Files" 171 | E3="Set Default Printer" 172 | E4="List Printers" 173 | E5="Set Default Scanner" 174 | E6="Scan With GUI" 175 | E7="List Scanners" 176 | E8="Scan Using Defaults" 177 | 178 | while true; do 179 | printf '\33[H\33[2J' # Use this instead of the clear command 180 | 181 | echo 182 | echo -e " $BG$TC Printers and Scanners $NC" 183 | echo -e " $TC+----------------------------------------------------------------+$NC" 184 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 185 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 186 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 187 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 188 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 189 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 190 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 191 | echo -e " $TC+----------------------------------------------------------------+$NC" 192 | echo "" 193 | echo -e " Enter marked number - $BG 0 $NC $E0 " 194 | 195 | # save entered number/letter in variable "choice" 196 | read -r -n 1 -e choice 197 | 198 | # test, whether "choice" fits any of the following numbers or letters 199 | case "$choice" in 200 | 201 | 1) 202 | echo 203 | webinterface 204 | STATUSVAR=$? 205 | if [ $STATUSVAR -eq 0 ]; then 206 | pressanykeyrequest 207 | else 208 | echo "" 209 | fi 210 | ;; 211 | 2) 212 | echo 213 | print_file 214 | STATUSVAR=$? 215 | if [ $STATUSVAR -eq 0 ]; then 216 | pressanykeyrequest 217 | else 218 | echo "" 219 | fi 220 | ;; 221 | 3) 222 | echo 223 | set_scanner 224 | STATUSVAR=$? 225 | if [ $STATUSVAR -eq 0 ]; then 226 | pressanykeyrequest 227 | else 228 | echo "" 229 | fi 230 | ;; 231 | 4) 232 | echo 233 | lpstat -p -d 234 | STATUSVAR=$? 235 | if [ $STATUSVAR -eq 0 ]; then 236 | pressanykeyrequest 237 | else 238 | echo "" 239 | fi 240 | ;; 241 | 5) 242 | echo 243 | set_default_scanner 244 | STATUSVAR=$? 245 | if [ $STATUSVAR -eq 0 ]; then 246 | pressanykeyrequest 247 | else 248 | echo "" 249 | fi 250 | ;; 251 | 6) 252 | echo 253 | scanner_inerface 254 | STATUSVAR=$? 255 | if [ $STATUSVAR -eq 0 ]; then 256 | pressanykeyrequest 257 | else 258 | echo "" 259 | fi 260 | ;; 261 | 7) 262 | echo 263 | scanimage -L 2>/dev/null 264 | STATUSVAR=$? 265 | if [ $STATUSVAR -eq 0 ]; then 266 | pressanykeyrequest 267 | else 268 | echo "" 269 | fi 270 | ;; 271 | 8) 272 | echo 273 | default_scan 274 | STATUSVAR=$? 275 | if [ $STATUSVAR -eq 0 ]; then 276 | pressanykeyrequest 277 | else 278 | echo "" 279 | fi 280 | ;; 281 | 0 | Q | q) 282 | printf '\33[H\33[2J' && exit 283 | ;; 284 | *) # do this, if $choice variable contains anything else not offered above 285 | echo -e "$ERRORMSG" 286 | echo -e "$TRYAGAINMSG" 287 | sleep 2 288 | ;; 289 | esac 290 | done 291 | } 292 | 293 | main 294 | -------------------------------------------------------------------------------- /bin/initmenu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | TEXTEDITOR=$EDITOR 11 | 12 | # ======================= 13 | # Service messages section 14 | # Wrong Option 15 | ERRORMSG="$RED Wrong option $NC" 16 | TRYAGAINMSG=" Please try again..." 17 | # 18 | CONTINMSG=" $RED To return to Init Menu press ENTER $NC" 19 | SELECTFILEMSG="Select file to configure and press Enter: " 20 | SELECTTARGETMSG="Select target and press Enter to change to: " 21 | SERVICEPREFIXMSG="Service " 22 | SERVICESTARTEDMSG=" was started successfully" 23 | SERVICEENABLEDMSG=" was enabled successfully" 24 | SERVICESTOPPEDMSG=" was stopped successfully" 25 | SERVICEDISABLEDMSG=" was disabled successfully" 26 | 27 | function pressanykeyrequest() { 28 | echo -e "$CONTINMSG" 29 | read -r 30 | STATUSVAR=1 31 | } 32 | 33 | function config_editor() { 34 | PS3="$SELECTFILEMSG" 35 | configs=("journald.conf" "system.conf" "logind.conf" "user.conf" "cancel") 36 | 37 | select pick in "${configs[@]}"; do 38 | case $pick in 39 | logind.conf) 40 | [ -e /etc/systemd/logind.conf.d/10-logind.conf ] || 41 | sudo mkdir -p /etc/systemd/logind.conf.d/ && 42 | sudo cp /etc/systemd/logind.conf /etc/systemd/logind.conf.d/10-logind.conf && 43 | sudo "$TEXTEDITOR" /etc/systemd/logind.conf.d/10-logind.conf 44 | break 45 | ;; 46 | system.conf) 47 | [ -e /etc/systemd/system.conf.d/10-system.conf ] || 48 | sudo mkdir -p /etc/systemd/system.conf.d/ && 49 | sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.d/10-system.conf && 50 | sudo "$TEXTEDITOR" /etc/systemd/system.conf.d/10-system.conf 51 | break 52 | ;; 53 | journald.conf) 54 | [ -e /etc/systemd/journald.conf.d/10-journald.conf ] || 55 | sudo mkdir -p /etc/systemd/journald.conf.d/ && 56 | sudo cp /etc/systemd/journald.conf /etc/systemd/journald.conf.d/10-journald.conf && 57 | sudo "$TEXTEDITOR" /etc/systemd/journald.conf.d/10-journald.conf 58 | break 59 | ;; 60 | user.conf) 61 | [ -e /etc/systemd/user.conf.d/10-user.conf ] || 62 | sudo mkdir -p /etc/systemd/user.conf.d/ && 63 | sudo cp /etc/systemd/user.conf /etc/systemd/user.conf.d/10-user.conf && 64 | sudo "$TEXTEDITOR" /etc/systemd/user.conf.d/10-user.conf 65 | break 66 | ;; 67 | cancel) 68 | break 69 | ;; 70 | esac 71 | done 72 | 73 | } 74 | 75 | function change_runlevel() { 76 | PS3="$SELECTTARGETMSG" 77 | targets=("poweroff" "rescue" "multi-user" "graphical" "reboot" "cancel") 78 | 79 | select pick in "${targets[@]}"; do 80 | case $pick in 81 | poweroff) 82 | sudo systemctl isolate poweroff.target 83 | break 84 | ;; 85 | reboot) 86 | sudo systemctl isolate reboot.target 87 | break 88 | ;; 89 | rescue) 90 | sudo systemctl isolate rescue.target 91 | break 92 | ;; 93 | multi-user) 94 | sudo systemctl isolate multi-user.target 95 | break 96 | ;; 97 | graphical) 98 | sudo systemctl isolate graphical.target 99 | break 100 | ;; 101 | cancel) 102 | break 103 | ;; 104 | esac 105 | done 106 | 107 | } 108 | 109 | function enable_services() { 110 | OUTPUTITEM="" 111 | OUTPUTITEM=$(systemctl list-unit-files | awk '/disabled/ {print $1}' | fzf -m -e --reverse) 112 | if [ "$OUTPUTITEM" != "" ]; then 113 | sudo systemctl enable "$OUTPUTITEM" 114 | STATUSVAR=$? 115 | else 116 | STATUSVAR=1 117 | fi 118 | return $STATUSVAR 119 | } 120 | 121 | function start_services() { 122 | OUTPUTITEM="" 123 | OUTPUTITEM=$(systemctl list-unit-files | awk '/disabled/ {print $1}' | fzf -m -e --reverse) 124 | if [ "$OUTPUTITEM" != "" ]; then 125 | sudo systemctl start "$OUTPUTITEM" 126 | STATUSVAR=$? 127 | else 128 | STATUSVAR=1 129 | fi 130 | return $STATUSVAR 131 | } 132 | 133 | function stop_services() { 134 | OUTPUTITEM="" 135 | OUTPUTITEM=$(systemctl list-unit-files | awk '/enabled/ {print $1}' | fzf -m -e --reverse) 136 | if [ "$OUTPUTITEM" != "" ]; then 137 | sudo systemctl stop "$OUTPUTITEM" 138 | STATUSVAR=$? 139 | else 140 | STATUSVAR=1 141 | fi 142 | return $STATUSVAR 143 | } 144 | 145 | function disable_services() { 146 | OUTPUTITEM="" 147 | OUTPUTITEM=$(systemctl list-unit-files | awk '/enabled/ {print $1}' | fzf -m -e --reverse) 148 | if [ "$OUTPUTITEM" != "" ]; then 149 | sudo systemctl disable "$OUTPUTITEM" 150 | STATUSVAR=$? 151 | else 152 | STATUSVAR=1 153 | fi 154 | return $STATUSVAR 155 | } 156 | 157 | function main() { 158 | 159 | # Define Menu entries which will be run with the echo command 160 | E0="\e[1mQ\e[0muit" 161 | E1="Enable Services" 162 | E2="Disable Services" 163 | E3="Start Services" 164 | E4="Stop Services" 165 | E5="List Active Services" 166 | E6="Show Boot Messages" 167 | E7="Edit Config Files" 168 | E8="Change Runlevel" 169 | E9="Analyze Boot" 170 | 171 | while true; do 172 | 173 | printf '\33[H\33[2J' # Use this instead of the clear command 174 | 175 | echo 176 | echo -e " $BG$TC Init-System $NC" 177 | echo -e " $TC+----------------------------------------------------------------+$NC" 178 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 179 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 180 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 181 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 182 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 183 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 184 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 185 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 186 | echo -e " $TC|$NC $BG 9 $NC $E9 $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $E12 $TC|$NC" 187 | echo -e " $TC+----------------------------------------------------------------+$NC" 188 | echo "" 189 | echo -e " Enter marked number - $BG 0 $NC $E0 " 190 | 191 | # save entered number/letter in variable "choice" 192 | read -r -n 1 -e choice 193 | 194 | # test, whether "choice" fits any of the following numbers or letters 195 | case "$choice" in 196 | 197 | 1) 198 | echo 199 | enable_services 200 | STATUSVAR=$? 201 | if [ $STATUSVAR -eq 0 ]; then 202 | echo -e "$SERVICEPREFIXMSG$OUTPUTITEM$SERVICEENABLEDMSG" 203 | pressanykeyrequest 204 | else 205 | echo "" 206 | fi 207 | ;; 208 | 2) 209 | echo 210 | disable_services 211 | STATUSVAR=$? 212 | if [ $STATUSVAR -eq 0 ]; then 213 | echo -e "$SERVICEPREFIXMSG$OUTPUTITEM$SERVICEDISABLEDMSG" 214 | pressanykeyrequest 215 | else 216 | echo "" 217 | fi 218 | ;; 219 | 3) 220 | echo 221 | start_services 222 | STATUSVAR=$? 223 | if [ $STATUSVAR -eq 0 ]; then 224 | echo -e "$SERVICEPREFIXMSG$OUTPUTITEM$SERVICESTARTEDMSG" 225 | pressanykeyrequest 226 | else 227 | echo"" 228 | fi 229 | ;; 230 | 4) 231 | echo 232 | stop_services 233 | STATUSVAR=$? 234 | if [ $STATUSVAR -eq 0 ]; then 235 | echo -e "$SERVICEPREFIXMSG$OUTPUTITEM$SERVICESTOPPEDMSG" 236 | pressanykeyrequest 237 | else 238 | echo "" 239 | fi 240 | ;; 241 | 5) 242 | echo 243 | systemctl 244 | echo "" 245 | pressanykeyrequest 246 | ;; 247 | 6) 248 | echo 249 | sudo dmesg 250 | echo "" 251 | pressanykeyrequest 252 | ;; 253 | 7) 254 | echo 255 | config_editor 256 | echo "" 257 | ;; 258 | 8) 259 | echo 260 | change_runlevel 261 | echo "" 262 | ;; 263 | 9) 264 | echo 265 | clear 266 | systemd-analyze blame 267 | echo "" 268 | pressanykeyrequest 269 | ;; 270 | 0 | Q | q) 271 | printf '\33[H\33[2J' && exit 272 | ;; 273 | *) # do this, if $choice variable contains anything else not offered above 274 | echo -e "$ERRORMSG" 275 | echo -e "$TRYAGAINMSG" 276 | sleep 2 277 | ;; 278 | esac 279 | done 280 | } 281 | 282 | main 283 | -------------------------------------------------------------------------------- /bin/mhwd-tui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | # ======================= 11 | # Service messages section 12 | # Wrong Option 13 | ERRORMSG="$RED Wrong option $NC" 14 | TRYAGAINMSG=" Please try again..." 15 | 16 | # ======================= 17 | # Pacman installation 18 | INSTALLPKGS="sudo pacman -Syu" 19 | 20 | # ======================= 21 | # mhwd-ui functions 22 | cd || exit 23 | trap 'rm $HOME/{.running_kernel,.installed_kernels,.available_kernels}' EXIT 24 | in_array() { 25 | local haystack=${1}[@] 26 | local needle=${2} 27 | for i in ${!haystack}; do 28 | if [[ ${i} == ${needle} ]]; then 29 | return 0 30 | fi 31 | done 32 | return 1 33 | } 34 | 35 | function install_kernel() { 36 | PS3="which kernel do you wish to install? (press ctrl+d to preceed, ctrl+c to cancel): " 37 | # Gather the results in an array. 38 | kernels=($(grep -v -f .installed_kernels .available_kernels) "proceed" "cancel") 39 | 40 | select pick in "${kernels[@]}"; do 41 | case $pick in 42 | proceed) 43 | break 44 | ;; 45 | cancel) 46 | exit 47 | ;; 48 | *) 49 | if in_array picks $pick; then 50 | picks=($(printf -- '%s\n' "${picks[@]}" | grep -v $pick)) 51 | else 52 | picks+=("$pick") 53 | fi 54 | printf 'Selected: %s\n' "${picks[*]}" 55 | ;; 56 | esac 57 | done 58 | 59 | if [[ $picks ]]; then 60 | printf 'Installing %s\n' "${picks[*]}" 61 | sudo mhwd-kernel -i "${picks[@]}" 62 | fi 63 | } 64 | 65 | function remove_kernel() { 66 | PS3="which kernel do you wish to remove? (press ctrl+d to preceed, ctrl+c to cancel): " 67 | # Gather the results in an array. 68 | kernels=($(grep -v -f .running_kernel .installed_kernels) "proceed" "cancel") 69 | 70 | select pick in "${kernels[@]}"; do 71 | case $pick in 72 | proceed) 73 | break 74 | ;; 75 | cancel) 76 | exit 77 | ;; 78 | *) 79 | if in_array picks $pick; then 80 | picks=($(printf -- '%s\n' "${picks[@]}" | grep -v $pick)) 81 | else 82 | picks+=("$pick") 83 | fi 84 | printf 'Selected: %s\n' "${picks[*]}" 85 | ;; 86 | esac 87 | done 88 | 89 | if [[ $picks ]]; then 90 | printf 'Removing %s\n' "${picks[*]}" 91 | sudo mhwd-kernel -r "${picks[@]}" 92 | fi 93 | } 94 | 95 | mhwd-kernel -li | awk 'NR==1 {print $4}' | tr -d '()' >.running_kernel & 96 | mhwd-kernel -li | awk 'NR > 2 { print $2}' >.installed_kernels & 97 | mhwd-kernel -l | awk 'NR > 1 { print $2}' >.available_kernels & 98 | 99 | # Run infinite loop for UI / menu, till the user quits using the "quit" option or CTRL+C. 100 | while true; do 101 | 102 | # Define Menu entries which will be run with the echo command 103 | E0="\e[1mQ\e[0muit" 104 | E1="\e[1mI\e[0mnstall a Kernel" 105 | E2="\e[1mR\e[0memove a Kernel" 106 | E3="Use \e[1mF\e[0mree Graphics" 107 | E4="Use \e[1mN\e[0monfree Graphics" 108 | E5="\e[1mL\e[0mist Installed Drivers" 109 | E6="\e[1mC\e[0monfigure Touchpad" 110 | E7="\e[1mS\e[0mystem Temperatures" 111 | E8="\e[1mD\e[0misk Usage" 112 | E9="\e[1mH\e[0mome Folder Usage" 113 | E10="\e[1mB\e[0mios Information" 114 | E11="P\e[1mo\e[0mwer Consumption" 115 | E12="\e[1mP\e[0mrinters" 116 | 117 | printf '\33[H\33[2J' # Use this instead of the clear command 118 | 119 | echo 120 | echo -e " $BG$TC Hardware and Drivers $NC" 121 | echo -e " $TC+----------------------------------------------------------------+$NC" 122 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 123 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 124 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 125 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 126 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 127 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 128 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 129 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 130 | echo -e " $TC|$NC $BG 9 $NC $E9 $TC|$NC $BG B $NC $E10 $TC|$NC" 131 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 132 | echo -e " $TC|$NC $BG O $NC $E11 $TC|$NC $BG P $NC $E12 $TC|$NC" 133 | echo -e " $TC+----------------------------------------------------------------+$NC" 134 | echo "" 135 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 136 | 137 | # save entered number/letter in variable "choice" 138 | read -r -n 1 -e choice 139 | 140 | # test, whether "choice" fits any of the following numbers or letters 141 | case "$choice" in 142 | 1 | I | i) 143 | printf '\33[H\33[2J' 144 | install_kernel 145 | echo "" 146 | ;; 147 | 2 | R | r) 148 | printf '\33[H\33[2J' 149 | remove_kernel 150 | echo "" 151 | ;; 152 | 3 | F | f) 153 | printf '\33[H\33[2J' 154 | sudo mhwd -a pci free 0300 155 | echo 156 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 157 | # wait for input, e.g. by pressing ENTER: 158 | read -r 159 | ;; 160 | 4 | N | n) 161 | printf '\33[H\33[2J' 162 | sudo mhwd -a pci nonfree 0300 163 | echo 164 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 165 | # wait for input, e.g. by pressing ENTER: 166 | read -r 167 | ;; 168 | 5 | L | l) 169 | printf '\33[H\33[2J' 170 | mhwd -li -d 171 | echo 172 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 173 | # wait for input, e.g. by pressing ENTER: 174 | read -r 175 | ;; 176 | 6 | C | c) 177 | printf '\33[H\33[2J' 178 | xinput_tui 179 | ;; 180 | 7 | S | s) 181 | printf '\33[H\33[2J' 182 | sensors 183 | echo 184 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 185 | # wait for input, e.g. by pressing ENTER: 186 | read -r 187 | ;; 188 | 8 | D | d) 189 | printf '\33[H\33[2J' 190 | ncdu -x / 191 | echo 192 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 193 | # wait for input, e.g. by pressing ENTER: 194 | read -r 195 | ;; 196 | 9 | H | h) 197 | printf '\33[H\33[2J' 198 | ncdu -x $HOME 199 | echo 200 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 201 | # wait for input, e.g. by pressing ENTER: 202 | read -r 203 | ;; 204 | B | b) 205 | printf '\33[H\33[2J' 206 | sudo dmidecode -t bios 207 | echo 208 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 209 | # wait for input, e.g. by pressing ENTER: 210 | read -r 211 | ;; 212 | O | o) 213 | printf '\33[H\33[2J' 214 | if [[ -f /usr/bin/powertop ]]; then 215 | sudo powertop 216 | else 217 | echo "Installing Powertop" 218 | if [[ -f /var/lib/pacman/db.lck ]]; then 219 | echo "powertop is not installed and Pacman seems to be in use" 220 | else 221 | $INSTALLPKGS powertop && sudo powertop 222 | fi 223 | fi 224 | echo 225 | echo -e " $RED To return to Hardware and Drivers press ENTER $NC" 226 | # wait for input, e.g. by pressing ENTER: 227 | read -r 228 | ;; 229 | P | p) 230 | printf '\33[H\33[2J' 231 | bcups 232 | ;; 233 | 0 | Q | q) 234 | printf '\33[H\33[2J' && exit 235 | ;; 236 | *) # do this, if $choice variable contains anything else not offered above 237 | echo -e "$ERRORMSG" 238 | echo -e "$TRYAGAINMSG" 239 | sleep 2 240 | ;; 241 | esac 242 | done 243 | -------------------------------------------------------------------------------- /bin/diagnosis-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | # System Diagnosis Menu 11 | function system_diagnosis_ui() { 12 | 13 | # Define Menu entries which will be run with the echo command 14 | E0="\e[1mQ\e[0muit" 15 | E1="\e[1mP\e[0macman Log Search" 16 | E2="\e[1mI\e[0mnstalled Packages" 17 | E3="\e[1mZ\e[0msh History Search" 18 | E4="\e[1mB\e[0mash History Search" 19 | E5="\e[1mJ\e[0mournal Error Search" 20 | E6="\e[1mD\e[0mmesg Search" 21 | E7="\e[1mG\e[0mraphics Log Search" 22 | E8="Man Page \e[1mS\e[0mearch" 23 | E9="Journal \e[1mL\e[0mive Log" 24 | E10="Enter The \e[1mM\e[0matrix" 25 | 26 | # Service messages section 27 | # Wrong Option 28 | ERRORMSG="$RED Wrong option $NC" 29 | TRYAGAINMSG=" Please try again..." 30 | 31 | # ======================= 32 | # Pacman installation 33 | INSTALLPKGS="sudo pacman -Syu" 34 | 35 | # Run infinite loop for UI / menu, till the user quits using the "quit" option or CTRL+C. 36 | while true; do 37 | 38 | printf '\33[H\33[2J' # Use this instead of the clear command 39 | 40 | echo 41 | echo -e " $BG$TC System Diagnosis $NC" 42 | echo -e " $TC+----------------------------------------------------------------+$NC" 43 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 44 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 45 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 46 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 47 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 48 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 49 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 50 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 51 | echo -e " $TC|$NC $BG 9 $NC $E9 $NC $TC|$NC $BG M $NC $E10 $TC|$NC" 52 | echo -e " $TC+----------------------------------------------------------------+$NC" 53 | echo "" 54 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 55 | 56 | # save entered number/letter in variable "choice" 57 | read -r -n 1 -e choice 58 | 59 | # test, whether "choice" fits any of the following numbers or letters 60 | case "$choice" in 61 | 62 | 1 | p | P) 63 | printf '\33[H\33[2J' 64 | cat /var/log/pacman.log | fzf -e +s --tac --multi --reverse --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 65 | echo 66 | echo -e " $RED Displaying Pacman Log. To return to System Diagnosis press ENTER $NC" 67 | # wait for input, e.g. by pressing ENTER: 68 | read -r 69 | ;; 70 | 2 | i | I) 71 | printf '\33[H\33[2J' 72 | pacman -Qq | fzf -i --multi --reverse --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " --preview ' pacman -Qi {} ' --no-unicode "$(if (($(tput cols) >= 125)); then echo "--preview-window=right:55%:wrap"; else echo "--preview-window=bottom:60%:wrap"; fi)" 73 | echo 74 | echo -e " $RED Displaying Installed Packages. To return to System Diagnosis press ENTER $NC" 75 | # wait for input, e.g. by pressing ENTER: 76 | read -r 77 | ;; 78 | 3 | Z | z) 79 | printf '\33[H\33[2J' 80 | if [[ -f $HOME/.zhistory ]]; then 81 | cat "$HOME"/.zhistory | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 82 | else 83 | echo ".zhistory not found" 84 | fi 85 | echo 86 | echo -e " $RED Displaying Zsh History. To return to System Diagnosis press ENTER $NC" 87 | # wait for input, e.g. by pressing ENTER: 88 | read -r 89 | ;; 90 | 4 | F | f) 91 | printf '\33[H\33[2J' 92 | if [[ -f $HOME/.bash_history ]]; then 93 | cat "$HOME"/.bash_history | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 94 | else 95 | echo ".bash_history not found" 96 | fi 97 | echo 98 | echo -e " $RED Displaying Bash History. To return to System Diagnosis press ENTER $NC" 99 | # wait for input, e.g. by pressing ENTER: 100 | read -r 101 | ;; 102 | 5 | J | j) 103 | printf '\33[H\33[2J' 104 | journalctl -p 3 -xb | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 105 | echo 106 | echo -e " $RED Displaying Journal Errors. To return to System Diagnosis press ENTER $NC" 107 | # wait for input, e.g. by pressing ENTER: 108 | read -r 109 | ;; 110 | 6 | D | d) 111 | printf '\33[H\33[2J' 112 | sudo dmesg | less | tee "$HOME"/.dmesg.txt 113 | cat .dmesg.txt | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 114 | rm -rf "$HOME"/.dmesg.txt 115 | echo 116 | echo -e " $RED Displaying Dmesg. To return to System Diagnosis press ENTER $NC" 117 | # wait for input, e.g. by pressing ENTER: 118 | read -r 119 | ;; 120 | 7 | G | g) 121 | printf '\33[H\33[2J' 122 | if [[ -f /var/log/Xorg.0.log ]]; then 123 | cat /var/log/Xorg.0.log | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 124 | else 125 | if [[ -f $HOME/.local/share/xorg/Xorg.0.log ]]; then 126 | cat "$HOME"/.local/share/xorg/Xorg.0.log | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 127 | fi 128 | fi 129 | echo 130 | echo -e " $RED Displaying Graphics Log. To return to System Diagnosis press ENTER $NC" 131 | # wait for input, e.g. by pressing ENTER: 132 | read -r 133 | ;; 134 | 8 | S | s) 135 | printf '\33[H\33[2J' 136 | pacman -Qq | fzf -i --reverse --info=inline --prompt="Enter string > " --header="Press Shift + Up & Down Keys to scroll. ESC to quit. " --preview ' man {} ' --no-unicode "$(if (($(tput cols) >= 125)); then echo "--preview-window=right:55%:wrap"; else echo "--preview-window=bottom:60%:wrap"; fi)" 137 | ;; 138 | 9 | L | l) 139 | printf '\33[H\33[2J' 140 | journalctl --follow --full | fzf -e +s --tac --reverse --multi --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " 141 | echo 142 | echo -e " $RED Displaying Live Journal. To return to System Diagnosis press ENTER $NC" 143 | # wait for input, e.g. by pressing ENTER: 144 | read -r 145 | ;; 146 | M | m) 147 | printf '\33[H\33[2J' 148 | if [[ -f /usr/bin/cmatrix ]]; then 149 | echo -e " $RED Press $BG Q $NC$RED to return to ToolBox $NC" 150 | sleep 2 151 | cmatrix 152 | else 153 | echo "Installing Cmatrix" 154 | if [[ -f /var/lib/pacman/db.lck ]]; then 155 | echo "cmatrix is not installed and Pacman seems to be in use" 156 | else 157 | $INSTALLPKGS cmatrix && cmatrix 158 | fi 159 | fi 160 | ;; 161 | 0 | Q | q) 162 | printf '\33[H\33[2J' && exit 163 | ;; 164 | *) # do this, if $choice variable contains anything else not offered above 165 | echo -e "$ERRORMSG" 166 | echo -e "$TRYAGAINMSG" 167 | sleep 2 168 | ;; 169 | 170 | esac # close case-loop 171 | 172 | done 173 | # close while-loop 174 | } 175 | system_diagnosis_ui 176 | -------------------------------------------------------------------------------- /bin/xinput_tui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## xinput_tui 3 | 4 | # ======================= 5 | # Define Colors 6 | RED='\e[41m' 7 | NC='\e[0m' # No color 8 | BG='\e[7m' # Highlighting Background color 9 | TC='\e[1m' # Highlighting Text color 10 | 11 | # ======================= 12 | # Service messages section 13 | # Wrong Option 14 | ERRORMSG="$RED Wrong option $NC" 15 | TRYAGAINMSG=" Please try again..." 16 | 17 | # ======================= 18 | # Pacman installation 19 | INSTALLPKGS="sudo pacman -Syu" 20 | 21 | touchpad_id=$(xinput --list | grep -i "Touchpad" | xargs -n 1 | grep "id=" | sed 's/id=//g') 22 | 23 | toggle_natural_scrolling() { 24 | natural_scrolling_code=$(xinput --list-props "$touchpad_id" | grep "Natural Scrolling" | awk '{print $5}' | grep -o '[0-9]\+') 25 | 26 | if [[ $(xinput --list-props "$touchpad_id" | grep "Natural Scrolling Enabled (" | awk '{print $6}' | head -n1) == 1 ]]; then 27 | xinput --set-prop "$touchpad_id" "$natural_scrolling_code" 0 && echo "Natural scrolling is now disabled" || echo "Something vent wrong" 28 | else 29 | xinput --set-prop "$touchpad_id" "$natural_scrolling_code" 1 && echo "Natural scrolling is now enabled" || echo "Something vent wrong" 30 | fi 31 | 32 | } 33 | 34 | toggle_tap_to_click() { 35 | tap_to_click_code=$(xinput --list-props "$touchpad_id" | awk '/Tapping Enabled \(/ {print $4}' | grep -o '[0-9]\+') 36 | 37 | if [[ $(xinput --list-props "$touchpad_id" | awk '/Tapping Enabled \(/ {print $5}') == 1 ]]; then 38 | xinput --set-prop "$touchpad_id" "$tap_to_click_code" 0 && echo "Tap to click is now disabled" || echo "Something vent wrong" 39 | else 40 | xinput --set-prop "$touchpad_id" "$tap_to_click_code" 1 && echo "Tap to click is now enabled" || echo "Something vent wrong" 41 | fi 42 | 43 | } 44 | 45 | toggle_left_handed() { 46 | left_handed_code=$(xinput --list-props "$touchpad_id" | grep "Left Handed Enabled" | awk '{print $5}' | grep -o '[0-9]\+') 47 | 48 | if [[ $(xinput --list-props "$touchpad_id" | grep "Left Handed Enabled" | awk '{print $6}' | head -n1) == 1 ]]; then 49 | xinput --set-prop "$touchpad_id" "$left_handed_code" 0 && echo "Left handed mode is now disabled" || echo "Something vent wrong" 50 | else 51 | xinput --set-prop "$touchpad_id" "$left_handed_code" 1 && echo "Left handed mode is now enabled" || echo "Something vent wrong" 52 | fi 53 | 54 | } 55 | 56 | set_pointer_speed() { 57 | 58 | accel_speed_code=$(xinput --list-props "$touchpad_id" | awk '/Accel Speed \(/ {print $4}' | grep -o '[0-9]\+') 59 | current_speed=$(xinput --list-props "$touchpad_id" | awk '/Accel Speed \(/ {print $5}') 60 | 61 | echo "" 62 | echo "Setting pointer speed." 63 | echo "Current speed is $current_speed" 64 | echo "input number between -1 and 1 and press enter" 65 | read speed 66 | xinput --set-prop "$touchpad_id" "$accel_speed_code" "$speed" 67 | echo "Speed is now set to $speed." 68 | read -r -p "${1:-Do you wish to make this setting permanent? [Y/n]} " response 69 | case $response in 70 | [nN] | [nN][oO]) 71 | false 72 | ;; 73 | *) 74 | sudo bash -c 'echo -e "Section \"InputClass\" 75 | \tIdentifier \"'"$touchpad_id"'\" 76 | \tDriver \"libinput\" 77 | \tMatchIsTouchpad \"on\" 78 | \tOption \"AccelSpeed\" \"'$speed'\" 79 | EndSection" > /etc/X11/xorg.conf.d/31-pointerspeed.conf' 80 | ;; 81 | esac 82 | echo "" 83 | echo "created file /etc/X11/xorg.conf.d/31-pointerspeed.conf. 84 | Press any key to continue" 85 | read -s -n1 86 | } 87 | 88 | toggle_drag_lock() { 89 | drag_lock_code=$(xinput --list-props "$touchpad_id" | grep "Drag Lock Enabled (" | awk '{print $6}' | grep -o '[0-9]\+') 90 | 91 | if [[ $(xinput --list-props "$touchpad_id" | grep "Drag Lock Enabled (" | awk '{print $7}' | head -n1) == 1 ]]; then 92 | xinput --set-prop "$touchpad_id" "$drag_lock_code" 0 && echo "Drag lock is now disabled" || echo "Something vent wrong" 93 | else 94 | xinput --set-prop "$touchpad_id" "$drag_lock_code" 1 && echo "Drag lock is now enabled" || echo "Something vent wrong" 95 | fi 96 | 97 | } 98 | 99 | toggle_disable_while_typing() { 100 | disable_while_typing_code=$(xinput --list-props "$touchpad_id" | grep "Disable While Typing Enabled (" | awk '{print $6}' | grep -o '[0-9]\+') 101 | 102 | if [[ $(xinput --list-props "$touchpad_id" | grep "Disable While Typing Enabled (" | awk '{print $7}' | head -n1) == 1 ]]; then 103 | xinput --set-prop "$touchpad_id" "$disable_while_typing_code" 1 && echo "Touchpad is now disabled while typing" || echo "Something vent wrong" 104 | else 105 | xinput --set-prop "$touchpad_id" "$disable_while_typing_code" 0 && echo "Touchpad is now enabled while typing" || echo "Something vent wrong" 106 | fi 107 | 108 | } 109 | 110 | toggle_horizontal_scrolling() { 111 | horizontal_scrolling_code=$(xinput --list-props "$touchpad_id" | grep "Horizontal Scroll Enabled" | awk '{print $5}' | grep -o '[0-9]\+') 112 | 113 | if [[ $(xinput --list-props "$touchpad_id" | grep "Horizontal Scroll Enabled" | awk '{print $6}' | head -n1) == 1 ]]; then 114 | xinput --set-prop "$touchpad_id" "$horizontal_scrolling_code" 0 && echo "Horizontal scrolling is now disabled" || echo "Something vent wrong" 115 | else 116 | xinput --set-prop "$touchpad_id" "$horizontal_scrolling_code" 1 && echo "Horizontal scrolling is now enabled" || echo "Something vent wrong" 117 | fi 118 | 119 | } 120 | 121 | function gui() { 122 | if [ -e /usr/bin/lxinput ]; then 123 | lxinput 124 | else 125 | read -p "Lxinput is not installed. Should it be installed? (y/N)" -n 1 -r 126 | echo 127 | if [[ $REPLY =~ ^[Yy]$ ]]; then 128 | if [ -e /var/lib/pacman/db.lck ]; then 129 | echo "Pacman seems to be currently in use." 130 | else 131 | $INSTALLPKGS lxinput && lxinput &>/dev/null 132 | fi 133 | fi 134 | fi 135 | } 136 | 137 | function main() { 138 | 139 | # Define Menu entries which will be run with the echo command 140 | E0="\e[1mQ\e[0muit" 141 | E1="Set Pointer Speed" 142 | E2="Toggle Tap to Click" 143 | E3="Toggle Drag Lock" 144 | E4="Toggle Left Handed Mode" 145 | E5="Toggle Disable While Typing" 146 | E6="Toggle Natural Scrolling" 147 | E7="Toggle Horizontal Scrolling" 148 | E8="Show Xinput Manual" 149 | E9="Show Xinput Wiki Entry" 150 | E10="Run \e[1mL\e[0mxinput" # (L) 151 | 152 | while true; do 153 | 154 | printf '\33[H\33[2J' # Use this instead of the clear command 155 | 156 | echo 157 | echo -e " $BG$TC Touchpad Settings $NC" 158 | echo -e " $TC+----------------------------------------------------------------+$NC" 159 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 160 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 161 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4$TC|$NC" 162 | echo -e " $TC|$NC----------------------------------------------------------------$TC|$NC" 163 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC" 164 | echo -e " $TC|$NC $TC|$NC" 165 | echo -e " $TC|$NC $BG 6 $NC $E6 $TC|$NC" 166 | echo -e " $TC|$NC $TC|$NC" 167 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC" 168 | echo -e " $TC|$NC----------------------------------------------------------------$TC|$NC" 169 | echo -e " $TC|$NC $BG 8 $NC $E8 $TC|$NC $BG 9 $NC $E9 $TC|$NC" 170 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 171 | echo -e " $TC|$NC $BG L $NC $E10 $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $E12 $TC|$NC" 172 | echo -e " $TC+----------------------------------------------------------------+$NC" 173 | echo "" 174 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 175 | 176 | # save entered number/letter in variable "choice" 177 | read -r -n 1 -e choice 178 | 179 | # test, whether "choice" fits any of the following numbers or letters 180 | case "$choice" in 181 | 182 | 1) 183 | echo 184 | set_pointer_speed 185 | ;; 186 | 2) 187 | echo 188 | toggle_tap_to_click 189 | echo 190 | echo -e "$RED To return press ENTER $NC" 191 | read -r 192 | ;; 193 | 3) 194 | echo 195 | toggle_drag_lock 196 | echo 197 | echo -e "$RED To return press ENTER $NC" 198 | read -r 199 | ;; 200 | 4) 201 | echo 202 | toggle_left_handed 203 | echo 204 | echo -e "$RED To return press ENTER $NC" 205 | read -r 206 | ;; 207 | 5) 208 | echo 209 | toggle_disable_while_typing 210 | echo 211 | echo -e "$RED To return press ENTER $NC" 212 | read -r 213 | ;; 214 | 6) 215 | echo 216 | toggle_natural_scrolling 217 | echo 218 | echo -e "$RED To return press ENTER $NC" 219 | read -r 220 | ;; 221 | 7) 222 | echo 223 | toggle_horizontal_scrolling 224 | echo 225 | echo -e "$RED To return press ENTER $NC" 226 | read -r 227 | ;; 228 | 8) 229 | echo 230 | man xinput 231 | echo 232 | echo -e "$RED To return press ENTER $NC" 233 | read -r 234 | ;; 235 | 9) 236 | echo 237 | xdg-open https://wiki.archlinux.org/index.php/Touchpad_Synaptics 238 | echo 239 | echo -e "$RED To return press ENTER $NC" 240 | read -r 241 | ;; 242 | l | L) 243 | echo 244 | gui 245 | echo 246 | echo -e "$RED To return press ENTER $NC" 247 | read -r 248 | ;; 249 | 0 | Q | q) 250 | printf '\33[H\33[2J' && exit 251 | ;; 252 | *) # do this, if $choice variable contains anything else not offered above 253 | echo -e "$ERRORMSG" 254 | echo -e "$TRYAGAINMSG" 255 | sleep 2 256 | ;; 257 | esac 258 | done 259 | } 260 | 261 | main 262 | -------------------------------------------------------------------------------- /bin/releasecompare: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as 4 | # published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 5 | # 6 | # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 7 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 8 | # 9 | # You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software 10 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 11 | # 12 | ### 13 | # Make a new folder for the results 14 | test -d "$HOME/releasecompare" || mkdir -p "$HOME/releasecompare" && cd $HOME/releasecompare 15 | ### 16 | # Custom URL to *pkgs* 17 | _custom_URL() { 18 | printf '\33[H\33[2J' 19 | echo 20 | if [ -e $HOME/releasecompare/release-removed-uninstalled.txt ]; then # If file exists 21 | echo -e "\e[1m Do you want to remove any existing results? (Recommended) \e[0m" 22 | read -r -p "$1 ([y]es or [N]o): " 23 | case $(echo "$REPLY" | tr '[:upper:]' '[:lower:]') in 24 | y | yes) 25 | echo -e "\e[1m yes \e[0m" 26 | rm -rf $HOME/releasecompare/* 27 | 28 | echo "" 29 | echo -e "For Manjaro Releases:" 30 | echo -e "Please go to \e[7mhttps://sourceforge.net/projects/manjarolinux/files/\e[0m" 31 | echo -e "\e[1m-> Edition\e[0m \e[1m-> Release_Number\e[0m \e[1m-> *pkgs*\e[0m and copy the URL." 32 | echo "" 33 | echo -e " 1) Copy/Paste the URL to *pkgs* and press ENTER" 34 | echo -e " 0) Quit" 35 | read -s -n1 choice 36 | case "$choice" in 37 | 1) 38 | echo -e "paste the URL to *pkgs*" 39 | read -p 'URL: ' uservar 40 | 41 | # Check if "$uservar" is "sourceforge" to remove the "/download" from the URL 42 | if [ "echo "$uservar" | grep 'sourceforge'" ]; then 43 | # remove /download from URL 44 | uservar=$(echo "$uservar" | rev | cut -c10- | rev) 45 | fi 46 | 47 | wget $uservar 48 | file="echo *pkgs*" 49 | 50 | # generate list of installed packages 51 | pacman -Q >pacman.txt 52 | 53 | # final Comparison 54 | cat ${file} | cut -d' ' -f1 >comp1.txt 55 | cat pacman.txt | cut -d' ' -f1 >comp2.txt 56 | diff -u comp2.txt comp1.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee release.txt # Packages from Release which are not installed local 57 | diff -u comp1.txt comp2.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee userpkglist.txt # Packages installed by User 58 | 59 | # clean up 60 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt 61 | 62 | _userreleasepkglist 63 | printf '\33[H\33[2J' 64 | echo "" 65 | echo -e "\e[7m The Results Were Saved To: \e[0m" 66 | echo -e "\e[1m $HOME/releasecompare \e[0m" 67 | echo "" 68 | _meld 69 | ;; 70 | 71 | 0 | q) 72 | # clean up 73 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 74 | exit 75 | ;; 76 | *) 77 | echo "invalid option $REPLY" 78 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 79 | ;; 80 | esac 81 | ;; 82 | *) 83 | echo -e "\e[1m no \e[0m" 84 | echo "" 85 | echo -e "For Manjaro Releases:" 86 | echo -e "Please go to \e[7mhttps://sourceforge.net/projects/manjarolinux/files/\e[0m" 87 | echo -e "\e[1m-> Edition\e[0m \e[1m-> Release_Number\e[0m \e[1m-> *pkgs*\e[0m and copy the URL." 88 | echo "" 89 | echo -e " 1) Copy/Paste the URL to *pkgs* and press ENTER" 90 | echo -e " 0) Quit" 91 | read -s -n1 choice 92 | case "$choice" in 93 | 1) 94 | echo -e "paste the URL to *pkgs*" 95 | read -p 'URL: ' uservar 96 | 97 | # Check if "$uservar" is "sourceforge" to remove the "/download" from the URL 98 | if [ "echo "$uservar" | grep 'sourceforge'" ]; then 99 | # remove /download from URL 100 | uservar=$(echo "$uservar" | rev | cut -c10- | rev) 101 | fi 102 | 103 | wget $uservar 104 | file="echo *pkgs*" 105 | 106 | # generate list of installed packages 107 | pacman -Q >pacman.txt 108 | 109 | # final Comparison 110 | cat ${file} | cut -d' ' -f1 >comp1.txt 111 | cat pacman.txt | cut -d' ' -f1 >comp2.txt 112 | diff -u comp2.txt comp1.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee release.txt # Packages from Release which are not installed local 113 | diff -u comp1.txt comp2.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee userpkglist.txt # Packages installed by User 114 | 115 | # clean up 116 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt 117 | 118 | _userreleasepkglist 119 | printf '\33[H\33[2J' 120 | echo "" 121 | echo -e "\e[7m The Results Were Saved To: \e[0m" 122 | echo -e "\e[1m $HOME/releasecompare \e[0m" 123 | echo "" 124 | _meld 125 | #rm -rf release-removed-uninstalled.txt 126 | ;; 127 | 128 | 0 | q) 129 | # clean up 130 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 131 | exit 132 | ;; 133 | *) 134 | echo "invalid option $REPLY" 135 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 136 | ;; 137 | esac 138 | 139 | ;; 140 | esac 141 | else 142 | echo "" 143 | echo -e "For Manjaro Releases:" 144 | echo -e "Please go to \e[7mhttps://sourceforge.net/projects/manjarolinux/files/\e[0m" 145 | echo -e "\e[1m-> Edition\e[0m \e[1m-> Release_Number\e[0m \e[1m-> *pkgs*\e[0m and copy the URL." 146 | echo "" 147 | echo -e " 1) Copy/Paste the URL to *pkgs* and press ENTER" 148 | echo -e " 0) Quit" 149 | read -s -n1 choice 150 | case "$choice" in 151 | 1) 152 | echo -e "paste the URL to *pkgs*" 153 | read -p 'URL: ' uservar 154 | 155 | # Check if "$uservar" is "sourceforge" to remove the "/download" from the URL 156 | if [ "echo "$uservar" | grep 'sourceforge'" ]; then 157 | # remove /download from URL 158 | uservar=$(echo "$uservar" | rev | cut -c10- | rev) 159 | fi 160 | 161 | wget $uservar 162 | file="echo *pkgs*" 163 | 164 | # generate list of installed packages 165 | pacman -Q >pacman.txt 166 | 167 | # final Comparison 168 | cat ${file} | cut -d' ' -f1 >comp1.txt 169 | cat pacman.txt | cut -d' ' -f1 >comp2.txt 170 | diff -u comp2.txt comp1.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee release.txt # Packages from Release which are not installed local 171 | diff -u comp1.txt comp2.txt | grep -E "^\+" | sed '1d' | cut -c2- | tee userpkglist.txt # Packages installed by User 172 | 173 | # clean up 174 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt 175 | 176 | _userreleasepkglist 177 | printf '\33[H\33[2J' 178 | echo "" 179 | echo -e "\e[7m The Results Were Saved To: \e[0m" 180 | echo -e "\e[1m $HOME/releasecompare \e[0m" 181 | echo "" 182 | _meld 183 | ;; 184 | 185 | 0 | q) 186 | # clean up 187 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 188 | exit 189 | ;; 190 | *) 191 | echo "invalid option $REPLY" 192 | rm -rf *pkgs* comp1.txt comp2.txt pacman.txt index.html path.txt release.txt 193 | ;; 194 | esac 195 | fi 196 | } 197 | # Open results in Meld 198 | _meld() { 199 | if [ -e /usr/bin/meld ]; then # If file exists 200 | echo 201 | echo -e "\e[1m Do you want to view the results in Meld? \e[0m" 202 | read -r -p "$1 ([y]es or [N]o): " 203 | case $(echo "$REPLY" | tr '[:upper:]' '[:lower:]') in 204 | y | yes) 205 | echo -e "\e[1m yes \e[0m" 206 | meld release-removed-uninstalled.txt *release.txt 207 | exit 208 | ;; 209 | *) echo -e "\e[1m no \e[0m" ;; 210 | esac 211 | fi 212 | } 213 | ### 214 | # Remove Existing Comparison Results 215 | _remove_results() { 216 | echo 217 | echo -e "\e[1m Do you want to remove existing results? \e[0m" 218 | read -r -p "$1 ([y]es or [N]o): " 219 | case $(echo "$REPLY" | tr '[:upper:]' '[:lower:]') in 220 | y | yes) 221 | echo -e "\e[1m yes \e[0m" 222 | rm -rf $HOME/releasecompare/* 223 | _compare 224 | _userreleasepkglist 225 | printf '\33[H\33[2J' 226 | echo "" 227 | echo -e "\e[7m The Results Were Saved To: \e[0m" 228 | echo -e "\e[1m $HOME/releasecompare \e[0m" 229 | echo "" 230 | _meld 231 | ;; 232 | *) 233 | echo -e "\e[1m no \e[0m" 234 | _compare 235 | rm -rf release-removed-uninstalled.txt 236 | ;; 237 | esac 238 | } 239 | ### 240 | # Create Release pkglist without packages that were uninstalled by the User 241 | _userreleasepkglist() { 242 | pacman -Q >pacman.txt 243 | grep "removed" /var/log/pacman.log | awk -F '[: ]' '{print $6}' | sort >removed.txt 244 | #sort removed.txt | uniq -u | tee removed.txt 245 | file="echo *release.txt" 246 | cat ${file} >install.txt 247 | diff --suppress-common-lines removed.txt install.txt | awk -F '<' '{print $1}' | grep ">" | cut -c3- | tee release-removed-uninstalled.txt 248 | rm -rf 4.txt 5.txt 6.txt comp2.txt ergebnis.txt final.txt install.txt newdiffreverse.txt outfile.txt pacman.txt removed.txt 249 | 250 | } 251 | ### 252 | # Check if comparison files already exist in case of multiple runs with different releases 253 | _rerun_check() { 254 | printf '\33[H\33[2J' 255 | if [[ -f $(readlink -e userpkglist.txt) ]]; then 256 | echo "" 257 | echo -e "\e[7m Rerunning the script with existing comparison files \e[0m" 258 | echo -e "\e[7m will disable creating the release-removed-uninstalled.txt \e[0m" 259 | echo "" 260 | _remove_results 261 | else 262 | _compare 263 | _userreleasepkglist 264 | printf '\33[H\33[2J' 265 | echo "" 266 | echo -e "\e[7m The Results Were Saved To: \e[0m" 267 | echo -e "\e[1m $HOME/releasecompare \e[0m" 268 | echo "" 269 | _meld 270 | 271 | fi 272 | } 273 | ### 274 | # Check if local release.txt file exists for possible installation and to avoid running a new comparison which would overwrite user changes 275 | _installcheck() { 276 | printf '\33[H\33[2J' 277 | echo "" 278 | if [[ -f $(readlink -e *release.txt) ]]; then 279 | file="echo *release.txt" 280 | cat ${file} >install.txt 281 | echo "" 282 | echo -e "\e[7m A existing comparison was found! Please choose what to do! \e[0m" 283 | echo "" 284 | echo " 1) Install from *release.txt" 285 | echo " 2) Install from release-removed-uninstalled.txt" 286 | echo " 3) Install from *release.txt after a new Comparison" 287 | echo " 4) Install from release-removed-uninstalled.txt after a new Comparison" 288 | echo " 0) Quit" 289 | read -s -n1 choice 290 | case "$choice" in 291 | 1) 292 | sudo pacman -S - /dev/null | awk -F'/' '/^Exec/ {print $NF}' 280 | done 281 | else 282 | grep 'DISPLAYMANAGER=' /etc/conf.d/xdm | cut -d \" -f 2 283 | fi 284 | } 285 | 286 | function choose_session() { 287 | PS3="$PS3CHOOSESESSIONMSG" 288 | # Gather the results in an array. 289 | dms=("$(ls /usr/share/xsessions/)" "cancel") 290 | 291 | select pick in "${dms[@]}"; do 292 | case $pick in 293 | *) 294 | echo $pick 295 | break 296 | ;; 297 | cancel) 298 | STATUSVAR=1 299 | break 300 | ;; 301 | esac 302 | done 303 | } 304 | 305 | function autologger() { 306 | sudo echo "" 307 | STATUSVAR=$? 308 | if [ $STATUSVAR -eq 1 ]; then 309 | return $STATUSVAR 310 | fi 311 | dm=$(dm_detect) 312 | eval user="$(whoami)" 313 | case dm in 314 | slim) 315 | sudo sed -i '/autologin/s/^#//g' /etc/slim.conf && sudo sed -i '/defaultuser/s/^#//g' /etc/slim.conf 316 | sudo sed -i "s/simone/$user/g" /etc/slim.conf 317 | STATUSVAR=$? 318 | break 319 | ;; 320 | lightdm) 321 | sudo sed -i "s/^autologin-user=*/autologin-user=$user/g" /etc/lightdm.conf 322 | sudo sed -i 's/^autologin-user-timeout=*/autologin-user-timeout=0/g' /etc/lightdm.conf 323 | sudo groupadd -r autologin 324 | sudo gpasswd -a "$user" autologin 325 | STATUSVAR=$? 326 | sudo "$TEXTEDITOR" /etc/lightdm.conf 327 | break 328 | ;; 329 | sddm) 330 | session=$(choose_session) 331 | if [ $STATUSVAR -eq 1 ] || [ "$session" == "" ]; then 332 | return 1 333 | fi 334 | sudo sddm --example-config >/etc/sddm.conf 335 | sudo sed -i "s/^User=/User=$user/g" /etc/sddm.conf 336 | sudo sed -i "s/^Session/Session=$session/g" /etc/sddm.conf 337 | STATUSVAR=$? 338 | break 339 | ;; 340 | lxdm) 341 | sudo sed -i "1s/^/autologin=$user /" /etc/lxdm/lxdm.conf 342 | STATUSVAR=$? 343 | sudo "$TEXTEDITOR" /etc/lxdm/lxdm.conf 344 | break 345 | ;; 346 | gdm) 347 | sudo sed -i "s/^AutomaticLogin=*/AutomaticLogin=$user/g" /etc/gdm/custom.conf 348 | sudo sed -i 's/^AutomaticLoginEnable=*/AutomaticLoginEnable=true/g' /etc/gdm/custom.conf 349 | sudo sed -i 's/^TimedLoginEnable=*/TimedLoginEnable=true/g' /etc/gdm/custom.conf 350 | sudo sed -i 's/^TimedLogin=*/TimedLoginEnable=$user/g' /etc/gdm/custom.conf 351 | sudo sed -i 's/^TimedLoginDelay=*/TimedLoginDelay=0/g' /etc/gdm/custom.conf 352 | STATUSVAR=$? 353 | break 354 | ;; 355 | *) 356 | echo -e "$NOSUPPORTAUTOLOGINMSG" 357 | read -s -n1 358 | ;; 359 | esac 360 | return $STATUSVAR 361 | } 362 | 363 | function _recover() { 364 | if [ -e /usr/bin/photorec ]; then 365 | photorec 366 | else 367 | echo "Installing the testdisk recovery tool" 368 | if [ -e /var/lib/pacman/db.lck ]; then 369 | echo "Testdisk is not installed and pacman seems to be in use" 370 | else 371 | $INSTALLPKGS testdisk && testdisk 372 | fi 373 | fi 374 | } 375 | 376 | function main() { 377 | 378 | # Define Menu entries which will be run with the echo command 379 | E0="\e[1mQ\e[0muit" 380 | E1="Install Display \e[1mM\e[0manager" 381 | E2="\e[1mE\e[0mnable Autologin" 382 | E3="Install \e[1mS\e[0mhell" 383 | E4="\e[1mD\e[0misk Utility" 384 | E5="Install \e[1mP\e[0mrinter Support" 385 | E6="Recover \e[1mF\e[0miles" 386 | 387 | while true; do 388 | 389 | printf '\33[H\33[2J' # Use this instead of the clear command 390 | 391 | echo 392 | echo -e " $BG$TC Setup $NC" 393 | echo -e " $TC+----------------------------------------------------------------+$NC" 394 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 395 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 396 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 397 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 398 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 399 | echo -e " $TC+----------------------------------------------------------------+$NC" 400 | echo "" 401 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 402 | 403 | # save entered number/letter in variable "choice" 404 | read -r -n 1 -e choice 405 | 406 | # test, whether "choice" fits any of the following numbers or letters 407 | case "$choice" in 408 | 409 | 1 | m) 410 | echo 411 | displaymanager 412 | STATUSVAR=$? 413 | if [ $STATUSVAR -eq 0 ]; then 414 | echo "" 415 | echo -e "$DISPLAYMGRPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 416 | pressanykeyrequest 417 | fi 418 | echo "" 419 | ;; 420 | 2 | e) 421 | echo 422 | autologger 423 | STATUSVAR=$? 424 | if [ $STATUSVAR -eq 0 ]; then 425 | echo "" 426 | echo -e "$AUTOLOGGERRPREFIXMSG$SETSUFFIXMSG" 427 | pressanykeyrequest 428 | fi 429 | echo "" 430 | ;; 431 | 3 | s) 432 | echo 433 | shell_chooser 434 | STATUSVAR=$? 435 | if [ $STATUSVAR -eq 0 ]; then 436 | echo "" 437 | echo -e "$SHELLPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 438 | pressanykeyrequest 439 | fi 440 | echo "" 441 | ;; 442 | 4 | d) 443 | echo 444 | disk_utils 445 | echo "" 446 | ;; 447 | 5 | p) 448 | echo 449 | $INSTALLPKGS manjaro-printer sane 450 | STATUSVAR=$? 451 | if [ $STATUSVAR -eq 0 ]; then 452 | echo "" 453 | echo -e "$PRINTERSUPPORTMSG$SETSUFFIXMSG" 454 | pressanykeyrequest 455 | fi 456 | echo "" 457 | ;; 458 | 6 | f) 459 | echo 460 | _recover 461 | echo "" 462 | ;; 463 | 0 | Q | q) 464 | printf '\33[H\33[2J' && exit 465 | ;; 466 | *) # do this, if $choice variable contains anything else not offered above 467 | echo -e "$ERRORMSG" 468 | echo -e "$TRYAGAINMSG" 469 | sleep 2 470 | ;; 471 | esac 472 | done 473 | } 474 | 475 | main 476 | -------------------------------------------------------------------------------- /bin/toolbox: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Local vars 5 | DISABLEPACUI=0 6 | DISABLEMHWD=0 7 | 8 | # ======================= 9 | # Define Colors 10 | RED='\e[41m' 11 | NC='\e[0m' # No color 12 | BG='\e[7m' # Highlighting Background color 13 | TC='\e[1m' # Highlighting Text color 14 | 15 | # ======================= 16 | # Service messages section 17 | # Wrong Option 18 | ERRORMSG="$RED Wrong option $NC" 19 | TRYAGAINMSG=" Please try again..." 20 | # File Manager (Ranger) 21 | INSTALLINGRNG1MSG="Installing ranger to manage files" 22 | CLIFMNOTINSTMSG="No cli filemanager is installed and Pacman seems to be in use" 23 | # Task Manager (btop) 24 | INSTALLINGTASKMANMSG="Installing btop to manage tasks" 25 | TASKMANNOTINSTMSG="Btop is not installed and Pacman seems to be in use" 26 | # File Search (Rifle) 27 | RIFLENOTINSTMSG="Rifle is not installed and Pacman seems to be in use" 28 | # Web Browser (Links) 29 | INSTALLINGCLIBRWOSMSG="Installing links to surf the web" 30 | CLIBROWSNOTINSTMSG="No cli browser installed and Pacman seems to be in use" 31 | # PacUI 32 | INSTALLINGPACUIMSG="Installing PacUI for package management" 33 | PACUINOTINSTMSG="PacUI is not installed and Pacman seems to be in use" 34 | PACUIFAILEDINSTMSG="Failed to install PacUI" 35 | # inxi 36 | INSTALLINGINXIMSG="Installing inxi to display system information" 37 | INXINOTINSTMSG="inxi is not installed and Pacman seems to be in use" 38 | # cpupower 39 | INSTALLINGCPUPOWERMSG="Installing cpupower to display frequency-info" 40 | CPUPOWERNOTINSTMSG="cpupower is not installed and Pacman seems to be in use" 41 | # cmus 42 | INSTALLINGCMUSMSG="Installing cmus to play music" 43 | CMUSNOTINSTMSG="cmus is not installed and Pacman seems to be in use" 44 | 45 | # ======================= 46 | # Pacman installation 47 | INSTALLPKGS="sudo pacman -Syu" 48 | 49 | # ======================= 50 | # Main Menu functions 51 | # PacUI 52 | function package_manager_ui() { 53 | if [ -x "$(command -v pacui)" ]; then # If command exists 54 | pacui # Run it 55 | else 56 | echo "$INSTALLINGPACUIMSG" # Install Message 57 | if [ -e /var/lib/pacman/db.lck ]; then # If file exists 58 | echo "$PACUINOTINSTMSG" # Not installed Message 59 | else 60 | if $INSTALLPKGS pacui && pacui; then # Else install package and run it 61 | DISABLEPACUI=0 62 | echo "installed" &>/dev/null 63 | else 64 | echo -e " \e[41m Installation failed, do you want to download PacUI from source? [Y|n] \e[0m" 65 | read -r -n 1 -e answer # save user input in "answer" variable (only accept 1 character as input) 66 | 67 | case ${answer:-n} in # if ENTER is pressed, the variable "answer" is empty. if "answer" is empty, its default value is "no". 68 | y | Y) # do this, if "answer" is y or Y. 69 | 70 | PACUISOURCE=https://raw.githubusercontent.com/excalibur1234/pacui/master/pacui 71 | PACUITMPDIR=/tmp/toolbox 72 | PACUIDOWNLOAD=$(mkdir -p "$PACUITMPDIR" && wget -O "$PACUITMPDIR/pacui" "$PACUISOURCE" && chmod +x "$PACUITMPDIR/pacui") 73 | 74 | if $PACUIDOWNLOAD && sh "$PACUITMPDIR/pacui"; then 75 | DISABLEPACUI=3 76 | PACUIFROMSOURCE=1 77 | fi 78 | ;; 79 | *) # do this in all other cases 80 | DISABLEPACUI=2 81 | PACUIFAILEDINSTALL=1 82 | echo "$PACUIFAILEDINSTMSG" 83 | ;; 84 | esac # end of "case" loop 85 | fi 86 | fi 87 | fi 88 | } 89 | 90 | # File Manager 91 | function cli_filemanager() { 92 | if [ -x "$(command -v ranger)" ]; then 93 | echo -e " $RED Press $BG Q $NC$RED to return to ToolBox $NC" 94 | sleep 2 95 | ranger 96 | elif [ -x "$(command -v mc)" ]; then 97 | mc 98 | else 99 | echo "$INSTALLINGRNG1MSG" 100 | if [ -e /var/lib/pacman/db.lck ]; then 101 | echo "$CLIFMNOTINSTMSG" 102 | else 103 | $INSTALLPKGS ranger && ranger 104 | fi 105 | fi 106 | } 107 | 108 | # Web Browser 109 | function cli_browser() { 110 | if [ -x "$(command -v links)" ]; then 111 | links 112 | elif [ -x "$(command -v elinks)" ]; then 113 | elinks 114 | elif [ -x "$(command -v w3m)" ]; then 115 | w3m 116 | elif [ -x "$(command -v lynx)" ]; then 117 | lynx 118 | else 119 | echo "$INSTALLINGCLIBRWOSMSG" 120 | if [ -e /var/lib/pacman/db.lck ]; then 121 | echo "$CLIBROWSNOTINSTMSG" 122 | else 123 | $INSTALLPKGS links && links 124 | fi 125 | fi 126 | } 127 | 128 | # File Search 129 | function file_finder() { 130 | if [ -x "$(command -v rifle)" ]; then 131 | rifle "$(find -type f | fzf -e --reverse --prompt="Enter string > " --header="ESC to quit. ")" 132 | else 133 | echo "$INSTALLINGRNG1MSG" 134 | if [ -e /var/lib/pacman/db.lck ]; then 135 | echo "$RIFLENOTINSTMSG" 136 | else 137 | $INSTALLPKGS ranger && rifle "$(find -type f | fzf -e --reverse --prompt="Enter string > " --header="ESC to quit. ")" 138 | fi 139 | fi 140 | } 141 | 142 | # Taskmanager 143 | function taskmanager() { 144 | if [ -x "$(command -v btop)" ]; then 145 | btop 146 | else 147 | echo "$INSTALLINGTASKMANMSG" 148 | if [ -e /var/lib/pacman/db.lck ]; then 149 | echo "$TASKMANNOTINSTMSG" 150 | else 151 | $INSTALLPKGS btop && btop 152 | fi 153 | fi 154 | } 155 | 156 | # System Information 157 | function sysinfo() { 158 | if [ -x "$(command -v inxi)" ]; then 159 | cd "$HOME" || exit 160 | sudo inxi -v8 | tee "$HOME/.inxi.txt" &>/dev/null 161 | printf '\33[H\33[2J' 162 | fzf <"$HOME/.inxi.txt" -i --multi --reverse --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " --no-unicode 163 | rm -rf "$HOME/.inxi.txt" 164 | else 165 | echo "$INSTALLINGINXIMSG" 166 | if [ -e /var/lib/pacman/db.lck ]; then 167 | echo "$INXINOTINSTMSG" 168 | else 169 | $INSTALLPKGS inxi && inxi -v8 | fzf -i --multi --reverse --info=inline --prompt="Enter string > " --header="TAB key to (un)select. ENTER to view selection. ESC to quit. " --no-unicode 170 | fi 171 | fi 172 | } 173 | 174 | # Cpupower frequency-info 175 | function freqinfo() { 176 | if [ -x "$(command -v cpupower)" ]; then 177 | sudo cpupower frequency-info 178 | echo 179 | echo -e " $RED Displaying frequency-info. To return to ToolBox press ENTER $NC" 180 | read -r 181 | else 182 | echo "$INSTALLINGCPUPOWERMSG" 183 | if [ -e /var/lib/pacman/db.lck ]; then 184 | echo "$CPUPOWERNOTINSTMSG" 185 | else 186 | $INSTALLPKGS cpupower && sudo cpupower frequency-info 187 | echo 188 | echo -e " $RED Displaying frequency-info. To return to ToolBox press ENTER $NC" 189 | read -r 190 | fi 191 | fi 192 | } 193 | 194 | # Music Player 195 | function music() { 196 | cd "$HOME" || exit 197 | if [ -x "$(command -v cmus)" ]; then 198 | echo -e " $RED Press $BG 1-7 $NC$RED to navigate and $BG Q $NC$RED to return to ToolBox $NC" 199 | sleep 3 200 | cmus 201 | else 202 | echo "$INSTALLINGCMUSMSG" 203 | if [ -e /var/lib/pacman/db.lck ]; then 204 | echo "$CMUSNOTINSTMSG" 205 | else 206 | $INSTALLPKGS cmus && cmus 207 | fi 208 | fi 209 | } 210 | 211 | # Check if a website is up via "ping" 212 | function isitup() { 213 | echo -e "Please type in the URL and press ENTER" 214 | echo -e "For example: \e[7mforum.manjaro.org\e[0m" 215 | read -p 'URL: ' uservar 216 | echo "" 217 | if ping -c1 -W1 "$uservar" &>/dev/null; then 218 | echo -e " Yay\e[1m $uservar \e[0mis up!" 219 | else 220 | echo -e " Oh no\e[1m $uservar \e[0mseems to be down!" 221 | fi 222 | echo "" 223 | } 224 | 225 | # Random Funny Message 226 | function randArrayElement() { 227 | arr=(" $RED Nice $BG Try $NC" " $RED Nope! $NC" " $RED Challange $BG Accepted $NC" " $RED Ha $BG Ha! $NC" " $RED You $BG Funny $NC" " $RED Really? $NC" " $RED I Love $BG FOSS $NC" " $RED You're the $BG Boss $NC" "$BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC") 228 | echo -e "${arr["$((RANDOM % ${#arr[@]}))"]}" 229 | } 230 | 231 | # Main UI code is below 232 | function main() { 233 | 234 | # Define Menu entries which will be run with the echo command 235 | E0="\e[1mQ\e[0muit" 236 | E1="\e[1mP\e[0mackage manager UI" 237 | E2="System \e[1mI\e[0mnformation" 238 | E3="\e[1mH\e[0mardware & Drivers" 239 | E4="System & Settings" 240 | E5="\e[1mF\e[0mile Manager" 241 | E6="File \e[1mS\e[0mearch" 242 | E7="Fast File Compression" 243 | E8="CLI Trans\e[1ml\e[0mator" 244 | E9="\e[1mW\e[0meb Browser" 245 | E10="\e[1mT\e[0mask Manager" 246 | E11="\e[1mC\e[0mpu Frequency Info" 247 | E12="System \e[1mD\e[0miagnosis" 248 | E13="Website Status Check" 249 | E14="\e[1mM\e[0music Player" 250 | 251 | # Run infinite loop for UI / menu, till the user quits using the "quit" option or CTRL+C. 252 | while true; do 253 | 254 | printf '\33[H\33[2J' # Use this instead of the clear command 255 | 256 | # Check if Pacui is installed for a different text 257 | if ! [ -x "$(command -v pacui)" ] && [ "$PACUIFAILEDINSTALL" == "1" ]; then 258 | DISABLEPACUI=2 259 | else 260 | if [ "$PACUIFROMSOURCE" == "1" ]; then 261 | DISABLEPACUI=3 262 | else 263 | if ! [ -x "$(command -v pacui)" ]; then 264 | DISABLEPACUI=1 265 | fi 266 | fi 267 | fi 268 | 269 | # Check if "mhwd" is installed for a different text 270 | if ! [ -x "$(command -v mhwd)" ]; then 271 | DISABLEMHWD=1 272 | fi 273 | 274 | echo 275 | echo -e " $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC" 276 | echo -e " $TC+----------------------------------------------------------------+$NC" 277 | #echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 278 | [[ "$DISABLEPACUI" == "0" ]] && echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 279 | [[ "$DISABLEPACUI" == "1" ]] && echo -e " $TC|$NC $BG 1 $NC [PacUI] (Not Installed) $TC|$NC $BG 2 $NC $E2 $TC|$NC" 280 | [[ "$DISABLEPACUI" == "2" ]] && echo -e " $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $TC|$NC $BG 2 $NC $E2 $TC|$NC" 281 | [[ "$DISABLEPACUI" == "3" ]] && echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 282 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 283 | [[ "$DISABLEMHWD" == "0" ]] && echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 284 | [[ "$DISABLEMHWD" == "1" ]] && echo -e " $TC|$NC $BG 3 $NC [mhwd] (Not Installed) $TC|$NC $BG 4 $NC $E4 $TC|$NC" 285 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 286 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 287 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 288 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 289 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 290 | echo -e " $TC|$NC $BG 9 $NC $E9 $TC |$NC $BG T $NC $E10 $TC|$NC" 291 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 292 | echo -e " $TC|$NC $BG C $NC $E11 $TC|$NC $BG D $NC $E12 $TC|$NC" 293 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 294 | echo -e " $TC|$NC $BG U $NC $E13 $TC|$NC $BG M $NC $E14 $TC|$NC" 295 | echo -e " $TC+----------------------------------------------------------------+$NC" 296 | echo "" 297 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 298 | 299 | # save entered number/letter in variable "choice" 300 | read -r -n 1 -e choice 301 | 302 | # test, whether "choice" fits any of the following numbers or letters 303 | case "$choice" in 304 | 305 | 1 | P | p) 306 | [[ "$DISABLEPACUI" == "0" ]] && package_manager_ui 307 | [[ "$DISABLEPACUI" == "1" ]] && package_manager_ui 308 | [[ "$DISABLEPACUI" == "3" ]] && sh "$PACUITMPDIR/pacui" 309 | ;; 310 | 2 | I | i) 311 | printf '\33[H\33[2J' 312 | sysinfo 313 | echo 314 | echo -e " $RED Displaying System Information. To return to ToolBox press ENTER $NC" 315 | # wait for input, e.g. by pressing ENTER: 316 | read -r 317 | ;; 318 | 3 | H | h) 319 | [[ "$DISABLEMHWD" == "0" ]] && mhwd-tui 320 | ;; 321 | 4) 322 | system-menu 323 | ;; 324 | 5 | F | f) 325 | printf '\33[H\33[2J' 326 | cli_filemanager 327 | ;; 328 | 6 | S | s) 329 | cd || exit 330 | file_finder 331 | echo 332 | ;; 333 | 7) 334 | printf '\33[H\33[2J' 335 | fastcompress-tui 336 | echo 337 | ;; 338 | 8 | L | l) 339 | printf '\33[H\33[2J' 340 | gawk -f <(curl -Ls git.io/translate) -- -shell 341 | ;; 342 | 9 | W | w) 343 | printf '\33[H\33[2J' 344 | cli_browser 345 | echo 346 | echo -e " $RED Displaying Web Browser. To return to ToolBox press ENTER $NC" 347 | # wait for input, e.g. by pressing ENTER: 348 | read -r 349 | ;; 350 | T | t) 351 | printf '\33[H\33[2J' 352 | taskmanager 353 | ;; 354 | C | c) 355 | printf '\33[H\33[2J' 356 | freqinfo 357 | ;; 358 | D | d) 359 | diagnosis-menu 360 | ;; 361 | U | u) 362 | printf '\33[H\33[2J' 363 | isitup 364 | echo 365 | echo -e " $RED Displaying Website Status Check. To return to ToolBox press ENTER $NC" 366 | read -r 367 | ;; 368 | M | m) 369 | printf '\33[H\33[2J' 370 | music 371 | ;; 372 | +) 373 | printf '\33[H\33[2J' 374 | randArrayElement "ARRAYISO[@]" 375 | sleep 1 376 | ;; 377 | 0 | Q | q) 378 | [[ "$PACUIFROMSOURCE" == "1" ]] && rm -rf "$PACUITMPDIR" &>/dev/null 379 | printf '\33[H\33[2J' && exit 380 | ;; 381 | *) # do this, if $choice variable contains anything else not offered above 382 | echo -e "$ERRORMSG" 383 | echo -e "$TRYAGAINMSG" 384 | sleep 2 385 | ;; 386 | 387 | esac # close case-loop 388 | 389 | done 390 | # close while-loop 391 | } 392 | main 393 | -------------------------------------------------------------------------------- /bin/appearance-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ======================= 4 | # Define Colors 5 | RED='\e[41m' 6 | NC='\e[0m' # No color 7 | BG='\e[7m' # Highlighting Background color 8 | TC='\e[1m' # Highlighting Text color 9 | 10 | MINFONTSIZE=6 11 | MAXFONTSIZE=72 12 | STATUSVAR=1 13 | CANCELSTATUS=0 14 | SELECTEDITEM="" 15 | TEXTEDITOR=$EDITOR 16 | 17 | # Service messages section 18 | # Wrong Option 19 | ERRORMSG="$RED Wrong option $NC" 20 | TRYAGAINMSG=" Please try again..." 21 | # 22 | CONTINMSG="$RED To return press ENTER $NC" 23 | CURRENTPREFIXMSG="(current: " 24 | CURRENTSUFFIXMSG="):" 25 | AVAILABLETHEMESMSG="Available themes " 26 | PS31MSG="Choose new gtk2 theme:" 27 | PS32MSG="Choose new gtk3 theme:" 28 | PS33MSG="Choose new icon theme:" 29 | PS34MSG="Choose new pointer theme:" 30 | SETTINGGTK2THEMEMSG='Setting theme to %s' 31 | SETTINGGTK3THEMEMSG='Setting theme to %s' 32 | SETTINGICONTHEMEMSG='Setting theme to %s' 33 | SETTINGPOINTERTHMSG='Setting theme to %s' 34 | GTK2THEMEPREFIXMSG="GTK2 theme " 35 | GTK3THEMEPREFIXMSG="GTK3 theme " 36 | ICONTHEMEPREFIXMSG="Icon theme " 37 | POINTERTHPREFIXMSG="Pointer theme " 38 | FONTSETPREFIXMSG="Font " 39 | FONTSIZESETMSG=" with size " 40 | FONTSIZEERRMSG="$RED Value is out of range$NC" 41 | SELECTEDFONTMSG="Selected font is: " 42 | INPUTFONTSIZEMSG="Input font size value in range from $MINFONTSIZE to $MAXFONTSIZE or just press Escape to discard changes" 43 | SELECTFONTSIZEMSG="Select font size value " 44 | CHOOSEFONTPROMPTMSG="Choose new font to use " 45 | SETSUFFIXMSG=" was set successfully" 46 | TOGGLEDARKTHEMEMSG="Done" 47 | 48 | if ! [ -f "$HOME/.gtkrc-2.0" ]; then 49 | cat >$HOME/.gtkrc-2.0 <$HOME/.config/gtk-3.0/settings.ini <$HOME/.icons/default/index.theme </dev/null | grep "\"$font_family" | grep -o "pixelsize=[0-9][0-9]*" | grep -o "[0-9][0-9]*") 327 | if [ "$fccatmsggrep" != "" ]; then 328 | numberstring=$(echo "$fccatmsggrep" | sort -n | uniq | fzf -e --reverse --prompt="< $SELECTFONTSIZEMSG$CURRENTPREFIXMSG$CURRENTITEM$CURRENTSUFFIXMSG >") 329 | if [ "$numberstring" == "" ]; then 330 | number=0 331 | return 1 332 | else 333 | number=$(expr $numberstring + 0) 334 | return 0 335 | fi 336 | else 337 | echo -e "$INPUTFONTSIZEMSG$CURRENTPREFIXMSG$CURRENTITEM$CURRENTSUFFIXMSG" 338 | manualnumberinput 339 | checkfontsize $number 340 | STATUSVAR=$? 341 | if [ $STATUSVAR -eq 1 ]; then 342 | echo "" 343 | echo -e "$ERRORMSG$FONTSIZEERRMSG" 344 | pressanykeyrequest 345 | return 1 346 | fi 347 | return 0 348 | fi 349 | } 350 | 351 | function manualnumberinput() { 352 | while true; do 353 | read -s -n 1 schar 354 | case $schar in 355 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0) 356 | numberstring+=$schar 357 | echo -n "$schar" 358 | ;; 359 | $'\000') #Enter 360 | break 361 | ;; 362 | $'\177') #Backspace 363 | numberstring="${numberstring%?}" 364 | echo -n -e "\b" 365 | echo -n " " 366 | echo -n -e "\b" 367 | ;; 368 | $'\e') #Escape 369 | numberstring="0" 370 | break 371 | ;; 372 | esac 373 | done 374 | number=$(expr $numberstring + 0) 375 | return 0 376 | } 377 | 378 | function checkfontsize() { 379 | value="$@" 380 | if [ $value -lt $MINFONTSIZE ] || [ $value -gt $MAXFONTSIZE ]; then 381 | return 1 382 | else 383 | return 0 384 | fi 385 | 386 | } 387 | 388 | function set_font() { 389 | new_theme="$@" 390 | cp $HOME/.config/gtk-3.0/settings.ini $HOME/.config/gtk-3.0/settings.ini.bak && sed -i "s/$(grep "gtk-font-name" $HOME/.config/gtk-3.0/settings.ini)/gtk-font-name=$new_theme/g" $HOME/.config/gtk-3.0/settings.ini 391 | cp $HOME/.gtkrc-2.0 $HOME/.gtkrc-2.0.bak && sed -i "s/$(grep "gtk-font-name" $HOME/.gtkrc-2.0)/gtk-font-name=\"$new_theme\"/g" $HOME/.gtkrc-2.0 392 | STATUSVAR=$? 393 | return $STATUSVAR 394 | } 395 | 396 | function choose_font() { 397 | new_font="" 398 | font_size=0 399 | CURRENTITEM=$(current_item_get "gtkfontname") 400 | SELECTEDITEM=$(fc-list : family | tr , \\n | sort | uniq | fzf -e --reverse --prompt="< $CHOOSEFONTPROMPTMSG$CURRENTPREFIXMSG$CURRENTITEM$CURRENTSUFFIXMSG >") 401 | if [ "$SELECTEDITEM" != "" ]; then 402 | new_font="$SELECTEDITEM" 403 | echo -e "$SELECTEDFONTMSG$SELECTEDITEM" 404 | numberinputprocedure 405 | STATUSVAR=$? 406 | if [ $STATUSVAR -eq 1 ]; then 407 | return $STATUSVAR 408 | else 409 | font_size=$number 410 | set_font $new_font $font_size 411 | return $STATUSVAR 412 | fi 413 | fi 414 | STATUSVAR=1 415 | return $STATUSVAR 416 | } 417 | 418 | function toggle_dark_theme() { 419 | grep -q "gtk-application-prefer-dark-theme=" $HOME/.config/gtk-3.0/settings.ini || echo "gtk-application-prefer-dark-theme=1" >>$HOME/.config/gtk-3.0/settings.ini 420 | STATUSVAR=$? 421 | case $(awk -F= '/gtk-application-prefer-dark-theme/{print $2}' $HOME/.config/gtk-3.0/settings.ini) in 422 | true) 423 | sed -i "s/gtk-application-prefer-dark-theme=true/gtk-application-prefer-dark-theme=false/g" $HOME/.config/gtk-3.0/settings.ini 424 | ;; 425 | false) 426 | sed -i "s/gtk-application-prefer-dark-theme=false/gtk-application-prefer-dark-theme=true/g" $HOME/.config/gtk-3.0/settings.ini 427 | ;; 428 | 1) 429 | sed -i "s/gtk-application-prefer-dark-theme=1/gtk-application-prefer-dark-theme=0/g" $HOME/.config/gtk-3.0/settings.ini 430 | ;; 431 | 0) 432 | sed -i "s/gtk-application-prefer-dark-theme=0/gtk-application-prefer-dark-theme=1/g" $HOME/.config/gtk-3.0/settings.ini 433 | ;; 434 | esac 435 | STATUSVAR+=$? 436 | return $STATUSVAR 437 | } 438 | 439 | function main() { 440 | 441 | # Define Menu entries which will be run with the echo command 442 | E0="\e[1mQ\e[0muit" 443 | E1="Set GTK2 Theme" 444 | E2="Set GTK3 Theme" 445 | E3="Set Font" 446 | E4="Set Icon Theme" 447 | E5="Toggle Dark Theme" 448 | E6="Set Pointer Theme" 449 | E7="Edit GTK2 Settings" 450 | E8="Edit GTK3 Settings" 451 | E9="Edit Xresources" 452 | 453 | while true; do 454 | printf '\33[H\33[2J' # Use this instead of the clear command 455 | 456 | echo 457 | echo -e " $BG$TC Appearance $NC" 458 | echo -e " $TC+----------------------------------------------------------------+$NC" 459 | echo -e " $TC|$NC $BG 1 $NC $E1 $TC|$NC $BG 2 $NC $E2 $TC|$NC" 460 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 461 | echo -e " $TC|$NC $BG 3 $NC $E3 $TC|$NC $BG 4 $NC $E4 $TC|$NC" 462 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 463 | echo -e " $TC|$NC $BG 5 $NC $E5 $TC|$NC $BG 6 $NC $E6 $TC|$NC" 464 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 465 | echo -e " $TC|$NC $BG 7 $NC $E7 $NC $TC|$NC $BG 8 $NC $E8 $TC|$NC" 466 | echo -e " $TC|$NC--------------------------------$TC|$NC-------------------------------$TC|$NC" 467 | echo -e " $TC|$NC $BG 9 $NC $E9 $TC|$NC $BG$TC T $NC$BG$TC O $NC$BG$TC O $NC$BG$TC L $NC $BG B $NC $BG O $NC $BG X $NC $TC|$NC" 468 | echo -e " $TC+----------------------------------------------------------------+$NC" 469 | echo "" 470 | echo -e " Enter marked number or letter - $BG 0 $NC $E0 " 471 | 472 | # save entered number/letter in variable "choice" 473 | read -r -n 1 -e choice 474 | 475 | # test, whether "choice" fits any of the following numbers or letters 476 | case "$choice" in 477 | 1) 478 | echo 479 | choose_gtk2_theme 480 | STATUSVAR=$? 481 | if [ $STATUSVAR -eq 0 ]; then 482 | echo "" 483 | echo -e "$GTK2THEMEPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 484 | pressanykeyrequest 485 | fi 486 | ;; 487 | 2) 488 | echo 489 | choose_gtk3_theme 490 | STATUSVAR=$? 491 | if [ $STATUSVAR -eq 0 ]; then 492 | echo "" 493 | echo -e "$GTK3THEMEPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 494 | pressanykeyrequest 495 | fi 496 | ;; 497 | 3) 498 | echo 499 | choose_font 500 | STATUSVAR=$? 501 | if [ $STATUSVAR -eq 0 ]; then 502 | echo "" 503 | echo -e "$FONTSETPREFIXMSG$SELECTEDITEM$FONTSIZESETMSG$font_size$SETSUFFIXMSG" 504 | pressanykeyrequest 505 | fi 506 | ;; 507 | 4) 508 | echo 509 | choose_icon_theme 510 | STATUSVAR=$? 511 | if [ $STATUSVAR -eq 0 ]; then 512 | echo "" 513 | echo -e "$ICONTHEMEPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 514 | pressanykeyrequest 515 | fi 516 | ;; 517 | 5) 518 | echo 519 | toggle_dark_theme 520 | STATUSVAR=$? 521 | if [ $STATUSVAR -eq 0 ]; then 522 | echo "" 523 | echo -e "$TOGGLEDARKTHEMEMSG" 524 | pressanykeyrequest 525 | fi 526 | ;; 527 | 6) 528 | echo 529 | choose_pointer_theme 530 | STATUSVAR=$? 531 | if [ $STATUSVAR -eq 0 ]; then 532 | echo "" 533 | echo -e "$POINTERTHPREFIXMSG$SELECTEDITEM$SETSUFFIXMSG" 534 | pressanykeyrequest 535 | fi 536 | ;; 537 | 7) 538 | echo 539 | $TEXTEDITOR $HOME/.gtkrc-2.0 540 | echo "" 541 | ;; 542 | 8) 543 | echo 544 | $TEXTEDITOR $HOME/.config/gtk-3.0/settings.ini 545 | echo "" 546 | ;; 547 | 9) 548 | echo 549 | $TEXTEDITOR $HOME/.Xresources 550 | echo "" 551 | ;; 552 | 0 | Q | q) 553 | printf '\33[H\33[2J' && exit 554 | ;; 555 | *) 556 | echo -e "$ERRORMSG" 557 | echo -e "$TRYAGAINMSG" 558 | sleep 2 559 | ;; 560 | esac 561 | done 562 | } 563 | 564 | main 565 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------