Fix autostart

This commit is contained in:
Digital Studium 2024-03-02 13:22:30 +00:00
parent 1c5ac00543
commit 41d2bc2a31
3 changed files with 83 additions and 35 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
# ubuntu hangs if network interface is not optional # ubuntu hangs if network interface is not optional
sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config-wifi.yaml sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config-wifi.yaml
sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config.yaml sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config.yaml
@ -23,11 +23,14 @@ libxinerama-dev `# for compiling dwm` \
libharfbuzz-dev `# for compiling st` \ libharfbuzz-dev `# for compiling st` \
suckless-tools `# for dmenu` \ suckless-tools `# for dmenu` \
ncdu `# for disk usage analysys` \ ncdu `# for disk usage analysys` \
brightnessctl `# for keyboard backlight` \
xcompmgr `# for st opacity` \
telegram-desktop \ telegram-desktop \
slack \ slack \
xfe `# classic file manager` \ xfe `# classic file manager` \
surf `# suckless browser` \ surf `# suckless browser` \
firefox firefox \
python3
@ -41,27 +44,40 @@ then
git clone https://git.digitalstudium.com/digitalstudium/ubuntu-gui ~/gui git clone https://git.digitalstudium.com/digitalstudium/ubuntu-gui ~/gui
fi fi
# compiling dwm for tool in dwm st sent
if ! command -v dwm &> /dev/null do
then # compiling dwm
cd ~/gui/dwm if ! command -v $tool &> /dev/null
then
cd ~/gui/$tool
sudo make install clean sudo make install clean
cd - cd -
echo dwm > ~/.xinitrc # for starting dwm when startx fi
fi done
# compiling st echo dwm > ~/.xinitrc # for starting dwm when startx
if ! command -v st &> /dev/null
then
cd ~/gui/st
sudo make install clean
cd -
fi
# compiling sent for tool in create_systemd_service.py create_systemd_timer.py set_brightness.sh update_gui.sh
if ! command -v sent &> /dev/null do
if ! command -v $tool &> /dev/null
then
sudo cp $tool /usr/local/bin
fi
done
git config --global user.name "Digital Studium"
git config --global user.email "digitalstudium001@gmail.com"
sudo create_systemd_service.py gui-updater /usr/local/bin/update_gui.sh
sudo create_systemd_timer.py gui-updater '*-*-* *:*:*'
if [ ! -d ~/.dwm ]
then then
cd ~/gui/sent mkdir $HOME/.dwm
sudo make install clean
cd -
fi fi
echo "firefox &" > $HOME/.dwm/autostart.sh
echo "xcompmgr &" >> $HOME/.dwm/autostart.sh
echo "telegram-desktop &" >> $HOME/.dwm/autostart.sh
echo "st &" >> $HOME/.dwm/autostart.sh
echo "DISPLAY=:0 xhost +local:" >> $HOME/.dwm/autostart.sh # give permissions to display
chmod +x $HOME/.dwm/autostart.sh

23
set_brightness.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
H=$(date +%k)
if (( $H >= 0 && $H <= 7 )); then
/usr/bin/xrandr --output eDP --brightness .2
sudo /usr/bin/brightnessctl --device='asus::kbd_backlight' set 3
elif (( $H > 7 && $H <= 10 )); then
/usr/bin/xrandr --output eDP --brightness .5
sudo /usr/bin/brightnessctl --device='asus::kbd_backlight' set 1
elif (( $H > 10 && $H <= 19 )); then
/usr/bin/xrandr --output eDP --brightness .7
sudo /usr/bin/brightnessctl --device='asus::kbd_backlight' set 0
elif (( $H > 19 && $H <= 22 )); then
/usr/bin/xrandr --output eDP --brightness .5
sudo /usr/bin/brightnessctl --device='asus::kbd_backlight' set 1
elif (( $H > 22 && $H <= 23 )); then
/usr/bin/xrandr --output eDP --brightness .3
sudo /usr/bin/brightnessctl --device='asus::kbd_backlight' set 2
else
echo "Error"
fi

9
update_gui.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
export DISPLAY=:0
set_brightness.sh # set monitor brightness
battery_capacity=$(cat /sys/class/power_supply/BAT0/capacity)
MEM=$(free -h --kilo | awk '/^Mem:/ {print $3 "/" $2}')
CPU=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}' )
DISK=$(df -Ph | grep "/dev/mapper/ubuntu--vg-ubuntu--lv" | awk {'print $5'})
/usr/bin/xsetroot -name "$battery_capacity% `date +"%a %d.%m %H:%M"`; $MEM$CPU%  $DISK" # set systray