big updates
No files matched your search
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"custom-color": "none",
|
||||
"swww-anim": "wipe",
|
||||
"color-scheme": "dark",
|
||||
"generation-scheme": "tonalSpot",
|
||||
"wallpaper-engine": "swww",
|
||||
"hyprpaper-tpl": "preload = WALLPAPER\n wallpaper = ,WALLPAPER\n splash = false"
|
||||
}
|
||||
@@ -36,7 +36,6 @@ export const updateGenerationScheme = async (scheme: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let theme_reload_lock = false;
|
||||
const color_generator = `${GLib.get_home_dir()}/dotfiles/material-colors/generate.py`;
|
||||
|
||||
@@ -83,55 +82,59 @@ function toHex(value: number) {
|
||||
return hex.length == 1 ? "0" + hex : hex;
|
||||
}
|
||||
|
||||
const ReloadTheme = () => {
|
||||
const ReloadTheme = async () => {
|
||||
let { color, scheme } = theme_settings;
|
||||
let _color = color.value;
|
||||
let color_to_write = _color;
|
||||
|
||||
if (_color.length > 0 && isNumeric(_color) && Number(_color) >= 0 && Number(_color) <= 360) {
|
||||
_color = hueToHex(Number(_color));
|
||||
color_to_write = `-${color.value}`;
|
||||
color_to_write = `${color.value}`;
|
||||
}
|
||||
|
||||
if (theme_reload_lock) return;
|
||||
function Default() {
|
||||
Utils.execAsync(`python -O ${color_generator} -w --color-scheme "${theme.value}" --scheme "${scheme.value}"`)
|
||||
.finally(() => {
|
||||
theme_reload_lock = false;
|
||||
})
|
||||
.then(() => {
|
||||
// Update custom-color in settings.json
|
||||
Utils.readFileAsync(settings_file)
|
||||
.then((out) => {
|
||||
const settings = JSON.parse(out);
|
||||
settings["custom-color"] = "none";
|
||||
Utils.writeFile(JSON.stringify(settings, null, 2), settings_file).catch(print);
|
||||
})
|
||||
.catch(print);
|
||||
})
|
||||
.catch(print);
|
||||
}
|
||||
|
||||
theme_reload_lock = true;
|
||||
if (_color != "none" && _color.length > 6)
|
||||
Utils.execAsync(
|
||||
`python -O ${color_generator} --color "${_color}" --color-scheme "${theme.value}" --scheme "${scheme.value}"`
|
||||
)
|
||||
.finally(() => {
|
||||
theme_reload_lock = false;
|
||||
})
|
||||
.then(() => {
|
||||
// Update custom-color in settings.json
|
||||
Utils.readFileAsync(settings_file)
|
||||
.then((out) => {
|
||||
const settings = JSON.parse(out);
|
||||
settings["custom-color"] = color_to_write;
|
||||
Utils.writeFile(JSON.stringify(settings, null, 2), settings_file).catch(print);
|
||||
})
|
||||
.catch(print);
|
||||
})
|
||||
.catch((err) => {
|
||||
print(err);
|
||||
Default();
|
||||
});
|
||||
else Default();
|
||||
|
||||
const updateSettingsFile = async (customColor: string) => {
|
||||
try {
|
||||
const settingsContent = await Utils.readFile(settings_file);
|
||||
const settings = JSON.parse(settingsContent);
|
||||
settings["custom-color"] = customColor;
|
||||
await Utils.writeFile(JSON.stringify(settings, null, 2), settings_file);
|
||||
} catch (error) {
|
||||
print(`Failed to update custom-color in settings.json: ${error}`);
|
||||
}
|
||||
};
|
||||
|
||||
const Default = async () => {
|
||||
try {
|
||||
await Utils.execAsync(
|
||||
`python -O ${color_generator} -w --color-scheme "${theme.value}" --scheme "${scheme.value}"`
|
||||
);
|
||||
await updateSettingsFile("none");
|
||||
} catch (error) {
|
||||
print(error);
|
||||
} finally {
|
||||
theme_reload_lock = false;
|
||||
}
|
||||
};
|
||||
|
||||
if (_color !== "none" && _color.length > 6) {
|
||||
try {
|
||||
await Utils.execAsync(
|
||||
`python -O ${color_generator} --color "${_color}" --color-scheme "${theme.value}" --scheme "${scheme.value}"`
|
||||
);
|
||||
await updateSettingsFile(color_to_write);
|
||||
} catch (error) {
|
||||
print(error);
|
||||
await Default();
|
||||
} finally {
|
||||
theme_reload_lock = false;
|
||||
}
|
||||
} else {
|
||||
await Default();
|
||||
}
|
||||
};
|
||||
|
||||
const DarkTheme = () =>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"custom-color": "none",
|
||||
"swww-anim": "wipe",
|
||||
"color-scheme": "dark",
|
||||
"generation-scheme": "tonalSpot"
|
||||
}
|
||||
@@ -30,6 +30,7 @@ const Windows = () => [
|
||||
forMonitors(BarCornerTopRight),
|
||||
sideright,
|
||||
sideleft,
|
||||
cheatsheet,
|
||||
forMonitors(popups)
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import argparse
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -9,28 +9,29 @@ group.add_argument('--browser', type=str, help="Change default browser")
|
||||
group.add_argument('--filemanager', type=str, help="Change file manager")
|
||||
group.add_argument('--editor', type=str, help="Change default editor")
|
||||
group.add_argument('--terminal', type=str, help="Change default terminal")
|
||||
group.add_argument('--get', type=str, help="Get default app", choices=["browser", "editor", "terminal", "filemanager"])
|
||||
group.add_argument('--get', type=str, help="Get default app",
|
||||
choices=["browser", "editor", "terminal", "filemanager"])
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
config_file = os.path.expanduser("~/dotfiles/hypr/UserConfigs/Apps.conf")
|
||||
json_config_file = os.path.expanduser("~/dotfiles/ags/assets/apps.json")
|
||||
browser = args.browser
|
||||
filemanager = args.filemanager
|
||||
editor = args.editor
|
||||
terminal = args.terminal
|
||||
get = args.get
|
||||
|
||||
def read_apps_conf():
|
||||
with open(config_file) as f:
|
||||
return f.read().strip()
|
||||
value = (args.browser or args.filemanager or
|
||||
args.editor or args.terminal or args.get)
|
||||
|
||||
def write_apps_conf(content):
|
||||
with open(config_file, 'w') as f:
|
||||
f.write(content + '\n')
|
||||
u = os.path.expanduser
|
||||
|
||||
def read_json_config():
|
||||
with open(json_config_file) as json_file:
|
||||
return json.load(json_file)
|
||||
CONFIG_FILE = u("~/dotfiles/hypr/conf/apps.conf")
|
||||
JSON_CONFIG_FILE = u("~/dotfiles/.settings/apps.json")
|
||||
|
||||
with open(CONFIG_FILE) as f:
|
||||
original_env_str = f.read().strip()
|
||||
env_str = original_env_str
|
||||
|
||||
def write_json_config(config):
|
||||
with open(json_config_file, 'w') as json_file:
|
||||
json.dump(config, json_file, indent=4)
|
||||
|
||||
def which(program: str):
|
||||
def is_executable(fpath):
|
||||
@@ -48,8 +49,12 @@ def which(program: str):
|
||||
return exe_file
|
||||
raise ProgramNotFound(value)
|
||||
|
||||
|
||||
def extract_associations(env_str):
|
||||
pattern = re.compile(r'^\s*env\s*=\s*(\w+)\s*,\s*(.*?)\s*#\s*!\s*-\s*@(\w+)\s*$', re.MULTILINE) # noqa
|
||||
pattern = re.compile(
|
||||
r'^\s*env\s*=\s*(\w+)\s*,\s*(.*?)\s*#\s*!\s*-\s*@(\w+)\s*$',
|
||||
re.MULTILINE
|
||||
)
|
||||
associations = {}
|
||||
matches = pattern.findall(env_str)
|
||||
for key, _, association in matches:
|
||||
@@ -59,53 +64,82 @@ def extract_associations(env_str):
|
||||
associations[association].append(key)
|
||||
return associations
|
||||
|
||||
|
||||
associations = extract_associations(env_str)
|
||||
|
||||
|
||||
def replace_value(env_str, key, new_value):
|
||||
pattern = re.compile(
|
||||
r'^(\s*env\s*=\s*' +
|
||||
re.escape(key) +
|
||||
r'\s*,\s*)(.*?)\s*(#.*)?$', re.MULTILINE
|
||||
r'\s*,\s*)(.*?)\s*(#.*)?$',
|
||||
re.MULTILINE
|
||||
)
|
||||
return re.sub(pattern, r'\1' + new_value + r' \3', env_str)
|
||||
|
||||
|
||||
class AssociationNotFound(Exception):
|
||||
def __init__(self, name: str, *args: object) -> None:
|
||||
error = f"{name} association not found"
|
||||
error = f"{name} association not found, \n{associations}"
|
||||
super().__init__(error, *args)
|
||||
|
||||
|
||||
class ProgramNotFound(Exception):
|
||||
def __init__(self, name: str, *args: object) -> None:
|
||||
error = f"{name} not found"
|
||||
super().__init__(error, *args)
|
||||
|
||||
|
||||
def change_association(key: str, value: str):
|
||||
env_str = read_apps_conf()
|
||||
global env_str
|
||||
which(value)
|
||||
associations = extract_associations(env_str)
|
||||
if key not in associations:
|
||||
raise AssociationNotFound(key)
|
||||
|
||||
for key in associations[key]:
|
||||
env_str = replace_value(env_str, key, value)
|
||||
for assoc_key in associations[key]:
|
||||
env_str = replace_value(env_str, assoc_key, value)
|
||||
|
||||
|
||||
def read_json_config():
|
||||
try:
|
||||
with open(JSON_CONFIG_FILE) as json_file:
|
||||
return json.load(json_file)
|
||||
except IOError as e:
|
||||
print(f"Error reading {JSON_CONFIG_FILE}: {e}")
|
||||
raise
|
||||
|
||||
|
||||
def write_json_config(config):
|
||||
try:
|
||||
with open(JSON_CONFIG_FILE, 'w') as json_file:
|
||||
json.dump(config, json_file, indent=4)
|
||||
except IOError as e:
|
||||
print(f"Error writing to {JSON_CONFIG_FILE}: {e}")
|
||||
raise
|
||||
|
||||
write_apps_conf(env_str)
|
||||
|
||||
def update_json_config(key: str, value: str):
|
||||
config = read_json_config()
|
||||
config[key] = value
|
||||
write_json_config(config)
|
||||
|
||||
if args.get:
|
||||
|
||||
if get:
|
||||
json_config = read_json_config()
|
||||
print(json_config[args.get])
|
||||
elif args.browser:
|
||||
change_association("browser", args.browser)
|
||||
update_json_config("browser", args.browser)
|
||||
elif args.filemanager:
|
||||
change_association("filemanager", args.filemanager)
|
||||
update_json_config("filemanager", args.filemanager)
|
||||
elif args.editor:
|
||||
change_association("editor", args.editor)
|
||||
update_json_config("editor", args.editor)
|
||||
elif args.terminal:
|
||||
change_association("terminal", args.terminal)
|
||||
update_json_config("terminal", args.terminal)
|
||||
print(json_config[get])
|
||||
elif browser:
|
||||
change_association("browser", value)
|
||||
update_json_config("browser", value)
|
||||
elif filemanager:
|
||||
change_association("filemanager", value)
|
||||
update_json_config("filemanager", value)
|
||||
elif editor:
|
||||
change_association("editor", value)
|
||||
update_json_config("editor", value)
|
||||
elif terminal:
|
||||
change_association("terminal", value)
|
||||
update_json_config("terminal", value)
|
||||
|
||||
if env_str != original_env_str:
|
||||
with open(CONFIG_FILE, 'w') as f:
|
||||
f.write(env_str + '\n')
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
GENERATOR="$HOME/dotfiles/material-colors/generate.py"
|
||||
SETTINGS_FILE="$HOME/dotfiles/ags/assets/settings.json"
|
||||
SETTINGS_FILE="$HOME/dotfiles/.settings/settings.json"
|
||||
|
||||
# Function to read a value from the JSON file
|
||||
get_json_value() {
|
||||
|
||||
@@ -72,9 +72,9 @@ const reload = () => {
|
||||
weather.setValue(JSON.parse(out));
|
||||
})
|
||||
.catch(print);
|
||||
}
|
||||
};
|
||||
Utils.interval(150, reload);
|
||||
configuration.connect("changed", reload)
|
||||
configuration.connect("changed", reload);
|
||||
|
||||
export const idle_inhibitor = Variable(false);
|
||||
export const cur_uptime = Variable("error");
|
||||
@@ -100,7 +100,7 @@ export const kernel_name = await Utils.execAsync(`${App.configDir}/scripts/syste
|
||||
export const hostname = await Utils.execAsync(`${App.configDir}/scripts/system.sh --hostname`);
|
||||
export const current_os = await Utils.execAsync(`${App.configDir}/scripts/system.sh --os`);
|
||||
|
||||
export const settings_file = `${GLib.get_home_dir()}/dotfiles/ags/assets/settings.json`;
|
||||
export const settings_file = `${GLib.get_home_dir()}/dotfiles/.settings/settings.json`;
|
||||
export const wallpaper_cache_file = `${GLib.get_home_dir()}/.cache/current_wallpaper`;
|
||||
|
||||
function checkBrightness() {
|
||||
@@ -114,7 +114,6 @@ export const current_brightness = Variable(100, {
|
||||
poll: [500, checkBrightness]
|
||||
});
|
||||
|
||||
|
||||
function readSettingsFile() {
|
||||
Utils.readFileAsync(settings_file)
|
||||
.then((out) => {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--enable-features=UseOzonePlatform --ozone-platform=wayland
|
||||
@@ -3,7 +3,7 @@
|
||||
$scriptsDir = $HOME/.config/hypr/scripts
|
||||
|
||||
# Startup
|
||||
exec-once = swww-daemon --format xrgb
|
||||
exec-once = $scriptsDir/init-wallpaper-engine.sh
|
||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||
exec-once = dbus-update-activation-environment --systemd --all
|
||||
|
||||
@@ -15,59 +15,43 @@ $RunCMD = $scriptsDir/RunCMD.sh
|
||||
#! @windows: Windows
|
||||
#! @workspaces: Workspaces
|
||||
#! @misc: Misc
|
||||
#! @plugins: Plugins
|
||||
|
||||
|
||||
|
||||
# Power off, Reboot, Log out, Lockscreen,
|
||||
bind = $mainMod CTRL, L, exec, pidof hyprlock || hyprlock -q #! @description: "Lock screen"; @actions;
|
||||
bind = $mainMod CTRL, P, exec, systemctl poweroff #! @description: "ShutDown"; @actions;
|
||||
bind = $mainMod CTRL, R, exec, systemctl reboot #! @description: "Restart"; @actions;
|
||||
bind = $mainMod CTRL, Q, exec, loginctl kill-session $XDG_SESSION_ID #! @description: "LogOut"; @actions;
|
||||
bind = CTRL SHIFT, R, exec, pkill ags ; ags
|
||||
|
||||
# Terminals
|
||||
# Applications
|
||||
bind = ALT SHIFT,Return, exec, kitty --title Kitty --single-instance #! @description: "Terminal Float"; @apps;
|
||||
bind = $mainMod, Return, exec, kitty #! @description: "Terminal"; @apps;
|
||||
|
||||
# Apps
|
||||
bind = $mainMod, E, exec, thunar #! @description: "File Manager"; @apps;
|
||||
bind = ALT, F, exec, firefox #! @description: "Browser"; @apps;
|
||||
bind = ALT, Y, exec, pypr toggle yazi && hyprctl dispatch bringactivetotop #! @description: "File Manager"; @apps;
|
||||
bind = $mainMod, Slash, exec, pypr toggle nvim && hyprctl dispatch bringactivetotop #! @description: "Neovim"; @apps;
|
||||
bind = $mainMod, Return, exec, $scriptsDir/apps.sh terminal #! @description: "Terminal"; @apps;
|
||||
bind = $mainMod, E, exec, $scriptsDir/apps.sh filemanager #! @description: "File Manager"; @apps;
|
||||
bind = ALT, F, exec, $scriptsDir/apps.sh browser #! @description: "Browser"; @apps;
|
||||
|
||||
|
||||
# FEATURES / EXTRAS
|
||||
# Actions
|
||||
bind = $mainMod SHIFT, G, exec, $RunCMD gamemode #! @description: "Toggle animations"; @actions;
|
||||
bind = ALT, F3, exec, $RunCMD kb_changer #! @description: "Change Keyboard Layout"; @actions;
|
||||
bind = $mainMod SHIFT, B, exec, $RunCMD toggle_blur #! @description: "Toggle blur"; @actions;
|
||||
bind = $mainMod, space, exec, $RunCMD change_layout #! @description: "Change Layout(master/dwindle)"; @actions;
|
||||
bind = SHIFT ALT,W, exec, python -O $scriptsDir/wallpaper.py -R #! @description: "Random wallpaper"; @actions;
|
||||
bind = $mainMod, COMMA, exec, pypr zoom #! @description: "Zoom the screen"; @plugins;
|
||||
bind = ALT, COMMA, exec, pypr zoom +1 #! @description: "Increase Zoom"; @plugins;
|
||||
|
||||
|
||||
|
||||
# AGS
|
||||
bind = $mainMod, D, exec, ags -r "toggleAppsWindow()" #! @description: "App Launcher"; @apps;
|
||||
bind = $mainMod SHIFT, Z, exec, ags -r "toggleMediaWindow()" #! @description: "Players"; @actions;
|
||||
bind = ALT, R, exec, ags -t sidebar #! @description: "rightbar"; @actions;
|
||||
bind = ALT, L, exec, ags -t sideleft #! @description: "leftbar"; @actions;
|
||||
bind = $mainMod, PERIOD, exec, ags -r "OpenEmojiPicker()" #! @description: "Emoji Picker"; @actions;
|
||||
bind = SHIFT ALT, C, exec, ags -r "toggleClipsWindow()" #! @description: "Clipboard history"; @actions;
|
||||
bind = $mainMod, W, exec, ags -r "OpenSettings('wallpaper')" #! @description: "Change wallpaper"; @actions;
|
||||
bind = $mainMod SHIFT, S, exec, ags -r 'OpenSettings()' #! @description: "Setting"; @actions;
|
||||
bind = ALT, F1, exec, ags -t cheatsheet #! @description: "List of keybindings"; @misc;
|
||||
|
||||
# Online Music related keybinds
|
||||
bind = ALT, M, exec, $RunCMD music -m # open rofi music
|
||||
bind = ALT, S, exec, $RunCMD music -s # Stop
|
||||
bind = ALT, N, exec, $RunCMD music -n # Next
|
||||
bind = ALT, P, exec, $RunCMD music -p # Previous
|
||||
bind = ALT, R, exec, $RunCMD music -k # Resume
|
||||
|
||||
# ScreenShot
|
||||
bind = $mainMod, Z, exec, $scriptsDir/ScreenShot.sh --area #! @description: "Window screenshot"; @actions;
|
||||
bind = ,Print, exec, $scriptsDir/ScreenShot.sh --now #! @description: "Screenshot"; @actions;
|
||||
bind = $mainMod CTRL, L, exec, pidof hyprlock || hyprlock -q #! @description: "Lock screen"; @actions;
|
||||
bind = $mainMod CTRL, P, exec, systemctl poweroff #! @description: "ShutDown"; @actions;
|
||||
bind = $mainMod CTRL, R, exec, systemctl reboot #! @description: "Restart"; @actions;
|
||||
bind = $mainMod CTRL, Q, exec, loginctl kill-session $XDG_SESSION_ID #! @description: "LogOut"; @actions;
|
||||
bind = CTRL SHIFT, R, exec, pkill ags ; ags #! @description: "Reload AGS" @actions;
|
||||
|
||||
# Tools
|
||||
bind = $mainMod, D, exec, ags -r "toggleAppsWindow()" #! @description: "App Launcher"; @tools;
|
||||
bind = $mainMod SHIFT, Z, exec, ags -r "toggleMediaWindow()" #! @description: "Players"; @tools;
|
||||
bind = ALT, R, exec, ags -t sidebar #! @description: "rightbar"; @tools;
|
||||
bind = ALT, L, exec, ags -t sideleft #! @description: "leftbar"; @tools;
|
||||
bind = $mainMod, PERIOD, exec, ags -r "OpenEmojiPicker()" #! @description: "Emoji Picker"; @tools;
|
||||
bind = SHIFT ALT, C, exec, ags -r "toggleClipsWindow()" #! @description: "Clipboard history"; @tools;
|
||||
bind = $mainMod, W, exec, ags -r "OpenSettings('wallpaper')" #! @description: "Change wallpaper"; @tools;
|
||||
bind = $mainMod SHIFT, S, exec, ags -r 'OpenSettings()' #! @description: "Setting"; @tools;
|
||||
bind = ALT, F1, exec, ags -t cheatsheet #! @description: "List of keybindings"; @tools;
|
||||
|
||||
|
||||
# Misc
|
||||
# misc
|
||||
bind = $mainMod ALT, P, submap, passthru #! @description: "Passthrough $mainMod key to Virtual Machine"; @misc;
|
||||
submap = passthru
|
||||
bind = $mainMod ALT, P, submap, reset #! @description: "Cancel passthrough"; @misc;
|
||||
submap = reset
|
||||
@@ -1,3 +0,0 @@
|
||||
general {
|
||||
resize_on_border = true
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||
|
||||
# Opacity Rules
|
||||
windowrulev2 = opacity 0.9 0.6, class:^([Rr]ofi)$
|
||||
windowrulev2 = opacity 0.9 0.6, class:^(yad)$
|
||||
windowrulev2 = opacity 0.9 0.6, class:^(mousepad)$
|
||||
windowrulev2 = opacity 0.9 0.9, class:^(geany)$
|
||||
windowrulev2 = opacity 0.80 0.70,class:^(nm-applet)$
|
||||
windowrulev2 = opacity 0.80 0.70,class:^(nm-connection-editor)$
|
||||
|
||||
# Xwaylandvideobridge (if installed)
|
||||
windowrulev2 = opacity 0.0 override,class:^(xwaylandvideobridge)$
|
||||
windowrulev2 = noanim,class:^(xwaylandvideobridge)$
|
||||
windowrulev2 = noinitialfocus,class:^(xwaylandvideobridge)$
|
||||
windowrulev2 = maxsize 1 1,class:^(xwaylandvideobridge)$
|
||||
windowrulev2 = noblur,class:^(xwaylandvideobridge)$
|
||||
|
||||
# Workspace Rules
|
||||
windowrule = workspace 5, ^(.*vlc*)$
|
||||
|
||||
#windowrule = stayfocused, ^(com.github.Aylur.ags)$
|
||||
windowrule = float, ^(com.github.Aylur.ags)$
|
||||
|
||||
# MPV
|
||||
windowrule = workspace 5, ^(.*mpv*)$
|
||||
windowrulev2 = float, class:^(.*mpv.*)
|
||||
windowrulev2 = size 70% 70%, class:^(.*mpv.*)
|
||||
|
||||
|
||||
# Do not lose focus when rofi or gnome polkit is opened
|
||||
windowrulev2 = stayfocused, class:(rofi)
|
||||
windowrulev2 = stayfocused, class:(polkit-gnome-authentication-agent-1)
|
||||
|
||||
# Pavucontrol
|
||||
windowrulev2 = float, class:(pavucontrol)
|
||||
windowrulev2 = size 533 533, class:(pavucontrol)
|
||||
windowrulev2 = center, class:(pavucontrol)
|
||||
|
||||
# Zathura
|
||||
$zathura = class:^(.*zathura.*)$
|
||||
windowrulev2 = float, $zathura
|
||||
windowrulev2 = size 35% 90%, $zathura
|
||||
windowrulev2 = center 1, $zathura
|
||||
|
||||
|
||||
# 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 = workspace 3, class:^(qutebrowser)$
|
||||
windowrulev2 = workspace 3, class:^(Firefox-esr)$
|
||||
windowrulev2 = opacity 0.9 0.9, class:^(firefox)$
|
||||
windowrulev2 = opacity 0.95 0.95,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = pin,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = float, title:^(Picture-in-Picture)$
|
||||
windowrulev2 = size 25% 25%,title:^(Picture-in-Picture)$
|
||||
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 = workspace 4, class:(thunar)
|
||||
windowrulev2 = opacity 0.9 0.9, class:^([Tt]hunar)$
|
||||
#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.*)$
|
||||
$center-float-title = title:^(.*Open Folder.*)$|^(.*Open File.*)$|^(.*Save File.*)$|^(.*Save Folder.*)$|^(.*Save Image.*)$|^(.*Save As.*)$|^(.*Open As.*)$
|
||||
windowrulev2 = float, $center-float
|
||||
windowrulev2 = float, $center-float-title
|
||||
windowrulev2 = size 50% 50%, $center-float
|
||||
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.*)
|
||||
windowrulev2 = opacity 0.9 0.9, class:^(.*Code.*)$|(.*codium.*)$|(.*codium-url-handler.*)$|(.*VSCodium.*)
|
||||
|
||||
|
||||
# Telegram
|
||||
# windowrulev2 = fullscreen, class:(org.telegram.desktop), title:(Media viewer)
|
||||
|
||||
windowrulev2 = opacity 0.90, class:^(org.telegram.desktop)$
|
||||
windowrulev2 = workspace 6, class:(org.telegram.desktop)
|
||||
windowrulev2 = size 833 455, class:(org.telegram.desktop), title:(Choose Files)
|
||||
windowrulev2 = center, class:(org.telegram.desktop), title:(Choose Files)
|
||||
#windowrulev2 = float, class:^(org.telegram.desktop)$
|
||||
#windowrulev2 = center, class:^(org.telegram.desktop)$
|
||||
#windowrulev2 = size 800 800, class:^(org.telegram.desktop)$
|
||||
|
||||
# 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)
|
||||
windowrulev2 = size 45% 50%, class:(file-roller), title:(Archive Manager)
|
||||
windowrulev2 = center, class:(file-roller), title:(Archive Manager)
|
||||
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)
|
||||
|
||||
|
||||
# qBittorrent
|
||||
windowrulev2 = workspace 9, class:(org.qbittorrent.qBittorrent)
|
||||
windowrulev2 = float, class:(org.qbittorrent.qBittorrent)
|
||||
windowrulev2 = size 1137 547, class:(org.qbittorrent.qBittorrent), title:(.*qbittorrent.*)
|
||||
windowrulev2 = center, class:(org.qbittorrent.qBittorrent), title:(.*qbittorrent.*)
|
||||
|
||||
|
||||
# Kitty
|
||||
windowrule = opacity 0.9 0.9,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)$
|
||||
windowrule = float, kitty_float
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
# Other
|
||||
windowrule = float, nm-connection-editor|vlc|yad|rofi|Lxappearance
|
||||
windowrule = float, org.kde.polkit-kde-authentication-agent-1
|
||||
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, title:(File Operation Progress)
|
||||
windowrulev2 = center, title:(File Operation Progress)
|
||||
|
||||
|
||||
|
||||
# Layer Rules
|
||||
layerrule = noanim, hyprpicker
|
||||
|
||||
layerrule = noanim, noanim
|
||||
layerrule = blur, gtk-layer-shell
|
||||
layerrule = ignorezero, gtk-layer-shell
|
||||
layerrule = blur, launcher
|
||||
layerrule = ignorealpha 0.5, launcher
|
||||
layerrule = blur, notifications
|
||||
layerrule = ignorealpha 0.69, notifications
|
||||
|
||||
layerrule = noanim, notifications
|
||||
@@ -11,14 +11,13 @@ $mainMod = SUPER
|
||||
#! @windows: Windows
|
||||
#! @workspaces: Workspaces
|
||||
#! @misc: Misc
|
||||
#! @plugins: Plugins
|
||||
|
||||
|
||||
# Master Layout
|
||||
bind = ALT, Space, layoutmsg, removemaster #! @description: "Remove Master"; @windows;
|
||||
bind = $mainMod, I, layoutmsg, addmaster #! @description: "Add Master"; @windows;
|
||||
bind = $mainMod, L, layoutmsg, cyclenext #! @description: "cycle next in Master"; @windows;
|
||||
bind = $mainMod, H, layoutmsg, cycleprev #! @description: "cycle prev in Master"; @windows;
|
||||
bind = ALT, Space, layoutmsg, removemaster
|
||||
bind = $mainMod, I, layoutmsg, addmaster
|
||||
bind = $mainMod, L, layoutmsg, cyclenext
|
||||
bind = $mainMod, H, layoutmsg, cycleprev
|
||||
bind = $mainMod, P, pseudo, # dwindle #! @description: "Toggle dwindle"; @windows;
|
||||
bind = $mainMod, S, layoutmsg, swapwithmaster #! @description: "Swap with master"; @windows;
|
||||
|
||||
@@ -29,9 +28,7 @@ bind = $mainMod SHIFT, C, closewindow, #! @description: "Close window"
|
||||
bind = $mainMod, F, exec, hyprctl dispatch togglefloating && hyprctl dispatch centerwindow 1 #! @description: "Toggle to center"; @windows;
|
||||
bind = $mainMod ALT, F, exec, hyprctl dispatch workspaceopt allfloat #! @description: "Toggle all float windows"; @windows;
|
||||
bind = $mainMod SHIFT, F, togglefloating, #! @description: "Toggle floating"; @windows;
|
||||
bind = CTRL ALT, Delete, exit, #exit hyprland #! @description: "Exit hyprland"; @actions;
|
||||
bind = $mainMod SHIFT, Space, fullscreen, 0 #! @description: "Open window in full screen mode"; @windows;
|
||||
bind = $mainMod SHIFT, O, toggleopaque #! @description: "Toggle opaque"; @actions;
|
||||
|
||||
# Change Workspace Mode
|
||||
bind = $mainMod SHIFT, F, exec, hyprctl dispatch workspaceopt allfloat
|
||||
@@ -49,11 +46,6 @@ bind = $mainMod SHIFT, Tab, focusmonitor, -1 #! @description: "Toggle Fo
|
||||
#bind = $mainMod, Tab, workspace, m+1
|
||||
#bind = $mainMod SHIFT, Tab, workspace, m-1
|
||||
|
||||
# Special Workspace
|
||||
bind = $mainMod, U, togglespecialworkspace, #! @description: "Toggle Special Workspace"; @workspaces;
|
||||
bind = $mainMod SHIFT, U, movetoworkspace, special #! @description: "Move to Special Workspace"; @windows;
|
||||
|
||||
|
||||
# Resize Active (Using arrow)
|
||||
binde = $mainMod ALT, left, resizeactive, -20 0
|
||||
binde = $mainMod ALT, right, resizeactive, 20 0
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# refer to Hyprland wiki for more info https://wiki.hyprland.org/Configuring/Variables
|
||||
|
||||
# Initial boot script enable to apply initial wallpapers, theming, new settings etc.
|
||||
exec-once = $HOME/.config/hypr/initial-boot.sh
|
||||
@@ -3,7 +3,6 @@
|
||||
# Default Configs
|
||||
$configs = $HOME/.config/hypr/configs
|
||||
|
||||
source=$configs/Settings.conf
|
||||
source=$configs/Keybinds.conf
|
||||
|
||||
# User Configs
|
||||
@@ -16,7 +15,6 @@ source= $UserConfigs/Monitors.conf
|
||||
source= $UserConfigs/Laptops.conf
|
||||
source= $UserConfigs/LaptopDisplay.conf
|
||||
source= $UserConfigs/WindowRules.conf
|
||||
source= $UserConfigs/custom.conf
|
||||
source= $UserConfigs/UserKeybinds.conf
|
||||
source= $UserConfigs/UserSettings.conf
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
general {
|
||||
grace = 5
|
||||
hide_cursor = true
|
||||
ignore_empty_input = true
|
||||
text_trim = true
|
||||
}
|
||||
|
||||
# BACKGROUND
|
||||
background {
|
||||
monitor =
|
||||
path = ~/.cache/current_wallpaper.png # only png supported for now
|
||||
color = rgba(<background.rgb>, 1.0)
|
||||
blur_passes = 3 # 0 disables blurring
|
||||
path = ~/.cache/current_wallpaper.png
|
||||
blur_passes = 3 3 0 disable blurring
|
||||
blur_size = 1
|
||||
noise = 0.01
|
||||
contrast = 0.8916
|
||||
@@ -18,86 +11,102 @@ background {
|
||||
vibrancy_darkness = 0.0
|
||||
}
|
||||
|
||||
input-field {
|
||||
monitor =
|
||||
size = 200, 50
|
||||
outline_thickness = 3
|
||||
dots_size = 0.33
|
||||
dots_spacing = 0.15
|
||||
dots_center = true
|
||||
dots_rounding = -1
|
||||
outer_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
inner_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
font_color = rgb(<onSurface.rgb>)
|
||||
fade_on_empty = false
|
||||
fade_timeout = 1000
|
||||
font_family = Product Sans
|
||||
placeholder_text = <span foreground="#<onSurfaceVariant>">$USER</span>
|
||||
hide_input = false
|
||||
rounding = 4
|
||||
check_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
fail_color = rgb(<onErrorContainer.rgb>)
|
||||
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i>
|
||||
fail_transition = 200
|
||||
capslock_color = -1
|
||||
numlock_color = -1
|
||||
bothlock_color = -1
|
||||
invert_numlock = false
|
||||
swap_font_color = false
|
||||
position = 0, 70
|
||||
halign = center
|
||||
valign = bottom
|
||||
# GENERAL
|
||||
general {
|
||||
no_fade_in = false
|
||||
grace = 5
|
||||
disable_loading_bar = false
|
||||
}
|
||||
|
||||
# DATE
|
||||
|
||||
# Day-Month-Date
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%d %b %A")"
|
||||
text = cmd[update:1000] echo -e "$(date +"%A, %B %d")"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 14
|
||||
font_size = 25
|
||||
font_family = JetBrains Mono Nerd Font Mono ExtraBold
|
||||
position = 0, 350
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
# Time
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo "<span>$(date +"%I:%M %P")</span>"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 120
|
||||
font_family = Product Sans Semibold
|
||||
position = 0, 250
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
# Profie-Photo
|
||||
image {
|
||||
monitor =
|
||||
path = ~/.face.icon
|
||||
border_size = 2
|
||||
border_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
size = 130
|
||||
rounding = -1
|
||||
rotate = 0
|
||||
reload_time = -1
|
||||
reload_cmd =
|
||||
position = 0, 40
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
# USER-BOX
|
||||
shape {
|
||||
monitor =
|
||||
size = 300, 60
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
rounding = -1
|
||||
border_size = 0
|
||||
border_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
rotate = 0
|
||||
xray = false # if true, make a "hole" in the background (rectangle of specified size, no rotation)
|
||||
|
||||
position = 0, -130
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
# TIME HR
|
||||
# USER
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%H")"
|
||||
text = $USER
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
shadow_pass = 2
|
||||
shadow_size = 3
|
||||
shadow_color = rgb(0,0,0)
|
||||
shadow_boost = 1.2
|
||||
font_size = 150
|
||||
font_family = Product Sans Semibold
|
||||
position = 0, -250
|
||||
outline_thickness = 2
|
||||
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
|
||||
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
|
||||
dots_center = true
|
||||
font_size = 18
|
||||
font_family = Product Sans Semibold
|
||||
position = 0, -130
|
||||
halign = center
|
||||
valign = top
|
||||
valign = center
|
||||
}
|
||||
|
||||
# TIME
|
||||
label {
|
||||
# INPUT FIELD
|
||||
input-field {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%M")"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 150
|
||||
font_family = Product Sans Semibold
|
||||
position = 0, -420
|
||||
size = 300, 60
|
||||
outline_thickness = 2
|
||||
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
|
||||
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
|
||||
dots_center = true
|
||||
outer_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
inner_color = rgb(<surfaceContainerHigh.rgb>)
|
||||
font_color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
fade_on_empty = false
|
||||
font_family = Product Sans
|
||||
placeholder_text = <i><span>🔒 Enter Pass</span></i>
|
||||
hide_input = false
|
||||
position = 0, -210
|
||||
halign = center
|
||||
valign = top
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = $LAYOUT
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 10
|
||||
font_family = Product Sans Semibold
|
||||
position = 0, 130
|
||||
halign = center
|
||||
valign = bottom
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
valign = center
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A bash script designed to run only once to install dotfiles
|
||||
# THIS SCRIPT CAN BE DELETED ONCE SUCCESSFULLY BOOTED!!
|
||||
|
||||
# Variables
|
||||
color_scheme="prefer-dark"
|
||||
gtk_theme="adw-gtk3-dark"
|
||||
icon_theme="Tela-nord-dark"
|
||||
cursor_theme="Bibata-Original-Classic"
|
||||
font_name="JetBrainsMono Nerd Font 12"
|
||||
|
||||
# Check if a marker file exists.
|
||||
if [ ! -f "$HOME/.cache/.initial_startup_done" ]; then
|
||||
|
||||
# Initiate GTK dark mode and apply icon and cursor theme
|
||||
gsettings set org.gnome.desktop.interface color-scheme "$color_scheme" > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "$gtk_theme" > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.wm.preferences theme "$gtk_theme" > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$icon_theme" > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.interface cursor-theme "$cursor_theme" > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.interface cursor-size 6 > /dev/null 2>&1 &
|
||||
gsettings set org.gnome.desktop.interface font-name "$font_name" > /dev/null 2>&1 &
|
||||
|
||||
|
||||
# Initiate the keyboard layout
|
||||
kb_layout=$(grep 'kb_layout=' "$HOME/dotfiles/hypr/UserConfigs/UserSettings.conf" | cut -d '=' -f 2 | cut -d ',' -f 1)
|
||||
echo "$kb_layout" > "$HOME/.cache/kb_layout"
|
||||
|
||||
# Create a marker file to indicate that the script has been executed.
|
||||
touch "$HOME/.cache/.initial_startup_done"
|
||||
|
||||
exit
|
||||
fi
|
||||
@@ -1,23 +0,0 @@
|
||||
[pyprland]
|
||||
plugins = ["scratchpads", "expose", "magnify"]
|
||||
|
||||
[scratchpads.terminal]
|
||||
command = "kitty --class scratchpad-large"
|
||||
excludes = ["yazi", "btop"]
|
||||
lazy = true
|
||||
|
||||
[scratchpads.yazi]
|
||||
command = "kitty --class scratchpad-large yazi"
|
||||
lazy = true
|
||||
|
||||
[scratchpads.nvim]
|
||||
command = "kitty --class scratchpad-large nvim"
|
||||
lazy = true
|
||||
|
||||
[scratchpads.btop]
|
||||
command = "kitty --class scratchpad-large btop"
|
||||
lazy = true
|
||||
|
||||
[scratchpads.cava]
|
||||
command = "kitty --class scratchpad-mini cava"
|
||||
lazy = true
|
||||
@@ -0,0 +1,221 @@
|
||||
import os
|
||||
import sys
|
||||
import importlib.util
|
||||
import argparse
|
||||
import fcntl
|
||||
import subprocess
|
||||
import asyncio
|
||||
import random as _random
|
||||
import colorsys
|
||||
import json
|
||||
|
||||
lock_file_path = '/tmp/wallpaper.lock'
|
||||
|
||||
def acquire_lock():
|
||||
global lock_file
|
||||
lock_file = open(lock_file_path, 'w')
|
||||
try:
|
||||
fcntl.flock(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
lock_file.write(str(os.getpid()))
|
||||
lock_file.flush()
|
||||
except IOError:
|
||||
print("Another instance of the script is already running.")
|
||||
sys.exit(1)
|
||||
|
||||
def release_lock():
|
||||
fcntl.flock(lock_file, fcntl.LOCK_UN)
|
||||
lock_file.close()
|
||||
os.remove(lock_file_path)
|
||||
|
||||
def hue_to_numeric_hex(hue):
|
||||
hue = hue / 360.0
|
||||
rgb = colorsys.hls_to_rgb(hue, 0.5, 1.0)
|
||||
hex_color_str = '#{:02x}{:02x}{:02x}'.format(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
|
||||
numeric_hex_color = int(hex_color_str.lstrip('#'), 16)
|
||||
return numeric_hex_color
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-I', '--image', type=str, help="Image")
|
||||
group.add_argument('-P', '--prev', help="Use last used wallpaper for color generation", action='store_true')
|
||||
group.add_argument('-R', '--random', help="Random image from folder", action='store_true')
|
||||
parser.add_argument('-n', '--notify', help="Send notifications", action='store_true')
|
||||
parser.add_argument('--status', type=str, help="Status file", default="/tmp/wallpaper.status")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
random = args.random
|
||||
prev = args.prev
|
||||
image = args.image
|
||||
notify = args.notify
|
||||
status = args.status
|
||||
|
||||
HOME = os.path.expanduser("~")
|
||||
|
||||
# Load configuration from JSON file
|
||||
config_file = f"{HOME}/dotfiles/ags/assets/settings.json" # Path to your JSON configuration file
|
||||
|
||||
with open(config_file, 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
color_scheme = config.get("color-scheme", "dark")
|
||||
custom_color = config.get("custom-color", "none")
|
||||
generation_scheme = config.get("generation-scheme", "tonalSpot")
|
||||
transition_type = config.get("swww-anim", "wipe")
|
||||
|
||||
module_path = f'{HOME}/dotfiles/material-colors'
|
||||
sys.path.append(module_path)
|
||||
|
||||
module_name = 'generate'
|
||||
file_path = f'{module_path}/{module_name}.py'
|
||||
|
||||
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
||||
GENERATOR = importlib.util.module_from_spec(spec) # type: ignore
|
||||
spec.loader.exec_module(GENERATOR) # type: ignore
|
||||
|
||||
cache_file = f"{HOME}/.cache/current_wallpaper"
|
||||
square = f"{HOME}/.cache/square_wallpaper.png"
|
||||
png = f"{HOME}/.cache/current_wallpaper.png"
|
||||
|
||||
def current_state(str: str):
|
||||
with open(status, 'w') as f:
|
||||
f.write(str)
|
||||
|
||||
def send_notify(label: str, desc: str):
|
||||
if not notify:
|
||||
return
|
||||
subprocess.run(["notify-send", label, desc])
|
||||
|
||||
def state(name: str | None, label: str | None, desc: str | None):
|
||||
if name is not None:
|
||||
current_state(name)
|
||||
if label is not None:
|
||||
send_notify(label, desc or "")
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
async def main():
|
||||
state("init", None, None)
|
||||
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/1.jpg"
|
||||
|
||||
if random:
|
||||
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:
|
||||
try:
|
||||
with open(cache_file) as f:
|
||||
new_wallpaper = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
...
|
||||
elif image is not None:
|
||||
new_wallpaper = os.path.abspath(image)
|
||||
|
||||
print(f":: Wallpaper {new_wallpaper}")
|
||||
|
||||
with open(cache_file, 'w') as f:
|
||||
f.write(new_wallpaper)
|
||||
|
||||
with_image = f"with image {new_wallpaper}"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
wallpaper_engine = "swww" # Default wallpaper engine
|
||||
|
||||
state("changing", "Changing wallpaper...", with_image)
|
||||
print(":: Changing wallpaper...")
|
||||
if wallpaper_engine == "swww":
|
||||
print(":: Using swww")
|
||||
|
||||
cursor_pos = subprocess.getoutput('hyprctl cursorpos')
|
||||
|
||||
subprocess.run([
|
||||
'swww', 'img', new_wallpaper,
|
||||
'--transition-bezier', '.43,1.19,1,.4',
|
||||
'--transition-fps', '60',
|
||||
'--transition-type', transition_type,
|
||||
'--transition-duration', '0.7',
|
||||
'--transition-pos', cursor_pos.replace(",",",")
|
||||
])
|
||||
else:
|
||||
print(":: Wallpaper Engine disabled")
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Generate colors
|
||||
# -----------------------------------------------------
|
||||
state("colors", "Generating colors...", with_image)
|
||||
print(":: Generate colors")
|
||||
_starts_with = (lambda x: str(x).startswith("-"))
|
||||
|
||||
GENERATOR.main(
|
||||
color_scheme, new_wallpaper,
|
||||
(hue_to_numeric_hex(int(custom_color.lstrip("-")))
|
||||
if _starts_with(custom_color) else (
|
||||
int(custom_color.lstrip('#'), 16)
|
||||
if custom_color != "none"
|
||||
else None
|
||||
)),
|
||||
scheme=GENERATOR.schemes[generation_scheme]
|
||||
)
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Square image
|
||||
# -----------------------------------------------------
|
||||
square_task = asyncio.create_task(square_image(new_wallpaper))
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Png image
|
||||
# -----------------------------------------------------
|
||||
png_task = asyncio.create_task(png_image(new_wallpaper))
|
||||
|
||||
state("tasks", None, None)
|
||||
await asyncio.gather(square_task, png_task)
|
||||
state("finish", "Wallpaper procedure complete!", with_image)
|
||||
|
||||
async def png_image(wallpaper: str):
|
||||
_from = (".jpg", "jpeg")
|
||||
if not wallpaper.endswith(_from):
|
||||
cmd = f"cp -f {wallpaper} {png}"
|
||||
else:
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Converting jpg to png...", with_image)
|
||||
print(":: Converting jpg to png...")
|
||||
cmd = f"magick {wallpaper} {png}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: JPG successfully converted to PNG!")
|
||||
|
||||
async def square_image(wallpaper):
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Creating square version...", with_image)
|
||||
print(":: Creating square version")
|
||||
cmd = f"magick {wallpaper} -gravity Center -extent 1:1 {square}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: Square image created!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
acquire_lock()
|
||||
try:
|
||||
asyncio.run(main())
|
||||
finally:
|
||||
release_lock()
|
||||
@@ -0,0 +1,262 @@
|
||||
import os
|
||||
import sys
|
||||
import importlib.util
|
||||
import argparse
|
||||
import fcntl
|
||||
import subprocess
|
||||
import asyncio
|
||||
import random as _random
|
||||
import colorsys
|
||||
import json
|
||||
|
||||
lock_file_path = '/tmp/wallpaper.lock'
|
||||
|
||||
|
||||
def acquire_lock():
|
||||
global lock_file
|
||||
lock_file = open(lock_file_path, 'w')
|
||||
try:
|
||||
fcntl.flock(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
lock_file.write(str(os.getpid()))
|
||||
lock_file.flush()
|
||||
except IOError:
|
||||
print("Another instance of the script is already running.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def release_lock():
|
||||
fcntl.flock(lock_file, fcntl.LOCK_UN)
|
||||
lock_file.close()
|
||||
os.remove(lock_file_path)
|
||||
|
||||
|
||||
def hue_to_numeric_hex(hue):
|
||||
hue = hue / 360.0
|
||||
|
||||
rgb = colorsys.hls_to_rgb(hue, 0.5, 1.0)
|
||||
|
||||
hex_color_str = '#{:02x}{:02x}{:02x}'.format(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
|
||||
|
||||
numeric_hex_color = int(hex_color_str.lstrip('#'), 16)
|
||||
|
||||
return numeric_hex_color
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-I', '--image', type=str, help="Image")
|
||||
group.add_argument('-P', '--prev', help="Use last used wallpaper for color generation", action='store_true')
|
||||
group.add_argument('-R', '--random', help="Random image from folder", action='store_true')
|
||||
parser.add_argument('-n', '--notify', help="Send notifications", action='store_true')
|
||||
parser.add_argument('--status', type=str, help="Status file", default="/tmp/wallpaper.status")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
random = args.random
|
||||
prev = args.prev
|
||||
image = args.image
|
||||
notify = args.notify
|
||||
status = args.status
|
||||
|
||||
HOME = os.path.expanduser("~")
|
||||
|
||||
module_path = f'{HOME}/dotfiles/material-colors'
|
||||
sys.path.append(module_path)
|
||||
|
||||
module_name = 'generate'
|
||||
file_path = f'{module_path}/{module_name}.py'
|
||||
|
||||
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
||||
GENERATOR = importlib.util.module_from_spec(spec) # type: ignore
|
||||
spec.loader.exec_module(GENERATOR) # type: ignore
|
||||
|
||||
cache_file = f"{HOME}/.cache/current_wallpaper"
|
||||
square = f"{HOME}/.cache/square_wallpaper.png"
|
||||
png = f"{HOME}/.cache/current_wallpaper.png"
|
||||
|
||||
settings_file = f"{HOME}/dotfiles/ags/assets/settings.json"
|
||||
|
||||
# Read settings from the JSON file
|
||||
with open(settings_file) as f:
|
||||
settings = json.load(f)
|
||||
|
||||
color_scheme = settings.get("color-scheme")
|
||||
custom_color = settings.get("custom-color")
|
||||
generation_scheme = settings.get("generation-scheme")
|
||||
swww_animation = settings.get("swww-anim")
|
||||
wallpaper_engine = settings.get("wallpaper-engine")
|
||||
|
||||
|
||||
def current_state(str: str):
|
||||
with open(status, 'w') as f:
|
||||
f.write(str)
|
||||
|
||||
|
||||
def send_notify(label: str, desc: str):
|
||||
if not notify:
|
||||
return
|
||||
subprocess.run(["notify-send", label, desc])
|
||||
|
||||
|
||||
def state(name: str | None, label: str | None, desc: str | None):
|
||||
if name is not None:
|
||||
current_state(name)
|
||||
if label is not None:
|
||||
send_notify(label, desc or "")
|
||||
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
|
||||
async def main():
|
||||
global color_scheme, custom_color
|
||||
state("init", None, None)
|
||||
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/default.jpg"
|
||||
|
||||
if random:
|
||||
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:
|
||||
try:
|
||||
with open(cache_file) as f:
|
||||
new_wallpaper = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
...
|
||||
elif image is not None:
|
||||
new_wallpaper = os.path.abspath(image)
|
||||
|
||||
print(f":: Wallpaper {new_wallpaper}")
|
||||
|
||||
with open(cache_file, 'w') as f:
|
||||
f.write(new_wallpaper)
|
||||
|
||||
with_image = f"with image {new_wallpaper}"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
|
||||
transition_type = swww_animation
|
||||
# transition_type = "outer"
|
||||
# transition_type = "random"
|
||||
|
||||
state("changing", "Changing wallpaper...", with_image)
|
||||
print(":: Changing wallpaper...")
|
||||
if wallpaper_engine == "swww":
|
||||
print(":: Using swww")
|
||||
|
||||
cursor_pos = subprocess.getoutput('hyprctl cursorpos').replace(", ", ",")
|
||||
|
||||
subprocess.run([
|
||||
'swww', 'img', new_wallpaper,
|
||||
'--transition-bezier', '.43,1.19,1,.4',
|
||||
'--transition-fps', '60',
|
||||
'--transition-type', transition_type,
|
||||
'--transition-duration', '0.7',
|
||||
'--transition-pos', cursor_pos
|
||||
])
|
||||
|
||||
elif wallpaper_engine == "hyprpaper":
|
||||
print(":: Using hyprpaper")
|
||||
|
||||
subprocess.run(['killall', 'hyprpaper'])
|
||||
hyprpaper_tpl_file = os.path.expanduser('~/dotfiles/.settings/hyprpaper.tpl')
|
||||
|
||||
with open(hyprpaper_tpl_file, 'r') as file:
|
||||
wal_tpl = file.read()
|
||||
|
||||
output = wal_tpl.replace('WALLPAPER', new_wallpaper)
|
||||
hyprpaper_conf_file = os.path.expanduser('~/dotfiles/hypr/hyprpaper.conf')
|
||||
|
||||
with open(hyprpaper_conf_file, 'w') as file:
|
||||
file.write(output)
|
||||
|
||||
subprocess.run([
|
||||
"hyprctl", "dispatch", "exec", "hyprpaper"
|
||||
])
|
||||
|
||||
else:
|
||||
print(":: Wallpaper Engine disabled")
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Generate colors
|
||||
# -----------------------------------------------------
|
||||
state("colors", "Generating colors...", with_image)
|
||||
print(":: Generate colors")
|
||||
_starts_with = (lambda x: str(x).startswith("-"))
|
||||
|
||||
GENERATOR.main(
|
||||
color_scheme, new_wallpaper,
|
||||
(hue_to_numeric_hex(int(custom_color.lstrip("-")))
|
||||
if _starts_with(custom_color) else (
|
||||
int(custom_color.lstrip('#'), 16)
|
||||
if custom_color != "none"
|
||||
else None
|
||||
)),
|
||||
scheme=GENERATOR.schemes[generation_scheme]
|
||||
)
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Square image
|
||||
# -----------------------------------------------------
|
||||
square_task = asyncio.create_task(square_image(new_wallpaper))
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Png image
|
||||
# -----------------------------------------------------
|
||||
png_task = asyncio.create_task(png_image(new_wallpaper))
|
||||
|
||||
state("tasks", None, None)
|
||||
await asyncio.gather(square_task, png_task)
|
||||
state("finish", "Wallpaper procedure complete!", with_image)
|
||||
|
||||
|
||||
async def png_image(wallpaper: str):
|
||||
_from = (".jpg", "jpeg")
|
||||
if not wallpaper.endswith(_from):
|
||||
cmd = f"cp -f {wallpaper} {png}"
|
||||
else:
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Converting jpg to png...", with_image)
|
||||
print(":: Converting jpg to png...")
|
||||
cmd = f"magick {wallpaper} {png}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: JPG successfully converted to PNG!")
|
||||
|
||||
|
||||
async def square_image(wallpaper):
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Creating square version...", with_image)
|
||||
print(":: Creating square version")
|
||||
cmd = f"magick {wallpaper} -gravity Center -extent 1:1 {square}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: Square image created!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
acquire_lock()
|
||||
try:
|
||||
asyncio.run(main())
|
||||
finally:
|
||||
release_lock()
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ~/dotfiles/hypr/scripts/Ui_cmd.sh
|
||||
source ~/dotfiles/hypr/scripts/Music_cmd.sh
|
||||
|
||||
|
||||
help() {
|
||||
declare -F
|
||||
|
||||
@@ -43,7 +43,7 @@ shotarea() {
|
||||
local tmpfile=$(mktemp)
|
||||
local area=$(slurp)
|
||||
if [[ -z "$area" ]]; then
|
||||
notify-send -u low -i "$iDIR/picture.png" 'No area selected'
|
||||
notify-send -u low -i "$iDIR/cancel.svg" 'No area selected'
|
||||
rm "$tmpfile"
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -3,30 +3,6 @@
|
||||
notif="$HOME/dotfiles/hypr/assets/bell.png"
|
||||
|
||||
|
||||
|
||||
# For Keyboard Layout Switcher
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Toggle Blur #
|
||||
# #
|
||||
######################################
|
||||
|
||||
toggle_blur (){
|
||||
STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int")
|
||||
|
||||
if [ "${STATE}" == "2" ]; then
|
||||
hyprctl keyword decoration:blur:size 2
|
||||
hyprctl keyword decoration:blur:passes 1
|
||||
notify-send -e -u low -i "$notif" "Less blur"
|
||||
else
|
||||
hyprctl keyword decoration:blur:size 5
|
||||
hyprctl keyword decoration:blur:passes 2
|
||||
notify-send -e -u low -i "$notif" "Normal blur"
|
||||
fi
|
||||
}
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Toggle Animation #
|
||||
@@ -77,32 +53,6 @@ change_layout() {
|
||||
}
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Auto Wallpaper Changer #
|
||||
# #
|
||||
######################################
|
||||
|
||||
auto_wall() {
|
||||
wallDIR="$HOME/Pictures/wallpapers"
|
||||
FPS=60
|
||||
TYPE="random"
|
||||
DURATION=1
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps ${FPS} --transition-type ${TYPE} --transition-duration ${DURATION} --transition-bezier ${BEZIER}"
|
||||
focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
|
||||
INTERVAL=1800 # This controls (in seconds) when to switch to the next image
|
||||
while true; do
|
||||
find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \
|
||||
| shuf -z -n 1 \
|
||||
| xargs -0 -I {} swww img -o $focused_monitor "{}" ${SWWW_PARAMS} &&
|
||||
$RunCMD symlink
|
||||
sleep $INTERVAL
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
######################################
|
||||
# #
|
||||
# GameMode #
|
||||
@@ -122,23 +72,9 @@ gamemode() {
|
||||
}
|
||||
|
||||
######################################
|
||||
# #
|
||||
# Toggle Opaque #
|
||||
# #
|
||||
######################################
|
||||
|
||||
enable_opaque() {
|
||||
sleep 0.2
|
||||
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 0 lock
|
||||
}
|
||||
disable_opaque() {
|
||||
sleep 0.2
|
||||
hyprctl setprop address:$(hyprctl -j activewindow | jq -r -c ".address") forceopaque 1 lock
|
||||
}
|
||||
|
||||
######################################
|
||||
# Keyboard Layout Switcher #
|
||||
# #
|
||||
# #
|
||||
# Keyboard Layout Switcher #
|
||||
# #
|
||||
######################################
|
||||
|
||||
kb_changer() {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to your JSON file
|
||||
JSON_FILE="$HOME/dotfiles/.settings/apps.json"
|
||||
|
||||
# Read the application type from the argument
|
||||
APP_TYPE=$1
|
||||
|
||||
# Extract the corresponding application value from the JSON file using jq
|
||||
APP=$(jq -r ".$APP_TYPE" "$JSON_FILE")
|
||||
|
||||
# Check if the application is defined in the JSON file
|
||||
if [ "$APP" != "null" ]; then
|
||||
# Open the specified application
|
||||
$APP
|
||||
else
|
||||
echo "No application defined for $APP_TYPE in $JSON_FILE"
|
||||
fi
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to your settings JSON file
|
||||
settings_file="$HOME/dotfiles/.settings/settings.json"
|
||||
|
||||
# Read wallpaper engine from the JSON file
|
||||
wallpaper_engine=$(jq -r '.["wallpaper-engine"]' "$settings_file")
|
||||
|
||||
if [ "$wallpaper_engine" == "swww" ]; then
|
||||
# swww
|
||||
echo ":: Using swww"
|
||||
swww-daemon
|
||||
swww-daemon --format xrgb
|
||||
sleep 0.5
|
||||
python -O ~/dotfiles/hypr/scripts/wallpaper.py -P
|
||||
elif [ "$wallpaper_engine" == "hyprpaper" ]; then
|
||||
# hyprpaper
|
||||
echo ":: Using hyprpaper"
|
||||
sleep 0.5
|
||||
python -O ~/dotfiles/hypr/scripts/wallpaper.py -P
|
||||
else
|
||||
echo ":: Wallpaper Engine disabled"
|
||||
python -O ~/dotfiles/hypr/scripts/wallpaper.py -P
|
||||
fi
|
||||
@@ -10,6 +10,8 @@ import colorsys
|
||||
import json
|
||||
|
||||
lock_file_path = '/tmp/wallpaper.lock'
|
||||
settings_file_path = os.path.expanduser('~/dotfiles/.settings/settings.json')
|
||||
|
||||
|
||||
def acquire_lock():
|
||||
global lock_file
|
||||
@@ -22,18 +24,28 @@ def acquire_lock():
|
||||
print("Another instance of the script is already running.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def release_lock():
|
||||
fcntl.flock(lock_file, fcntl.LOCK_UN)
|
||||
lock_file.close()
|
||||
os.remove(lock_file_path)
|
||||
|
||||
|
||||
def hue_to_numeric_hex(hue):
|
||||
hue = hue / 360.0
|
||||
rgb = colorsys.hls_to_rgb(hue, 0.5, 1.0)
|
||||
hex_color_str = '#{:02x}{:02x}{:02x}'.format(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
|
||||
hex_color_str = '#{:02x}{:02x}{:02x}'.format(
|
||||
int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255)
|
||||
)
|
||||
numeric_hex_color = int(hex_color_str.lstrip('#'), 16)
|
||||
return numeric_hex_color
|
||||
|
||||
|
||||
def load_settings():
|
||||
with open(settings_file_path, 'r') as file:
|
||||
return json.load(file)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-I', '--image', type=str, help="Image")
|
||||
@@ -52,17 +64,6 @@ status = args.status
|
||||
|
||||
HOME = os.path.expanduser("~")
|
||||
|
||||
# Load configuration from JSON file
|
||||
config_file = f"{HOME}/dotfiles/ags/assets/settings.json" # Path to your JSON configuration file
|
||||
|
||||
with open(config_file, 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
color_scheme = config.get("color-scheme", "dark")
|
||||
custom_color = config.get("custom-color", "none")
|
||||
generation_scheme = config.get("generation-scheme", "tonalSpot")
|
||||
transition_type = config.get("swww-anim", "wipe")
|
||||
|
||||
module_path = f'{HOME}/dotfiles/material-colors'
|
||||
sys.path.append(module_path)
|
||||
|
||||
@@ -77,28 +78,43 @@ cache_file = f"{HOME}/.cache/current_wallpaper"
|
||||
square = f"{HOME}/.cache/square_wallpaper.png"
|
||||
png = f"{HOME}/.cache/current_wallpaper.png"
|
||||
|
||||
def current_state(str: str):
|
||||
|
||||
def current_state(state_str: str):
|
||||
with open(status, 'w') as f:
|
||||
f.write(str)
|
||||
f.write(state_str)
|
||||
|
||||
|
||||
def send_notify(label: str, desc: str):
|
||||
if not notify:
|
||||
return
|
||||
subprocess.run(["notify-send", label, desc])
|
||||
|
||||
|
||||
def state(name: str | None, label: str | None, desc: str | None):
|
||||
if name is not None:
|
||||
current_state(name)
|
||||
if label is not None:
|
||||
send_notify(label, desc or "")
|
||||
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
|
||||
async def main():
|
||||
global color_scheme, custom_color, generation_scheme, swww_animation, wallpaper_engine, hyprpaper_tpl
|
||||
|
||||
state("init", None, None)
|
||||
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/1.jpg"
|
||||
settings = load_settings()
|
||||
color_scheme = settings['color-scheme']
|
||||
custom_color = settings['custom-color']
|
||||
generation_scheme = settings['generation-scheme']
|
||||
swww_animation = settings['swww-anim']
|
||||
wallpaper_engine = settings['wallpaper-engine']
|
||||
hyprpaper_tpl = settings['hyprpaper-tpl']
|
||||
|
||||
new_wallpaper = f"{HOME}/Picutres/wallpapers/default.jpg"
|
||||
|
||||
if random:
|
||||
files = [f for f in os.listdir(f"{HOME}/Pictures/wallpapers") if f.endswith(('.png', '.jpg', '.jpeg'))]
|
||||
@@ -123,14 +139,16 @@ async def main():
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
wallpaper_engine = "swww" # Default wallpaper engine
|
||||
|
||||
transition_type = swww_animation
|
||||
|
||||
state("changing", "Changing wallpaper...", with_image)
|
||||
print(":: Changing wallpaper...")
|
||||
|
||||
if wallpaper_engine == "swww":
|
||||
print(":: Using swww")
|
||||
|
||||
cursor_pos = subprocess.getoutput('hyprctl cursorpos')
|
||||
cursor_pos = subprocess.getoutput('hyprctl cursorpos').replace(", ", ",")
|
||||
|
||||
subprocess.run([
|
||||
'swww', 'img', new_wallpaper,
|
||||
@@ -138,8 +156,24 @@ async def main():
|
||||
'--transition-fps', '60',
|
||||
'--transition-type', transition_type,
|
||||
'--transition-duration', '0.7',
|
||||
'--transition-pos', cursor_pos.replace(",",",")
|
||||
'--transition-pos', cursor_pos
|
||||
])
|
||||
|
||||
elif wallpaper_engine == "hyprpaper":
|
||||
print(":: Using hyprpaper")
|
||||
|
||||
subprocess.run(['killall', 'hyprpaper'])
|
||||
|
||||
output = hyprpaper_tpl.replace('WALLPAPER', new_wallpaper)
|
||||
hyprpaper_conf_file = os.path.expanduser('~/dotfiles/hypr/hyprpaper.conf')
|
||||
|
||||
with open(hyprpaper_conf_file, 'w') as file:
|
||||
file.write(output)
|
||||
|
||||
subprocess.run([
|
||||
"hyprctl", "dispatch", "exec", "hyprpaper"
|
||||
])
|
||||
|
||||
else:
|
||||
print(":: Wallpaper Engine disabled")
|
||||
|
||||
@@ -175,6 +209,7 @@ async def main():
|
||||
await asyncio.gather(square_task, png_task)
|
||||
state("finish", "Wallpaper procedure complete!", with_image)
|
||||
|
||||
|
||||
async def png_image(wallpaper: str):
|
||||
_from = (".jpg", "jpeg")
|
||||
if not wallpaper.endswith(_from):
|
||||
@@ -196,6 +231,7 @@ async def png_image(wallpaper: str):
|
||||
else:
|
||||
print(":: JPG successfully converted to PNG!")
|
||||
|
||||
|
||||
async def square_image(wallpaper):
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Creating square version...", with_image)
|
||||
@@ -213,6 +249,7 @@ async def square_image(wallpaper):
|
||||
else:
|
||||
print(":: Square image created!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
acquire_lock()
|
||||
try:
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
import os
|
||||
import sys
|
||||
import importlib.util
|
||||
import argparse
|
||||
import fcntl
|
||||
import subprocess
|
||||
import asyncio
|
||||
import random as _random
|
||||
import colorsys
|
||||
|
||||
|
||||
lock_file_path = '/tmp/wallpaper.lock'
|
||||
|
||||
|
||||
def acquire_lock():
|
||||
global lock_file
|
||||
lock_file = open(lock_file_path, 'w')
|
||||
try:
|
||||
fcntl.flock(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
lock_file.write(str(os.getpid()))
|
||||
lock_file.flush()
|
||||
except IOError:
|
||||
print("Another instance of the script is already running.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def release_lock():
|
||||
fcntl.flock(lock_file, fcntl.LOCK_UN)
|
||||
lock_file.close()
|
||||
os.remove(lock_file_path)
|
||||
|
||||
|
||||
def hue_to_numeric_hex(hue):
|
||||
hue = hue / 360.0
|
||||
|
||||
rgb = colorsys.hls_to_rgb(hue, 0.5, 1.0)
|
||||
|
||||
hex_color_str = '#{:02x}{:02x}{:02x}'.format(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
|
||||
|
||||
numeric_hex_color = int(hex_color_str.lstrip('#'), 16)
|
||||
|
||||
return numeric_hex_color
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('-I', '--image', type=str, help="Image")
|
||||
group.add_argument('-P', '--prev', help="Use last used wallpaper for color generation", action='store_true')
|
||||
group.add_argument('-R', '--random', help="Random image from folder", action='store_true')
|
||||
parser.add_argument('-n', '--notify', help="Send notifications", action='store_true')
|
||||
parser.add_argument('--status', type=str, help="Status file", default="/tmp/wallpaper.status")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
random = args.random
|
||||
prev = args.prev
|
||||
image = args.image
|
||||
notify = args.notify
|
||||
status = args.status
|
||||
|
||||
HOME = os.path.expanduser("~")
|
||||
|
||||
module_path = f'{HOME}/dotfiles/material-colors'
|
||||
sys.path.append(module_path)
|
||||
|
||||
module_name = 'generate'
|
||||
file_path = f'{module_path}/{module_name}.py'
|
||||
|
||||
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
||||
GENERATOR = importlib.util.module_from_spec(spec) # type: ignore
|
||||
spec.loader.exec_module(GENERATOR) # type: ignore
|
||||
|
||||
cache_file = f"{HOME}/.cache/current_wallpaper"
|
||||
square = f"{HOME}/.cache/square_wallpaper.png"
|
||||
png = f"{HOME}/.cache/current_wallpaper.png"
|
||||
color_scheme_file = f"{HOME}/dotfiles/.settings/color-scheme"
|
||||
custom_color_file = f"{HOME}/dotfiles/.settings/custom-color"
|
||||
generation_scheme_file = f"{HOME}/dotfiles/.settings/generation-scheme"
|
||||
swww_animation_file = f"{HOME}/dotfiles/.settings/swww-anim"
|
||||
|
||||
|
||||
def current_state(str: str):
|
||||
with open(status, 'w') as f:
|
||||
f.write(str)
|
||||
|
||||
|
||||
def send_notify(label: str, desc: str):
|
||||
if not notify:
|
||||
return
|
||||
subprocess.run(["notify-send", label, desc])
|
||||
|
||||
|
||||
def state(name: str | None, label: str | None, desc: str | None):
|
||||
if name is not None:
|
||||
current_state(name)
|
||||
if label is not None:
|
||||
send_notify(label, desc or "")
|
||||
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
|
||||
async def main():
|
||||
global color_scheme, custom_color
|
||||
state("init", None, None)
|
||||
with open(color_scheme_file) as f:
|
||||
color_scheme = f.read().strip()
|
||||
|
||||
with open(custom_color_file) as f:
|
||||
custom_color = f.read().strip()
|
||||
|
||||
with open(generation_scheme_file) as f:
|
||||
generation_scheme = f.read().strip()
|
||||
|
||||
with open(swww_animation_file) as f:
|
||||
swww_animation = f.read().strip()
|
||||
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/1.jpg"
|
||||
|
||||
if random:
|
||||
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:
|
||||
try:
|
||||
with open(cache_file) as f:
|
||||
new_wallpaper = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
...
|
||||
elif image is not None:
|
||||
new_wallpaper = os.path.abspath(image)
|
||||
|
||||
print(f":: Wallpaper {new_wallpaper}")
|
||||
|
||||
with open(cache_file, 'w') as f:
|
||||
f.write(new_wallpaper)
|
||||
|
||||
with_image = f"with image {new_wallpaper}"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
|
||||
transition_type = swww_animation
|
||||
# transition_type = "outer"
|
||||
# transition_type = "random"
|
||||
|
||||
wallpaper_engine = "swww" # Default wallpaper engine
|
||||
|
||||
state("changing", "Changing wallpaper...", with_image)
|
||||
print(":: Changing wallpaper...")
|
||||
if wallpaper_engine == "swww":
|
||||
print(":: Using swww")
|
||||
|
||||
cursor_pos = subprocess.getoutput('hyprctl cursorpos')
|
||||
|
||||
subprocess.run([
|
||||
'swww', 'img', new_wallpaper,
|
||||
'--transition-bezier', '.43,1.19,1,.4',
|
||||
'--transition-fps', '60',
|
||||
'--transition-type', transition_type,
|
||||
'--transition-duration', '0.7',
|
||||
'--transition-pos', cursor_pos.replace(",",",")
|
||||
])
|
||||
else:
|
||||
print(":: Wallpaper Engine disabled")
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Generate colors
|
||||
# -----------------------------------------------------
|
||||
state("colors", "Generating colors...", with_image)
|
||||
print(":: Generate colors")
|
||||
_starts_with = (lambda x: str(x).startswith("-"))
|
||||
|
||||
GENERATOR.main(
|
||||
color_scheme, new_wallpaper,
|
||||
(hue_to_numeric_hex(int(custom_color.lstrip("-")))
|
||||
if _starts_with(custom_color) else (
|
||||
int(custom_color.lstrip('#'), 16)
|
||||
if custom_color != "none"
|
||||
else None
|
||||
)),
|
||||
scheme=GENERATOR.schemes[generation_scheme]
|
||||
)
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Square image
|
||||
# -----------------------------------------------------
|
||||
square_task = asyncio.create_task(square_image(new_wallpaper))
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Png image
|
||||
# -----------------------------------------------------
|
||||
png_task = asyncio.create_task(png_image(new_wallpaper))
|
||||
|
||||
state("tasks", None, None)
|
||||
await asyncio.gather(square_task, png_task)
|
||||
state("finish", "Wallpaper procedure complete!", with_image)
|
||||
|
||||
|
||||
async def png_image(wallpaper: str):
|
||||
_from = (".jpg", "jpeg")
|
||||
if not wallpaper.endswith(_from):
|
||||
cmd = f"cp -f {wallpaper} {png}"
|
||||
else:
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Converting jpg to png...", with_image)
|
||||
print(":: Converting jpg to png...")
|
||||
cmd = f"magick {wallpaper} {png}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: JPG successfully converted to PNG!")
|
||||
|
||||
|
||||
async def square_image(wallpaper):
|
||||
with_image = f"with image {wallpaper}"
|
||||
state(None, "Creating square version...", with_image)
|
||||
print(":: Creating square version")
|
||||
cmd = f"magick {wallpaper} -gravity Center -extent 1:1 {square}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: Square image created!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
acquire_lock()
|
||||
try:
|
||||
asyncio.run(main())
|
||||
finally:
|
||||
release_lock()
|
||||
@@ -1,78 +0,0 @@
|
||||
# Fonts
|
||||
font_family Iosevka Nerd Font
|
||||
bold_font auto
|
||||
italic_font auto
|
||||
bold_italic_font auto
|
||||
font_size 11
|
||||
|
||||
# Cursor
|
||||
cursor #928374
|
||||
cursor_text_color background
|
||||
scrollback_lines 99999
|
||||
enable_audio_bell no
|
||||
remember_window_size no
|
||||
initial_window_width 840
|
||||
initial_window_height 320
|
||||
confirm_os_window_close 0
|
||||
|
||||
|
||||
|
||||
active_tab_background #47423E
|
||||
active_tab_foreground #E0CDA5
|
||||
active_tab_font_style bold
|
||||
inactive_tab_background #E0CDA5
|
||||
inactive_tab_foreground #928374
|
||||
inactive_tab_font_style normal
|
||||
|
||||
background_opacity 0.9
|
||||
dim_opacity 0.60
|
||||
|
||||
selection_background #E0CDA5
|
||||
selection_foreground #47423E
|
||||
|
||||
|
||||
background #000000
|
||||
foreground #E0CDA5
|
||||
|
||||
# Black
|
||||
color0 #47423E
|
||||
color8 #928374
|
||||
|
||||
# Red
|
||||
color1 #DB4740
|
||||
color9 #F3594B
|
||||
|
||||
# Green
|
||||
color2 #A1A740
|
||||
color10 #B1B946
|
||||
|
||||
# Yellow
|
||||
color3 #DF9238
|
||||
color11 #E9B243
|
||||
|
||||
# Blue
|
||||
color4 #619A96
|
||||
color12 #80AA9E
|
||||
|
||||
# Magenta
|
||||
color5 #C27491
|
||||
color13 #D3869B
|
||||
|
||||
# Cyan
|
||||
color6 #79A976
|
||||
color14 #8CBA7F
|
||||
|
||||
# White
|
||||
color7 #BEAC8E
|
||||
color15 #E0CDA5
|
||||
|
||||
|
||||
|
||||
#: Keyboard shortcuts {{{
|
||||
|
||||
map ctrl+v paste_from_clipboard
|
||||
map ctrl+c copy_and_clear_or_interrupt
|
||||
map ctrl+shift+e open_url_with_hints
|
||||
map ctrl+shift+o pass_selection_to_program qutebrowser
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
dark_icon="Tela-nord-dark"
|
||||
light_icon="Tela-nord-light"
|
||||
|
||||
if [ "$1" == "--light" ]; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Tela-nord-light"
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$light_icon"
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-dark
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Tela-nord-dark"
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$dark_icon"
|
||||
fi
|
||||
@@ -130,6 +130,7 @@ pkg=(
|
||||
adw-gtk-theme
|
||||
bibata-cursor-theme-bin
|
||||
hyprpicker
|
||||
hyprpaper
|
||||
power-profile-daemon
|
||||
hyprlock
|
||||
pyprland
|
||||
@@ -441,6 +442,7 @@ CONFIG_DIRS=(
|
||||
"yazi"
|
||||
"zathura"
|
||||
"zsh"
|
||||
"electron-flags.conf"
|
||||
)
|
||||
# Install .config directories
|
||||
for dir in "${CONFIG_DIRS[@]}"; do
|
||||
|
||||
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 197 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 844 KiB |
|
Before Width: | Height: | Size: 406 KiB |
|
Before Width: | Height: | Size: 630 KiB |
|
Before Width: | Height: | Size: 869 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 837 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 724 KiB |