Skip to content

Instantly share code, notes, and snippets.

@sugamkarki
Last active December 19, 2024 16:44
Show Gist options
  • Save sugamkarki/96448ce6e047667e30ff475646f53e83 to your computer and use it in GitHub Desktop.
Save sugamkarki/96448ce6e047667e30ff475646f53e83 to your computer and use it in GitHub Desktop.
arch-install
# install yay
sudo pacman -S --needed git base-devel --noconfirm
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
# install brave browser
yay -S brave-bin
# install google-chrome
yay -S google-chrome
# install fish
sudo pacman -Syu fish
chsh -l
chsh -s /usr/bin/fish
# fix nvidia graphics issue
sudo pacman -S xorg-xrandr
sudo vi /usr/share/sddm/scripts/Xsetup
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
Step 1: Install redshift
redshift is a tool designed to adjust the color temperature of your screen based on time and location.
bash
Copy code
sudo pacman -S redshift
Step 2: Configure redshift
Create a configuration file for redshift. For instance, create ~/.config/redshift.conf:
ini
Copy code
[redshift]
temp-day=5500 # Softer filter for daytime
temp-night=3000 # Stronger filter for nighttime
transition=1
[manual]
lat=your-latitude
lon=your-longitude
Replace your-latitude and your-longitude with your geographical location. You can find these values online.
Step 3: Create Scripts
Daytime Filter Script
Create a script day_filter.sh:
bash
Copy code
#!/bin/bash
redshift -x # Reset any existing adjustments
redshift -O 5500
Nighttime Filter Script
Create a script night_filter.sh:
bash
Copy code
#!/bin/bash
redshift -x # Reset any existing adjustments
redshift -O 3000
Make both scripts executable:
bash
Copy code
chmod +x day_filter.sh night_filter.sh
chmod +x night_filter.sh
Step 4: Automate Using Cron or Systemd Timer
Option 1: Cron
Edit your crontab:
bash
Copy code
crontab -e
Add the following lines:
bash
Copy code
# Run daytime filter at 7 AM
0 7 * * * /path/to/day_filter.sh
# Run nighttime filter at 7 PM
0 19 * * * /path/to/night_filter.sh
Option 2: Systemd Timer
Create a service for daytime:
/etc/systemd/system/day_filter.service
ini
Copy code
[Unit]
Description=Apply daytime filter
[Service]
ExecStart=/path/to/day_filter.sh
/etc/systemd/system/night_filter.service
ini
Copy code
[Unit]
Description=Apply nighttime filter
[Service]
ExecStart=/path/to/night_filter.sh
Create timers: /etc/systemd/system/day_filter.timer
ini
Copy code
[Unit]
Description=Run daytime filter at 7 AM
[Timer]
OnCalendar=07:00
Persistent=true
[Install]
WantedBy=timers.target
/etc/systemd/system/night_filter.timer
ini
Copy code
[Unit]
Description=Run nighttime filter at 7 PM
[Timer]
OnCalendar=19:00
Persistent=true
[Install]
WantedBy=timers.target
Enable and start the timers:
bash
Copy code
sudo systemctl enable --now day_filter.timer
sudo systemctl enable --now night_filter.timer
Additional Notes:
Manual Adjustment: If you ever need to tweak it manually, you can run:
bash
Copy code
redshift -O [temperature]
Replace [temperature] with your desired value (e.g., 4000).
Integration: For finer control, you can integrate the scripts into KDE's global shortcuts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment