Ported to new base

This commit is contained in:
adi1090x
2023-01-12 12:50:35 +05:30
parent 1ea82a1a89
commit 64fbae1aca
42 changed files with 430 additions and 122 deletions
+7 -5
View File
@@ -1,9 +1,9 @@
# Maintainer: Aditya Shakya <adi1090x@gmail.com>
pkgname=archcraft-berry
pkgver=1.0
pkgrel=6
pkgdesc="berry Configurations for Archcraft"
pkgver=2.0
pkgrel=0
pkgdesc="Berry Configurations for Archcraft"
url="https://github.com/archcraft-os/archcraft-berry"
arch=('any')
license=('GPL3')
@@ -16,8 +16,10 @@ depends=('berry-git'
'ksuperkey'
'betterlockscreen'
'xfce4-power-manager'
'sxhkd'
'hsetroot')
'sxhkd' 'hsetroot'
'wmname'
'pulsemixer' 'light' 'xcolor'
)
conflicts=()
provides=("${pkgname}")
options=(!strip !emptydirs)
+3 -4
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## Script Termination
exit_on_signal_SIGINT () {
@@ -20,9 +19,9 @@ trap exit_on_signal_SIGTERM SIGTERM
# Build packages
build_pkg () {
echo -e "\nBuilding Package - \n"
makepkg -s && rm -rf src pkg
makepkg -sc
RDIR='../packages/x86_64'
RDIR='../../pkgs/x86_64'
if [[ -d "$RDIR" ]]; then
mv -f *.pkg.tar.zst "$RDIR"
echo -e "\nPackage moved to Repository.\n[!] Don't forget to update the database.\n"
+3 -4
View File
@@ -1,6 +1,5 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Configuration for Alacritty, the GPU enhanced terminal emulator.
## It's a very basic and simple config file, for full configuration...
## See, /usr/share/doc/alacritty/example/alacritty.yml
@@ -19,7 +18,7 @@ env:
window:
dimensions:
columns: 84
lines: 24
lines: 23
padding:
x: 25
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## Colors configuration
colors:
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## Font configuration
font:
+6 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Config file for berry WM
@@ -32,5 +31,10 @@ berryc decorate_new "true"
berryc pointer_interval 0
berryc manage Dialog|Toolbar|Menu|Splash|Utility
berryc move_mask "mod1"
berryc move_button 1
berryc resize_mask "mod4"
berryc resize_button 3
## Autostart Programs ------------------------------------------
bash "$HOME"/.config/berry/bin/autostart.sh
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
rofi -dmenu \
-password \
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## rofi sudo askpass helper
export SUDO_ASKPASS=~/.config/berry/bin/askpass.sh
+2 -2
View File
@@ -1,7 +1,7 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Autostart Programs
# Kill already running process
+11 -7
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## Files and Directories
DIR="$HOME/.config/berry/polybar"
@@ -51,11 +50,16 @@ launch_bar() {
touch "$MFILE"
fi
if [[ ! `pidof polybar` ]]; then
polybar -q main -c "$DIR"/config &
else
polybar-msg cmd restart
fi
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch the bar
for mon in $(polybar --list-monitors | cut -d":" -f1); do
MONITOR=$mon polybar -q main -c "$DIR"/config &
done
}
# Execute functions
+73
View File
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Script to manage brightness on Archcraft.
# Icons
iDIR='/usr/share/archcraft/icons/dunst'
# Graphics card
CARD=`ls /sys/class/backlight | head -n 1`
# Get brightness
get_backlight() {
if [[ "$CARD" == *"intel_"* ]]; then
BNESS=`xbacklight -get`
LIGHT=${BNESS%.*}
else
LIGHT=$(printf "%.0f\n" `light -G`)
fi
echo "${LIGHT}%"
}
# Get icons
get_icon() {
backlight="$(get_backlight)"
current="${backlight%%%}"
if [[ ("$current" -ge "0") && ("$current" -le "20") ]]; then
icon="$iDIR"/brightness-20.png
elif [[ ("$current" -ge "20") && ("$current" -le "40") ]]; then
icon="$iDIR"/brightness-40.png
elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
icon="$iDIR"/brightness-60.png
elif [[ ("$current" -ge "60") && ("$current" -le "80") ]]; then
icon="$iDIR"/brightness-80.png
elif [[ ("$current" -ge "80") && ("$current" -le "100") ]]; then
icon="$iDIR"/brightness-100.png
fi
}
# Notify
notify_bl() {
get_icon && dunstify -u low -h string:x-dunst-stack-tag:obbacklight -i "$icon" "Brightness : $(get_backlight)"
}
# Increase brightness
inc_backlight() {
if [[ "$CARD" == *"intel_"* ]]; then
xbacklight -inc 10 && notify_bl
else
light -A 5 && notify_bl
fi
}
# Decrease brightness
dec_backlight() {
if [[ "$CARD" == *"intel_"* ]]; then
xbacklight -dec 10 && notify_bl
else
light -U 5 && notify_bl
fi
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_backlight
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
else
get_backlight
fi
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Simple script to pick color quickly.
color=$(xcolor --format hex --preview-size 255 --scale 10)
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo $color | tr -d "\n" | xclip -selection clipboard
# generate preview
convert -size 48x48 xc:"$color" ${image}
# notify about it
dunstify -u low -h string:x-dunst-stack-tag:obcolorpicker -i ${image} "$color, copied to clipboard."
fi
}
# run the script
main
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
# Terminate if picom is already running
killall -q picom
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## Launch dunst daemon
if [[ `pidof dunst` ]]; then
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Run ncmpcpp with alternate config
# Berry directory
DIR="$HOME/.config/i3"
CONFIG="$DIR/alacritty/alacritty.yml"
alacritty --class 'Music,Music' --config-file "$CONFIG" \
-o window.dimensions.columns=109 window.dimensions.lines=22 \
-e ~/.ncmpcpp/scripts/ncmpcpp-art
+87
View File
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Script to take screenshots on Archcraft.
# file
time=`date +%Y-%m-%d-%H-%M-%S`
geometry=`xrandr | grep 'current' | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'`
dir="`xdg-user-dir PICTURES`/Screenshots"
file="Screenshot_${time}_${geometry}.png"
# directory
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
fi
# notify and view screenshot
notify_view () {
notify_cmd_shot='dunstify -u low -h string:x-dunst-stack-tag:obscreenshot -i /usr/share/archcraft/icons/dunst/picture.png'
${notify_cmd_shot} "Copied to clipboard."
paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
viewnior ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
else
${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
dunstify -t 1000 -h string:x-dunst-stack-tag:screenshottimer -i /usr/share/archcraft/icons/dunst/timer.png "Taking shot in : $sec"
sleep 1
done
}
# take shots
shotnow () {
cd ${dir} && maim -u -f png | copy_shot
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && maim -u -f png | copy_shot
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && maim -u -f png | copy_shot
notify_view
}
shotwin () {
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 | copy_shot
notify_view
}
# execute
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
shot5
elif [[ "$1" == "--in10" ]]; then
shot10
elif [[ "$1" == "--win" ]]; then
shotwin
elif [[ "$1" == "--area" ]]; then
shotarea
else
echo -e "Available Options : --now --in5 --in10 --win --area"
fi
exit 0
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
## launch alacritty with berry config
+83
View File
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Script to manage speaker volume on Archcraft.
# Icons
iDIR='/usr/share/archcraft/icons/dunst'
notify_cmd='dunstify -u low -h string:x-dunst-stack-tag:obvolume'
# Get Volume
get_volume() {
echo "`pulsemixer --get-volume | cut -d' ' -f1`"
}
# Get icons
get_icon() {
current="$(get_volume)"
if [[ "$current" -eq "0" ]]; then
icon="$iDIR/volume-mute.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
icon="$iDIR/volume-low.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
icon="$iDIR/volume-mid.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
icon="$iDIR/volume-high.png"
fi
}
# Notify
notify_user() {
${notify_cmd} -i "$icon" "Volume : $(get_volume)%"
}
# Increase Volume
inc_volume() {
[[ `pulsemixer --get-mute` == 1 ]] && pulsemixer --unmute
pulsemixer --max-volume 100 --change-volume +5 && get_icon && notify_user
}
# Decrease Volume
dec_volume() {
[[ `pulsemixer --get-mute` == 1 ]] && pulsemixer --unmute
pulsemixer --max-volume 100 --change-volume -5 && get_icon && notify_user
}
# Toggle Mute
toggle_mute() {
if [[ `pulsemixer --get-mute` == 0 ]]; then
pulsemixer --toggle-mute && ${notify_cmd} -i "$iDIR/volume-mute.png" "Mute"
else
pulsemixer --toggle-mute && get_icon && ${notify_cmd} -i "$icon" "Unmute"
fi
}
# Toggle Mic
toggle_mic() {
ID="`pulsemixer --list-sources | grep 'Default' | cut -d',' -f1 | cut -d' ' -f3`"
if [[ `pulsemixer --id $ID --get-mute` == 0 ]]; then
pulsemixer --id ${ID} --toggle-mute && ${notify_cmd} -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
else
pulsemixer --id ${ID} --toggle-mute && ${notify_cmd} -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Execute accordingly
if [[ -x `which pulsemixer` ]]; then
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
else
echo $(get_volume)%
fi
else
${notify_cmd} "'pulsemixer' is not installed."
fi
+27 -10
View File
@@ -1,3 +1,5 @@
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
[global]
monitor = 0
follow = mouse
@@ -5,33 +7,48 @@ width = 300
height = 80
origin = top-right
offset = 20x82
corner_radius = 0
scale = 0
notification_limit = 0
progress_bar = true
progress_bar_height = 80
progress_bar_frame_width = 1
progress_bar_min_width = 300
progress_bar_max_width = 300
indicate_hidden = yes
shrink = no
separator_color = auto
transparency = 0
separator_height = 4
line_height = 4
padding = 15
horizontal_padding = 15
text_icon_padding = 0
frame_width = 0
sort = no
gap_size = 0
separator_color = frame
sort = yes
idle_threshold = 120
font = JetBrains Mono Medium 10
font = Iosevka Custom 9
line_height = 4
markup = full
format = %s\n%b
alignment = left
vertical_alignment = center
show_age_threshold = 60
word_wrap = yes
ellipsize = middle
ignore_newline = no
stack_duplicates = false
hide_duplicate_count = yes
show_indicators = no
stack_duplicates = true
hide_duplicate_count = false
show_indicators = yes
enable_recursive_icon_lookup = true
icon_position = left
min_icon_size = 24
max_icon_size = 48
sticky_history = yes
history_length = 20
browser = x-www-browser -new-tab
browser = /usr/bin/xdg-open
always_run_script = true
mouse_left_click = close_current
mouse_middle_click = do_action, close_current
mouse_right_click = close_all
title = Dunst
class = Dunst
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
#========================= Shadows =========================#
+2 -2
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
[color]
+3 -3
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
;; Global WM Settings
@@ -33,7 +33,7 @@ include-file = ~/.config/berry/polybar/decor
; If unspecified, the application will pick the first one it finds.
; $ polybar -m | cut -d ':' -f 1
; $ xrandr -q | grep " connected" | cut -d ' ' -f1
monitor =
monitor = ${env:MONITOR:}
; Use the specified monitor as a fallback if the main one is not found.
monitor-fallback =
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
;; DECOR _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
+2 -2
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
[module/alsa]
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
;;
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
DIR="$HOME/.config/berry"
rofi_cmd="rofi -theme $DIR/rofi/themes/asroot.rasi"
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
DIR="$HOME/.config/berry"
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
DIR="$HOME/.config/berry"
+44 -18
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/berry/rofi/themes/networkmenu_config.ini
~/.config/networkmanager-dmenu/nmd.ini
"""
import pathlib
@@ -21,21 +21,20 @@ from os.path import expanduser
import shlex
from shutil import which
import sys
from time import sleep
import uuid
import subprocess
# pylint: disable=import-error
import gi
gi.require_version('NM', '1.0')
from gi.repository import GLib, NM # noqa pylint: disable=wrong-import-position
# pylint: enable=import-error
ENV = os.environ.copy()
ENV['LC_ALL'] = 'C'
ENC = locale.getpreferredencoding()
CLIENT = NM.Client.new(None)
LOOP = GLib.MainLoop()
CONNS = CLIENT.get_connections()
CONF = configparser.ConfigParser()
CONF.read(expanduser("~/.config/berry/rofi/themes/networkmenu_config.ini"))
@@ -85,7 +84,7 @@ def dmenu_pass(command, color):
def dmenu_cmd(num_lines, prompt="Networks", active_lines=None):
"""Parse config.ini for menu options
"""Parse nmd.ini for menu options
Args: args - num_lines: number of lines to display
prompt: prompt to show
@@ -190,11 +189,15 @@ def rescan_wifi():
"""
Rescan Wifi Access Points
"""
delay = CONF.getint('nmdm', 'rescan_delay', fallback=5)
for dev in CLIENT.get_devices():
if gi.repository.NM.DeviceWifi == type(dev):
try:
dev.request_scan_async(None, rescan_cb, None)
LOOP.run()
sleep(delay)
notify("Wifi scan complete")
main()
except gi.repository.GLib.Error as err:
# Too frequent rescan error
notify("Wifi rescan failed", urgency="critical")
@@ -207,7 +210,7 @@ def rescan_cb(dev, res, data):
"""
if dev.request_scan_finish(res) is True:
notify("Wifi scan complete")
notify("Wifi scan running...")
else:
notify("Wifi scan failed", urgency="critical")
LOOP.quit()
@@ -237,14 +240,19 @@ def ap_security(nm_ap):
sec_str = ""
if ((flags & getattr(NM, '80211ApFlags').PRIVACY) and
(wpa_flags == 0) and (rsn_flags == 0)):
sec_str += " WEP"
if wpa_flags != 0:
sec_str += " WPA1"
if rsn_flags != 0:
sec_str = " WEP"
if wpa_flags:
sec_str = " WPA1"
if rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_PSK:
sec_str += " WPA2"
if rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_SAE:
sec_str += " WPA3"
if ((wpa_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_802_1X) or
(rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_802_1X)):
sec_str += " 802.1X"
if ((wpa_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_OWE) or
(rsn_flags & getattr(NM, '80211ApSecurityFlags').KEY_MGMT_OWE)):
sec_str += " OWE"
# If there is no security use "--"
if sec_str == "":
@@ -634,7 +642,7 @@ def launch_connection_editor():
"""
terminal = CONF.get("editor", "terminal", fallback="xterm")
gui_if_available = CONF.getboolean("editor", "gui_if_available", fallback=True)
guis = ["gnome-continue-center", "nm-connection-editor"]
guis = ["gnome-control-center", "nm-connection-editor"]
if gui_if_available is True:
for gui in guis:
if is_installed(gui):
@@ -719,8 +727,8 @@ def set_new_connection(nm_ap, nm_pw, adapter):
def create_wifi_profile(nm_ap, password, adapter):
# pylint: disable=line-too-long
# From https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi/add_connection.py
# and https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-wifi-psk-connection.py
# noqa From https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi/add_connection.py
# noqa and https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/add-wifi-psk-connection.py
# pylint: enable=line-too-long
"""Create the NM profile given the AP and passphrase"""
ap_sec = ap_security(nm_ap)
@@ -749,8 +757,12 @@ def create_wifi_profile(nm_ap, password, adapter):
if ap_sec != "--":
s_wifi_sec = NM.SettingWirelessSecurity.new()
if "WPA" in ap_sec:
s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT,
"wpa-psk")
if "WPA3" in ap_sec:
s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT,
"sae")
else:
s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_KEY_MGMT,
"wpa-psk")
s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_AUTH_ALG,
"open")
s_wifi_sec.set_property(NM.SETTING_WIRELESS_SECURITY_PSK, password)
@@ -839,7 +851,9 @@ def notify(message, details=None, urgency="low"):
"""Use notify-send if available for notifications
"""
args = ["-u", urgency, "-a", "networkmanager-dmenu", message]
delay = CONF.getint('nmdm', 'rescan_delay', fallback=5)
args = ["-u", urgency, "-a", "networkmanager-dmenu",
"-t", str(delay * 1000), message]
if details is not None:
args.append(details)
if is_installed("notify-send"):
@@ -892,7 +906,19 @@ def run(): # pylint: disable=too-many-locals
sel()
if __name__ == '__main__':
def main():
"""Main. Enables script to be re-run after a wifi rescan
"""
global CLIENT, CONNS, LOOP # noqa pylint: disable=global-variable-undefined
CLIENT = NM.Client.new(None)
LOOP = GLib.MainLoop()
CONNS = CLIENT.get_connections()
run()
if __name__ == '__main__':
main()
# vim: set et ts=4 sw=4 :
+1 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
DIR="$HOME/.config/berry"
+2 -2
View File
@@ -1,7 +1,6 @@
#!/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
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
DIR="$HOME/.config/berry"
@@ -25,6 +24,7 @@ inten=""
# notify and view screenshot
notify_view () {
${notify_cmd_shot} "Copied to clipboard."
paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
viewnior ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
@import "colors.rasi"
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
font: "JetBrains Mono Medium 10";
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
* {
background: #011826;
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
@import "colors.rasi"
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
location: 8;
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
location: 4;
+2 -3
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
font: "JetBrains Mono Medium 10";
@@ -20,7 +19,7 @@ window {
border-color: @selected;
border-radius: 14px;
width: 400px;
height: 420px;
height: 400px;
location: center;
anchor: center;
x-offset: 0;
+1 -2
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
[dmenu]
dmenu_command = rofi -dmenu -theme ~/.config/berry/rofi/themes/networkmenu.rasi
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
location: 4;
+1 -2
View File
@@ -1,5 +1,4 @@
/* Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> */
/* Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 */
/* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com> */
configuration {
location: 4;
+14 -12
View File
@@ -1,5 +1,4 @@
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##---------- Keybindings for berry ----------##
@@ -43,37 +42,37 @@ ctrl + alt + l
# Take a screenshot
Print
takeshot --now
~/.config/berry/bin/berryscreenshot.sh --now
# Take screenshot in 5 second
alt + Print
takeshot --in5
~/.config/berry/bin/berryscreenshot.sh --in5
# Take screenshot in 10 second
shift + Print
takeshot --in10
~/.config/berry/bin/berryscreenshot.sh --in10
# Take screenshot of active window
ctrl + Print
takeshot --win
~/.config/berry/bin/berryscreenshot.sh --win
# Take screenshot of area
ctrl + alt + Print
takeshot --area
super + Print
~/.config/berry/bin/berryscreenshot.sh --area
# Brighness control
XF86MonBrightness{Up,Down}
brightness{ --inc, --dec}
~/.config/berry/bin/berrybrightness.sh{ --inc, --dec}
# Volume control
XF86Audio{RaiseVolume,LowerVolume}
volume{ --inc, --dec}
~/.config/berry/bin/berryvolume.sh{ --inc, --dec}
XF86AudioMute
volume --toggle
~/.config/berry/bin/berryvolume.sh --toggle
XF86AudioMicMute
volume --toggle-mic
~/.config/berry/bin/berryvolume.sh --toggle-mic
# Music control
XF86Audio{Next,Prev,Play,Stop}
@@ -118,6 +117,9 @@ super + t
super + Tab
berryc cycle_focus
alt + Tab
berryc cycle_focus
super + c
berryc window_center