update
This commit is contained in:
1 parent
afe3d0d4fe
commit
c69495ee0c
11 files changed
+216
-242
No files matched your search
@@ -1,6 +1,5 @@
|
||||
from fabric.hyprland.widgets import Language
|
||||
|
||||
# from fabric.system_tray.widgets import SystemTray
|
||||
from fabric.system_tray.widgets import SystemTray
|
||||
from fabric.utils import FormattedString, bulk_replace
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
@@ -9,21 +8,23 @@ from fabric.widgets.datetime import DateTime
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
from modules.bar.widgets import (
|
||||
BatteryLabel,
|
||||
Bluetooth,
|
||||
BluetoothIndicator,
|
||||
IdleIndicator,
|
||||
MicrophoneIndicator,
|
||||
Network,
|
||||
NetworkIndicator,
|
||||
PowerProfileIndicator,
|
||||
SystemInfo,
|
||||
TaskBar,
|
||||
VolumeIndicator,
|
||||
workspace,
|
||||
Recorder,
|
||||
)
|
||||
from services import ScreenRecorder
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class Bar(Window):
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
layer="top",
|
||||
anchor="left bottom right",
|
||||
@@ -31,6 +32,8 @@ class Bar(Window):
|
||||
visible=False,
|
||||
all_visible=False,
|
||||
)
|
||||
self.screen_recorder = ScreenRecorder()
|
||||
self.workspaces = Button(child=workspace, name="workspaces")
|
||||
self.language = Language(
|
||||
formatter=FormattedString(
|
||||
"{replace_lang(language)}",
|
||||
@@ -42,23 +45,39 @@ class Bar(Window):
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
self.date_time = DateTime(formatters=["%-I:%M %a %d %b"], name="datetime")
|
||||
# self.system_tray = SystemTray(name="tray", spacing=4, icon_size=18)
|
||||
self.taskbar = TaskBar()
|
||||
self.volume = VolumeIndicator()
|
||||
self.network = Network()
|
||||
self.bluetooth = Bluetooth()
|
||||
|
||||
self.recording_indicator = Button(
|
||||
name="bar-button",
|
||||
child=MaterialIcon("screen_record", size=16),
|
||||
visible=False,
|
||||
on_clicked=lambda *_: self.screen_recorder.screencast_stop(),
|
||||
)
|
||||
|
||||
self.screen_recorder.connect(
|
||||
"recording",
|
||||
lambda _, status: self.recording_indicator.set_visible(status),
|
||||
)
|
||||
|
||||
self.battery = BatteryLabel(name="battery")
|
||||
self.volume = VolumeIndicator()
|
||||
self.bluetooth = BluetoothIndicator()
|
||||
self.network = NetworkIndicator()
|
||||
self.microphone = MicrophoneIndicator()
|
||||
self.workspaces = Button(child=workspace, name="workspaces")
|
||||
self.info = SystemInfo()
|
||||
self.idle = IdleIndicator()
|
||||
self.taskbar = TaskBar()
|
||||
self.info = SystemInfo()
|
||||
self.powerindicator = PowerProfileIndicator()
|
||||
self.tray = SystemTray(name="tray", icon_size=16, spacing=4)
|
||||
self.recorder = Recorder()
|
||||
|
||||
self.applets = Box(
|
||||
name="applets",
|
||||
spacing=4,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.language,
|
||||
self.powerindicator,
|
||||
self.bluetooth,
|
||||
self.network,
|
||||
self.volume,
|
||||
@@ -82,16 +101,15 @@ class Bar(Window):
|
||||
name="center-container",
|
||||
spacing=8,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.taskbar,
|
||||
],
|
||||
children=self.taskbar,
|
||||
),
|
||||
end_children=Box(
|
||||
name="end-container",
|
||||
spacing=8,
|
||||
orientation="h",
|
||||
children=[
|
||||
# self.system_tray,
|
||||
self.recorder,
|
||||
self.tray,
|
||||
self.battery,
|
||||
self.applets,
|
||||
self.date_time,
|
||||
|
||||
@@ -42,7 +42,7 @@ class SystemInfo(Button):
|
||||
|
||||
def _create_progress_bar(self):
|
||||
return CircularProgressBar(
|
||||
style_classes="progress", line_style="round", line_width=1, size=30
|
||||
name="progress", line_style="round", line_width=1, size=30
|
||||
)
|
||||
|
||||
def _create_label(self):
|
||||
|
||||
@@ -11,7 +11,6 @@ from fabric.widgets.label import Label
|
||||
from fabric.widgets.revealer import Revealer
|
||||
from fabric.widgets.scrolledwindow import ScrolledWindow
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
|
||||
from modules.launcher.widgets import (
|
||||
BluetoothMenu,
|
||||
Calendar,
|
||||
|
||||
@@ -7,26 +7,16 @@ from gi.repository import Gio, GLib
|
||||
from loguru import logger
|
||||
|
||||
|
||||
|
||||
class ScreenRecorder(Service):
|
||||
@Signal
|
||||
def recording(self, value: bool) -> None: ...
|
||||
|
||||
_instance = None
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
if hasattr(self, "_initialized") and self._initialized:
|
||||
return
|
||||
def __init__(self, **kwargs):
|
||||
self.screenshot_path = GLib.get_home_dir() + "/Pictures/Screenshots/"
|
||||
self.screenrecord_path = GLib.get_home_dir() + "/Videos/Screencasting/"
|
||||
self._current_screencast_path = None
|
||||
self.screenrecord_path = GLib.get_home_dir() + "/Videos/Screenrecords/"
|
||||
|
||||
super().__init__(**kwargs)
|
||||
self._initialized = True
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not cls._instance:
|
||||
cls._instance = super(ScreenRecorder, cls).__new__(cls, *args, **kwargs)
|
||||
return cls._instance
|
||||
|
||||
def screenshot(self, fullscreen=False, save_copy=True):
|
||||
time = datetime.datetime.today().strftime("%Y-%m-%d_%H-%M-%S")
|
||||
@@ -37,13 +27,13 @@ class ScreenRecorder(Service):
|
||||
else ["grimblast", "copy" "screen"]
|
||||
)
|
||||
if not fullscreen:
|
||||
command[2] = "area"
|
||||
command[3] = "area"
|
||||
try:
|
||||
subprocess.run(command, check=True)
|
||||
self.send_screenshot_notification(
|
||||
file_path=file_path if file_path else None,
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logger.error(f"[SCREENSHOT] Failed to run command: {command}")
|
||||
|
||||
def screencast_start(self, fullscreen=False):
|
||||
@@ -54,6 +44,7 @@ class ScreenRecorder(Service):
|
||||
return
|
||||
time = datetime.datetime.today().strftime("%Y-%m-%d_%H-%M-%S")
|
||||
file_path = self.screenrecord_path + str(time) + ".mp4"
|
||||
|
||||
self._current_screencast_path = file_path
|
||||
area = "" if fullscreen else f"-g '{exec_shell_command('slurp')}'"
|
||||
command = f"wf-recorder --file={file_path} --pixel-format yuv420p {area}"
|
||||
@@ -61,25 +52,11 @@ class ScreenRecorder(Service):
|
||||
self.emit("recording", True)
|
||||
|
||||
def screencast_stop(self):
|
||||
if not self.is_recording:
|
||||
logger.error("[SCREENRECORD] No active recording to stop")
|
||||
return
|
||||
exec_shell_command_async("killall -INT wf-recorder")
|
||||
self.emit("recording", False)
|
||||
self.send_screencast_notification(self._current_screencast_path)
|
||||
|
||||
# def screencast_stop(self):
|
||||
# exec_shell_command_async("killall -INT wf-recorder")
|
||||
# self.emit("recording", False)
|
||||
# if hasattr(self, "_current_screencast_path") and self._current_screencast_path:
|
||||
# self.send_screencast_notification(self._current_screencast_path)
|
||||
# else:
|
||||
# logger.error("[SCREENRECORD] No active screencast to stop")
|
||||
#
|
||||
def send_screencast_notification(self, file_path):
|
||||
# TODO: Generate a thumbnail
|
||||
# exec_shell_command_async(f"totem-video-thumbnailer {file_path} {FABRIC_CACHE}")
|
||||
|
||||
cmd = ["notify-send"]
|
||||
cmd.extend(
|
||||
[
|
||||
@@ -161,4 +138,5 @@ class ScreenRecorder(Service):
|
||||
|
||||
@Property(bool, "readable", default_value=False)
|
||||
def is_recording(self):
|
||||
return False if len(exec_shell_command("pidof wf-recorder")) == 0 else True
|
||||
return len(exec_shell_command("pidof wf-recorder")) != 0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@import url(../../../.cache/material/colors.css);
|
||||
@import "launcher.css";
|
||||
@import "bar.css";
|
||||
@import "notification.css";
|
||||
@import "osd.css";
|
||||
@import url(/home/sankalp/.cache/material/colors.css);
|
||||
@import "./launcher.css";
|
||||
@import "./bar.css";
|
||||
@import "./notification.css";
|
||||
@import "./osd.css";
|
||||
|
||||
* {
|
||||
all: unset;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||
|
||||
# Opacity Rules
|
||||
|
||||
# Xwaylandvideobridge (if installed)
|
||||
windowrulev2 = opacity 0.0 override,class:^(xwaylandvideobridge)$
|
||||
@@ -10,52 +9,22 @@ windowrulev2 = maxsize 1 1,class:^(xwaylandvideobridge)$
|
||||
windowrulev2 = noblur,class:^(xwaylandvideobridge)$
|
||||
|
||||
# Workspace Rules
|
||||
windowrule = workspace 5, ^(.*vlc*)$
|
||||
windowrule = workspace 2, ^(.*neovim*)$
|
||||
|
||||
#windowrule = stayfocused, ^(com.github.Aylur.ags)$
|
||||
windowrule = float, ^(com.github.Aylur.ags)$
|
||||
windowrule=float,title:^(Volume Control)(.*)$
|
||||
|
||||
# MPV
|
||||
windowrule = workspace 5, ^(.*mpv*)$
|
||||
windowrulev2 = float, class:^(.*mpv.*)
|
||||
windowrulev2 = size 70% 70%, class:^(.*mpv.*)
|
||||
|
||||
|
||||
# Do not lose focus when gnome polkit is opened
|
||||
windowrulev2 = stayfocused, class:(polkit-gnome-authentication-agent-1)
|
||||
# MPV/VLC
|
||||
windowrule = workspace 5, ^(.*vlc.*)$|(.*mpv.*)$
|
||||
windowrulev2 = float, class:^(.*mpv.*)$|(.*vlc.*)$
|
||||
windowrulev2 = size 70% 70%, class:^(.*mpv.*)$|(.*vlc.*)$
|
||||
|
||||
# Pavucontrol
|
||||
windowrulev2 = float, class:(pavucontrol)
|
||||
windowrulev2 = size 533 533, class:(pavucontrol)
|
||||
windowrulev2 = center, class:(pavucontrol)
|
||||
windowrulev2 = float, class:^(pavucontrol|org.pulseaudio.pavucontrol|com.saivert.pavucontrol)$
|
||||
|
||||
# Zathura
|
||||
#Zathura
|
||||
$zathura = class:^(.*zathura.*)$
|
||||
windowrulev2 = float, $zathura
|
||||
windowrulev2 = size 35% 90%, $zathura
|
||||
windowrulev2 = center 1, $zathura
|
||||
|
||||
|
||||
# Do not lose focus when gnome polkit is opened
|
||||
windowrulev2 = stayfocused, class:(polkit-gnome-authentication-agent-1)
|
||||
|
||||
# OBS
|
||||
|
||||
# Main window / Profile screen
|
||||
windowrulev2 = size 75% 70%, class:(com.obsproject.Studio), title:(.*Profile:.*)
|
||||
|
||||
# Class settings
|
||||
windowrulev2 = workspace 9, class:(com.obsproject.Studio)
|
||||
windowrulev2 = float, class:(com.obsproject.Studio)
|
||||
windowrulev2 = center, class:(com.obsproject.Studio)
|
||||
|
||||
# Folder picker
|
||||
windowrulev2 = size 50% 45%, class:(com.obsproject.Studio), title:(Select Recording Directory)
|
||||
windowrulev2 = center, class:(com.obsproject.Studio), title:(Select Recording Directory)
|
||||
|
||||
|
||||
# Fireox class settings
|
||||
windowrulev2 = workspace 3, class:^(firefox)$
|
||||
windowrulev2 = pin,title:^(Picture-in-Picture)$
|
||||
@@ -65,31 +34,9 @@ windowrulev2 = move 72% 7%,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = idleinhibit fullscreen, class:^(.*firefox.*)$
|
||||
|
||||
# Thunar
|
||||
windowrulev2 = size 456 884, title:(.*Compress.*), class:(thunar)
|
||||
windowrulev2 = center, title:(.*Compress.*), class:(thunar)
|
||||
windowrulev2 = float, title:(.*Compress.*), class:(thunar)
|
||||
|
||||
windowrulev2 = size 516 158, title:(.*Rename.*), class:(thunar)
|
||||
windowrulev2 = center, title:(.*Rename.*), class:(thunar)
|
||||
|
||||
windowrulev2 = size 950 270, title:(Confirm to replace files), class:(thunar)
|
||||
windowrulev2 = center, title:(Confirm to replace files), class:(thunar)
|
||||
windowrulev2 = float,title:^(Confirm to replace files)
|
||||
|
||||
windowrulev2 = size 444 103, title:(File Operation Progress), class:(thunar)
|
||||
windowrulev2 = center, title:(File Operation Progress), class:(thunar)
|
||||
|
||||
windowrulev2 = size 565 591, class:(thunar), title:(Properties)
|
||||
windowrulev2 = center, class:(thunar), title:(Properties)
|
||||
|
||||
windowrulev2 = size 477 149, class:(thunar), title:(Create New Folder)
|
||||
windowrulev2 = center, class:(thunar), title:(Create New Folder)
|
||||
|
||||
windowrulev2 = float, class:([Tt]hunar), title:(File Operation Progress)
|
||||
windowrulev2 = float, class:([Tt]hunar), title:(Confirm to replace files)
|
||||
windowrulev2 = workspace 4, class:(thunar)
|
||||
#windowrulev2 = float, class:(thunar)
|
||||
#windowrulev2 = size 1161 619, class:(thunar)
|
||||
#windowrulev2 = center, class:(thunar)
|
||||
|
||||
|
||||
# File / Folder pickers
|
||||
$center-float = class:^(center-float)$|^(.*file-roller.*)$|^(.*FileRoller.*)$
|
||||
@@ -101,20 +48,6 @@ windowrulev2 = size 50% 50%, $center-float-title
|
||||
windowrulev2 = center 1, $center-float
|
||||
windowrulev2 = center 1, $center-float-title
|
||||
|
||||
|
||||
# VS Code
|
||||
# windowrulev2 = workspace 2, class:^(.*Code.*)$|(.*codium.*)$|(.*VSCodium.*)
|
||||
|
||||
|
||||
# Telegram
|
||||
windowrulev2 = fullscreen, class:(.*materialgram.*), title:(Media viewer)
|
||||
windowrulev2 = workspace 6, class:(.*materialgram.*)
|
||||
windowrulev2 = size 833 455, class:(.*materialgram.*), title:(Choose Files)
|
||||
windowrulev2 = center, class:(.*materialgram.*), title:(Choose Files)
|
||||
|
||||
# discord
|
||||
windowrulev2 = workspace 7, class:^(.*discord.*)$|(.*vesktop.*)$|(.*WebCord.*)$
|
||||
|
||||
# File Roller
|
||||
windowrulev2 = workspace 4, class:(file-roller), title:(Archive Manager)
|
||||
windowrulev2 = float, class:(file-roller), title:(Archive Manager)
|
||||
@@ -124,71 +57,61 @@ windowrulev2 = float, class:(file-roller), title:(Extract archive)
|
||||
windowrulev2 = size 30% 15%, class:(file-roller), title:(Extract archive)
|
||||
windowrulev2 = center, class:(file-roller), title:(Extract archive)
|
||||
|
||||
# VS Code
|
||||
# windowrulev2 = workspace 2, class:(codium|codium-url-handler|VSCodium|code-oss|code)
|
||||
windowrulev2 = float, class:(codium|codium-url-handler|VSCodium|code-oss|code), title:(Add Folder to Workspace)
|
||||
|
||||
# Telegram
|
||||
windowrulev2 = fullscreen, class:^(.*materialgram.*)$|(.*telegram-desktop.*), title:(Media viewer)
|
||||
windowrulev2 = workspace 6, class:^(.*materialgram.*)$|(.*telegram-desktop.*)$
|
||||
windowrulev2 = size 833 455, class:^(.*materialgram.*)$|(.*telegram-desktop.*)$, title:(Choose Files)
|
||||
windowrulev2 = center, class:^(.*materialgram.*)$|(.*telegram-desktop.*), title:(Choose Files)
|
||||
|
||||
# discord
|
||||
windowrulev2 = workspace 7, class:^(.*discord.*)$|(.*vesktop.*)$|(.*WebCord.*)$
|
||||
|
||||
# Kitty
|
||||
windowrule = float, title:^(Kitty)$
|
||||
windowrule = size 800 500, title:^(Kitty)$
|
||||
windowrule = move center, title:^(Kitty)$
|
||||
windowrule = animation slide, title:^(Kitty)$
|
||||
windowrule = float, title:^(Kitty)$
|
||||
windowrulev2 = float,class:^(kitty)$,title:^(Kitty)$
|
||||
windowrulev2 = size 800 500, class^(kitty)$, title:^(Kitty)$
|
||||
windowrulev2 = move center, class^(kitty)$, title:^(Kitty)$
|
||||
windowrulev2 = animation slide, class:^(kitty)$, title:^(Kitty)$
|
||||
windowrulev2 = float, class:^(kitty)$, title:^(Kitty)$
|
||||
|
||||
# Bluetooth applet
|
||||
windowrulev2 = float, class:(blueman)
|
||||
windowrulev2 = size 680 665, class:(blueman)
|
||||
windowrulev2 = center, class:(blueman)
|
||||
|
||||
|
||||
# IMV image viewer
|
||||
$center-float-large = class:^(center-float-large)$|^(.*imv.*)$|^(.*imv-dir.*)$
|
||||
windowrulev2 = float, $center-float-large
|
||||
windowrulev2 = size 70% 70%, $center-float-large
|
||||
windowrulev2 = center 1, $center-float-large
|
||||
|
||||
|
||||
# qt5ct / qt6ct
|
||||
windowrulev2 = float, class:(qt5ct)
|
||||
windowrulev2 = float, class:(qt6ct)
|
||||
|
||||
windowrulev2 = size 1256 689, class:(qt5ct)
|
||||
windowrulev2 = size 1256 689, class:(qt6ct)
|
||||
|
||||
windowrulev2 = center, class:(qt5ct)
|
||||
windowrulev2 = center, class:(qt6ct)
|
||||
|
||||
windowrulev2 = size 257 116, class:(qt5ct), title:(Enter Color Scheme Name)
|
||||
windowrulev2 = size 257 116, class:(qt6ct), title:(Enter Color Scheme Name)
|
||||
|
||||
windowrulev2 = size 548 476, class:(qt5ct), title:(Select Color)
|
||||
windowrulev2 = size 548 476, class:(qt6ct), title:(Select Color)
|
||||
|
||||
windowrulev2 = float, class:^(nwg-look|qt5ct|qt6ct)$
|
||||
windowrulev2 = size 60% 70%, class:^(qt6ct)$
|
||||
|
||||
# Other
|
||||
windowrule = float, nm-connection-editor|vlc|yad|rofi|Lxappearance
|
||||
windowrule = float, org.kde.polkit-kde-authentication-agent-1
|
||||
windowrule = float, nm-connection-editor|yad|Lxappearance
|
||||
windowrulev2 = size 543 239, class:^(polkit-gnome-authentication-agent-1)$
|
||||
windowrulev2 = float, class:^(polkit-gnome-authentication-agent-1)$
|
||||
windowrulev2 = center, class:(polkit-gnome-authentication-agent-1)
|
||||
windowrulev2 = float, class:(electron), title:(Add Folder to Workspace)
|
||||
windowrulev2 = float, class:^(org.kde.polkit-kde-authentication-agent-1)$
|
||||
windowrulev2 = float, class:(xdg-desktop-portal-gtk)
|
||||
windowrulev2 = size 70% 70%, class:^(xdg-desktop-portal-gtk)$
|
||||
windowrulev2 = stayfocused, class:(polkit-gnome-authentication-agent-1)
|
||||
|
||||
windowrulev2 = float, title:(File Operation Progress)
|
||||
windowrulev2 = center, title:(File Operation Progress)
|
||||
|
||||
|
||||
|
||||
windowrulev2 = stayfocused, class:(launcher)
|
||||
# Layer Rules
|
||||
#Layer Rules
|
||||
# layerrule = noanim, popup.*
|
||||
layerrule = noanim, hyprpicker
|
||||
layerrule = noanim, selection
|
||||
|
||||
layerrule = noanim, noanim
|
||||
layerrule = ignorezero, gtk-layer-shell
|
||||
layerrule = blur, notifications
|
||||
layerrule = ignorealpha 0.69, notifications
|
||||
layerrule = noanim,selection
|
||||
layerrule = noanim, notifications
|
||||
|
||||
# layerrule = noanim, fabric
|
||||
layerrule = animation slide, launcher
|
||||
|
||||
# fabric
|
||||
# layerrule = noanim, fabric
|
||||
# layerrule = ignorezero, fabric
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
DIR="$HOME/Pictures/screenshots/"
|
||||
NAME="screenshot_$(date +%d%m%Y_%H%M%S).png"
|
||||
|
||||
# hyprshot -z -m region -o "/tmp" -f "$NAME" -s
|
||||
|
||||
if [[ "$1" == "--window" ]]; then
|
||||
hyprshot -z -m window -o "/tmp" -f "$NAME" -s
|
||||
elif [[ "$1" == "--active" ]]; then
|
||||
hyprshot -z -m active -m output -o "/tmp" -f "$NAME" -s
|
||||
else
|
||||
hyprshot -z -m region -o "/tmp" -f "$NAME" -s --
|
||||
fi
|
||||
|
||||
swappy -f "/tmp/$NAME" -o "$DIR$NAME"
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script is used for the lockscreen battery indicator.
|
||||
|
||||
for bat in /sys/class/power_supply/BAT*; do
|
||||
if [ -e "$bat/uevent" ]; then
|
||||
BAT_PATH="$bat"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$BAT_PATH" ]; then
|
||||
echo "No battery found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read battery status and capacity from the uevent file
|
||||
POWER_SUPPLY_STATUS=$(grep "^POWER_SUPPLY_STATUS=" "$BAT_PATH/uevent" | cut -d'=' -f2)
|
||||
POWER_SUPPLY_CAPACITY=$(grep "^POWER_SUPPLY_CAPACITY=" "$BAT_PATH/uevent" | cut -d'=' -f2)
|
||||
|
||||
# Check if the values are actually found
|
||||
if [ -z "$POWER_SUPPLY_STATUS" ] || [ -z "$POWER_SUPPLY_CAPACITY" ]; then
|
||||
echo "Error: Could not read battery status or capacity."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A battery_icons_charging=(
|
||||
[100]="battery_charging_full"
|
||||
[90]="battery_charging_90"
|
||||
[80]="battery_charging_80"
|
||||
[70]="battery_charging_80"
|
||||
[60]="battery_charging_60"
|
||||
[50]="battery_charging_50"
|
||||
[40]="battery_charging_30"
|
||||
[30]="battery_charging_30"
|
||||
[20]="battery_charging_20"
|
||||
[10]="battery_charging_20"
|
||||
[0]="battery_charging_20"
|
||||
)
|
||||
|
||||
declare -A battery_icons=(
|
||||
[100]="battery_full"
|
||||
[90]="battery_6_bar"
|
||||
[80]="battery_5_bar"
|
||||
[70]="battery_5_bar"
|
||||
[60]="battery_4_bar"
|
||||
[50]="battery_3_bar"
|
||||
[40]="battery_2_bar"
|
||||
[30]="battery_2_bar"
|
||||
[20]="battery_1_bar"
|
||||
[10]="battery_1_bar"
|
||||
[0]="battery_alert"
|
||||
)
|
||||
|
||||
get_closest_battery_icon() {
|
||||
local level="$1"
|
||||
local charging="$2"
|
||||
local -n icons_array
|
||||
|
||||
if [ "$charging" = "true" ]; then
|
||||
icons_array=battery_icons_charging
|
||||
else
|
||||
icons_array=battery_icons
|
||||
fi
|
||||
|
||||
local levels=($(for key in "${!icons_array[@]}"; do echo "$key"; done | sort -nr))
|
||||
|
||||
for threshold in "${levels[@]}"; do
|
||||
if [ "$level" -ge "$threshold" ]; then
|
||||
echo "${icons_array[$threshold]}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${icons_array[${levels[-1]}]}"
|
||||
}
|
||||
|
||||
icon() {
|
||||
local capacity="$POWER_SUPPLY_CAPACITY"
|
||||
local charging="false"
|
||||
|
||||
if [ "$POWER_SUPPLY_STATUS" = "Charging" ]; then
|
||||
charging="true"
|
||||
fi
|
||||
|
||||
get_closest_battery_icon "$capacity" "$charging"
|
||||
}
|
||||
|
||||
info() {
|
||||
cat "$BAT_PATH/uevent"
|
||||
}
|
||||
|
||||
status() {
|
||||
echo "$POWER_SUPPLY_CAPACITY%"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
info) info ;;
|
||||
icon) icon ;;
|
||||
status) status ;;
|
||||
*)
|
||||
echo "Usage: $0 {info|icon|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
############ Variables ############
|
||||
enable_battery=false
|
||||
|
||||
####### Check availability ########
|
||||
for battery in /sys/class/power_supply/*BAT*; do
|
||||
if [[ -f "$battery/uevent" ]]; then
|
||||
enable_battery=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
############# Output #############
|
||||
if [[ $enable_battery == true ]]; then
|
||||
if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then
|
||||
echo -n "(+) "
|
||||
fi
|
||||
echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% remaining
|
||||
echo ''
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@@ -114,10 +114,10 @@ async def main():
|
||||
wallpaper_engine = settings['wallpaper-engine']
|
||||
hyprpaper_tpl = settings['hyprpaper-tpl']
|
||||
|
||||
new_wallpaper = f"{HOME}/dotfiles/wallpapers/lake.png"
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/1.png"
|
||||
|
||||
if random:
|
||||
files = [f for f in os.listdir(f"{HOME}/Pictures/wallpapers") if f.endswith(('.png', '.jpg', '.jpeg'))]
|
||||
files = [f for f in os.listdir(f"{HOME}/Pictures/wallpapers/") if f.endswith(('.png', '.jpg', '.jpeg'))]
|
||||
if files:
|
||||
new_wallpaper = join(f"{HOME}/Pictures/wallpapers", _random.choice(files))
|
||||
elif prev:
|
||||
@@ -192,7 +192,7 @@ async def main():
|
||||
if custom_color != "none"
|
||||
else None
|
||||
)),
|
||||
scheme=GENERATOR.schemes[generation_scheme]
|
||||
scheme_name=generation_scheme
|
||||
)
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
@@ -1,40 +1,28 @@
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pickle
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import numpy as np
|
||||
from materialyoucolor.dynamiccolor.material_dynamic_colors import (
|
||||
MaterialDynamicColors,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.hct import Hct # type: ignore
|
||||
from materialyoucolor.quantize import QuantizeCelebi # type: ignore
|
||||
from materialyoucolor.scheme.dynamic_scheme import DynamicScheme # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_content import SchemeContent # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_expressive import (
|
||||
SchemeExpressive,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fidelity import (
|
||||
SchemeFidelity,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fruit_salad import (
|
||||
SchemeFruitSalad,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_monochrome import (
|
||||
SchemeMonochrome,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_neutral import SchemeNeutral # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_rainbow import SchemeRainbow # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_tonal_spot import (
|
||||
SchemeTonalSpot,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_vibrant import SchemeVibrant # type: ignore # noqa
|
||||
from materialyoucolor.score.score import Score # type: ignore
|
||||
import json
|
||||
from PIL import Image
|
||||
import argparse
|
||||
from materialyoucolor.quantize import QuantizeCelebi # type: ignore
|
||||
from materialyoucolor.score.score import Score # type: ignore
|
||||
from materialyoucolor.hct import Hct # type: ignore
|
||||
from materialyoucolor.dynamiccolor.material_dynamic_colors import MaterialDynamicColors # type: ignore # noqa
|
||||
from materialyoucolor.scheme.dynamic_scheme import DynamicScheme # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_tonal_spot import SchemeTonalSpot # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_expressive import SchemeExpressive # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fruit_salad import SchemeFruitSalad # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_monochrome import SchemeMonochrome # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_rainbow import SchemeRainbow # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_vibrant import SchemeVibrant # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_neutral import SchemeNeutral # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fidelity import SchemeFidelity # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_content import SchemeContent # type: ignore # noqa
|
||||
import hashlib
|
||||
import pickle
|
||||
import numpy as np
|
||||
import re
|
||||
|
||||
|
||||
schemes = {
|
||||
"tonalSpot": SchemeTonalSpot,
|
||||
|
||||
Reference in new issue
Block a user