Updated config files and scripts

This commit is contained in:
adi1090x
2022-07-17 17:12:32 +05:30
parent 62a311d17a
commit 5855961fbb
16 changed files with 132 additions and 98 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
pkgname=archcraft-berry
pkgver=1.0
pkgrel=5
pkgrel=6
pkgdesc="berry Configurations for Archcraft"
url="https://github.com/archcraft-os/archcraft-berry"
arch=('any')
+15 -11
View File
@@ -41,22 +41,26 @@ backup_wm() {
echo -e ${YELLOW}"[*] Your current config files are stored in : ${_dir}/${_wmpkg}_backup_${BNAME} , In case you want to use them." && reset_color
}
post_install() {
if [[ ! -d "${_dir}/${_wmpkg}" ]]; then
install_wm
## Main
run_main() {
if [[ "${_group}" == 'liveuser' ]]; then
exit
else
backup_wm
install_wm
if [[ ! -d "${_dir}/${_wmpkg}" ]]; then
install_wm
else
backup_wm
install_wm
fi
fi
}
post_install() {
run_main
}
post_upgrade() {
if [[ ! -d "${_dir}/${_wmpkg}" ]]; then
install_wm
else
backup_wm
install_wm
fi
run_main
}
post_remove() {
+6
View File
@@ -46,3 +46,9 @@ cursor:
## Live config reload
live_config_reload: true
## Shell
#shell:
# program: /bin/zsh
# args:
# - --login
+1 -1
View File
@@ -1,7 +1,7 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
# Font configuration
## Font configuration
font:
# Normal (roman) font face
normal:
+5 -5
View File
@@ -3,9 +3,9 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
rofi -dmenu\
-password\
-i\
-no-fixed-num-lines\
-p "User Password: "\
rofi -dmenu \
-password \
-i \
-no-fixed-num-lines \
-p "User Password: " \
-theme ~/.config/berry/rofi/themes/askpass.rasi &
+4 -4
View File
@@ -20,16 +20,16 @@ get_values() {
## Write values to `system` file
set_values() {
if [[ "$ADAPTER" ]]; then
sed -i -e "s/adapter = .*/adapter = $ADAPTER/g" ${SFILE}
sed -i -e "s/sys_adapter = .*/sys_adapter = $ADAPTER/g" ${SFILE}
fi
if [[ "$BATTERY" ]]; then
sed -i -e "s/battery = .*/battery = $BATTERY/g" ${SFILE}
sed -i -e "s/sys_battery = .*/sys_battery = $BATTERY/g" ${SFILE}
fi
if [[ "$CARD" ]]; then
sed -i -e "s/graphics_card = .*/graphics_card = $CARD/g" ${SFILE}
sed -i -e "s/sys_graphics_card = .*/sys_graphics_card = $CARD/g" ${SFILE}
fi
if [[ "$INTERFACE" ]]; then
sed -i -e "s/network_interface = .*/network_interface = $INTERFACE/g" ${SFILE}
sed -i -e "s/sys_network_interface = .*/sys_network_interface = $INTERFACE/g" ${SFILE}
fi
}
+2 -2
View File
@@ -7,9 +7,9 @@
CONFIG="$HOME/.config/berry/alacritty/alacritty.yml"
if [ "$1" == "-f" ]; then
if [ "$1" == "--float" ]; then
alacritty --class 'alacritty-float,alacritty-float' --config-file "$CONFIG"
elif [ "$1" == "-s" ]; then
elif [ "$1" == "--full" ]; then
alacritty --class 'Fullscreen,Fullscreen' --config-file "$CONFIG" -o window.startup_mode=fullscreen window.padding.x=30 window.padding.y=30 window.opacity=0.95 font.size=14
else
alacritty --config-file "$CONFIG"
+5 -5
View File
@@ -142,7 +142,7 @@ type = internal/backlight
; Use the following command to list available cards:
; $ ls -1 /sys/class/backlight/
card = ${system.graphics_card}
card = ${system.sys_graphics_card}
enable-scroll = true
@@ -183,8 +183,8 @@ full-at = 99
; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = ${system.battery}
adapter = ${system.adapter}
battery = ${system.sys_battery}
adapter = ${system.sys_adapter}
; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
@@ -592,7 +592,7 @@ icon-next-foreground = ${color.blue}
; If you use both a wired and a wireless network, Add both modules in config.ini
[module/ethernet]
type = internal/network
interface = ${system.network_interface}
interface = ${system.sys_network_interface}
interval = 1.0
accumulate-stats = true
@@ -619,7 +619,7 @@ label-disconnected = "%{A1:~/.config/berry/rofi/bin/network_menu &:}Offline%{A}"
[module/network]
type = internal/network
interface = ${system.network_interface}
interface = ${system.sys_network_interface}
; Seconds to sleep between updates
; Default: 1
+8 -8
View File
@@ -14,15 +14,15 @@
;; Run `ip link | awk '/state UP/ {print $2}' | tr -d :` to get active network interface.
;;
;; Polybar Variables For Modules :
;; card = ${system.graphics_card}
;; battery = ${system.battery}
;; adapter = ${system.adapter}
;; interface = ${system.network_interface}
;; card = ${system.sys_graphics_card}
;; battery = ${system.sys_battery}
;; adapter = ${system.sys_adapter}
;; interface = ${system.sys_network_interface}
[system]
adapter = ACAD
battery = BAT1
graphics_card = amdgpu_bl0
network_interface = wlan0
sys_adapter = ACAD
sys_battery = BAT1
sys_graphics_card = amdgpu_bl0
sys_network_interface = wlan0
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
+6 -12
View File
@@ -4,26 +4,25 @@
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
DIR="$HOME/.config/berry"
rofi_command="rofi -theme $DIR/rofi/themes/asroot.rasi"
rofi_cmd="rofi -theme $DIR/rofi/themes/asroot.rasi"
# Apps
terminal=" Alacritty"
files=" Thunar"
editor=" Geany"
clifm=" Ranger"
lpad=" Leafpad"
vim=" Vim"
# Variable passed to rofi
options="$terminal\n$files\n$editor\n$clifm\n$vim"
term='alacritty --class alacritty-float,alacritty-float --config-file /root/.config/alacritty/alacritty.yml'
# Functions
chosen="$(echo -e "$options" | $rofi_command -p "Run as root" -dmenu -selected-row 0)"
chosen="$(echo -e "$options" | $rofi_cmd -p "Run as root" -dmenu -selected-row 0)"
case $chosen in
$terminal)
"$DIR"/bin/asroot.sh 'alacritty --class alacritty-float,alacritty-float --config-file /root/.config/alacritty/alacritty.yml'
"$DIR"/bin/asroot.sh "$term"
;;
$files)
"$DIR"/bin/asroot.sh 'dbus-run-session thunar'
@@ -32,14 +31,9 @@ case $chosen in
"$DIR"/bin/asroot.sh geany
;;
$clifm)
"$DIR"/bin/asroot.sh 'alacritty --class alacritty-float,alacritty-float --config-file /root/.config/alacritty/alacritty.yml -e ranger'
;;
$lpad)
"$DIR"/bin/asroot.sh leafpad
"$DIR"/bin/asroot.sh "$term -e ranger"
;;
$vim)
"$DIR"/bin/asroot.sh 'alacritty --class alacritty-float,alacritty-float --config-file /root/.config/alacritty/alacritty.yml -e vim'
"$DIR"/bin/asroot.sh "$term -e vim"
;;
esac
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "Are You Sure? : "\
-theme ~/.config/berry/rofi/themes/confirm.rasi
+2 -2
View File
@@ -5,7 +5,7 @@
DIR="$HOME/.config/berry"
rofi_command="rofi -theme $DIR/rofi/themes/mpd.rasi"
rofi_cmd="rofi -theme $DIR/rofi/themes/mpd.rasi"
button_music=''
button_play=''
@@ -62,7 +62,7 @@ if [[ -z "$current" ]]; then
fi
# Spawn the mpd menu with the "Play / Pause" entry selected by default
chosen="$(echo -e "$options" | $rofi_command -p "$current" -dmenu $active $urgent -selected-row 0)"
chosen="$(echo -e "$options" | $rofi_cmd -p "$current" -dmenu $active $urgent -selected-row 0)"
case $chosen in
$button_previous)
mpc -q prev && kunst --size 60x60 --silent
+30 -13
View File
@@ -9,7 +9,7 @@ https://wiki.archlinux.org/index.php/NetworkManager#Set_up_PolicyKit_permissions
OR running the script as root
Add dmenu options and default terminal if desired to
~/.config/networkmanager-dmenu/nmd.ini
~/.config/berry/rofi/themes/networkmenu_config.ini
"""
import pathlib
@@ -63,8 +63,29 @@ def cli_args():
return args
def dmenu_pass(command, color):
"""Check if dmenu passphrase patch is applied and return the correct command
line arg list
Args: command - string
color - obscure color string
Returns: list or None
"""
if command != 'dmenu':
return None
try:
# Check for dmenu password patch
dm_patch = b'P' in subprocess.run(["dmenu", "-h"],
capture_output=True,
check=False).stderr
except FileNotFoundError:
dm_patch = False
return ["-P"] if dm_patch else ["-nb", color, "-nf", color]
def dmenu_cmd(num_lines, prompt="Networks", active_lines=None):
"""Parse nmd.ini for menu options
"""Parse config.ini for menu options
Args: args - num_lines: number of lines to display
prompt: prompt to show
@@ -73,9 +94,11 @@ def dmenu_cmd(num_lines, prompt="Networks", active_lines=None):
["dmenu", "-l", "<num_lines>", "-p", "<prompt>", "-i"]
"""
# Create command string
commands = {"dmenu": ["-p", str(prompt)],
"rofi": ["-dmenu", "-p", str(prompt), "-l", str(num_lines)],
"bemenu": ["-p", str(prompt)]}
"bemenu": ["-p", str(prompt)],
"wofi": ["-p", str(prompt)]}
command = shlex.split(CONF.get('dmenu', 'dmenu_command', fallback="dmenu"))
command.extend(cli_args())
command.extend(commands.get(command[0], []))
@@ -87,17 +110,10 @@ def dmenu_cmd(num_lines, prompt="Networks", active_lines=None):
obscure = CONF.getboolean('dmenu_passphrase', 'obscure', fallback=False)
if prompt == "Passphrase" and obscure is True:
obscure_color = CONF.get('dmenu_passphrase', 'obscure_color', fallback='#222222')
try:
# Check for dmenu password patch
dm_patch = b'P' in subprocess.run(["dmenu", "-h"],
capture_output=True,
check=False).stderr
except FileNotFoundError:
dm_patch = False
dmenu = ["-P"] if dm_patch else ["-nb", obscure_color, "-nf", obscure_color]
pass_prompts = {"dmenu": dmenu,
pass_prompts = {"dmenu": dmenu_pass(command[0], obscure_color),
"rofi": ['-password'],
"bemenu": ['x']}
"bemenu": ['-x'],
"wofi": ['-P']}
command.extend(pass_prompts.get(command[0], []))
return command
@@ -650,6 +666,7 @@ def get_passphrase():
pin = res.split("D ")[1]
return pin
return subprocess.run(dmenu_cmd(0, "Passphrase"),
stdin=subprocess.DEVNULL,
capture_output=True,
check=False,
encoding=ENC).stdout
+23 -12
View File
@@ -5,8 +5,7 @@
DIR="$HOME/.config/berry"
rofi_command="rofi -theme $DIR/rofi/themes/powermenu.rasi"
rofi_cmd="rofi -theme $DIR/rofi/themes/powermenu.rasi"
uptime=$(uptime -p | sed -e 's/up //g')
# Options
@@ -16,37 +15,49 @@ lock=""
suspend=""
logout=""
# Get user confirmation
get_confirmation() {
rofi -dmenu -i \
-no-fixed-num-lines \
-p "Are You Sure? : " \
-theme "$DIR"/rofi/themes/confirm.rasi
}
# Show message
show_msg() {
rofi -theme "$DIR"/rofi/themes/askpass.rasi -e "Options - yes / y / no / n"
}
# Variable passed to rofi
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
_msg="Options - yes / y / no / n"
chosen="$(echo -e "$options" | $rofi_command -p "UP - $uptime" -dmenu -selected-row 2)"
chosen="$(echo -e "$options" | $rofi_cmd -p "UP - $uptime" -dmenu -selected-row 2)"
case $chosen in
$shutdown)
ans=$($HOME/.config/berry/rofi/bin/confirm &)
ans=$(get_confirmation)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
systemctl poweroff
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit
else
rofi -theme ~/.config/berry/rofi/themes/askpass.rasi -e "$_msg"
show_msg
fi
;;
$reboot)
ans=$($HOME/.config/berry/rofi/bin/confirm &)
ans=$(get_confirmation)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
systemctl reboot
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit
else
rofi -theme ~/.config/berry/rofi/themes/askpass.rasi -e "$_msg"
show_msg
fi
;;
$lock)
betterlockscreen --lock
;;
$suspend)
ans=$($HOME/.config/berry/rofi/bin/confirm &)
ans=$(get_confirmation)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
mpc -q pause
amixer set Master mute
@@ -54,17 +65,17 @@ case $chosen in
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit
else
rofi -theme ~/.config/berry/rofi/themes/askpass.rasi -e "$_msg"
show_msg
fi
;;
$logout)
ans=$($HOME/.config/berry/rofi/bin/confirm &)
ans=$(get_confirmation)
if [[ $ans == "yes" ]] || [[ $ans == "YES" ]] || [[ $ans == "y" ]]; then
berryc quit
elif [[ $ans == "no" ]] || [[ $ans == "NO" ]] || [[ $ans == "n" ]]; then
exit
else
rofi -theme ~/.config/berry/rofi/themes/askpass.rasi -e "$_msg"
show_msg
fi
;;
esac
+20 -11
View File
@@ -4,13 +4,17 @@
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
DIR="$HOME/.config/berry"
rofi_command="rofi -theme $DIR/rofi/themes/screenshot.rasi"
# File
time=`date +%Y-%m-%d-%H-%M-%S`
geometry=`xrandr | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'`
geometry=`xrandr | grep 'current' | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'`
dir="`xdg-user-dir PICTURES`/Screenshots"
file="Screenshot_${time}_${geometry}.png"
# Commands
notify_cmd_shot="dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png"
rofi_cmd="rofi -theme $DIR/rofi/themes/screenshot.rasi"
# Buttons
screen=""
area=""
@@ -20,15 +24,20 @@ inten=""
# notify and view screenshot
notify_view () {
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Copied to clipboard."
${notify_cmd_shot} "Copied to clipboard."
viewnior ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Saved."
${notify_cmd_shot} "Screenshot Saved."
else
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Deleted."
${notify_cmd_shot} "Screenshot Deleted."
fi
}
# Copy screenshot to clipboard
copy_shot () {
tee "$file" | xclip -selection clipboard -t image/png
}
# countdown
countdown () {
for sec in `seq $1 -1 1`; do
@@ -39,29 +48,29 @@ countdown () {
# take shots
shotnow () {
cd ${dir} && sleep 0.5 && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
cd ${dir} && sleep 0.5 && maim -u -f png | copy_shot
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
sleep 1 && cd ${dir} && maim -u -f png | copy_shot
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png
sleep 1 && cd ${dir} && maim -u -f png | copy_shot
notify_view
}
shotwin () {
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | tee "$file" | xclip -selection clipboard -t image/png
cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | copy_shot
notify_view
}
shotarea () {
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | tee "$file" | xclip -selection clipboard -t image/png
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | copy_shot
notify_view
}
@@ -72,7 +81,7 @@ fi
# Variable passed to rofi
options="$screen\n$area\n$window\n$infive\n$inten"
chosen="$(echo -e "$options" | $rofi_command -p 'Take Screenshot' -dmenu -selected-row 0)"
chosen="$(echo -e "$options" | $rofi_cmd -p 'Take Screenshot' -dmenu -selected-row 0)"
case $chosen in
$screen)
shotnow
+4 -1
View File
@@ -9,7 +9,7 @@ super + Return
# Terminal (floating)
super + shift + Return
bash ~/.config/berry/bin/berryterm.sh -s
bash ~/.config/berry/bin/berryterm.sh --full
##---------- Rofi Launcher & Menus ----------##
@@ -72,6 +72,9 @@ XF86Audio{RaiseVolume,LowerVolume}
XF86AudioMute
volume --toggle
XF86AudioMicMute
volume --toggle-mic
# Music control
XF86Audio{Next,Prev,Play,Stop}
mpc {next,prev,toggle,stop}