init
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"workspace": {
|
||||
"library": [
|
||||
"/usr/share/hypr/stubs"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
# _ _ _ _
|
||||
# | |__ _ _ _ __ _ __(_) __| | | ___
|
||||
# | '_ \| | | | '_ \| '__| |/ _` | |/ _ \
|
||||
# | | | | |_| | |_) | | | | (_| | | __/
|
||||
# |_| |_|\__, | .__/|_| |_|\__,_|_|\___|
|
||||
# |___/|_|
|
||||
#
|
||||
# Version 2.8.3
|
||||
# DO NOT REMOVE THE REPLACEMENT COMMENTS
|
||||
# REQUIRED BY THE ML4W SETTINGS APP
|
||||
# https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/
|
||||
|
||||
general {
|
||||
ignore_dbus_inhibit = false
|
||||
}
|
||||
|
||||
general {
|
||||
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
|
||||
before_sleep_cmd = loginctl lock-session # lock before suspend.
|
||||
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
|
||||
}
|
||||
|
||||
# Screenlock
|
||||
listener {
|
||||
# HYPRLOCK TIMEOUT
|
||||
timeout = 600
|
||||
# HYPRLOCK ONTIMEOUT
|
||||
on-timeout = loginctl lock-session
|
||||
}
|
||||
|
||||
# dpms
|
||||
listener {
|
||||
# DPMS TIMEOUT
|
||||
timeout = 660
|
||||
# DPMS ONTIMEOUT
|
||||
on-timeout = hyprctl dispatch dpms off
|
||||
# DPMS ONRESUME
|
||||
on-resume = hyprctl dispatch dpms on
|
||||
}
|
||||
|
||||
# Suspend
|
||||
listener {
|
||||
# SUSPEND TIMEOUT
|
||||
timeout = 1800
|
||||
#SUSPEND ONTIMEOUT
|
||||
on-timeout = systemctl suspend
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
require("lua.conf")
|
||||
@@ -0,0 +1,95 @@
|
||||
# _ _ _
|
||||
# | |__ _ _ _ __ _ __| | ___ ___| | __
|
||||
# | '_ \| | | | '_ \| '__| |/ _ \ / __| |/ /
|
||||
# | | | | |_| | |_) | | | | (_) | (__| <
|
||||
# |_| |_|\__, | .__/|_| |_|\___/ \___|_|\_\
|
||||
# |___/|_|
|
||||
#
|
||||
|
||||
source = ~/dotfiles/theme/hyprland-color.conf
|
||||
background {
|
||||
monitor =
|
||||
path = $HOME/.cache/used_wallpaper # only png supported for now
|
||||
#color = rgba(0,0,0,0)
|
||||
blur_passes = 3
|
||||
blur_size = 14
|
||||
noise = 0.1
|
||||
}
|
||||
|
||||
input-field {
|
||||
monitor =
|
||||
size = 400, 70
|
||||
outline_thickness = 3
|
||||
dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8
|
||||
dots_spacing = 0.4 # Scale of dots' absolute size, 0.0 - 1.0
|
||||
dots_center = true
|
||||
dots_rounding = -1 # -1 default circle, -2 follow input-field rounding
|
||||
outer_color = $blue
|
||||
inner_color = $surface2
|
||||
font_color = $blue
|
||||
fade_on_empty = true
|
||||
fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered.
|
||||
placeholder_text = <i>Input Password...</i> # Text rendered in the input box when it's empty.
|
||||
hide_input = false
|
||||
rounding = -1 # -1 means complete rounding (circle/oval)
|
||||
check_color = rgb(250, 179, 135)
|
||||
fail_color = rgb(243, 139, 168) # if authentication failed, changes outer_color and fail message color
|
||||
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> # can be set to empty
|
||||
invert_numlock = false # change color if numlock is off
|
||||
swap_font_color = false # see below
|
||||
position = 0, -20
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(~/dotfiles/hypr/scripts/battery_on_lock.sh)"
|
||||
color = rgb(137, 180, 250)
|
||||
font_size = 32
|
||||
font_family = Fira Code NF
|
||||
halign = right
|
||||
valign = bottom
|
||||
position = -100, 10
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo "$TIME"
|
||||
color = rgba(205, 214, 244, 1.0)
|
||||
font_size = 55
|
||||
font_family = Fira Semibold
|
||||
position = -100, 50
|
||||
halign = right
|
||||
valign = bottom
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = $USER
|
||||
color = rgba(205, 214, 244, 1.0)
|
||||
font_size = 32
|
||||
font_family = Fira Semibold
|
||||
position = -100, 170
|
||||
halign = right
|
||||
valign = bottom
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
}
|
||||
|
||||
image {
|
||||
monitor =
|
||||
path = $HOME/.cache/square_wallpaper.png
|
||||
size = 300 # lesser side if not 1:1 ratio
|
||||
rounding = -1 # negative values mean circle
|
||||
border_size = 4
|
||||
border_color = rgb(137, 180, 250)
|
||||
rotate = 0 # degrees, counter-clockwise
|
||||
reload_time = -1 # seconds between reloading, 0 to reload with SIGUSR2
|
||||
# reload_cmd = # command to get new path. if empty, old path will be used. don't run "follow" commands like tail -F
|
||||
position = 0, 250
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
@@ -0,0 +1,37 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
local colorscheme
|
||||
|
||||
-- currently, only catppuccin is considerd
|
||||
if settings["colorscheme"] == "catppuccin" or settings["colorscheme"] == "catppuccin-mocha" or true then
|
||||
colorscheme.rosewater = "#f5e0dc"
|
||||
colorscheme.flamingo = "#f2cdcd"
|
||||
colorscheme.pink = "#f5c2e7"
|
||||
colorscheme.mauve = "#cba6f7"
|
||||
colorscheme.red = "#f38ba8"
|
||||
colorscheme.maroon = "#eba0ac"
|
||||
colorscheme.peach = "#fab387"
|
||||
colorscheme.yellow = "#f9e2af"
|
||||
colorscheme.green = "#a6e3a1"
|
||||
colorscheme.teal = "#94e2d5"
|
||||
colorscheme.sky = "#89dceb"
|
||||
colorscheme.sapphire = "#74c7ec"
|
||||
colorscheme.blue = "#89b4fa"
|
||||
colorscheme.lavender = "#b4befe"
|
||||
colorscheme.text = "#cdd6f4"
|
||||
colorscheme.subtext1 = "#bac2de"
|
||||
colorscheme.subtext0 = "#a6adc8"
|
||||
colorscheme.overlay2 = "#9399b2"
|
||||
colorscheme.overlay1 = "#7f849c"
|
||||
colorscheme.overlay0 = "#6c7086"
|
||||
colorscheme.surface2 = "#585b70"
|
||||
colorscheme.surface1 = "#45475a"
|
||||
colorscheme.surface0 = "#313244"
|
||||
colorscheme.base = "#1e1e2e"
|
||||
colorscheme.mantle = "#181825"
|
||||
colorscheme.crust = "#11111b"
|
||||
colorscheme.foreground = colorscheme.text
|
||||
colorscheme.background = colorscheme.surface0
|
||||
colorscheme.accent = colorscheme.blue
|
||||
end
|
||||
|
||||
return colorscheme
|
||||
@@ -0,0 +1,8 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
require("lua.lib.globals")
|
||||
|
||||
require("lua.conf.monitor")
|
||||
|
||||
require("lua.modules").load()
|
||||
|
||||
hl.bind("SUPER + Return", hl.dsp.exec_cmd("kitty"))
|
||||
@@ -0,0 +1,9 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
|
||||
if settings["host"] == "laptop" then
|
||||
hl.monitor({
|
||||
output = "eDP-1",
|
||||
mode = "highres",
|
||||
scale = "auto",
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
local bind = {}
|
||||
|
||||
bind.leader = "SUPER"
|
||||
|
||||
local function merge(...)
|
||||
local out = {}
|
||||
|
||||
for _, t in ipairs({ ... }) do
|
||||
if t ~= nil then
|
||||
for k, v in pairs(t) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return out
|
||||
end
|
||||
|
||||
local function with_leader(keys)
|
||||
if keys == nil or keys == "" then
|
||||
return bind.leader
|
||||
end
|
||||
|
||||
return bind.leader .. " + " .. keys
|
||||
end
|
||||
|
||||
function bind.key(keys, dispatcher, desc, opts)
|
||||
local flags = merge(opts)
|
||||
|
||||
if desc ~= nil then
|
||||
flags.description = desc
|
||||
end
|
||||
|
||||
return hl.bind(keys, dispatcher, flags)
|
||||
end
|
||||
|
||||
function bind.leader_key(keys, dispatcher, desc, opts)
|
||||
return bind.key(with_leader(keys), dispatcher, desc, opts)
|
||||
end
|
||||
|
||||
return bind
|
||||
@@ -0,0 +1,9 @@
|
||||
local M = {}
|
||||
|
||||
function M.map(event, func_list)
|
||||
for _, func in pairs(func_list) do
|
||||
hl.on(event, func)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,7 @@
|
||||
HOME = os.getenv("HOME")
|
||||
CONFIG_HOME = os.getenv("XDG_CONFIG_HOME")
|
||||
if not CONFIG_HOME then
|
||||
CONFIG_HOME = HOME .. "/.config"
|
||||
end
|
||||
HYPR = CONFIG_HOME .. "/hypr"
|
||||
USER_CONFIG = HYPR .. "/lua/user"
|
||||
@@ -0,0 +1,22 @@
|
||||
local settings = {}
|
||||
|
||||
---@type string
|
||||
settings["hostname"] = ""
|
||||
|
||||
---@type "desktop"|"laptop"
|
||||
settings["profile"] = "desktop"
|
||||
|
||||
---@type "catppuccin"|"catppuccin-mocha"
|
||||
settings["colorscheme"] = "catppuccin"
|
||||
|
||||
---@type boolean
|
||||
settings["systemd"] = false
|
||||
|
||||
---@type table<string, boolean>
|
||||
settings["modules"] = {
|
||||
waybar = true,
|
||||
swaync = true,
|
||||
swayosd = true,
|
||||
}
|
||||
|
||||
return require("lua.lib.utils").extend_config(settings, "lua.user.settings")
|
||||
@@ -0,0 +1,31 @@
|
||||
local utils = require("lua.lib.utils")
|
||||
local M = {}
|
||||
|
||||
function M.is_user_unit_exists(unit)
|
||||
return utils.command_success("systemctl --user cat " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
end
|
||||
|
||||
M.user_unit_dir = CONFIG_HOME .. "/systemd/user"
|
||||
|
||||
function M.ensure_user_unit(unit, source)
|
||||
if M.is_user_unit_exists(unit) then
|
||||
return true
|
||||
end
|
||||
|
||||
local target_dir = M.user_unit_dir
|
||||
local target = target_dir .. "/" .. unit
|
||||
|
||||
local cmd = table.concat({
|
||||
"mkdir -p " .. utils.shell_quote(target_dir),
|
||||
"ln -s " .. utils.shell_quote(source) .. " " .. utils.shell_quote(target),
|
||||
"systemctl --user daemon-reload",
|
||||
}, " && ")
|
||||
|
||||
return utils.command_success(cmd)
|
||||
end
|
||||
|
||||
function M.start_user_unit(unit)
|
||||
return utils.command_success("systemctl --user start " .. utils.shell_quote(unit) .. " >/dev/null 2>&1")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,134 @@
|
||||
-- lua/lib/utils.lua
|
||||
require("lua.lib.globals")
|
||||
local M = {}
|
||||
|
||||
local function is_table(x)
|
||||
return type(x) == "table"
|
||||
end
|
||||
|
||||
local function is_list(t)
|
||||
if type(t) ~= "table" then
|
||||
return false
|
||||
end
|
||||
|
||||
local n = 0
|
||||
|
||||
for k, _ in pairs(t) do
|
||||
if type(k) ~= "number" then
|
||||
return false
|
||||
end
|
||||
|
||||
if k > n then
|
||||
n = k
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, n do
|
||||
if t[i] == nil then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function M.list_extend(dst, src)
|
||||
for _, value in ipairs(src) do
|
||||
table.insert(dst, value)
|
||||
end
|
||||
|
||||
return dst
|
||||
end
|
||||
|
||||
local function deepcopy(value, seen)
|
||||
if type(value) ~= "table" then
|
||||
return value
|
||||
end
|
||||
|
||||
seen = seen or {}
|
||||
if seen[value] then
|
||||
return seen[value]
|
||||
end
|
||||
|
||||
local result = {}
|
||||
seen[value] = result
|
||||
|
||||
for k, v in pairs(value) do
|
||||
result[deepcopy(k, seen)] = deepcopy(v, seen)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function M.tbl_recursive_merge(defaults, overrides)
|
||||
local result = deepcopy(defaults)
|
||||
|
||||
if not is_table(overrides) then
|
||||
return result
|
||||
end
|
||||
|
||||
for key, value in pairs(overrides) do
|
||||
if is_table(value) and is_table(result[key]) then
|
||||
result[key] = M.tbl_recursive_merge(result[key], value)
|
||||
else
|
||||
result[key] = deepcopy(value)
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function M.extend_config(defaults, user_module)
|
||||
if not M.is_file_exists(HYPR .. user_module) then
|
||||
return deepcopy(defaults)
|
||||
end
|
||||
local ok, overrides = pcall(require, user_module)
|
||||
|
||||
if not ok then
|
||||
return deepcopy(defaults)
|
||||
end
|
||||
|
||||
if type(overrides) ~= "table" then
|
||||
return deepcopy(defaults)
|
||||
end
|
||||
|
||||
return M.tbl_recursive_merge(defaults, overrides)
|
||||
end
|
||||
|
||||
function M.is_file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function M.exec_if_file_extes(file)
|
||||
if M.is_file_exists(file) then
|
||||
hl.exec_cmd(file)
|
||||
else
|
||||
hl.notification.create({ file .. " doesn't extist", 5000, 0 })
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_if_not_exists(path)
|
||||
if not M.is_file_exists(path) then
|
||||
os.execute('mkdir -pv "$(dirname "' .. path .. '")"')
|
||||
os.execute("touch " .. path)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.shell_quote(s)
|
||||
return "'" .. tostring(s):gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
|
||||
function M.command_success(cmd)
|
||||
local ok = os.execute(cmd)
|
||||
return ok == true or ok == 0
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,61 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
require("lua.lib.globals")
|
||||
local utils = require("lua.lib.utils")
|
||||
local events = require("lua.lib.events")
|
||||
|
||||
local M = {}
|
||||
local modules = {}
|
||||
|
||||
local function is_module_exists(name)
|
||||
return utils.is_file_exists(HYPR .. "/lua/modules/" .. name .. ".lua")
|
||||
end
|
||||
|
||||
local function load_module(name)
|
||||
if not is_module_exists(name) then
|
||||
return {}
|
||||
end
|
||||
local default_mod = require("lua.modules." .. name)
|
||||
|
||||
local user_modname = "lua.user.modules." .. name
|
||||
local mod = utils.extend_config(default_mod, user_modname)
|
||||
|
||||
return mod
|
||||
end
|
||||
|
||||
for name, enabled in pairs(settings.modules) do
|
||||
if enabled then
|
||||
local mod = load_module(name)
|
||||
table.insert(modules, {
|
||||
name = name,
|
||||
config = mod,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
M.autostart = {}
|
||||
M.autostop = {}
|
||||
M.binds = {}
|
||||
|
||||
local function collect_modules_prop(module, prop)
|
||||
if module[prop] then
|
||||
M[prop] = utils.list_extend(M[prop], module[prop])
|
||||
end
|
||||
end
|
||||
|
||||
for _, item in ipairs(modules) do
|
||||
local module = item.config
|
||||
collect_modules_prop(module, "autostart")
|
||||
collect_modules_prop(module, "autostop")
|
||||
collect_modules_prop(module, "binds")
|
||||
end
|
||||
|
||||
function M.load()
|
||||
events.map("hyprland.start", M.autostart)
|
||||
events.map("hyprland.shutdown", M.autostop)
|
||||
|
||||
for _, bind in pairs(M.binds) do
|
||||
bind()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,36 @@
|
||||
local settings = require("lua.lib.settings")
|
||||
local systemd = require("lua.lib.systemd")
|
||||
local utils = require("lua.lib.utils")
|
||||
require("lua.lib.globals")
|
||||
local M = {}
|
||||
|
||||
local function start_swaync()
|
||||
if settings["systemd"] then
|
||||
local unit = "swaync.service"
|
||||
local source = CONFIG_HOME .. "hypr/systemd/" .. unit
|
||||
|
||||
if systemd.ensure_user_unit(unit, source) then
|
||||
hl.exec_cmd("systemctl --user start swaync")
|
||||
else
|
||||
hl.exec_cmd("swaync")
|
||||
end
|
||||
else
|
||||
hl.exec_cmd("swaync")
|
||||
end
|
||||
end
|
||||
|
||||
local function stop_swaync()
|
||||
if settings["systemd"] and utils.command_success("systemctl --user status swaync") then
|
||||
hl.exec_cmd("systemctl --user stop swaync")
|
||||
end
|
||||
end
|
||||
|
||||
M.autostart = {
|
||||
start_swaync,
|
||||
}
|
||||
|
||||
M.autostop = {
|
||||
stop_swaync,
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,19 @@
|
||||
local M = {}
|
||||
local bind = require("lua.lib.bind")
|
||||
|
||||
local function start_waybar()
|
||||
hl.exec_cmd("~/dotfiles/waybar/launch.sh")
|
||||
end
|
||||
|
||||
M.autostart = {
|
||||
start_waybar,
|
||||
}
|
||||
|
||||
M.binds = {
|
||||
function()
|
||||
bind.leader_key("SHIFT + B", hl.dsp.exec_cmd("~/dotfiles/waybar/launch.sh"), "(re)launch waybar", {})
|
||||
bind.leader_key("CTRL + B", hl.dsp.exec_cmd("~/dotfiles/waybar/toggle.sh"), "toggle waybar", {})
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,6 @@
|
||||
local settings = {}
|
||||
|
||||
settings["hostname"] = "arch-c940"
|
||||
settings["profile"] = "laptop"
|
||||
|
||||
return settings
|
||||
@@ -0,0 +1,2 @@
|
||||
#source = hyprgrass.conf
|
||||
#source = hyprexpo.conf
|
||||
@@ -0,0 +1,18 @@
|
||||
plugin {
|
||||
hyprexpo {
|
||||
columns = 2
|
||||
gap_size = 5
|
||||
bg_col = rgb(1e1e2e)
|
||||
workspace_method = center current # [center/first] [workspace] e.g. first 1 or center m+1
|
||||
|
||||
gesture_distance = 300 # how far is the "max" for the gesture
|
||||
}
|
||||
}
|
||||
|
||||
hyprexpo-gesture = 3, vertical, expo
|
||||
|
||||
#gesture = 3, up, dispatcher, hyprexpo:expo, on
|
||||
#gesture = 3, down, dispatcher, hyprexpo:expo, off
|
||||
|
||||
bind = $mainMod, F3, hyprexpo:expo, toggle
|
||||
bind = $mainMod CTRL, RETURN, hyprexpo:expo, select
|
||||
@@ -0,0 +1,39 @@
|
||||
plugin {
|
||||
touch_gestures {
|
||||
# The default sensitivity is probably too low on tablet screens,
|
||||
# I recommend turning it up to 4.0
|
||||
sensitivity = 4.0
|
||||
|
||||
# must be >= 3
|
||||
workspace_swipe_fingers = 3
|
||||
|
||||
# switching workspaces by swiping from an edge, this is separate from workspace_swipe_fingers
|
||||
# and can be used at the same time
|
||||
# possible values: l, r, u, or d
|
||||
# to disable it set it to anything else
|
||||
workspace_swipe_edge = x
|
||||
|
||||
# in milliseconds
|
||||
long_press_delay = 400
|
||||
|
||||
# resize windows by long-pressing on window borders and gaps.
|
||||
# If general:resize_on_border is enabled, general:extend_border_grab_area is used for floating
|
||||
# windows
|
||||
resize_on_border_long_press = true
|
||||
|
||||
# in pixels, the distance from the edge that is considered an edge
|
||||
edge_margin = 40
|
||||
|
||||
# emulates touchpad swipes when swiping in a direction that does not trigger workspace swipe.
|
||||
# ONLY triggers when finger count is equal to workspace_swipe_fingers
|
||||
#
|
||||
# might be removed in the future in favor of event hooks
|
||||
emulate_touchpad_swipe = true
|
||||
|
||||
experimental {
|
||||
# send proper cancel events to windows instead of hacky touch_up events,
|
||||
# NOT recommended as it crashed a few times, once it's stabilized I'll make it the default
|
||||
send_cancel = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
|
||||
# Get script path
|
||||
pathname = os.path.dirname(sys.argv[0])
|
||||
homeFolder = os.path.expanduser('~') # Path to home folder
|
||||
dotfiles = homeFolder + "/dotfiles/"
|
||||
|
||||
result = subprocess.run(["bash", dotfiles + "hypr/scripts/monitors.sh"], capture_output=True, text=True)
|
||||
monitors_json = result.stdout.strip()
|
||||
monitors_arr = json.loads(monitors_json)
|
||||
for row in monitors_arr:
|
||||
if row["focused"]:
|
||||
print(row["id"])
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current battery percentage
|
||||
battery_percentage=$(cat /sys/class/power_supply/BAT1/capacity)
|
||||
|
||||
# Get the battery status (Charging or Discharging)
|
||||
battery_status=$(cat /sys/class/power_supply/BAT1/status)
|
||||
|
||||
# Define the battery icons for each 10% segment
|
||||
battery_icons=("" "" "" "" "" "" "" "" "" "")
|
||||
|
||||
# Define the charging icon
|
||||
charging_icon=""
|
||||
|
||||
# Calculate the index for the icon array
|
||||
icon_index=$((battery_percentage / 10))
|
||||
|
||||
# Get the corresponding icon
|
||||
battery_icon=${battery_icons[icon_index]}
|
||||
|
||||
# Check if the battery is charging
|
||||
if [ "$battery_status" = "Charging" ]; then
|
||||
battery_icon="$charging_icon"
|
||||
fi
|
||||
|
||||
# Output the battery percentage and icon
|
||||
echo "$battery_icon $battery_percentage%"
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Remove gamemode flag
|
||||
if [ -f ~/.cache/gamemode ] ;then
|
||||
rm ~/.cache/gamemode
|
||||
echo ":: ~/.cache/gamemode removed"
|
||||
fi
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# ____ _ _
|
||||
# | _ \(_) __ _ __ _ _ __ ___ ___(_)___
|
||||
# | | | | |/ _` |/ _` | '_ \ / _ \/ __| / __|
|
||||
# | |_| | | (_| | (_| | | | | (_) \__ \ \__ \
|
||||
# |____/|_|\__,_|\__, |_| |_|\___/|___/_|___/
|
||||
# |___/
|
||||
#
|
||||
|
||||
clear
|
||||
sleep 0.5
|
||||
figlet "Diagnosis"
|
||||
echo
|
||||
echo "This script will check that essential packages and "
|
||||
echo "execution commands are available on your system."
|
||||
echo
|
||||
|
||||
_commandExists() {
|
||||
package="$1";
|
||||
if ! type $package > /dev/null 2>&1; then
|
||||
echo ":: ERROR: $package doesn't exists. Please install it with yay -S $2"
|
||||
else
|
||||
echo ":: OK: $package found."
|
||||
fi
|
||||
}
|
||||
|
||||
_folderExists() {
|
||||
folder="$1";
|
||||
if [ ! -d $folder ]; then
|
||||
echo ":: ERROR: $folder doesn't exists."
|
||||
else
|
||||
echo ":: OK: $folder found."
|
||||
fi
|
||||
}
|
||||
|
||||
_commandExists "rofi" "rofi-wayland"
|
||||
_commandExists "dunst" "dunst"
|
||||
_commandExists "waybar" "waybar"
|
||||
_commandExists "hyprpaper" "hyprpaper"
|
||||
_commandExists "hyprlock" "hyprpaper"
|
||||
_commandExists "hypridle" "hyprpaper"
|
||||
_commandExists "wal" "python-pywal"
|
||||
_commandExists "gum" "gum"
|
||||
_commandExists "wlogout" "wlogout"
|
||||
_commandExists "swww" "swww"
|
||||
_commandExists "eww" "eww"
|
||||
_commandExists "magick" "imagemagick"
|
||||
_commandExists "figlet" "figlet"
|
||||
|
||||
echo
|
||||
echo "Press return to exit"
|
||||
read
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
cat <<"EOF"
|
||||
____ _ _ _ ____ __ __
|
||||
| _ \(_)___ __ _| |__ | | ___| _ \| \/ |
|
||||
| | | | / __|/ _` | '_ \| |/ _ \ | | | |\/| |
|
||||
| |_| | \__ \ (_| | |_) | | __/ |_| | | | |
|
||||
|____/|_|___/\__,_|_.__/|_|\___|____/|_| |_|
|
||||
|
||||
EOF
|
||||
|
||||
echo "Hyprland recommends the start with the tty login."
|
||||
echo "You can deactivate the current display manager (if exists)."
|
||||
echo ""
|
||||
echo "-> Do you really want to deactivate the display manager?"
|
||||
while true; do
|
||||
read -p "Do you want to enable the sddm display manager and setup theme? (Yy/Nn): " yn
|
||||
case $yn in
|
||||
[Yy]* )
|
||||
if [ -f /etc/systemd/system/display-manager.service ]; then
|
||||
sudo rm /etc/systemd/system/display-manager.service
|
||||
echo "Current display manager removed."
|
||||
else
|
||||
echo "No active display manager found."
|
||||
fi
|
||||
break;;
|
||||
[Nn]* )
|
||||
exit
|
||||
break;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# _____ ____ __
|
||||
# / _ \ \ /\ / /\ \ /\ / /
|
||||
# | __/\ V V / \ V V /
|
||||
# \___| \_/\_/ \_/\_/
|
||||
#
|
||||
EWW=`which eww`
|
||||
if [[ ! `pidof eww` ]]; then
|
||||
${EWW} daemon
|
||||
sleep 0.5
|
||||
fi
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 0.5
|
||||
killall -9 Hyprland sleep 2
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# ____ _
|
||||
# / ___| __ _ _ __ ___ ___ _ __ ___ ___ __| | ___
|
||||
# | | _ / _` | '_ ` _ \ / _ \ '_ ` _ \ / _ \ / _` |/ _ \
|
||||
# | |_| | (_| | | | | | | __/ | | | | | (_) | (_| | __/
|
||||
# \____|\__,_|_| |_| |_|\___|_| |_| |_|\___/ \__,_|\___|
|
||||
#
|
||||
|
||||
if [ -f ~/.cache/gamemode ] ;then
|
||||
hyprctl reload
|
||||
rm ~/.cache/gamemode
|
||||
notify-send "Gamemode deactivated" "Animations and blur enabled"
|
||||
else
|
||||
hyprctl --batch "\
|
||||
keyword animations:enabled 0;\
|
||||
keyword decoration:drop_shadow 0;\
|
||||
keyword decoration:blur:enabled 0;\
|
||||
keyword general:gaps_in 0;\
|
||||
keyword general:gaps_out 0;\
|
||||
keyword general:border_size 1;\
|
||||
keyword decoration:rounding 0"
|
||||
touch ~/.cache/gamemode
|
||||
notify-send "Gamemode activated" "Animations and blur disabled"
|
||||
fi
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# ____ _____ _ __
|
||||
# / ___|_ _| |/ /
|
||||
# | | _ | | | ' /
|
||||
# | |_| | | | | . \
|
||||
# \____| |_| |_|\_\
|
||||
#
|
||||
# Source: https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
|
||||
|
||||
config="$HOME/.config/gtk-3.0/settings.ini"
|
||||
if [ ! -f "$config" ]; then exit 1; fi
|
||||
|
||||
gnome_schema="org.gnome.desktop.interface"
|
||||
gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
cursor_size="$(grep 'gtk-cursor-theme-size' "$config" | sed 's/.*\s*=\s*//')"
|
||||
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
|
||||
echo $gtk_theme
|
||||
echo $icon_theme
|
||||
echo $cursor_theme
|
||||
echo $cursor_size
|
||||
echo $font_name
|
||||
|
||||
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
|
||||
gsettings set "$gnome_schema" icon-theme "$icon_theme"
|
||||
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
|
||||
gsettings set "$gnome_schema" font-name "$font_name"
|
||||
gsettings set "$gnome_schema" color-scheme "prefer-dark"
|
||||
|
||||
# if [ -f ~/dotfiles/hypr/conf/cursor.conf ] ;then
|
||||
# echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" > ~/dotfiles/hypr/conf/cursor.conf
|
||||
# hyprctl setcursor $cursor_theme $cursor_size
|
||||
# fi
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# _ _ _ _ _
|
||||
# | | | |_ _ _ __ _ __(_) __| | | ___
|
||||
# | |_| | | | | '_ \| '__| |/ _` | |/ _ \
|
||||
# | _ | |_| | |_) | | | | (_| | | __/
|
||||
# |_| |_|\__, | .__/|_| |_|\__,_|_|\___|
|
||||
# |___/|_|
|
||||
#
|
||||
|
||||
SERVICE="hypridle"
|
||||
if [[ "$1" == "status" ]]; then
|
||||
sleep 1
|
||||
if pgrep -x "$SERVICE" >/dev/null ;then
|
||||
echo '{"text": "RUNNING", "class": "active", "tooltip": "Screen locking active"}'
|
||||
else
|
||||
echo '{"text": "NOT RUNNING", "class": "notactive", "tooltip": "Screen locking deactivated"}'
|
||||
fi
|
||||
fi
|
||||
if [[ "$1" == "toggle" ]]; then
|
||||
if pgrep -x "$SERVICE" >/dev/null ;then
|
||||
killall hypridle
|
||||
else
|
||||
hypridle
|
||||
fi
|
||||
fi
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# _ _ _ _
|
||||
# | | | |_ _ _ __ _ __ ___| |__ __ _ __| | ___
|
||||
# | |_| | | | | '_ \| '__/ __| '_ \ / _` |/ _` |/ _ \
|
||||
# | _ | |_| | |_) | | \__ \ | | | (_| | (_| | __/
|
||||
# |_| |_|\__, | .__/|_| |___/_| |_|\__,_|\__,_|\___|
|
||||
# |___/|_|
|
||||
#
|
||||
|
||||
if [[ "$1" == "rofi" ]]; then
|
||||
|
||||
# Open rofi to select the Hyprshade filter for toggle
|
||||
options="$(hyprshade ls)\noff"
|
||||
|
||||
# Open rofi
|
||||
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-hyprshade.rasi -i -no-show-icons -l 4 -width 30 -p "Hyprshade")
|
||||
if [ ! -z $choice ] ;then
|
||||
echo "hyprshade_filter=\"$choice\"" > ~/dotfiles/.settings/hyprshade.sh
|
||||
dunstify "Changing Hyprshade to $choice" "Toggle shader with SUPER+SHIFT+S"
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# Toggle Hyprshade based on the selected filter
|
||||
hyprshade_filter="blue-light-filter"
|
||||
|
||||
# Check if hyprshade.sh settings file exists and load
|
||||
if [ -f ~/dotfiles/.settings/hyprshade.sh ] ;then
|
||||
source ~/dotfiles/.settings/hyprshade.sh
|
||||
fi
|
||||
|
||||
# Toggle Hyprshade
|
||||
if [ "$hyprshade_filter" != "off" ] ;then
|
||||
if [ -z $(hyprshade current) ] ;then
|
||||
echo ":: hyprshade is not running"
|
||||
hyprshade on $hyprshade_filter
|
||||
notify-send "Hyprshade activated" "with $(hyprshade current)"
|
||||
echo ":: hyprshade started with $(hyprshade current)"
|
||||
else
|
||||
notify-send "Hyprshade deactivated"
|
||||
echo ":: Current hyprshade $(hyprshade current)"
|
||||
echo ":: Switching hyprshade off"
|
||||
hyprshade off
|
||||
fi
|
||||
else
|
||||
if [ -z $(hyprshade current) ] ;then
|
||||
hyprshade off
|
||||
fi
|
||||
echo ":: hyprshade turned off"
|
||||
fi
|
||||
|
||||
fi
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# __ ______ _____ _
|
||||
# \ \ / / _ \ | ____|_ __ __ _(_)_ __ ___
|
||||
# \ \ /\ / /| |_) | | _| | '_ \ / _` | | '_ \ / _ \
|
||||
# \ V V / | __/ | |___| | | | (_| | | | | | __/
|
||||
# \_/\_/ |_| |_____|_| |_|\__, |_|_| |_|\___|
|
||||
# |___/
|
||||
#
|
||||
|
||||
wallpaper_engine=$(cat $HOME/dotfiles/.settings/wallpaper-engine.sh)
|
||||
if [ "$wallpaper_engine" == "awww" ] ;then
|
||||
# awww
|
||||
echo ":: Using awww"
|
||||
awww-daemon --format xrgb
|
||||
sleep 0.5
|
||||
~/dotfiles/hypr/scripts/wallpaper.sh init
|
||||
elif [ "$wallpaper_engine" == "hyprpaper" ] ;then
|
||||
# hyprpaper
|
||||
echo ":: Using hyprpaper"
|
||||
sleep 0.5
|
||||
~/dotfiles/hypr/scripts/wallpaper.sh init
|
||||
else
|
||||
echo ":: Wallpaper Engine disabled"
|
||||
~/dotfiles/hypr/scripts/wallpaper.sh init
|
||||
fi
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# _ _ _ _ _
|
||||
# | | _____ _ _| |__ (_)_ __ __| (_)_ __ __ _ ___
|
||||
# | |/ / _ \ | | | '_ \| | '_ \ / _` | | '_ \ / _` / __|
|
||||
# | < __/ |_| | |_) | | | | | (_| | | | | | (_| \__ \
|
||||
# |_|\_\___|\__, |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___/
|
||||
# |___/ |___/
|
||||
# by Stephan Raabe (2023)
|
||||
# -----------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Get keybindings location based on variation
|
||||
# -----------------------------------------------------
|
||||
config_file=$(cat ~/dotfiles/hypr/conf/keybinding.conf)
|
||||
config_file=${config_file/source = ~/}
|
||||
config_file=${config_file/source=~/}
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Path to keybindings config file
|
||||
# -----------------------------------------------------
|
||||
config_file="/home/$USER$config_file"
|
||||
echo "Reading from: $config_file"
|
||||
|
||||
keybinds=""
|
||||
|
||||
# Detect Start String
|
||||
while read -r line
|
||||
do
|
||||
if [[ "$line" == "bind"* ]]; then
|
||||
|
||||
line="$(echo "$line" | sed 's/$mainMod/SUPER/g')"
|
||||
line="$(echo "$line" | sed 's/bind = //g')"
|
||||
line="$(echo "$line" | sed 's/bindm = //g')"
|
||||
|
||||
IFS='#'
|
||||
read -a strarr <<<"$line"
|
||||
kb_str=${strarr[0]}
|
||||
cm_str=${strarr[1]}
|
||||
|
||||
IFS=','
|
||||
read -a kbarr <<<"$kb_str"
|
||||
|
||||
item="${kbarr[0]} + ${kbarr[1]}"$'\r'"${cm_str:1}"
|
||||
keybinds=$keybinds$item$'\n'
|
||||
fi
|
||||
done < "$config_file"
|
||||
|
||||
sleep 0.2
|
||||
rofi -dmenu -i -markup -eh 2 -replace -p "Keybinds" -config ~/dotfiles/rofi/config-compact.rasi <<< "$keybinds"
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
hyprctl reload
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 0.5
|
||||
hyprlock
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
hyprctl -j monitors
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# ____
|
||||
# | _ \ _____ _____ _ __
|
||||
# | |_) / _ \ \ /\ / / _ \ '__|
|
||||
# | __/ (_) \ V V / __/ |
|
||||
# |_| \___/ \_/\_/ \___|_|
|
||||
#
|
||||
|
||||
if [[ "$1" == "exit" ]]; then
|
||||
echo ":: Exit"
|
||||
hyprctl dispatch exit
|
||||
fi
|
||||
|
||||
if [[ "$1" == "lock" ]]; then
|
||||
echo ":: Lock"
|
||||
sleep 0.5
|
||||
hyprlock
|
||||
fi
|
||||
|
||||
if [[ "$1" == "reboot" ]]; then
|
||||
echo ":: Reboot"
|
||||
sleep 0.5
|
||||
systemctl reboot
|
||||
fi
|
||||
|
||||
if [[ "$1" == "shutdown" ]]; then
|
||||
echo ":: Shutdown"
|
||||
sleep 0.5
|
||||
systemctl poweroff
|
||||
fi
|
||||
|
||||
if [[ "$1" == "suspend" ]]; then
|
||||
echo ":: Suspend"
|
||||
sleep 0.5
|
||||
systemctl suspend
|
||||
fi
|
||||
|
||||
if [[ "$1" == "hibernate" ]]; then
|
||||
echo ":: Hibernate"
|
||||
sleep 1;
|
||||
systemctl hibernate
|
||||
fi
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 0.5
|
||||
systemctl reboot
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
killall hypridle
|
||||
sleep 1
|
||||
hypridle &
|
||||
notify-send "hypridle has been restarted."
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
# ____ _ _
|
||||
# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_
|
||||
# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __|
|
||||
# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_
|
||||
# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__|
|
||||
#
|
||||
#
|
||||
# by Stephan Raabe (2023)
|
||||
# -----------------------------------------------------
|
||||
|
||||
DIR="$HOME/Pictures/screenshots/"
|
||||
NAME="screenshot_$(date +%Y%m%d_%H%M%S).png"
|
||||
|
||||
option2="Selected area"
|
||||
option3="Fullscreen (delay 3 sec)"
|
||||
option4="Current display (delay 3 sec)"
|
||||
|
||||
options="$option2\n$option3\n$option4"
|
||||
|
||||
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 3 -width 30 -p "Take Screenshot")
|
||||
|
||||
case $choice in
|
||||
$option2)
|
||||
grim -g "$(slurp)" "$DIR$NAME"
|
||||
xclip -selection clipboard -t image/png -i "$DIR$NAME"
|
||||
notify-send "Screenshot created and copied to clipboard" "Mode: Selected area"
|
||||
swappy -f "$DIR$NAME"
|
||||
;;
|
||||
$option3)
|
||||
sleep 3
|
||||
grim "$DIR$NAME"
|
||||
xclip -selection clipboard -t image/png -i "$DIR$NAME"
|
||||
notify-send "Screenshot created and copied to clipboard" "Mode: Fullscreen"
|
||||
swappy -f "$DIR$NAME"
|
||||
;;
|
||||
$option4)
|
||||
sleep 3
|
||||
monitor="$(hyprctl monitors | awk '/Monitor/{monitor=$2} /focused: yes/{print monitor; exit}')"
|
||||
grim -o "$monitor" "$DIR$NAME"
|
||||
xclip -selection clipboard -t image/png -i "$DIR$NAME"
|
||||
notify-send "Screenshot created and copied to clipboard" "Mode: Fullscreen"
|
||||
swappy -f "$DIR$NAME"
|
||||
;;
|
||||
esac
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 0.5
|
||||
systemctl poweroff
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 0.5
|
||||
systemctl suspend
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
cache_file="$HOME/.cache/toggle_animation"
|
||||
if [[ $(cat $HOME/dotfiles/hypr/conf/animation.conf) == *"disabled"* ]]; then
|
||||
echo ":: Toggle blocked by disabled.conf variation."
|
||||
else
|
||||
if [ -f $cache_file ] ;then
|
||||
hyprctl keyword animations:enabled true
|
||||
rm $cache_file
|
||||
else
|
||||
hyprctl keyword animations:enabled false
|
||||
touch $cache_file
|
||||
fi
|
||||
fi
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# _ _ _ __ _ _
|
||||
# / \ | | |/ _| | ___ __ _| |_
|
||||
# / _ \ | | | |_| |/ _ \ / _` | __|
|
||||
# / ___ \| | | _| | (_) | (_| | |_
|
||||
# /_/ \_\_|_|_| |_|\___/ \__,_|\__|
|
||||
#
|
||||
# by Stephan Raabe (2023)
|
||||
# -----------------------------------------------------
|
||||
|
||||
hyprctl dispatch workspaceopt allfloat
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Open rofi to select the Hyprshade filter for toggle
|
||||
options="$(ls ~/dotfiles/hypr/effects/wallpaper/)\noff"
|
||||
|
||||
# Open rofi
|
||||
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-themes.rasi -i -no-show-icons -l 5 -width 30 -p "Hyprshade")
|
||||
if [ ! -z $choice ] ;then
|
||||
echo "$choice" > ~/dotfiles/.settings/wallpaper-effect.sh
|
||||
dunstify "Changing Wallpaper Effect to " "$choice"
|
||||
~/dotfiles/hypr/scripts/wallpaper.sh init
|
||||
fi
|
||||
Executable
+211
@@ -0,0 +1,211 @@
|
||||
#!/bin/bash
|
||||
# _ _
|
||||
# __ ____ _| | |_ __ __ _ _ __ ___ _ __
|
||||
# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__|
|
||||
# \ V V / (_| | | | |_) | (_| | |_) | __/ |
|
||||
# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_|
|
||||
# |_| |_|
|
||||
#
|
||||
# by Stephan Raabe (2024)
|
||||
# -----------------------------------------------------
|
||||
|
||||
# Cache file for holding the current wallpaper
|
||||
wallpaper_folder="$HOME/wallpaper"
|
||||
if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then
|
||||
source ~/dotfiles/.settings/wallpaper-folder.sh
|
||||
fi
|
||||
used_wallpaper="$HOME/.cache/used_wallpaper"
|
||||
cache_file="$HOME/.cache/current_wallpaper"
|
||||
square="$HOME/.cache/square_wallpaper.png"
|
||||
rasi_file="$HOME/.cache/current_wallpaper.rasi"
|
||||
blur_file="$HOME/dotfiles/.settings/blur.sh"
|
||||
|
||||
square_dir="$HOME/.cache/square_wallpaper/"
|
||||
|
||||
mkdir -pv "${square_dir}"
|
||||
|
||||
blur="50x30"
|
||||
blur=$(cat $blur_file)
|
||||
|
||||
# Create cache file if not exists
|
||||
#if [ ! -f $cache_file ] ;then
|
||||
# touch $cache_file
|
||||
# echo "$wallpaper_folder/default.jpg" > "$cache_file"
|
||||
#fi
|
||||
|
||||
## Create rasi file if not exists
|
||||
#if [ ! -f $rasi_file ] ;then
|
||||
# touch $rasi_file
|
||||
# echo "* { current-image: url(\"$wallpaper_folder/default.jpg\", height); }" > "$rasi_file"
|
||||
#fi
|
||||
|
||||
#current_wallpaper=$(cat "$cache_file")
|
||||
|
||||
case $1 in
|
||||
|
||||
# Load wallpaper from .cache of last session
|
||||
"init")
|
||||
sleep 1
|
||||
if [ -f $cache_file ]; then
|
||||
pass #wal -q -i $current_wallpaper
|
||||
else
|
||||
pass #wal -q -i $wallpaper_folder/
|
||||
fi
|
||||
;;
|
||||
|
||||
# Select wallpaper with rofi
|
||||
"select")
|
||||
sleep 0.2
|
||||
entries=""
|
||||
for wp in "${wallpaper_folder}"/*.{jpg,jpeg,png}; do
|
||||
[[ -f "$wp" ]] || continue
|
||||
name=$(basename "$wp")
|
||||
#name="${name%.*}"
|
||||
sq="${square_dir}/${name%.*}.png"
|
||||
|
||||
if [[ ! -f "${sq}" ]]; then
|
||||
magick "${wp}" -gravity Center -extent 512:512 "$sq"
|
||||
fi
|
||||
entries+="${name}\x00icon\x1f${sq}\n"
|
||||
done
|
||||
|
||||
selected=$( printf "$entries" | sort -R | rofi -dmenu -i -replace -config ~/dotfiles/rofi/config-wallpaper.rasi)
|
||||
if [ ! "$selected" ]; then
|
||||
echo "No wallpaper selected"
|
||||
exit
|
||||
fi
|
||||
#wal -q -i $wallpaper_folder/$selected
|
||||
export wallpaper=$wallpaper_folder/$selected
|
||||
echo $wallpaper
|
||||
;;
|
||||
|
||||
# Randomly select wallpaper
|
||||
*)
|
||||
pass
|
||||
#wal -q -i $wallpaper_folder/
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Load current pywal color scheme
|
||||
# -----------------------------------------------------
|
||||
#source "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# get wallpaper image name
|
||||
# -----------------------------------------------------
|
||||
newwall=$(echo $wallpaper | sed "s|$wallpaper_folder/||g")
|
||||
echo $newwall
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Reload waybar with new colors
|
||||
# -----------------------------------------------------
|
||||
~/dotfiles/waybar/launch.sh
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
transition_type="wipe"
|
||||
# transition_type="outer"
|
||||
# transition_type="random"
|
||||
|
||||
ln -svfr $wallpaper $used_wallpaper
|
||||
|
||||
# Load Wallpaper Effect
|
||||
if [ -f $HOME/dotfiles/.settings/wallpaper-effect.sh ] ;then
|
||||
effect=$(cat $HOME/dotfiles/.settings/wallpaper-effect.sh)
|
||||
if [ ! "$effect" == "off" ] ;then
|
||||
if [ "$1" == "init" ] ;then
|
||||
echo ":: Init"
|
||||
else
|
||||
notify-send -e "Using wallpaper effect $effect..." "with image $newwall" -h int:value:10 -h string:x-dunst-stack-tag:wallpaper
|
||||
fi
|
||||
source $HOME/dotfiles/hypr/effects/wallpaper/$effect
|
||||
fi
|
||||
fi
|
||||
|
||||
wallpaper_engine=$(cat $HOME/dotfiles/.settings/wallpaper-engine.sh)
|
||||
if [ "$wallpaper_engine" == "awww" ] ;then
|
||||
# awww
|
||||
echo ":: Using awww"
|
||||
awww img $used_wallpaper \
|
||||
--transition-bezier .43,1.19,1,.4 \
|
||||
--transition-fps=60 \
|
||||
--transition-type=$transition_type \
|
||||
--transition-duration=0.7 \
|
||||
--transition-pos "$( hyprctl cursorpos )"
|
||||
elif [ "$wallpaper_engine" == "hyprpaper" ] ;then
|
||||
# hyprpaper
|
||||
echo ":: Using hyprpaper"
|
||||
killall hyprpaper
|
||||
wal_tpl=$(cat $HOME/dotfiles/.settings/hyprpaper.tpl)
|
||||
output=${wal_tpl//WALLPAPER/$used_wallpaper}
|
||||
echo "$output" > $HOME/dotfiles/hypr/hyprpaper.conf
|
||||
hyprpaper &
|
||||
else
|
||||
echo ":: Wallpaper Engine disabled"
|
||||
fi
|
||||
|
||||
if [ "$1" == "init" ] ;then
|
||||
echo ":: Init"
|
||||
else
|
||||
sleep 1
|
||||
notifyid=$(notify-send -e "Changing wallpaper ..." "with image $newwall" -h int:value:25 -p)
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Created blurred wallpaper
|
||||
# -----------------------------------------------------
|
||||
if [ "$1" == "init" ] ;then
|
||||
echo ":: Init"
|
||||
else
|
||||
notify-send -e "Creating blurred version ..." "with image $newwall" -h int:value:50 -r $notifyid
|
||||
fi
|
||||
|
||||
#magick $used_wallpaper -resize 75% $blurred
|
||||
#echo ":: Resized to 75%"
|
||||
#if [ ! "$blur" == "0x0" ] ;then
|
||||
# magick $blurred -blur $blur $blurred
|
||||
# echo ":: Blurred"
|
||||
#fi
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Created quare wallpaper
|
||||
# -----------------------------------------------------
|
||||
if [ "$1" == "init" ] ;then
|
||||
echo ":: Init"
|
||||
else
|
||||
notify-send -e "Creating square version ..." "with image $newwall" -h int:value:75 -r $notifyid
|
||||
fi
|
||||
#magick $wallpaper -gravity Center -extent 1:1 $square
|
||||
name=$(basename "$wallpaper")
|
||||
ln -svfr "${square_dir}/${name%.*}.png" "$square"
|
||||
echo ":: Square version created"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Write selected wallpaper into .cache files
|
||||
# -----------------------------------------------------
|
||||
echo "$wallpaper" > "$cache_file"
|
||||
|
||||
#read bw bh < <(identify -format "%w %h" "$blurred")
|
||||
#rw=900
|
||||
#rh=522
|
||||
#if (( bw * rh >= rw * bh )); then
|
||||
# scale=height
|
||||
#else
|
||||
# scale=width
|
||||
#fi
|
||||
#echo "* { current-image: url(\"$blurred\", $scale); }" > "$rasi_file"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Send notification
|
||||
# -----------------------------------------------------
|
||||
|
||||
if [ "$1" == "init" ] ;then
|
||||
echo ":: Init"
|
||||
else
|
||||
notify-send -e "Wallpaper procedure complete!" "with image $newwall" -h int:value:100 -r $notifyid -t 1000
|
||||
fi
|
||||
|
||||
echo "DONE!"
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# __ ______ ____
|
||||
# \ \/ / _ \ / ___|
|
||||
# \ /| | | | | _
|
||||
# / \| |_| | |_| |
|
||||
# /_/\_\____/ \____|
|
||||
#
|
||||
# -----------------------------------------------------
|
||||
sleep 1
|
||||
|
||||
# kill all possible running xdg-desktop-portals
|
||||
killall -e xdg-desktop-portal-hyprland
|
||||
killall -e xdg-desktop-portal-gnome
|
||||
killall -e xdg-desktop-portal-kde
|
||||
killall -e xdg-desktop-portal-lxqt
|
||||
killall -e xdg-desktop-portal-wlr
|
||||
killall -e xdg-desktop-portal-gtk
|
||||
killall xdg-desktop-portal
|
||||
sleep 1
|
||||
|
||||
# start xdg-desktop-portal-hyprland
|
||||
/usr/lib/xdg-desktop-portal-hyprland &
|
||||
sleep 2
|
||||
|
||||
# start xdg-desktop-portal
|
||||
/usr/lib/xdg-desktop-portal &
|
||||
sleep 1
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Swaync notification daemon
|
||||
Documentation=https://github.com/ErikReider/SwayNotificationCenter
|
||||
PartOf=graphical-session.target
|
||||
After=graphical-session.target
|
||||
# ConditionEnvironment requires systemd v247 to work correctly
|
||||
ConditionEnvironment=WAYLAND_DISPLAY
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.freedesktop.Notifications
|
||||
Environment=GTK_THEME=Adwaita:dark
|
||||
ExecStart=/usr/bin/swaync
|
||||
ExecReload=/usr/bin/swaync-client --reload-config ; /usr/bin/swaync-client --reload-css
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
Reference in New Issue
Block a user