Move deprecated scripts to deprecated/
This commit is contained in:
17
deprecated/comingback.sh
Executable file
17
deprecated/comingback.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Ferit Yigit BALABAN <fyb@duck.com>, 2022
|
||||
#
|
||||
|
||||
# Step 1: Revert status from default location
|
||||
screen=$(cat $HOME/.config/navi/screen)
|
||||
kbdlgt=$(cat $HOME/.config/navi/kbdlgt)
|
||||
brightnessctl set $screen
|
||||
brightnessctl set --device asus::kbd_backlight $kbdlgt
|
||||
|
||||
# Step 2: Set mouse light to breathing colors
|
||||
rivalcfg --color=#FF66F5 --light-effect=breath
|
||||
|
||||
# Step 3: Write log message
|
||||
dt=$(date +'%d/%m/%y-%H.%M.%S')
|
||||
echo "[$dt] navi was unlocked. fyb's back!" >> $HOME/navi.log
|
||||
4
deprecated/fetchdark.theme
Normal file
4
deprecated/fetchdark.theme
Normal file
@@ -0,0 +1,4 @@
|
||||
#75FDFF
|
||||
#FFE252
|
||||
#D66565
|
||||
#FFAB3D
|
||||
4
deprecated/fetchlight.theme
Normal file
4
deprecated/fetchlight.theme
Normal file
@@ -0,0 +1,4 @@
|
||||
#00348A
|
||||
#FF0000
|
||||
#FF0055
|
||||
#FF0055
|
||||
154
deprecated/fetchpy
Executable file
154
deprecated/fetchpy
Executable file
@@ -0,0 +1,154 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Ferit Yiğit BALABAN <fyb@duck.com>, 2022
|
||||
#
|
||||
# fetchpy, fetch script alternative to neofetch
|
||||
import os
|
||||
from subprocess import run
|
||||
from rich.console import Console
|
||||
from rich.traceback import install
|
||||
install(show_locals=True)
|
||||
|
||||
|
||||
COLOR1 = '#75FDFF'
|
||||
COLOR2 = '#FFE252'
|
||||
COLOR3 = '#D66565'
|
||||
COLOR4 = '#FFAB3D'
|
||||
|
||||
|
||||
def read_theme():
|
||||
with open('/home/ferit/scripts/fetch.theme', 'r') as f:
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
global COLOR1
|
||||
global COLOR2
|
||||
global COLOR3
|
||||
global COLOR4
|
||||
COLOR1 = l[0]
|
||||
COLOR2 = l[1]
|
||||
COLOR3 = l[2]
|
||||
COLOR4 = l[3]
|
||||
|
||||
|
||||
def coloring(text):
|
||||
frame = COLOR2
|
||||
info = COLOR3
|
||||
title = COLOR1
|
||||
color_dictionary = {
|
||||
'╭': frame,
|
||||
'╰': frame,
|
||||
'╯': frame,
|
||||
'─': frame,
|
||||
'╮': frame,
|
||||
'┤': frame,
|
||||
'│': frame,
|
||||
'├': frame,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'': info,
|
||||
'─ferit@navi': title,
|
||||
'Hardware': title,
|
||||
}
|
||||
c = Console()
|
||||
iterator = 0
|
||||
while iterator < len(text):
|
||||
character = text[iterator]
|
||||
peekable = iterator < len(text) - 1
|
||||
peek = text[iterator + 1] if peekable else ' '
|
||||
|
||||
if character == ' ':
|
||||
if peekable and peek != ' ' and not color_dictionary.__contains__(peek):
|
||||
print(' ', end='')
|
||||
word, jump_to = read_until_space(text, start_at=iterator + 1)
|
||||
if color_dictionary.__contains__(word):
|
||||
if '\\' in word:
|
||||
word_style = color_dictionary[word]
|
||||
for character in word:
|
||||
c.print(character, style=word_style, end='')
|
||||
else:
|
||||
c.print(f'[{color_dictionary[word]}]{word}[/{color_dictionary[word]}]', end='')
|
||||
else:
|
||||
print(word, end='')
|
||||
iterator = jump_to
|
||||
print(' ', end='')
|
||||
elif color_dictionary.__contains__(character):
|
||||
if character == '\\':
|
||||
c.print(character, style=color_dictionary[character], end='')
|
||||
else:
|
||||
c.print(f'[{color_dictionary[character]}]{character}[/{color_dictionary[character]}]', end='')
|
||||
else:
|
||||
print(character, end='')
|
||||
iterator += 1
|
||||
print('')
|
||||
|
||||
|
||||
def read_until_space(text, start_at):
|
||||
buffer = ''
|
||||
iterator = start_at
|
||||
while text[iterator] != ' ':
|
||||
buffer += text[iterator]
|
||||
iterator += 1
|
||||
next_space_at = iterator
|
||||
return buffer, next_space_at
|
||||
|
||||
|
||||
def main():
|
||||
read_theme()
|
||||
padding_count = 23
|
||||
|
||||
distro_name = 'Arch GNU/Linux'
|
||||
distro_name = distro_name.ljust(padding_count, ' ')
|
||||
|
||||
kernel_version = str(os.uname().release)
|
||||
kernel_version = kernel_version.ljust(padding_count, ' ')
|
||||
|
||||
installed_packages = run(['pacman', '-Q'], text=True, capture_output=True).stdout.splitlines()
|
||||
shell_name = 'fish'
|
||||
for _ in installed_packages:
|
||||
if shell_name in _:
|
||||
shell_name = _.removesuffix('\n').ljust(padding_count, ' ')
|
||||
package_count = str(len(installed_packages)).ljust(padding_count, ' ')
|
||||
|
||||
total_memory, used_memory, free_memory, d1, d2, d3 = map(int, os.popen('free -m').readlines()[1].split()[1:])
|
||||
memory_usage = f'{round((used_memory / 1024), 1)} GB / {round((total_memory / 1024), 1)} GB'.ljust(padding_count, ' ')
|
||||
|
||||
with open('/proc/uptime', 'r') as f:
|
||||
uptime_seconds = float(f.readline().split()[0])
|
||||
f.close()
|
||||
if uptime_seconds < 60:
|
||||
uptime = str(uptime_seconds).split('.')[0] + ' seconds'
|
||||
elif uptime_seconds < 3600:
|
||||
number = str(uptime_seconds / 60).split('.')[0]
|
||||
uptime = f'{number} minute' if number == '1' else f'{number} minutes'
|
||||
else:
|
||||
number = str(uptime_seconds / 3600).split('.')[0]
|
||||
uptime = f'{number} hour' if number == '1' else f'{number} hours'
|
||||
uptime = uptime.ljust(padding_count, ' ')
|
||||
|
||||
txt = f'''╭─────── ferit@navi ───────╮
|
||||
│ {distro_name}│
|
||||
│ {kernel_version}│
|
||||
│ {shell_name}│
|
||||
│ {package_count}│
|
||||
├──────── Hardware ────────┤
|
||||
│ AMD Ryzen 7 5800H │
|
||||
│ NV GeForce RTX3050 Ti │
|
||||
│ {memory_usage}│
|
||||
│ {uptime}│
|
||||
╰──────────────────────────╯
|
||||
'''
|
||||
txt_padded = ''
|
||||
img_width = 15
|
||||
for line in txt.splitlines():
|
||||
txt_padded += ((' ' * img_width) + line + '\n')
|
||||
coloring(txt_padded)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
31
deprecated/goingaway.sh
Executable file
31
deprecated/goingaway.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Ferit Yigit BALABAN <fyb@duck.com>, 2022
|
||||
#
|
||||
|
||||
# Step 0: Save status to default location
|
||||
r_screen=$(brightnessctl --machine-readable)
|
||||
r_kbdlgt=$(brightnessctl --machine-readable --device asus::kbd_backlight)
|
||||
screen=(${r_screen//,/ })
|
||||
kbdlgt=(${r_kbdlgt//,/ })
|
||||
echo ${screen[2]} > $HOME/.config/navi/screen
|
||||
echo ${kbdlgt[2]} > $HOME/.config/navi/kbdlgt
|
||||
|
||||
# Step 1: Set screen brightness to 0
|
||||
brightnessctl set 0
|
||||
|
||||
# Step 2: Set keyboard backlight to 0
|
||||
brightnessctl --device asus::kbd_backlight set 0
|
||||
|
||||
# Step 3: Set mouse light to 0
|
||||
rivalcfg --color=#000000 --light-effect=steady
|
||||
|
||||
# Step 4: Set volume level to 0
|
||||
pactl set-sink-volume @DEFAULT_SINK@ 0%
|
||||
|
||||
# Step 5: Lock the screen with screensaver
|
||||
betterlockscreen --lock --off 10
|
||||
|
||||
# Step 7: Write log message
|
||||
dt=$(date +'%d/%m/%y-%H.%M.%S')
|
||||
echo "[$dt] navi is locked." >> $HOME/navi.log
|
||||
7
deprecated/launch_compton.sh
Executable file
7
deprecated/launch_compton.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Terminate all running instances of compton
|
||||
killall -q compton
|
||||
|
||||
# Launch compton
|
||||
compton -b
|
||||
77
deprecated/modeset.py
Executable file
77
deprecated/modeset.py
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Ferit Yiğit BALABAN, <fyb@duck.com>
|
||||
#
|
||||
# modeset.py is a handy theme switcher for multiple applications.
|
||||
from datetime import datetime
|
||||
import os
|
||||
import sys
|
||||
from subprocess import run
|
||||
|
||||
|
||||
HOME_FOLDR = '/home/ferit'
|
||||
PATH_LOGFL = f'{HOME_FOLDR}/navi.log'
|
||||
DARK_THEME = f'Hardcore'
|
||||
LGHT_THEME = f'Tango Light'
|
||||
DARK_WLLPR = f'{HOME_FOLDR}/sources/wallpapers/6kkzj7.png'
|
||||
LGHT_WLLPR = f'{HOME_FOLDR}/sources/wallpapers/5dd9v9.png'
|
||||
DARK_FETCH = f'{HOME_FOLDR}/scripts/fetchdark.theme'
|
||||
LGHT_FETCH = f'{HOME_FOLDR}/scripts/fetchlight.theme'
|
||||
PATH_KITTY = f'{HOME_FOLDR}/.config/kitty/theme.conf'
|
||||
PATH_FETCH = f'{HOME_FOLDR}/scripts/fetch.theme'
|
||||
KBD_NAME = 'asus::kbd_backlight'
|
||||
|
||||
|
||||
def write(status: str):
|
||||
log = f'[{datetime.now().strftime("%d/%m/%y-%H.%M.%S")}]'
|
||||
log += ' navi is going dark.\n' if status == 'dark' else ' navi is enlightened.\n'
|
||||
with open(PATH_LOGFL, 'a') as f:
|
||||
f.write(log)
|
||||
f.close()
|
||||
|
||||
|
||||
def set_kbdlight(intensity: int):
|
||||
run(['brightnessctl', 'set', '--device', KBD_NAME, str(intensity)])
|
||||
|
||||
|
||||
def set_wallpaper(wallpaper: str):
|
||||
run(['nitrogen', '--set-centered', '--save', wallpaper])
|
||||
|
||||
|
||||
def set_fetchpy(theme: str):
|
||||
try:
|
||||
os.remove(PATH_FETCH)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
os.symlink(theme, PATH_FETCH)
|
||||
|
||||
|
||||
def set_kitty(theme: str):
|
||||
run(['kitty', '+kitten', 'themes', '--reload-in=all', theme])
|
||||
|
||||
|
||||
def main():
|
||||
sys.argv.reverse()
|
||||
sys.argv.pop()
|
||||
if len(sys.argv) != 0:
|
||||
mode = sys.argv.pop()
|
||||
if mode == 'd' or mode == 'dark':
|
||||
set_kitty(DARK_THEME)
|
||||
set_wallpaper(DARK_WLLPR)
|
||||
set_fetchpy(DARK_FETCH)
|
||||
set_kbdlight(1)
|
||||
write('dark')
|
||||
elif mode == 'l' or mode == 'light':
|
||||
set_kitty(LGHT_THEME)
|
||||
set_wallpaper(LGHT_WLLPR)
|
||||
set_fetchpy(LGHT_FETCH)
|
||||
set_kbdlight(0)
|
||||
write('light')
|
||||
else:
|
||||
print("Error: expected d, dark, l or light as argument.")
|
||||
exit(1)
|
||||
exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
25
deprecated/nowplaying.py
Executable file
25
deprecated/nowplaying.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess as s
|
||||
|
||||
|
||||
def main():
|
||||
l = str(s.run(['playerctl', 'metadata'], capture_output=True, text=True).stdout).splitlines()
|
||||
if len(l) == 0:
|
||||
print('')
|
||||
exit(0)
|
||||
artist = ''
|
||||
title = ''
|
||||
s_artist = 'chromium xesam:artist'
|
||||
s_title = 'chromium xesam:title'
|
||||
for x in l:
|
||||
if s_artist in x:
|
||||
artist = x.split(s_artist)[1].strip()
|
||||
elif s_title in x:
|
||||
title = x.split(s_title)[1].strip()
|
||||
break
|
||||
print(f'{artist} - {title}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
41
deprecated/update_repos.py
Executable file
41
deprecated/update_repos.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Ferit Yiğit BALABAN <fyb@duck.com>, 2022
|
||||
#
|
||||
import os
|
||||
import subprocess
|
||||
from termcolor import colored
|
||||
|
||||
|
||||
def main():
|
||||
print(colored('UwU Hewwo goowd siw! I wiww upwate youw wepos :3', 'magenta'))
|
||||
print('You smelly self compiling narcissist~ OwO')
|
||||
|
||||
# change folder name below if you keep your repos in a different place
|
||||
path_to_folders = os.environ['HOME'] + '/sources/'
|
||||
|
||||
list_of_folders = [d for d in os.listdir(path_to_folders) if os.path.isdir(os.path.join(path_to_folders, d))]
|
||||
print('Found folders ', colored(f'{list_of_folders}', 'green'), ' in ', colored(f'{path_to_folders}', 'green'))
|
||||
|
||||
# append base directory to subdirectory names
|
||||
for i in range(len(list_of_folders)):
|
||||
list_of_folders[i] = path_to_folders + list_of_folders[i]
|
||||
|
||||
# list repos (folders that have '.git' as a subfolder)
|
||||
list_of_repos = [d for d in list_of_folders if '.git' in os.listdir(d)]
|
||||
print('Found repos ', colored(f'{list_of_repos}', 'yellow'))
|
||||
|
||||
# call git in every repository
|
||||
i = 1
|
||||
for repo in list_of_repos:
|
||||
print(colored(f'\n[{i}/{len(list_of_repos)}]', 'magenta'), 'Calling "git pull" in', colored(f'{repo}:', 'blue'))
|
||||
process = subprocess.Popen(['git', 'pull'], cwd=repo)
|
||||
output = process.communicate()[0]
|
||||
i += 1
|
||||
|
||||
print(f'\nOwO {len(list_of_repos)} tasks compweted successfuwwy')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user