Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb10b2b741
|
||
|
|
6d2a1ca47a
|
||
|
|
15b04ddb4a
|
||
|
|
da66fd27d2
|
||
|
|
ccecfd0d2c
|
||
|
|
3870e69fa5
|
||
|
|
0d297296ca
|
||
|
|
7a57f3a0d2
|
||
|
|
2a737ed6df
|
||
|
|
2f656c4a9e
|
@@ -0,0 +1,16 @@
|
|||||||
|
# `config`
|
||||||
|
|
||||||
|
My tool and machine configuration ranging from `~/.config` symlinks to libraries which support my daily workflows.
|
||||||
|
|
||||||
|
The [`setup`](../setup) and [`scwrypts`](../scwrypts) handle the setup / maintenance details, but contained herein:
|
||||||
|
|
||||||
|
<!------------------------------------------------------------------------------------------------------------>
|
||||||
|
| Submodule | Description |
|
||||||
|
| ------------------------------------ | -------------------------------------------------------------------- |
|
||||||
|
| [`bin`](./bin) | goes on my `${PATH}`; used in limited cases |
|
||||||
|
| [`colorschemes`](./colorschemes) | my colorscheme YAML definitions which style all my desktop apps; uses the [spec established in `dotwryn/scwrypts`](../scwrypts/dotwryn/desktop/colorscheme/coloscheme.module.zsh) |
|
||||||
|
| [`desktop`](./desktop) | utilities which configure, support, or launch a desktop environment |
|
||||||
|
| [`etc`](./etc) | config files linked back to `/etc` on the local system |
|
||||||
|
| [`host-overrides`](./host-overrides) | hostname-based values overrides for `etc`, `user`, and `bin` |
|
||||||
|
| [`user`](./user) | config files linked back to `${XDG_CONFIG_HOME:-${HOME}/.config` |
|
||||||
|
<!------------------------------------------------------------------------------------------------------------>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# config : bin
|
||||||
|
|
||||||
|
This directory contains shell one-offs which solve focused problems.
|
||||||
|
Generally, `scwrypts` are a better source for long-term maintenance, but, for a _few selected scenarios_, a raw shell script is preferred.
|
||||||
|
This is typically due to:
|
||||||
|
|
||||||
|
1. The simplicity of the script outweighs the maintenance overhead for an equivalent `scwrypt`
|
||||||
|
2. The overhead of `scwrypts` causes excessive slowdowns for quick, simple tasks
|
||||||
|
|
||||||
|
## Reference / Usage
|
||||||
|
|
||||||
|
All scripts in this directory support and can be used in one of two ways:
|
||||||
|
|
||||||
|
1. Direct reference through `${DOTWRYN}/config/bin/${script_name}`
|
||||||
|
2. Symlinked on the user's `${PATH}`
|
||||||
|
|
||||||
|
### Direct Reference
|
||||||
|
|
||||||
|
Anytime a raw script is referenced throughout the `dotwryn` repository, it should be referenced with _direct reference_.
|
||||||
|
`dotwryn`-internal operations must not assume the user has a symlink to any of these functions.
|
||||||
|
|
||||||
|
### Symlink
|
||||||
|
|
||||||
|
An API for human users!
|
||||||
|
All the scripts in this directory allow for symlinking.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# you can decide where it goes
|
||||||
|
ln -s "${DOTWRYN}/config/bin/${script_name}" "${somewhere_on_users_path}/${local_script_name}"
|
||||||
|
|
||||||
|
# since ~/.local/bin is on MY ${PATH} (and I want it to have the same name)
|
||||||
|
cd ~/.local/bin
|
||||||
|
ln -s "${DOTWRYN}/config/bin/${script_name}"
|
||||||
|
```
|
||||||
|
|
||||||
|
<!--
|
||||||
|
## NOTES TO AGENTS
|
||||||
|
|
||||||
|
Do not add new bin/ scripts without explicit approval and review from the human maintainer.
|
||||||
|
|
||||||
|
### Direct Reference : It's actually a scwrypt
|
||||||
|
|
||||||
|
If a `scwrypt` intends to reference one of these scripts directly, STOP.
|
||||||
|
This is an indicator that the `bin/` script must be built or refactored [in `scwrypts`](../scwrypts).
|
||||||
|
|
||||||
|
- If the `bin/` script in question is a _new_ script, proceed to develop it as a scwrypt.
|
||||||
|
- If the `bin/` script in question is an _existing_ script, you must now confirm with the human maintainer on how to proceed.
|
||||||
|
-->
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
USAGE="$0 (next|prev|playpause)"
|
|
||||||
|
|
||||||
function ERROR() {
|
|
||||||
local ERROR_CODE=$1
|
|
||||||
local MESSAGE="$2"
|
|
||||||
|
|
||||||
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
|
|
||||||
notify-send "YouTube media controller" "$MESSAGE"
|
|
||||||
|
|
||||||
exit $ERROR_CODE
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
COMMAND="$1"
|
|
||||||
case $COMMAND in
|
|
||||||
next ) COMMAND_KEY='j';;
|
|
||||||
prev ) COMMAND_KEY='k';;
|
|
||||||
play ) COMMAND_KEY='space';;
|
|
||||||
* ) ERROR 1 "unsupported command '$COMMAND'" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
xdotool search --name 'YouTube Music' windowactivate \
|
|
||||||
|| ERROR 2 "YouTube Music is not running"
|
|
||||||
|
|
||||||
|
|
||||||
# Chrome / YouTube only accepts keypresses when window is active
|
|
||||||
xdotool search --name 'YouTube Music' windowactivate
|
|
||||||
sleep 0.3
|
|
||||||
xdotool key --clearmodifiers "$COMMAND_KEY"
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# do not edit; generated by scwrypts
|
# do not edit; generated by scwrypts
|
||||||
# theme : main
|
# theme : winter
|
||||||
#
|
#
|
||||||
# source this file to apply colorscheme to linux getty
|
# source this file to apply colorscheme to linux getty
|
||||||
#
|
#
|
||||||
[[ "$TERM" =~ ^linux$ ]] || return 0
|
[[ "$TERM" =~ ^linux$ ]] || return 0
|
||||||
/bin/echo -e " ]P0000505 ]P1c80064 ]P211bb98 ]P36911aa ]P42262bb ]P59922dd ]P622ccba ]P7d0f0f0 ]P8ff44ff ]P944dddd ]PAaa44ff ]PB229df6 ]PCdd88ff ]PD88ffff ]PEd0f0f0 ]PF7e707e "
|
/bin/echo -e " ]P0000505 ]P1d11455 ]P2906556 ]P300ffe7 ]P43d8890 ]P57b70af ]P650a3b5 ]P7d0f0f0 ]P8f48bae ]P9cfb8af ]PA8bfff4 ]PB1abcdd ]PC7d72fe ]PD86abb3 ]PEd0f0f0 ]PF7e707e "
|
||||||
[ ! $NO_CLEAR ] && clear
|
[ ! $NO_CLEAR ] && clear
|
||||||
return 0
|
return 0
|
||||||
sed $d
|
sed $d
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# do not edit; generated by scwrypts
|
||||||
|
# theme : winter
|
||||||
|
$background = rgb(000505)
|
||||||
|
$foreground = rgb(d0f0f0)
|
||||||
|
$accent = rgb(00ffe7)
|
||||||
|
$accent_alt = rgb(30221d)
|
||||||
|
$verifying = rgb(cfb8af)
|
||||||
|
$wrong = rgb(f48bae)
|
||||||
|
$keypress = rgb(8bfff4)
|
||||||
|
$clock = rgb(d0f0f0)
|
||||||
|
$date = rgb(7e707e)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# do not edit; generated by scwrypts
|
||||||
|
# theme : winter
|
||||||
|
background = rgb(100906)
|
||||||
|
base = rgb(100906)
|
||||||
|
alternate_base = rgb(000505)
|
||||||
|
text = rgb(d0f0f0)
|
||||||
|
bright_text = rgb(d0f0f0)
|
||||||
|
accent = rgb(007469)
|
||||||
|
accent_secondary = rgb(00ffe7)
|
||||||
|
|
||||||
|
font_family = Monaspace Argon
|
||||||
|
font_family_monospace = Monaspace Argon
|
||||||
|
|
||||||
|
rounding_large = 0
|
||||||
|
rounding_small = 0
|
||||||
@@ -1 +1 @@
|
|||||||
main
|
winter
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* do not edit; generated by scwrypts
|
* do not edit; generated by scwrypts
|
||||||
* theme : main
|
* theme : winter
|
||||||
**/
|
**/
|
||||||
|
|
||||||
*{
|
*{
|
||||||
background: #001129;
|
background: #100906;
|
||||||
foreground: #d0f0f0;
|
foreground: #d0f0f0;
|
||||||
background-alt: #9922dd;
|
background-alt: #007469;
|
||||||
foreground-alt: #000505;
|
foreground-alt: #d0f0f0;
|
||||||
selected: #000505;
|
selected: #d0f0f0;
|
||||||
active: #6911aa;
|
active: #00ffe7;
|
||||||
urgent: #c80064;
|
urgent: #d11455;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
../main.yaml
|
../winter.yaml
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
--- # yamllint disable rule:colons
|
---
|
||||||
|
# yamllint disable rule:colons
|
||||||
background: .material.primary.900
|
background: .material.primary.900
|
||||||
foreground: .material.primary.50
|
foreground: .material.primary.50
|
||||||
|
|
||||||
@@ -71,4 +72,4 @@ material:
|
|||||||
800: .ansi.gray.black
|
800: .ansi.gray.black
|
||||||
900: .ansi.gray.black
|
900: .ansi.gray.black
|
||||||
secondary:
|
secondary:
|
||||||
400: .ansi.gray.white
|
400: .ansi.gray.black
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
--- # yamllint disable rule:colons
|
---
|
||||||
|
# yamllint disable rule:colons
|
||||||
ansi:
|
ansi:
|
||||||
blue:
|
blue:
|
||||||
regular: '#ac0041'
|
regular: '#ac0041'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
--- # yamllint disable rule:colons
|
---
|
||||||
|
# yamllint disable rule:colons
|
||||||
ansi:
|
ansi:
|
||||||
blue:
|
blue:
|
||||||
regular: '#2262bb'
|
regular: '#2262bb'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
--- # yamllint disable rule:colons
|
---
|
||||||
|
# yamllint disable rule:colons
|
||||||
background: .material.secondary.900
|
background: .material.secondary.900
|
||||||
foreground: .material.secondary.50
|
foreground: .material.secondary.50
|
||||||
|
|
||||||
@@ -21,6 +22,17 @@ i3:
|
|||||||
indicator: .material.secondary.900
|
indicator: .material.secondary.900
|
||||||
text: .material.foreground.secondary.800
|
text: .material.foreground.secondary.800
|
||||||
|
|
||||||
|
gtk:
|
||||||
|
accent:
|
||||||
|
color: .material.primary.200
|
||||||
|
bg: .material.primary.500
|
||||||
|
fg: .material.foreground.primary.500
|
||||||
|
|
||||||
|
hyprland:
|
||||||
|
hyprlock:
|
||||||
|
accent: .material.primary.500
|
||||||
|
accent-alt: .material.secondary.800
|
||||||
|
|
||||||
ansi:
|
ansi:
|
||||||
blue:
|
blue:
|
||||||
regular: '#5ab5e0'
|
regular: '#5ab5e0'
|
||||||
@@ -85,3 +97,5 @@ material:
|
|||||||
900: .ansi.gray.black
|
900: .ansi.gray.black
|
||||||
secondary:
|
secondary:
|
||||||
400: .ansi.gray.white
|
400: .ansi.gray.white
|
||||||
|
error:
|
||||||
|
500: .ansi.gray.black
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
--- # yamllint disable rule:colons
|
---
|
||||||
|
# yamllint disable rule:colons
|
||||||
ansi:
|
ansi:
|
||||||
blue:
|
blue:
|
||||||
regular: '#3d8890'
|
regular: '#3d8890'
|
||||||
@@ -36,6 +37,24 @@ rofi:
|
|||||||
polybar:
|
polybar:
|
||||||
background-alt: .material.primary.800
|
background-alt: .material.primary.800
|
||||||
|
|
||||||
|
gtk:
|
||||||
|
accent:
|
||||||
|
color: .material.primary.200
|
||||||
|
bg: .material.primary.500
|
||||||
|
fg: .material.foreground.primary.500
|
||||||
|
|
||||||
|
hyprland:
|
||||||
|
hyprlock:
|
||||||
|
accent: .material.primary.500
|
||||||
|
accent-alt: .material.secondary.800
|
||||||
|
|
||||||
|
hyprtoolkit:
|
||||||
|
accent: .material.primary.800
|
||||||
|
bright-text: .material.foreground.primary.800
|
||||||
|
|
||||||
|
quickshell:
|
||||||
|
background-alt: .material.primary.800
|
||||||
|
|
||||||
material:
|
material:
|
||||||
base:
|
base:
|
||||||
secondary: .material.secondary.500
|
secondary: .material.secondary.500
|
||||||
@@ -80,6 +99,8 @@ material:
|
|||||||
900: '#170209'
|
900: '#170209'
|
||||||
|
|
||||||
foreground:
|
foreground:
|
||||||
|
primary:
|
||||||
|
500: .ansi.gray.black
|
||||||
secondary:
|
secondary:
|
||||||
500: .ansi.gray.black
|
500: .ansi.gray.black
|
||||||
error:
|
error:
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
--
|
||||||
|
-- dotwryn hyprland configuration library
|
||||||
|
--
|
||||||
|
|
||||||
|
local DOTWRYN = os.getenv("DOTWRYN")
|
||||||
|
local dotwryn = {
|
||||||
|
DOTWRYN = DOTWRYN,
|
||||||
|
|
||||||
|
colorscheme = dofile(DOTWRYN .. "/scwrypts/dotwryn/desktop/colorscheme/colorscheme.lua").load(),
|
||||||
|
scwrypts = dofile(DOTWRYN .. "/config/desktop/hyprland/scwrypts.lua"),
|
||||||
|
|
||||||
|
font = {
|
||||||
|
family = table.concat({
|
||||||
|
"Pokémoji Color",
|
||||||
|
"Monaspace Argon",
|
||||||
|
}, ", "),
|
||||||
|
|
||||||
|
size = 11,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
local config_filepaths = {}
|
||||||
|
|
||||||
|
local config_dir = (DOTWRYN .. "/config/desktop/hyprland/config.lua.d")
|
||||||
|
local config_dir_quoted = config_dir:gsub("'", "'\\''")
|
||||||
|
|
||||||
|
assert(io.open(config_dir, "r"), "error reading hyprland config.lua.d : " .. config_dir)
|
||||||
|
|
||||||
|
local find = io.popen("find '" .. config_dir_quoted .. "' -mindepth 1 -maxdepth 1 -type f -name '*.lua'")
|
||||||
|
for config_filepath in find:lines() do
|
||||||
|
table.insert(config_filepaths, config_filepath)
|
||||||
|
end
|
||||||
|
find:close()
|
||||||
|
|
||||||
|
table.sort(config_filepaths)
|
||||||
|
|
||||||
|
for _, config_filepath in ipairs(config_filepaths) do
|
||||||
|
assert(loadfile(config_filepath))(dotwryn)
|
||||||
|
end
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- hyprland-base configuration
|
||||||
|
--
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
ecosystem = {
|
||||||
|
no_update_news = true,
|
||||||
|
no_donation_nag = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
input = {
|
||||||
|
kb_layout = "us",
|
||||||
|
},
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
font_family = dotwryn.font.family,
|
||||||
|
force_default_wallpaper = 0,
|
||||||
|
disable_hyprland_logo = true,
|
||||||
|
disable_splash_rendering = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.monitor({
|
||||||
|
output = "",
|
||||||
|
mode = "preferred",
|
||||||
|
position = "auto",
|
||||||
|
scale = "auto",
|
||||||
|
})
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
hl.bind("SUPER + SHIFT + e", hl.dsp.exec_cmd("qs ipc call logout show"))
|
||||||
|
hl.bind("CTRL + ALT + Delete", hl.dsp.exit())
|
||||||
|
hl.bind("SUPER + SHIFT + r", hl.dsp.exec_cmd("hyprctl reload"))
|
||||||
|
hl.bind("SUPER + SHIFT + c", hl.dsp.exec_cmd("hyprctl reload"))
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- high-dpi scaling : XWayland apps render at 1x and scale themselves
|
||||||
|
--
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
xwayland = {
|
||||||
|
force_zero_scaling = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- force_zero_scaling leaves steam at 1x; match the active monitor's scale instead
|
||||||
|
local set_steam_scaling = function()
|
||||||
|
local monitor = hl.get_active_monitor()
|
||||||
|
if monitor == nil or monitor.scale == nil or monitor.scale <= 0 then return end
|
||||||
|
|
||||||
|
hl.env("STEAM_FORCE_DESKTOPUI_SCALING", tostring(monitor.scale))
|
||||||
|
end
|
||||||
|
|
||||||
|
set_steam_scaling()
|
||||||
|
|
||||||
|
for _, event in ipairs({ "monitor.added", "monitor.removed", "monitor.layout_changed" }) do
|
||||||
|
hl.on(event, set_steam_scaling)
|
||||||
|
end
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- named monitor layouts (hyprland port of the per-host xrandr layout scripts)
|
||||||
|
--
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- hosts define their monitors and layouts using the following spec:
|
||||||
|
--
|
||||||
|
-- (inside config/local/<host>/user/hypr/host.lua)
|
||||||
|
--
|
||||||
|
-- dotwryn.monitors.<name> = {
|
||||||
|
-- output = "<connector>", -- e.g. "DP-1"; a "desc:" rule can't re-enable a disabled monitor
|
||||||
|
-- modes = { "<w>x<h>@<hz>", ... }, -- the modes the monitor advertises
|
||||||
|
-- excluded_modes = { "<w>x<h>@<hz>", ... }, -- (optional) advertised, but tested and not working
|
||||||
|
-- max_refresh = <hz>, -- (optional) never pick a faster mode
|
||||||
|
-- mirrored_max_refresh = <hz>, -- (optional) cap while another monitor mirrors this one
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- dotwryn.monitor_layouts["<layout>"] = {
|
||||||
|
-- primary = "<name>", -- the monitor an emergency monitor mirrors
|
||||||
|
-- monitors = { -- omit monitor = monitor disabled
|
||||||
|
-- <name> = { resolution = "4k", position = "0x0", scale = 1.5 },
|
||||||
|
-- <name> = { resolution = "4k", mirror = "<name>" },
|
||||||
|
-- },
|
||||||
|
-- wallpaper = "theme", -- (optional) set-background selection
|
||||||
|
-- sfx = "gamedock", -- (optional) play-sfx selection
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- dotwryn.emergency_monitor = { monitor = "<name>", key = "<keysym>" } -- (optional) the key toggles <name> as a mirror of the active layout's primary
|
||||||
|
--
|
||||||
|
-- a monitor runs the fastest of its modes at the requested resolution which isn't excluded
|
||||||
|
-- or over its refresh caps; 'max' takes the highest resolution, and a resolution the monitor
|
||||||
|
-- doesn't have falls back to 'max'. a resolution chosen in the picker replaces the resolution
|
||||||
|
-- of every monitor in the layout; the scale is kept unless it doesn't divide the mode evenly (then 1)
|
||||||
|
--
|
||||||
|
-- 'default' is applied on startup and reload (see ./99-autostart.lua)
|
||||||
|
--
|
||||||
|
|
||||||
|
dotwryn.monitors = {}
|
||||||
|
dotwryn.monitor_layouts = {}
|
||||||
|
|
||||||
|
local RESOLUTIONS = {
|
||||||
|
["1080"] = "1920x1080",
|
||||||
|
["1440"] = "2560x1440",
|
||||||
|
["4k"] = "3840x2160",
|
||||||
|
["max"] = "max",
|
||||||
|
}
|
||||||
|
|
||||||
|
local MAX_RESOLUTION_ORDER = { "4k", "1440", "1080" }
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
local get_sorted_keys = function(table_)
|
||||||
|
local keys = {}
|
||||||
|
for key, _ in pairs(table_) do table.insert(keys, key) end
|
||||||
|
table.sort(keys)
|
||||||
|
return keys
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_layout = function(layout_name, resolution)
|
||||||
|
local layout = dotwryn.monitor_layouts[layout_name]
|
||||||
|
|
||||||
|
assert(layout ~= nil, "unknown monitor layout '" .. tostring(layout_name) .. "' (available : " .. table.concat(get_sorted_keys(dotwryn.monitor_layouts), ", ") .. ")")
|
||||||
|
assert(resolution == nil or RESOLUTIONS[resolution] ~= nil, "unknown resolution '" .. tostring(resolution) .. "' (available : " .. table.concat(get_sorted_keys(RESOLUTIONS), ", ") .. ")")
|
||||||
|
assert(layout.primary ~= nil and (layout.monitors or {})[layout.primary] ~= nil, "monitor layout '" .. layout_name .. "' needs a primary from its monitors")
|
||||||
|
|
||||||
|
for monitor_name, monitor in pairs(layout.monitors) do
|
||||||
|
assert(dotwryn.monitors[monitor_name] ~= nil, "monitor layout '" .. layout_name .. "' uses unknown monitor '" .. monitor_name .. "'")
|
||||||
|
assert(RESOLUTIONS[monitor.resolution or "max"] ~= nil, "monitor layout '" .. layout_name .. "' uses unknown resolution '" .. tostring(monitor.resolution) .. "' for '" .. monitor_name .. "'")
|
||||||
|
assert(monitor.mirror == nil or layout.monitors[monitor.mirror] ~= nil, "monitor layout '" .. layout_name .. "' mirrors '" .. tostring(monitor.mirror) .. "', which isn't in the layout")
|
||||||
|
end
|
||||||
|
|
||||||
|
return layout
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_monitor_mode = function(monitor_name, resolution, is_mirrored)
|
||||||
|
local monitor = dotwryn.monitors[monitor_name]
|
||||||
|
|
||||||
|
local max_refresh = monitor.max_refresh or math.huge
|
||||||
|
if is_mirrored and monitor.mirrored_max_refresh ~= nil then max_refresh = math.min(max_refresh, monitor.mirrored_max_refresh) end
|
||||||
|
|
||||||
|
local excluded_modes = {}
|
||||||
|
for _, mode in ipairs(monitor.excluded_modes or {}) do excluded_modes[mode] = true end
|
||||||
|
|
||||||
|
local get_fastest_mode = function(size)
|
||||||
|
local fastest_mode, fastest_refresh
|
||||||
|
for _, mode in ipairs(monitor.modes or {}) do
|
||||||
|
local mode_size, refresh = mode:match("^(%d+x%d+)@([%d.]+)$")
|
||||||
|
refresh = tonumber(refresh)
|
||||||
|
|
||||||
|
if mode_size == size and refresh <= max_refresh and not excluded_modes[mode] and (fastest_refresh == nil or refresh > fastest_refresh) then
|
||||||
|
fastest_mode, fastest_refresh = mode, refresh
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return fastest_mode
|
||||||
|
end
|
||||||
|
|
||||||
|
local mode = resolution ~= "max" and get_fastest_mode(RESOLUTIONS[resolution]) or nil
|
||||||
|
for _, max_resolution in ipairs(MAX_RESOLUTION_ORDER) do
|
||||||
|
if mode ~= nil then break end
|
||||||
|
mode = get_fastest_mode(RESOLUTIONS[max_resolution])
|
||||||
|
end
|
||||||
|
|
||||||
|
assert(mode ~= nil, "monitor '" .. monitor_name .. "' has no usable 1080/1440/4k mode")
|
||||||
|
return mode
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_resolution_scale = function(mode, scale)
|
||||||
|
local width, height = mode:match("^(%d+)x(%d+)")
|
||||||
|
if width == nil or type(scale) ~= "number" then return scale end
|
||||||
|
|
||||||
|
if (width / scale) % 1 == 0 and (height / scale) % 1 == 0 then return scale end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_monitor_has_workspaces = function(output)
|
||||||
|
for _, workspace in ipairs(hl.get_workspaces()) do
|
||||||
|
if workspace.monitor ~= nil and workspace.monitor.name == output then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local emergency_monitor_enabled = false
|
||||||
|
|
||||||
|
dotwryn.set_monitor_layout = function(layout_name, resolution, options)
|
||||||
|
local layout = get_layout(layout_name, resolution)
|
||||||
|
|
||||||
|
local layout_monitors = {}
|
||||||
|
for monitor_name, monitor in pairs(layout.monitors) do layout_monitors[monitor_name] = monitor end
|
||||||
|
|
||||||
|
local emergency_monitor = dotwryn.emergency_monitor
|
||||||
|
if emergency_monitor ~= nil and emergency_monitor_enabled and layout_monitors[emergency_monitor.monitor] == nil then
|
||||||
|
layout_monitors[emergency_monitor.monitor] = { resolution = "max", mirror = layout.primary }
|
||||||
|
end
|
||||||
|
|
||||||
|
local mirrored_monitor_names = {}
|
||||||
|
for _, monitor in pairs(layout_monitors) do
|
||||||
|
if monitor.mirror ~= nil then mirrored_monitor_names[monitor.mirror] = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_monitor_spec = function(monitor_name)
|
||||||
|
local monitor = layout_monitors[monitor_name]
|
||||||
|
local output = dotwryn.monitors[monitor_name].output
|
||||||
|
local mode = get_monitor_mode(monitor_name, resolution or monitor.resolution or "max", mirrored_monitor_names[monitor_name])
|
||||||
|
|
||||||
|
local monitor_spec = { -- every field set; hl.monitor merges into the output's previous rule
|
||||||
|
output = output,
|
||||||
|
disabled = false,
|
||||||
|
mode = mode,
|
||||||
|
position = monitor.position or "auto",
|
||||||
|
scale = get_resolution_scale(mode, monitor.scale or 1),
|
||||||
|
mirror = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
if monitor.mirror ~= nil then
|
||||||
|
monitor_spec.mirror = dotwryn.monitors[monitor.mirror].output
|
||||||
|
|
||||||
|
-- after a dpms cycle hyprland can lose a mirror it still reports (the "mirror"
|
||||||
|
-- owns workspaces); re-setting the same mirror is a no-op, so clear it first
|
||||||
|
if get_monitor_has_workspaces(output) then hl.monitor({ output = output, mirror = "" }) end
|
||||||
|
end
|
||||||
|
|
||||||
|
return monitor_spec
|
||||||
|
end
|
||||||
|
|
||||||
|
-- monitors the others mirror come up first and disabled monitors go down last,
|
||||||
|
-- so there's never a mirror of a disabled monitor or a moment with no monitors
|
||||||
|
for monitor_name, monitor in pairs(layout_monitors) do
|
||||||
|
if monitor.mirror == nil then hl.monitor(get_monitor_spec(monitor_name)) end
|
||||||
|
end
|
||||||
|
for monitor_name, monitor in pairs(layout_monitors) do
|
||||||
|
if monitor.mirror ~= nil then hl.monitor(get_monitor_spec(monitor_name)) end
|
||||||
|
end
|
||||||
|
for monitor_name, monitor in pairs(dotwryn.monitors) do
|
||||||
|
if layout_monitors[monitor_name] == nil then hl.monitor({ output = monitor.output, disabled = true }) end
|
||||||
|
end
|
||||||
|
|
||||||
|
dotwryn.active_monitor_layout = { name = layout_name, resolution = resolution }
|
||||||
|
|
||||||
|
if not (options or {}).switch then return end
|
||||||
|
|
||||||
|
if layout.wallpaper ~= nil then hl.dispatch(dotwryn.scwrypts.hyprland.set_background(layout.wallpaper)) end
|
||||||
|
if layout.sfx ~= nil then hl.dispatch(dotwryn.scwrypts.media.play_sfx(layout.sfx)) end
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
hl.bind("SUPER + d", hl.dsp.exec_cmd("qs ipc call -- displays show"))
|
||||||
|
|
||||||
|
dotwryn_set_monitor_layout = function(layout_name, resolution)
|
||||||
|
dotwryn.set_monitor_layout(layout_name, resolution, { switch = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
dotwryn_toggle_emergency_monitor = function()
|
||||||
|
assert(dotwryn.emergency_monitor ~= nil, "no emergency monitor configured for this host")
|
||||||
|
|
||||||
|
emergency_monitor_enabled = not emergency_monitor_enabled
|
||||||
|
|
||||||
|
local layout = dotwryn.active_monitor_layout
|
||||||
|
dotwryn.set_monitor_layout(layout.name, layout.resolution)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- eval can't return values; the picker (config/user/quickshell/DisplayPicker.qml) reads this IPC event instead
|
||||||
|
dotwryn_publish_monitor_layouts = function()
|
||||||
|
local get_json_string = function(value)
|
||||||
|
return '"' .. value:gsub('[%c"\\]', function(character) return string.format("\\u%04x", character:byte()) end) .. '"'
|
||||||
|
end
|
||||||
|
|
||||||
|
local get_json_strings = function(values)
|
||||||
|
local json_strings = {}
|
||||||
|
for _, value in ipairs(values) do table.insert(json_strings, get_json_string(value)) end
|
||||||
|
return "[" .. table.concat(json_strings, ",") .. "]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local layout_names = get_sorted_keys(dotwryn.monitor_layouts)
|
||||||
|
for index, layout_name in ipairs(layout_names) do
|
||||||
|
if layout_name == "default" then table.insert(layout_names, 1, table.remove(layout_names, index)) break end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.dispatch(hl.dsp.event("dotwryn-monitor-layouts " .. table.concat({
|
||||||
|
'{"layouts":', get_json_strings(layout_names),
|
||||||
|
',"resolutions":', get_json_strings(get_sorted_keys(RESOLUTIONS)), "}",
|
||||||
|
})))
|
||||||
|
end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
hl.config({ animations = { enabled = true } })
|
||||||
|
|
||||||
|
hl.curve("easeOutQuint", { type = "bezier", points = { {0.23, 1}, {0.32, 1} } })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "global", enabled = false })
|
||||||
|
hl.animation({ leaf = "windows", enabled = true, speed = 3, bezier = "easeOutQuint", style = "slide" })
|
||||||
|
hl.animation({ leaf = "layers", enabled = true, speed = 3, bezier = "easeOutQuint", style = "popin" })
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 3, bezier = "easeOutQuint", style = "slide" })
|
||||||
|
hl.animation({ leaf = "border", enabled = true, speed = 3, bezier = "easeOutQuint" })
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- as a long-time i3wm user, my dwindle configuration contains tries to
|
||||||
|
-- make the transition feel smooth
|
||||||
|
--
|
||||||
|
-- <https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/>
|
||||||
|
--
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
active = {
|
||||||
|
border = dotwryn.colorscheme.get_hex(".dwindle.colors.active.border", ".i3.focused.border", ".material.secondary.500", ".ansi.green.bright"),
|
||||||
|
text = dotwryn.colorscheme.get_hex(".dwindle.colors.active.text", ".i3.focused.text", ".material.foreground.secondary.500", ".foreground"),
|
||||||
|
locked = dotwryn.colorscheme.get_hex(".dwindle.colors.active.locked", ".i3.urgent.border", ".material.error.500", ".ansi.red.bright"),
|
||||||
|
},
|
||||||
|
|
||||||
|
inactive = {
|
||||||
|
border = dotwryn.colorscheme.get_hex(".dwindle.colors.inactive.border", ".i3.unfocused.border", ".material.primary.700", ".ansi.yellow.bright"),
|
||||||
|
text = dotwryn.colorscheme.get_hex(".dwindle.colors.inactive.text", ".i3.unfocused.text", ".material.foreground.primary.700", ".foreground"),
|
||||||
|
locked = dotwryn.colorscheme.get_hex(".dwindle.colors.inactive.locked", ".i3.inactive.border", ".material.primary.700", ".ansi.yellow.bright"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
general = {
|
||||||
|
layout = "dwindle",
|
||||||
|
|
||||||
|
border_size = 4,
|
||||||
|
gaps_in = 0,
|
||||||
|
gaps_out = 0,
|
||||||
|
|
||||||
|
resize_on_border = false,
|
||||||
|
|
||||||
|
col = {
|
||||||
|
active_border = colors.active.border,
|
||||||
|
inactive_border = colors.inactive.border,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
dwindle = { preserve_split = true },
|
||||||
|
input = { follow_mouse = 1 },
|
||||||
|
binds = { movefocus_cycles_groupfirst = true },
|
||||||
|
|
||||||
|
decoration = {
|
||||||
|
rounding = 0,
|
||||||
|
shadow = { enabled = false },
|
||||||
|
blur = { enabled = false },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- currently treating dwindle "groups" like an i3 "tabbed"
|
||||||
|
group = {
|
||||||
|
col = {
|
||||||
|
border_active = colors.active.border,
|
||||||
|
border_inactive = colors.inactive.border,
|
||||||
|
border_locked_active = colors.active.locked,
|
||||||
|
border_locked_inactive = colors.inactive.locked,
|
||||||
|
},
|
||||||
|
|
||||||
|
groupbar = {
|
||||||
|
font_family = dotwryn.font.family,
|
||||||
|
font_size = dotwryn.font.size,
|
||||||
|
height = 22,
|
||||||
|
gradients = true,
|
||||||
|
rounding = 0,
|
||||||
|
gradient_rounding = 0,
|
||||||
|
render_titles = true,
|
||||||
|
|
||||||
|
text_color = colors.active.text,
|
||||||
|
text_color_inactive = colors.inactive.text,
|
||||||
|
|
||||||
|
col = {
|
||||||
|
active = colors.active.border,
|
||||||
|
inactive = colors.inactive.border,
|
||||||
|
locked_active = colors.active.locked,
|
||||||
|
locked_inactive = colors.inactive.locked,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- i3wm & vim-style window navigation
|
||||||
|
--
|
||||||
|
|
||||||
|
-- moves a window through groups to recreate i3wm tab behavior
|
||||||
|
local move_window = function(direction)
|
||||||
|
return function()
|
||||||
|
local window = hl.get_active_window()
|
||||||
|
local group = window ~= nil and window.group or nil
|
||||||
|
|
||||||
|
if group ~= nil and group.size > 1 and (direction == "left" or direction == "right") then
|
||||||
|
local at_edge = (direction == "left" and group.current_index <= 1)
|
||||||
|
or (direction == "right" and group.current_index >= group.size)
|
||||||
|
if not at_edge then
|
||||||
|
hl.dispatch(hl.dsp.group.move_window({ forward = direction == "right" }))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.dispatch(hl.dsp.window.move({ direction = direction, group_aware = true }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
for key, direction in pairs({ h = "left", j = "down", k = "up", l = "right" }) do
|
||||||
|
hl.bind("SUPER + " .. key, hl.dsp.focus({ direction = direction }))
|
||||||
|
hl.bind("SUPER + SHIFT + " .. key, move_window(direction))
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + f", hl.dsp.window.fullscreen({ mode = "fullscreen" }))
|
||||||
|
|
||||||
|
hl.bind("SUPER + q", hl.dsp.window.close())
|
||||||
|
|
||||||
|
-- i3 'layout toggle split'
|
||||||
|
hl.bind("SUPER + e", hl.dsp.layout("togglesplit"))
|
||||||
|
|
||||||
|
-- i3 'layout tabbed' / 'layout stacking' : both toggle a group
|
||||||
|
hl.bind("SUPER + w", hl.dsp.group.toggle())
|
||||||
|
hl.bind("SUPER + s", hl.dsp.group.toggle())
|
||||||
|
|
||||||
|
-- (no equivalent) bindsym $mod+BackSpace open
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- i3wm-style resize mode
|
||||||
|
--
|
||||||
|
|
||||||
|
local resize = function(x, y)
|
||||||
|
return function()
|
||||||
|
local monitor = hl.get_active_monitor()
|
||||||
|
local scale = (monitor ~= nil and monitor.scale ~= nil and monitor.scale > 0) and monitor.scale or 1
|
||||||
|
local step_x = monitor ~= nil and math.floor(monitor.width / scale * 0.1) or 10
|
||||||
|
local step_y = monitor ~= nil and math.floor(monitor.height / scale * 0.1) or 10
|
||||||
|
hl.dispatch(hl.dsp.window.resize({ x = x * step_x, y = y * step_y, relative = true }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + r", hl.dsp.submap("resize"))
|
||||||
|
|
||||||
|
hl.define_submap("resize", function()
|
||||||
|
hl.bind("h", resize( 1, 0), { repeating = true })
|
||||||
|
hl.bind("j", resize( 0, -1), { repeating = true })
|
||||||
|
hl.bind("k", resize( 0, 1), { repeating = true })
|
||||||
|
hl.bind("l", resize(-1, 0), { repeating = true })
|
||||||
|
|
||||||
|
hl.bind("Return", hl.dsp.submap("reset"))
|
||||||
|
hl.bind("Escape", hl.dsp.submap("reset"))
|
||||||
|
hl.bind("SUPER + r", hl.dsp.submap("reset"))
|
||||||
|
end)
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- i3wm-style floating windows and scratchpad
|
||||||
|
--
|
||||||
|
|
||||||
|
hl.bind("SUPER + SHIFT + space", hl.dsp.window.float({ action = "toggle" }))
|
||||||
|
|
||||||
|
hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||||
|
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
|
||||||
|
local SCRATCHPAD = "special:scratchpad"
|
||||||
|
|
||||||
|
local SCRATCHPAD_FILTERS = {
|
||||||
|
terminal = { "^Alacritty$", "^kitty$" },
|
||||||
|
games = { "^steam$", "^dolphin%-emu$", "^Visualboyadvance%-m$", "^steam_app_" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local function matches_filter(class, filter)
|
||||||
|
if filter == nil then
|
||||||
|
for name, _ in pairs(SCRATCHPAD_FILTERS) do
|
||||||
|
if matches_filter(class, name) then return false end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
for _, pattern in ipairs(SCRATCHPAD_FILTERS[filter]) do
|
||||||
|
if class ~= nil and class:match(pattern) then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local workspace_selector = function(workspace)
|
||||||
|
return workspace.id > 0 and tostring(workspace.id) or ("name:" .. workspace.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
local scratchpad_shown = {}
|
||||||
|
local scratchpad_queue = {}
|
||||||
|
|
||||||
|
local scratchpad_enqueue = function(address)
|
||||||
|
for index, queued in ipairs(scratchpad_queue) do
|
||||||
|
if queued == address then table.remove(scratchpad_queue, index) break end
|
||||||
|
end
|
||||||
|
table.insert(scratchpad_queue, address)
|
||||||
|
end
|
||||||
|
|
||||||
|
local scratchpad_windows = function()
|
||||||
|
local stashed = {}
|
||||||
|
for _, window in ipairs(hl.get_workspace_windows(SCRATCHPAD)) do stashed[window.address] = window end
|
||||||
|
|
||||||
|
local ordered = {}
|
||||||
|
for _, address in ipairs(scratchpad_queue) do
|
||||||
|
if stashed[address] ~= nil then
|
||||||
|
table.insert(ordered, stashed[address])
|
||||||
|
stashed[address] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for address, window in pairs(stashed) do
|
||||||
|
table.insert(ordered, window)
|
||||||
|
scratchpad_enqueue(address)
|
||||||
|
end
|
||||||
|
return ordered
|
||||||
|
end
|
||||||
|
|
||||||
|
local scratchpad_fit = function(selector)
|
||||||
|
local monitor = hl.get_active_monitor()
|
||||||
|
if monitor ~= nil then
|
||||||
|
local scale = (monitor.scale ~= nil and monitor.scale > 0) and monitor.scale or 1
|
||||||
|
hl.dispatch(hl.dsp.window.resize({
|
||||||
|
window = selector,
|
||||||
|
x = math.floor(monitor.width / scale * 0.75),
|
||||||
|
y = math.floor(monitor.height / scale * 0.75),
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
hl.dispatch(hl.dsp.window.center({ window = selector }))
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + SHIFT + Tab", function()
|
||||||
|
local window = hl.get_active_window()
|
||||||
|
if window == nil then return end
|
||||||
|
|
||||||
|
local selector = "address:" .. window.address
|
||||||
|
hl.dispatch(hl.dsp.window.float({ window = selector, action = "enable" }))
|
||||||
|
scratchpad_fit(selector)
|
||||||
|
hl.dispatch(hl.dsp.window.move({ window = selector, workspace = SCRATCHPAD, follow = false }))
|
||||||
|
scratchpad_shown[window.address] = nil
|
||||||
|
scratchpad_enqueue(window.address)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local scratchpad_show = function(filter)
|
||||||
|
return function()
|
||||||
|
local workspace = hl.get_active_workspace()
|
||||||
|
if workspace == nil then return end
|
||||||
|
|
||||||
|
local active = hl.get_active_window()
|
||||||
|
local candidates = {}
|
||||||
|
if filter == nil and active ~= nil and scratchpad_shown[active.address] then
|
||||||
|
table.insert(candidates, active.address)
|
||||||
|
end
|
||||||
|
for address, _ in pairs(scratchpad_shown) do table.insert(candidates, address) end
|
||||||
|
|
||||||
|
for _, address in ipairs(candidates) do
|
||||||
|
local window = hl.get_window("address:" .. address)
|
||||||
|
if window == nil or window.workspace == nil or window.workspace.name == SCRATCHPAD then
|
||||||
|
scratchpad_shown[address] = nil
|
||||||
|
elseif window.workspace.id == workspace.id and (filter == nil or matches_filter(window.class, filter)) then
|
||||||
|
hl.dispatch(hl.dsp.window.move({ window = "address:" .. address, workspace = SCRATCHPAD, follow = false }))
|
||||||
|
scratchpad_shown[address] = nil
|
||||||
|
scratchpad_enqueue(address)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, window in ipairs(scratchpad_windows()) do
|
||||||
|
if matches_filter(window.class, filter) then
|
||||||
|
local selector = "address:" .. window.address
|
||||||
|
hl.dispatch(hl.dsp.window.move({ window = selector, workspace = workspace_selector(workspace), follow = false }))
|
||||||
|
scratchpad_fit(selector)
|
||||||
|
hl.dispatch(hl.dsp.focus({ window = selector }))
|
||||||
|
scratchpad_shown[window.address] = true
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + Tab", scratchpad_show(nil))
|
||||||
|
hl.bind("SUPER + x", scratchpad_show("terminal"))
|
||||||
|
hl.bind("SUPER + SHIFT + x", scratchpad_show("games"))
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- desktop workspace settings
|
||||||
|
--
|
||||||
|
|
||||||
|
dotwryn.workspace_defaults = {
|
||||||
|
gaps = { inner = "0.5%", outer = "1%" },
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.workspaces = {
|
||||||
|
{ key = "1", name = "1" },
|
||||||
|
{ key = "2", name = "2", gaps = { enabled = false } },
|
||||||
|
{ key = "3", name = "3" },
|
||||||
|
{ key = "4", name = "4" },
|
||||||
|
{ key = "5", name = "5" },
|
||||||
|
{ key = "6", name = "6" },
|
||||||
|
{ key = "7", name = "7" },
|
||||||
|
{ key = "8", name = "8" },
|
||||||
|
{ key = "9", name = "9" },
|
||||||
|
|
||||||
|
{ key = "g", name = "100", label = "🎮", vertical = true, },
|
||||||
|
{ key = "0", name = "name:🎧", vertical = true, },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, workspace in ipairs(dotwryn.workspaces) do
|
||||||
|
if workspace.label ~= nil then
|
||||||
|
hl.workspace_rule({ workspace = workspace.name, default_name = workspace.label })
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + SHIFT + " .. workspace.key, hl.dsp.window.move({ workspace = workspace.name, follow = false }))
|
||||||
|
end
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- workspace navigation with per-switch slide direction
|
||||||
|
--
|
||||||
|
|
||||||
|
local VERTICAL_WORKSPACES = {} -- by target ("100", "name:🎧") and display name ("🎮", "🎧")
|
||||||
|
for _, workspace in ipairs(dotwryn.workspaces) do
|
||||||
|
if workspace.vertical then
|
||||||
|
VERTICAL_WORKSPACES[workspace.name] = true
|
||||||
|
VERTICAL_WORKSPACES[workspace.label or (workspace.name:gsub("^name:", ""))] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function animate_workspace_focus(name)
|
||||||
|
local active = hl.get_active_workspace()
|
||||||
|
local vertical = VERTICAL_WORKSPACES[name]
|
||||||
|
or (active ~= nil and VERTICAL_WORKSPACES[active.name])
|
||||||
|
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 3, bezier = "easeOutQuint", style = vertical and "slidevert" or "slide" })
|
||||||
|
hl.dispatch(hl.dsp.focus({ workspace = name }))
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, workspace in ipairs(dotwryn.workspaces) do
|
||||||
|
if workspace.name ~= "2" then -- (special case below)
|
||||||
|
hl.bind("SUPER + " .. workspace.key, function() animate_workspace_focus(workspace.name) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- workspace 2 is home to the 'omni' tmux session; open a terminal if nothing is attached
|
||||||
|
hl.bind("SUPER + 2", function()
|
||||||
|
animate_workspace_focus("2")
|
||||||
|
hl.dispatch(hl.dsp.exec_cmd("[[ $(tmux -L omni.socket list-clients 2>/dev/null | wc -l) -eq 0 ]] && $TERMINAL"))
|
||||||
|
end)
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- provides per-workspace gaps settings
|
||||||
|
--
|
||||||
|
|
||||||
|
local get_gaps_config = function(workspace)
|
||||||
|
local gaps = {}
|
||||||
|
for key, value in pairs(dotwryn.workspace_defaults.gaps) do gaps[key] = value end
|
||||||
|
for key, value in pairs(workspace.gaps or {}) do gaps[key] = value end
|
||||||
|
return gaps
|
||||||
|
end
|
||||||
|
|
||||||
|
local to_pixels = function(value)
|
||||||
|
local percent = type(value) == "string" and tonumber((value:gsub("%%$", ""))) or nil
|
||||||
|
if percent == nil then return value end
|
||||||
|
|
||||||
|
local monitor = hl.get_active_monitor()
|
||||||
|
if monitor == nil then return 0 end -- (recomputed once a monitor shows up)
|
||||||
|
|
||||||
|
local scale = (monitor.scale ~= nil and monitor.scale > 0) and monitor.scale or 1
|
||||||
|
return math.floor(math.min(monitor.width, monitor.height) / scale * percent / 100)
|
||||||
|
end
|
||||||
|
|
||||||
|
local labels = {} -- reattach labels from ./80-workspaces.lua
|
||||||
|
for _, workspace in ipairs(dotwryn.workspaces) do labels[workspace.name] = workspace.label end
|
||||||
|
|
||||||
|
local gaps_rules = {}
|
||||||
|
local set_gaps = function(workspace, inner, outer)
|
||||||
|
if gaps_rules[workspace] ~= nil then gaps_rules[workspace].rule:set_enabled(false) end
|
||||||
|
gaps_rules[workspace] = {
|
||||||
|
inner = inner,
|
||||||
|
outer = outer,
|
||||||
|
rule = hl.workspace_rule({ workspace = workspace, gaps_in = inner, gaps_out = outer, default_name = labels[workspace] }),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local apply_gaps = function()
|
||||||
|
for _, workspace in ipairs(dotwryn.workspaces) do
|
||||||
|
local gaps = get_gaps_config(workspace)
|
||||||
|
if gaps.enabled == false then
|
||||||
|
set_gaps(workspace.name, 0, 0)
|
||||||
|
else
|
||||||
|
set_gaps(workspace.name, to_pixels(gaps.inner), to_pixels(gaps.outer))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
apply_gaps()
|
||||||
|
|
||||||
|
for _, event in ipairs({ "monitor.added", "monitor.removed", "monitor.layout_changed" }) do
|
||||||
|
hl.on(event, apply_gaps)
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "smart-no-borders",
|
||||||
|
match = { float = false, group = false, workspace = "s[false] w[tv1]" },
|
||||||
|
border_size = 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
local GAPS_STEP = "0.5%"
|
||||||
|
|
||||||
|
local adjust_gaps = function(direction)
|
||||||
|
return function()
|
||||||
|
local workspace = hl.get_active_workspace()
|
||||||
|
if workspace == nil then return end
|
||||||
|
|
||||||
|
local name = workspace.id > 0 and tostring(workspace.id) or ("name:" .. workspace.name)
|
||||||
|
local current = gaps_rules[name] or { inner = 0, outer = 0 }
|
||||||
|
local delta = direction * math.max(1, to_pixels(GAPS_STEP))
|
||||||
|
set_gaps(name, math.max(0, current.inner + delta), math.max(0, current.outer + delta))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.bind("SUPER + z", adjust_gaps( 1), { repeating = true })
|
||||||
|
hl.bind("SUPER + SHIFT + z", adjust_gaps(-1), { repeating = true })
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
local bind = function(bindings, ...)
|
||||||
|
for keys, dispatcher in pairs(bindings) do
|
||||||
|
hl.bind(keys, dispatcher, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local set_background =
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
bind({
|
||||||
|
["XF86AudioRewind"] = hl.dsp.exec_cmd("playerctl previous"),
|
||||||
|
["XF86AudioPrev"] = hl.dsp.exec_cmd("playerctl previous"),
|
||||||
|
["XF86AudioForward"] = hl.dsp.exec_cmd("playerctl next"),
|
||||||
|
["XF86AudioNext"] = hl.dsp.exec_cmd("playerctl next"),
|
||||||
|
["XF86AudioPlay"] = hl.dsp.exec_cmd("playerctl play-pause"),
|
||||||
|
|
||||||
|
["XF86AudioMute"] = hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"),
|
||||||
|
["XF86AudioMicMute"] = hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"),
|
||||||
|
}, { locked = true })
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
bind({
|
||||||
|
["XF86AudioRaiseVolume"] = hl.dsp.exec_cmd("qs ipc call volume up"), -- ../../../user/quickshell/VolumeOsd.qml "going past 100%"
|
||||||
|
["XF86AudioLowerVolume"] = hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 10%-"),
|
||||||
|
}, { locked = true, repeating = true })
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
bind({
|
||||||
|
["SUPER + SHIFT + m"] = dotwryn.scwrypts.hyprland.launch_or_show("slack"),
|
||||||
|
["SUPER + SHIFT + d"] = dotwryn.scwrypts.hyprland.launch_or_show("fluxer", "-c", "Fluxer"),
|
||||||
|
["SUPER + c"] = dotwryn.scwrypts.hyprland.launch_or_show("google-voice-desktop"),
|
||||||
|
["SUPER + m"] = dotwryn.scwrypts.hyprland.launch_or_show("youtube-music-desktop-app", "-c", "YouTube Music Desktop App"),
|
||||||
|
["SUPER + SHIFT + s"] = dotwryn.scwrypts.hyprland.launch_or_show("signal"),
|
||||||
|
["SUPER + a"] = dotwryn.scwrypts.hyprland.launch_or_show("pavucontrol", "-s", "0.5", "-c", "pavucontrol"),
|
||||||
|
["SUPER + SHIFT + o"] = dotwryn.scwrypts.hyprland.launch_or_show("obs", "-c", "^obs", "-n", "-l"),
|
||||||
|
["SUPER + Return"] = hl.dsp.exec_cmd("$TERMINAL"),
|
||||||
|
|
||||||
|
["SUPER + p"] = dotwryn.scwrypts.hyprland.set_background("random"),
|
||||||
|
["SUPER + SHIFT + p"] = dotwryn.scwrypts.hyprland.set_background("theme"),
|
||||||
|
|
||||||
|
["SUPER + SHIFT + minus"] = hl.dsp.exec_cmd("pidof hyprlock || hyprlock"),
|
||||||
|
["SUPER + space"] = hl.dsp.exec_cmd("rofi -theme $DOTWRYN/config/rofi.theme.rasi -modes drun,run -show run"),
|
||||||
|
["SUPER + backslash"] = dotwryn.scwrypts.hyprland.screenshot(),
|
||||||
|
|
||||||
|
--
|
||||||
|
-- global application shortcuts (wayland apps can't grab global keys)
|
||||||
|
--
|
||||||
|
|
||||||
|
["ALT + SHIFT + space"] = hl.dsp.exec_cmd("1password --quick-access"),
|
||||||
|
})
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
hl.window_rule({ name = "float-modal", match = { modal = true }, float = true })
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "float-dialog-titles",
|
||||||
|
match = { title = "^(About|Organizer|Preferences|Task Dialog|Toolbox|Web Console).*$" },
|
||||||
|
float = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "screenshot-flameshot", -- scwrypts hyprland screenshot
|
||||||
|
match = { class = "^flameshot$" },
|
||||||
|
float = true,
|
||||||
|
move = "0 0",
|
||||||
|
pin = true,
|
||||||
|
no_anim = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "games-workspace",
|
||||||
|
match = { class = "^steam_app_.*$" },
|
||||||
|
workspace = "100", -- 🎮
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "idle-inhibit-fullscreen",
|
||||||
|
match = { class = ".*" },
|
||||||
|
idle_inhibit = "fullscreen",
|
||||||
|
})
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
local hostnamectl = io.popen("hostnamectl --static")
|
||||||
|
local HOSTNAME = hostnamectl:read("l")
|
||||||
|
hostnamectl:close()
|
||||||
|
|
||||||
|
local dofile_if_exists = function(path)
|
||||||
|
local file = io.open(path, "r")
|
||||||
|
if file == nil then return end
|
||||||
|
file:close()
|
||||||
|
assert(loadfile(path))(dotwryn)
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
dofile_if_exists(dotwryn.DOTWRYN .. "/config/local/" .. HOSTNAME .. "/user/hypr/host.lua")
|
||||||
|
dofile_if_exists((os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")) .. "/hypr/local.lua")
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
local dotwryn = ... -- ../config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.dispatch(dotwryn.scwrypts.hyprland.set_background("theme")) -- (starts hyprpaper if it isn't running)
|
||||||
|
hl.dispatch(dotwryn.scwrypts.wayland.sync_gtk_settings()) -- gtk theme from settings.ini
|
||||||
|
hl.exec_cmd("quickshell")
|
||||||
|
hl.exec_cmd("1password --silent")
|
||||||
|
hl.dispatch(dotwryn.scwrypts.tmux.omni())
|
||||||
|
hl.exec_cmd("/usr/lib/xfce-polkit/xfce-polkit")
|
||||||
|
hl.exec_cmd("command -v apps && apps") -- host-local background apps ($DOTWRYN/config/local/<hostname>/bin/apps)
|
||||||
|
end)
|
||||||
|
|
||||||
|
if dotwryn.monitor_layouts["default"] ~= nil then
|
||||||
|
dotwryn.set_monitor_layout("default")
|
||||||
|
end
|
||||||
|
|
||||||
|
if dotwryn.emergency_monitor ~= nil then
|
||||||
|
hl.bind(dotwryn.emergency_monitor.key, dotwryn_toggle_emergency_monitor)
|
||||||
|
end
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
--
|
||||||
|
-- custom (temporary?) interface to scwrypts for hyprland lua
|
||||||
|
--
|
||||||
|
|
||||||
|
local scwrypts = function(args_meta, args_scwrypt, environment)
|
||||||
|
local get_quoted = function(args)
|
||||||
|
local quoted_args = {}
|
||||||
|
for _, arg in ipairs(args) do
|
||||||
|
table.insert(quoted_args, "'" .. arg:gsub("'", "'\\''") .. "'")
|
||||||
|
end
|
||||||
|
return table.concat(quoted_args, " ")
|
||||||
|
end
|
||||||
|
|
||||||
|
local environment_names = {}
|
||||||
|
for name, _ in pairs(environment or {}) do table.insert(environment_names, name) end
|
||||||
|
table.sort(environment_names)
|
||||||
|
|
||||||
|
local environment_assignments = {}
|
||||||
|
for _, name in ipairs(environment_names) do
|
||||||
|
table.insert(environment_assignments, name .. "=" .. get_quoted({ environment[name] }))
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.concat({
|
||||||
|
table.concat(environment_assignments, " "),
|
||||||
|
get_quoted({ os.getenv("DOTWRYN") .. "/zsh/plugins/scwrypts/scwrypts" }),
|
||||||
|
get_quoted(args_meta or {}),
|
||||||
|
"--",
|
||||||
|
get_quoted(args_scwrypt or {}),
|
||||||
|
}, " ")
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
local scwrypts_desktop = function(args_meta, args_scwrypt)
|
||||||
|
return scwrypts(args_meta, args_scwrypt, {
|
||||||
|
SCWRYPTS_LOG_LEVEL = "0",
|
||||||
|
DESKTOP__SFX_PATH = os.getenv("HOME") .. "/Media/sfx",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
local hyprland = {
|
||||||
|
launch_or_show = function(program, ...)
|
||||||
|
return hl.dsp.exec_cmd(scwrypts_desktop({ 'hyprland', 'launch-or-show' }, { program, ... }))
|
||||||
|
end,
|
||||||
|
|
||||||
|
screenshot = function(...)
|
||||||
|
return hl.dsp.exec_cmd(scwrypts_desktop({ 'hyprland', 'screenshot' }, { ... }))
|
||||||
|
end,
|
||||||
|
|
||||||
|
set_background = function(...)
|
||||||
|
return hl.dsp.exec_cmd(scwrypts_desktop({ 'hyprland', 'set-background' }, { ... }))
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local media = {
|
||||||
|
play_sfx = function(...)
|
||||||
|
return hl.dsp.exec_cmd(scwrypts_desktop({ 'play-sfx' }, { ... }))
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local wayland = {
|
||||||
|
sync_gtk_settings = function(...)
|
||||||
|
return hl.dsp.exec_cmd(scwrypts({ 'sync-gtk-settings' }, { ... }))
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
local tmux = {
|
||||||
|
omni = function()
|
||||||
|
return hl.dsp.exec_cmd(scwrypts({ 'omni', 'tmux' }, { '--background' }))
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
return {
|
||||||
|
scwrypts = scwrypts,
|
||||||
|
scwrypts_desktop = scwrypts_desktop,
|
||||||
|
|
||||||
|
hyprland = hyprland,
|
||||||
|
media = media,
|
||||||
|
wayland = wayland,
|
||||||
|
tmux = tmux,
|
||||||
|
}
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
# hyprland session; TTY alias is 'starth'
|
||||||
|
export XDG_SESSION_TYPE=wayland
|
||||||
|
source "${DOTWRYN}/config/desktop/server/common.zsh"
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
export XDG_CURRENT_DESKTOP=Hyprland
|
||||||
|
export XDG_SESSION_DESKTOP=Hyprland
|
||||||
|
export DESKTOP_SESSION=hyprland
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
systemctl --user start hyprland-session.target
|
||||||
|
cd; start-hyprland
|
||||||
|
systemctl --user stop hyprland-session.target
|
||||||
Regular → Executable
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
source "${DOTWRYN}/config/xinitrc.common"
|
# KDE plasma session; TTY alias is 'starti'; also default 'startx' target
|
||||||
|
export XDG_SESSION_TYPE=x11
|
||||||
|
source "${DOTWRYN}/config/desktop/server/common.zsh"
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
export DESKTOP_SESSION=i3
|
export DESKTOP_SESSION=i3
|
||||||
export XDG_CURRENT_DESKTOP=i3
|
export XDG_CURRENT_DESKTOP=i3
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
# KDE plasma session; TTY alias is 'startk'
|
||||||
|
export XDG_SESSION_TYPE=x11
|
||||||
|
source "$DOTWRYN/config/desktop/server/common.zsh"
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
export DESKTOP_SESSION=plasma
|
||||||
|
exec startplasma-x11
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# shared by every desktop session (config/desktop/*/session)
|
||||||
|
#
|
||||||
|
|
||||||
|
case "${XDG_SESSION_TYPE}" in
|
||||||
|
( x11 | wayland ) ;;
|
||||||
|
( '' )
|
||||||
|
echo "ERROR : XDG_SESSION_TYPE must be set to one of 'x11' or 'wayland' (currently unset)" >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
( * )
|
||||||
|
echo "ERROR : XDG_SESSION_TYPE must be 'x11' or 'wayland' (got '${XDG_SESSION_TYPE}')" >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
for PREFERRED_TERMINAL in \
|
||||||
|
alacritty \
|
||||||
|
kitty \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
command -v ${PREFERRED_TERMINAL} &>/dev/null \
|
||||||
|
&& export TERMINAL="$(which ${PREFERRED_TERMINAL})" \
|
||||||
|
&& break
|
||||||
|
done
|
||||||
|
unset PREFERRED_TERMINAL
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
for PREFERRED_BROWSER in \
|
||||||
|
brave \
|
||||||
|
firefox \
|
||||||
|
google-chrome-stable \
|
||||||
|
google-chrome \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
command -v ${PREFERRED_BROWSER} &>/dev/null \
|
||||||
|
&& export BROWSER="$(which ${PREFERRED_BROWSER})" \
|
||||||
|
&& break
|
||||||
|
done
|
||||||
|
unset PREFERRED_BROWSER
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
source "${DOTWRYN}/config/desktop/server/${XDG_SESSION_TYPE}.zsh"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#
|
||||||
|
# currently empty; the previous server-level configurations are
|
||||||
|
# owned by the "Wayland Compositor" instead rather than the server
|
||||||
|
#
|
||||||
|
true
|
||||||
@@ -1,32 +1,3 @@
|
|||||||
#!/bin/zsh
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
for PREFERRED_TERMINAL in \
|
|
||||||
alacritty \
|
|
||||||
kitty \
|
|
||||||
;
|
|
||||||
do
|
|
||||||
command -v ${PREFERRED_TERMINAL} &>/dev/null \
|
|
||||||
&& export TERMINAL="$(which ${PREFERRED_TERMINAL})" \
|
|
||||||
&& break
|
|
||||||
done
|
|
||||||
unset PREFERRED_TERMINAL
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
for PREFERRED_BROWSER in \
|
|
||||||
brave \
|
|
||||||
firefox \
|
|
||||||
google-chrome-stable \
|
|
||||||
google-chrome \
|
|
||||||
;
|
|
||||||
do
|
|
||||||
command -v ${PREFERRED_BROWSER} &>/dev/null \
|
|
||||||
&& export BROWSER="$(which ${PREFERRED_BROWSER})" \
|
|
||||||
&& break
|
|
||||||
done
|
|
||||||
unset PREFERRED_BROWSER
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
for XINITRC_FILE in $(find /etc/X11/xinit/xinitrc.d | sort); do source "${XINITRC_FILE}"; done
|
for XINITRC_FILE in $(find /etc/X11/xinit/xinitrc.d | sort); do source "${XINITRC_FILE}"; done
|
||||||
@@ -47,7 +18,7 @@ for BACKGROUND_APPLICATION in \
|
|||||||
"${DOTWRYN}/config/local/$(hostnamectl --static)/bin/default" \
|
"${DOTWRYN}/config/local/$(hostnamectl --static)/bin/default" \
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
command -v ${BACKGROUND_APPLCATION} && exec ${BACKGROUND_APPLICATION} &
|
command -v ${BACKGROUND_APPLICATION} && exec ${BACKGROUND_APPLICATION} &
|
||||||
done
|
done
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# config : host-overrides
|
||||||
|
|
||||||
|
Currently an in-progress migration from the name "local" to "host-overrides."
|
||||||
|
|
||||||
|
I recently identified the need for a distinction between "a machine-distinct setting" which should still be tracked and a "one-off hack, or temporary local detail" which is NOT tracked.
|
||||||
|
|
||||||
|
The new general configuration hierarchy, from most general to highest precedence, is then:
|
||||||
|
- The primary application configuration (e.g. `config/user` or `config/etc` in this repository)
|
||||||
|
- The host-level overrides / additions (e.g. _this folder_)
|
||||||
|
- The local overrides
|
||||||
|
|
||||||
|
## Migration Notes
|
||||||
|
|
||||||
|
Where possible, it's better to use a unique, descriptive name, but in some situations we have a clear hierarchy linked within a specific application's configuration folder.
|
||||||
|
Old files tend to be called or linked to places with the name "local.{extension}," but new files in this directory should now prefer the terminology `host`.
|
||||||
|
For example:
|
||||||
|
```
|
||||||
|
# OLD NAME -> NEW NAME
|
||||||
|
pikachu/user/alacritty/local.toml -> pikachu/user/alacritty/host.toml
|
||||||
|
```
|
||||||
@@ -176,7 +176,7 @@ XRANDR_SET() {
|
|||||||
# disabling for a moment since the latest X11/NVIDIA drivers are causing some issues after "disconnect all"
|
# disabling for a moment since the latest X11/NVIDIA drivers are causing some issues after "disconnect all"
|
||||||
#scwrypts desktop xrandr disconnect all
|
#scwrypts desktop xrandr disconnect all
|
||||||
|
|
||||||
xrandr ${XRANDR_ARGS[@]}
|
xrandr ${XRANDR_ARGS[@]}
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
local dotwryn = ... -- $DOTWRYN/config/desktop/hyprland/config.lua
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
dotwryn.monitors.desk = {
|
||||||
|
output = "DP-2",
|
||||||
|
modes = {
|
||||||
|
"3840x2160@239.99", "3840x2160@180.00", "3840x2160@120.00", "3840x2160@119.88", "3840x2160@60.00", "3840x2160@59.94",
|
||||||
|
"2560x1440@239.85", "2560x1440@120.00", "2560x1440@59.95",
|
||||||
|
"1920x1080@239.88", "1920x1080@119.88", "1920x1080@60.00", "1920x1080@59.94",
|
||||||
|
},
|
||||||
|
excluded_modes = { "1920x1080@239.88" },
|
||||||
|
mirrored_max_refresh = 120,
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitors.zapdos = {
|
||||||
|
output = "DP-1",
|
||||||
|
modes = {
|
||||||
|
"3840x2160@60.00", "3840x2160@59.94",
|
||||||
|
"2560x1440@143.97", "2560x1440@120.00",
|
||||||
|
"1920x1080@143.98", "1920x1080@119.88", "1920x1080@100.00", "1920x1080@60.00", "1920x1080@59.94",
|
||||||
|
},
|
||||||
|
excluded_modes = { "2560x1440@143.97", "1920x1080@119.88" },
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitors.splitter = {
|
||||||
|
output = "HDMI-A-1",
|
||||||
|
modes = {
|
||||||
|
"3840x2160@119.88", "3840x2160@100.00", "3840x2160@60.00", "3840x2160@59.94",
|
||||||
|
"2560x1440@144.01",
|
||||||
|
"1920x1080@119.98", "1920x1080@60.00", "1920x1080@59.94",
|
||||||
|
},
|
||||||
|
max_refresh = 60,
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitors.server_rack = {
|
||||||
|
output = "DP-3",
|
||||||
|
modes = {
|
||||||
|
"1920x1080@144.00", "1920x1080@120.00", "1920x1080@119.88", "1920x1080@100.00", "1920x1080@60.00", "1920x1080@59.94",
|
||||||
|
},
|
||||||
|
max_refresh = 60,
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.emergency_monitor = { monitor = "server_rack", key = "XF86Calculator" }
|
||||||
|
|
||||||
|
dotwryn.monitor_layouts["default"] = {
|
||||||
|
primary = "desk",
|
||||||
|
monitors = {
|
||||||
|
desk = { resolution = "4k", position = "0x0", scale = 1.5 },
|
||||||
|
zapdos = { resolution = "4k", mirror = "desk" },
|
||||||
|
splitter = { resolution = "4k", mirror = "desk" },
|
||||||
|
},
|
||||||
|
wallpaper = "theme",
|
||||||
|
sfx = "login",
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitor_layouts["broadcast"] = {
|
||||||
|
primary = "desk",
|
||||||
|
monitors = {
|
||||||
|
desk = { resolution = "4k", position = "2560x0", scale = 1.5 },
|
||||||
|
zapdos = { resolution = "4k", position = "0x0", scale = 1.5 },
|
||||||
|
splitter = { resolution = "4k", mirror = "zapdos" },
|
||||||
|
},
|
||||||
|
wallpaper = "theme",
|
||||||
|
sfx = "login",
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitor_layouts["beeg-game"] = {
|
||||||
|
primary = "zapdos",
|
||||||
|
monitors = {
|
||||||
|
zapdos = { resolution = "max", position = "0x0", scale = 1.5 },
|
||||||
|
},
|
||||||
|
wallpaper = "theme",
|
||||||
|
sfx = "gamedock",
|
||||||
|
}
|
||||||
|
|
||||||
|
dotwryn.monitor_layouts["smol-game"] = {
|
||||||
|
primary = "desk",
|
||||||
|
monitors = {
|
||||||
|
desk = { resolution = "max", position = "0x0", scale = 1.5 },
|
||||||
|
},
|
||||||
|
wallpaper = "theme",
|
||||||
|
sfx = "gamedock",
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.exec_cmd("hypridle") -- ./hypridle.conf : power the desk monitor off after an hour idle
|
||||||
|
|
||||||
|
-- office mouse
|
||||||
|
hl.exec_cmd("razer-cli --device 632531H25800834 --brightness 80 --effect breath_dual --color 006942 420069 --dpi 6400 --poll 1000")
|
||||||
|
|
||||||
|
-- zapdos keyboard
|
||||||
|
hl.exec_cmd("razer-cli --device IO2524F99900428 --brightness 5 --effect multicolor")
|
||||||
|
end)
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
--- a/analog-output-speaker.conf
|
--- a/analog-output-speaker.conf
|
||||||
+++ b/analog-output-speaker.conf
|
+++ b/analog-output-speaker.conf
|
||||||
@@ -71,12 +71,14 @@
|
@@ -71,12 +71,14 @@
|
||||||
|
|
||||||
[Element Hardware Master]
|
[Element Hardware Master]
|
||||||
switch = mute
|
switch = mute
|
||||||
-volume = merge
|
-volume = merge
|
||||||
-override-map.1 = all
|
-override-map.1 = all
|
||||||
-override-map.2 = all-left,all-right
|
-override-map.2 = all-left,all-right
|
||||||
+volume = ignore
|
+volume = ignore
|
||||||
|
|
||||||
[Element Master]
|
[Element Master]
|
||||||
switch = mute
|
switch = mute
|
||||||
+volume = ignore
|
+volume = ignore
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Author : Aditya Shakya (adi1090x)
|
* Author : Aditya Shakya (adi1090x)
|
||||||
* Github : @adi1090x
|
* Github : @adi1090x
|
||||||
*
|
*
|
||||||
* Rofi Theme File
|
* Rofi Theme File
|
||||||
* Rofi Version: 1.7.3
|
* Rofi Version: 1.7.3
|
||||||
**/
|
**/
|
||||||
@@ -132,7 +132,7 @@ listview {
|
|||||||
reverse: false;
|
reverse: false;
|
||||||
fixed-height: true;
|
fixed-height: true;
|
||||||
fixed-columns: true;
|
fixed-columns: true;
|
||||||
|
|
||||||
spacing: 0px;
|
spacing: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- # local.pikachu > dotwryn
|
--- # local.pikachu > dotwryn
|
||||||
desktop:
|
desktop:
|
||||||
backlight-device:
|
backlight-device:
|
||||||
value: amdgpu_bl1
|
value: xrandr-fake-brightness
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ directus:
|
|||||||
discord:
|
discord:
|
||||||
content-header:
|
content-header:
|
||||||
value: '<@380809228450922507> '
|
value: '<@380809228450922507> '
|
||||||
media-sync:
|
|
||||||
s3-bucket:
|
|
||||||
value: yage
|
|
||||||
twilio:
|
twilio:
|
||||||
account-sid:
|
account-sid:
|
||||||
value: ACac926b109b3cd8a78685a2a0994d0271
|
value: ACac926b109b3cd8a78685a2a0994d0271
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
VUNDLE__BUILD__vim-hexokinase() {
|
VUNDLE__BUILD__vim-hexokinase() {
|
||||||
# ... build steps from /home/w0ryn/.vim/vim-hexokinase
|
# ... build steps from /home/w0ryn/.vim/vim-hexokinase
|
||||||
make hexokinase
|
make hexokinase
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# sound effect names -> files in DESKTOP__SFX_PATH
|
||||||
|
#
|
||||||
|
# shared by:
|
||||||
|
# - scwrypts 'media audio/play-sfx' (i3, login/dock scripts, automation)
|
||||||
|
# - quickshell VolumeOsd.qml (hyprland volume / mute feedback)
|
||||||
|
#
|
||||||
|
# <name> <file>
|
||||||
|
backlight yaru-audio-volume-change.oga
|
||||||
|
gamedock gamedock.oga
|
||||||
|
homedock homedock.oga
|
||||||
|
login yaru-desktop-login.oga
|
||||||
|
logout smooth-desktop-login.oga
|
||||||
|
mute smooth-dialog-warning.oga
|
||||||
|
notify yaru-complete.oga
|
||||||
|
undock yaru-desktop-login.oga
|
||||||
|
volume yaru-message.oga
|
||||||
|
volume-max smooth-dialog-warning.oga
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
source "${HOME}/.zshrc" &>/dev/null
|
source "${HOME}/.zshrc" &>/dev/null
|
||||||
source "${DOTWRYN}/config/xinitrc.i3wm"
|
source "${DOTWRYN}/config/desktop/i3wm/session"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# do not edit; generated by scwrypts
|
# do not edit; generated by scwrypts
|
||||||
# theme : main
|
# theme : winter
|
||||||
[colors.cursor]
|
[colors.cursor]
|
||||||
cursor = '0xeeddff'
|
cursor = '0xe8fffd'
|
||||||
|
|
||||||
[colors.primary]
|
[colors.primary]
|
||||||
background = '0x000505'
|
background = '0x000505'
|
||||||
@@ -9,20 +9,20 @@ foreground = '0xd0f0f0'
|
|||||||
|
|
||||||
[colors.normal]
|
[colors.normal]
|
||||||
black = '0x000505'
|
black = '0x000505'
|
||||||
red = '0xc80064'
|
red = '0xd11455'
|
||||||
green = '0x11bb98'
|
green = '0x906556'
|
||||||
yellow = '0x6911aa'
|
yellow = '0x00ffe7'
|
||||||
blue = '0x2262bb'
|
blue = '0x3d8890'
|
||||||
magenta = '0x9922dd'
|
magenta = '0x7b70af'
|
||||||
cyan = '0x22ccba'
|
cyan = '0x50a3b5'
|
||||||
white = '0xd0f0f0'
|
white = '0xd0f0f0'
|
||||||
|
|
||||||
[colors.bright]
|
[colors.bright]
|
||||||
black = '0x424253'
|
black = '0x424253'
|
||||||
red = '0xff44ff'
|
red = '0xf48bae'
|
||||||
green = '0x44dddd'
|
green = '0xcfb8af'
|
||||||
yellow = '0xaa44ff'
|
yellow = '0x8bfff4'
|
||||||
blue = '0x229df6'
|
blue = '0x1abcdd'
|
||||||
magenta = '0xdd88ff'
|
magenta = '0x7d72fe'
|
||||||
cyan = '0x88ffff'
|
cyan = '0x86abb3'
|
||||||
white = '0x7e707e'
|
white = '0x7e707e'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[General]
|
[General]
|
||||||
contrastOpacity=188
|
contrastOpacity=188
|
||||||
contrastUiColor=#11bb98
|
contrastUiColor=#a97f6f
|
||||||
disabledTrayIcon=false
|
disabledTrayIcon=false
|
||||||
drawColor=#aa44ff
|
drawColor=#aa44ff
|
||||||
drawFontSize=24
|
drawFontSize=24
|
||||||
@@ -11,11 +11,11 @@ saveAsFileExtension=png
|
|||||||
savePath=/home/w0ryn/Pictures/Screenshots
|
savePath=/home/w0ryn/Pictures/Screenshots
|
||||||
showSidePanelButton=false
|
showSidePanelButton=false
|
||||||
showStartupLaunchMessage=false
|
showStartupLaunchMessage=false
|
||||||
uiColor=#490099
|
uiColor=#00d1bd
|
||||||
undoLimit=100
|
undoLimit=100
|
||||||
uploadClientSecret=
|
uploadClientSecret=
|
||||||
useX11LegacyScreenshot=true
|
useX11LegacyScreenshot=true
|
||||||
userColors=picker, #aa44ff, #6911aa, #220069, #44dddd, #00aa79, #006922, #c80064, #ff44ff, #d0f0f0
|
userColors=picker, #8bfff4, #00ffe7, #007469, #cfb8af, #906556, #30221d, #d11455, #f48bae, #000505
|
||||||
|
|
||||||
[Shortcuts]
|
[Shortcuts]
|
||||||
TYPE_ARROW=E
|
TYPE_ARROW=E
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/* do not edit; generated by scwrypts
|
||||||
|
* theme : winter
|
||||||
|
*/
|
||||||
|
|
||||||
|
@define-color view_bg_color #000505;
|
||||||
|
@define-color view_fg_color #d0f0f0;
|
||||||
|
|
||||||
|
@define-color window_bg_color mix(@view_bg_color, #906556, 0.10);
|
||||||
|
@define-color window_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color headerbar_bg_color mix(@view_bg_color, #00ffe7, 0.25);
|
||||||
|
@define-color headerbar_fg_color @view_fg_color;
|
||||||
|
@define-color headerbar_border_color @view_fg_color;
|
||||||
|
@define-color headerbar_backdrop_color @window_bg_color;
|
||||||
|
@define-color headerbar_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color headerbar_darker_shade_color rgba(0, 0, 0, 0.9);
|
||||||
|
|
||||||
|
@define-color sidebar_bg_color mix(@view_bg_color, @window_bg_color, 0.6);
|
||||||
|
@define-color sidebar_fg_color @view_fg_color;
|
||||||
|
@define-color sidebar_backdrop_color @view_bg_color;
|
||||||
|
@define-color sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
@define-color secondary_sidebar_bg_color @view_bg_color;
|
||||||
|
@define-color secondary_sidebar_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color card_bg_color alpha(@view_fg_color, 0.05);
|
||||||
|
@define-color card_fg_color @view_fg_color;
|
||||||
|
@define-color card_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
|
||||||
|
@define-color dialog_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color dialog_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color popover_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color popover_fg_color @view_fg_color;
|
||||||
|
@define-color popover_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
|
||||||
|
@define-color thumbnail_bg_color @window_bg_color;
|
||||||
|
@define-color thumbnail_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color scrollbar_outline_color rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
@define-color accent_color #8bfff4;
|
||||||
|
@define-color accent_bg_color #00ffe7;
|
||||||
|
@define-color accent_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color destructive_color #f48bae;
|
||||||
|
@define-color destructive_bg_color #d11455;
|
||||||
|
@define-color destructive_fg_color #d0f0f0;
|
||||||
|
|
||||||
|
@define-color success_color #cfb8af;
|
||||||
|
@define-color success_bg_color #906556;
|
||||||
|
@define-color success_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color warning_color #8bfff4;
|
||||||
|
@define-color warning_bg_color #00ffe7;
|
||||||
|
@define-color warning_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color error_color #f48bae;
|
||||||
|
@define-color error_bg_color #d11455;
|
||||||
|
@define-color error_fg_color #d0f0f0;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
[Settings]
|
||||||
|
gtk-theme-name=adw-gtk3-dark
|
||||||
|
gtk-icon-theme-name=Adwaita
|
||||||
|
gtk-font-name=Cantarell 11
|
||||||
|
gtk-cursor-theme-name=Breeze_Hacked
|
||||||
|
gtk-cursor-theme-size=0
|
||||||
|
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||||
|
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||||
|
gtk-button-images=1
|
||||||
|
gtk-menu-images=1
|
||||||
|
gtk-enable-event-sounds=1
|
||||||
|
gtk-enable-input-feedback-sounds=1
|
||||||
|
gtk-xft-antialias=1
|
||||||
|
gtk-xft-hinting=1
|
||||||
|
gtk-xft-hintstyle=hintfull
|
||||||
|
gtk-application-prefer-dark-theme=1
|
||||||
|
gtk-xft-rgba=none
|
||||||
|
gtk-application-prefer-dark-theme=1
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/* do not edit; generated by scwrypts
|
||||||
|
* theme : winter
|
||||||
|
*/
|
||||||
|
|
||||||
|
@define-color view_bg_color #000505;
|
||||||
|
@define-color view_fg_color #d0f0f0;
|
||||||
|
|
||||||
|
@define-color window_bg_color mix(@view_bg_color, #906556, 0.10);
|
||||||
|
@define-color window_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color headerbar_bg_color mix(@view_bg_color, #00ffe7, 0.25);
|
||||||
|
@define-color headerbar_fg_color @view_fg_color;
|
||||||
|
@define-color headerbar_border_color @view_fg_color;
|
||||||
|
@define-color headerbar_backdrop_color @window_bg_color;
|
||||||
|
@define-color headerbar_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color headerbar_darker_shade_color rgba(0, 0, 0, 0.9);
|
||||||
|
|
||||||
|
@define-color sidebar_bg_color mix(@view_bg_color, @window_bg_color, 0.6);
|
||||||
|
@define-color sidebar_fg_color @view_fg_color;
|
||||||
|
@define-color sidebar_backdrop_color @view_bg_color;
|
||||||
|
@define-color sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
@define-color secondary_sidebar_bg_color @view_bg_color;
|
||||||
|
@define-color secondary_sidebar_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color card_bg_color alpha(@view_fg_color, 0.05);
|
||||||
|
@define-color card_fg_color @view_fg_color;
|
||||||
|
@define-color card_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
|
||||||
|
@define-color dialog_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color dialog_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color popover_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color popover_fg_color @view_fg_color;
|
||||||
|
@define-color popover_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
|
||||||
|
@define-color thumbnail_bg_color @window_bg_color;
|
||||||
|
@define-color thumbnail_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color scrollbar_outline_color rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
@define-color accent_color #8bfff4;
|
||||||
|
@define-color accent_bg_color #00ffe7;
|
||||||
|
@define-color accent_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color destructive_color #f48bae;
|
||||||
|
@define-color destructive_bg_color #d11455;
|
||||||
|
@define-color destructive_fg_color #d0f0f0;
|
||||||
|
|
||||||
|
@define-color success_color #cfb8af;
|
||||||
|
@define-color success_bg_color #906556;
|
||||||
|
@define-color success_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color warning_color #8bfff4;
|
||||||
|
@define-color warning_bg_color #00ffe7;
|
||||||
|
@define-color warning_fg_color #000505;
|
||||||
|
|
||||||
|
@define-color error_color #f48bae;
|
||||||
|
@define-color error_bg_color #d11455;
|
||||||
|
@define-color error_fg_color #d0f0f0;
|
||||||
|
:root {
|
||||||
|
--accent-color: @accent_color;
|
||||||
|
--accent-bg-color: @accent_bg_color;
|
||||||
|
--accent-fg-color: @accent_fg_color;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
local DOTWRYN = os.getenv("DOTWRYN")
|
||||||
|
assert(DOTWRYN ~= nil and DOTWRYN ~= "", "DOTWRYN must be set for hyprland to start (have you loaded ~/.zshrc?)")
|
||||||
|
|
||||||
|
dofile(DOTWRYN .. "/config/desktop/hyprland/config.lua")
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
source = $DOTWRYN/config/colorschemes/active/hyprlock.conf
|
||||||
|
|
||||||
|
$font = Monaspace Argon
|
||||||
|
|
||||||
|
general {
|
||||||
|
hide_cursor = true
|
||||||
|
ignore_empty_input = true
|
||||||
|
}
|
||||||
|
|
||||||
|
background {
|
||||||
|
path = screenshot
|
||||||
|
blur_passes = 3
|
||||||
|
blur_size = 11
|
||||||
|
brightness = 0.6
|
||||||
|
color = $background
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text = $TIME12
|
||||||
|
color = $clock
|
||||||
|
font_size = 96
|
||||||
|
font_family = $font
|
||||||
|
position = 0, 220
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text = cmd[update:60000] date +'%A %B %d, %Y'
|
||||||
|
color = $date
|
||||||
|
font_size = 22
|
||||||
|
font_family = $font
|
||||||
|
position = 0, 110
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
input-field {
|
||||||
|
size = 420, 64
|
||||||
|
outline_thickness = 4
|
||||||
|
rounding = 0
|
||||||
|
|
||||||
|
outer_color = $accent
|
||||||
|
inner_color = $background
|
||||||
|
font_color = $foreground
|
||||||
|
check_color = $verifying
|
||||||
|
fail_color = $wrong
|
||||||
|
capslock_color = $keypress
|
||||||
|
|
||||||
|
font_family = $font
|
||||||
|
placeholder_text = <i>$USER</i>
|
||||||
|
fail_text = <i>$FAIL ($ATTEMPTS)</i>
|
||||||
|
|
||||||
|
dots_size = 0.25
|
||||||
|
dots_spacing = 0.3
|
||||||
|
dots_rounding = 0
|
||||||
|
fade_on_empty = false
|
||||||
|
|
||||||
|
position = 0, -40
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ipc = true
|
||||||
|
splash = false
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
# do not edit; generated by scwrypts
|
# do not edit; generated by scwrypts
|
||||||
# theme : main
|
# theme : winter
|
||||||
color0 #000505
|
color0 #000505
|
||||||
color1 #c80064
|
color1 #d11455
|
||||||
color2 #11bb98
|
color2 #906556
|
||||||
color3 #6911aa
|
color3 #00ffe7
|
||||||
color4 #2262bb
|
color4 #3d8890
|
||||||
color5 #9922dd
|
color5 #7b70af
|
||||||
color6 #22ccba
|
color6 #50a3b5
|
||||||
color7 #d0f0f0
|
color7 #d0f0f0
|
||||||
color8 #424253
|
color8 #424253
|
||||||
color9 #ff44ff
|
color9 #f48bae
|
||||||
color10 #44dddd
|
color10 #cfb8af
|
||||||
color11 #aa44ff
|
color11 #8bfff4
|
||||||
color12 #229df6
|
color12 #1abcdd
|
||||||
color13 #dd88ff
|
color13 #7d72fe
|
||||||
color14 #88ffff
|
color14 #86abb3
|
||||||
color15 #7e707e
|
color15 #7e707e
|
||||||
cursor #eeddff
|
cursor #e8fffd
|
||||||
background #000505
|
background #000505
|
||||||
foreground #d0f0f0
|
foreground #d0f0f0
|
||||||
selection_background #
|
selection_background #
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ null_string = '<null>'
|
|||||||
# manage pager on startup
|
# manage pager on startup
|
||||||
enable_pager = True
|
enable_pager = True
|
||||||
|
|
||||||
# Use keyring to automatically save and load password in a secure manner
|
# Use keyring to automatically save and load password in a secure manner
|
||||||
keyring = True
|
keyring = True
|
||||||
|
|
||||||
# Custom colors for the completion menu, toolbar, etc.
|
# Custom colors for the completion menu, toolbar, etc.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ enable-ipc = true
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
[bar/i3]
|
[bar/i3]
|
||||||
modules-left = xworkspaces
|
modules-left = xworkspaces
|
||||||
|
|
||||||
[module/xworkspaces]
|
[module/xworkspaces]
|
||||||
type = internal/xworkspaces
|
type = internal/xworkspaces
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
# do not edit; generated by scwrypts
|
# do not edit; generated by scwrypts
|
||||||
# theme : main
|
# theme : winter
|
||||||
[colors]
|
[colors]
|
||||||
background = #000505
|
background = #000505
|
||||||
foreground = #d0f0f0
|
foreground = #d0f0f0
|
||||||
background-alt = #6911aa
|
background-alt = #007469
|
||||||
foreground-alt = #d0f0f0
|
foreground-alt = #000505
|
||||||
primary = #6911aa
|
primary = #00ffe7
|
||||||
secondary = #11bb98
|
secondary = #906556
|
||||||
alert = #c80064
|
alert = #d11455
|
||||||
disabled = #424253
|
disabled = #424253
|
||||||
|
|
||||||
primary-gradient-0 = #420069
|
primary-gradient-0 = #00a293
|
||||||
primary-gradient-1 = #490099
|
primary-gradient-1 = #00d1bd
|
||||||
primary-gradient-2 = #6911aa
|
primary-gradient-2 = #00ffe7
|
||||||
primary-gradient-3 = #8811cc
|
primary-gradient-3 = #2effec
|
||||||
primary-gradient-4 = #9922dd
|
primary-gradient-4 = #5dfff0
|
||||||
|
|
||||||
secondary-gradient-0 = #006942
|
secondary-gradient-0 = #503830
|
||||||
secondary-gradient-1 = #009949
|
secondary-gradient-1 = #704f43
|
||||||
secondary-gradient-2 = #00aa79
|
secondary-gradient-2 = #906556
|
||||||
secondary-gradient-3 = #11bb98
|
secondary-gradient-3 = #a97f6f
|
||||||
secondary-gradient-4 = #22ccba
|
secondary-gradient-4 = #bc9b8f
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
|
||||||
|
// port of the polybar 'i3' bar ($DOTWRYN/config/user/polybar/config.ini)
|
||||||
|
PanelWindow {
|
||||||
|
id: bar
|
||||||
|
|
||||||
|
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(screen)
|
||||||
|
readonly property int activeWorkspaceId: monitor?.activeWorkspace?.id ?? 1
|
||||||
|
readonly property bool activeWorkspaceFullscreen: monitor?.activeWorkspace?.hasFullscreen ?? false
|
||||||
|
|
||||||
|
// the bar shows on every workspace except these
|
||||||
|
readonly property var hiddenWorkspaceIds: [2]
|
||||||
|
|
||||||
|
// fullscreen is checked here too: re-mapping the bar (on workspace switch) would
|
||||||
|
// otherwise draw it over a window that was already fullscreen
|
||||||
|
visible: !hiddenWorkspaceIds.includes(activeWorkspaceId)
|
||||||
|
&& !activeWorkspaceFullscreen
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: 32
|
||||||
|
color: Colors.background
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: padding
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
text: " "
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property real separatorWidth: padding.advanceWidth * 2
|
||||||
|
|
||||||
|
Row { // modules-left
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: padding.advanceWidth
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height
|
||||||
|
spacing: bar.separatorWidth
|
||||||
|
|
||||||
|
Workspaces { height: parent.height; monitor: bar.monitor }
|
||||||
|
}
|
||||||
|
|
||||||
|
Row { // modules-center
|
||||||
|
anchors.centerIn: parent
|
||||||
|
height: parent.height
|
||||||
|
spacing: bar.separatorWidth
|
||||||
|
|
||||||
|
Tray { height: parent.height; window: bar }
|
||||||
|
Repeater {
|
||||||
|
model: UPower.devices.values.filter(device => device.isLaptopBattery)
|
||||||
|
Battery { required property var modelData; device: modelData; anchors.verticalCenter: parent.verticalCenter }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row { // modules-right
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: padding.advanceWidth
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height
|
||||||
|
spacing: bar.separatorWidth
|
||||||
|
|
||||||
|
Disk { anchors.verticalCenter: parent.verticalCenter }
|
||||||
|
Memory { anchors.verticalCenter: parent.verticalCenter }
|
||||||
|
Cpu { anchors.verticalCenter: parent.verticalCenter }
|
||||||
|
Network { anchors.verticalCenter: parent.verticalCenter; interfaceType: "wireless" }
|
||||||
|
Network { anchors.verticalCenter: parent.verticalCenter; interfaceType: "wired" }
|
||||||
|
Clock { anchors.verticalCenter: parent.verticalCenter }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// polybar-style text; hidden whenever it has nothing to say (like an empty polybar label)
|
||||||
|
Text {
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
visible: text !== ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
|
||||||
|
// polybar 'internal/battery' (battery0 / battery1)
|
||||||
|
Row {
|
||||||
|
id: battery
|
||||||
|
|
||||||
|
required property UPowerDevice device
|
||||||
|
|
||||||
|
readonly property int fullAt: 74
|
||||||
|
readonly property int lowAt: 39
|
||||||
|
|
||||||
|
readonly property real percentage: device.percentage <= 1 ? device.percentage * 100 : device.percentage
|
||||||
|
readonly property bool discharging: device.state === UPowerDeviceState.Discharging
|
||||||
|
|
||||||
|
readonly property var ramp: ["", "", "", "", ""]
|
||||||
|
readonly property int rampIndex: Math.min(ramp.length - 1, Math.floor(percentage / (100 / ramp.length)))
|
||||||
|
readonly property var rampColors: [
|
||||||
|
Colors.alert,
|
||||||
|
Colors.foreground,
|
||||||
|
Colors.secondaryGradient[2],
|
||||||
|
Colors.secondaryGradient[3],
|
||||||
|
Colors.secondaryGradient[4],
|
||||||
|
]
|
||||||
|
|
||||||
|
spacing: 4
|
||||||
|
visible: device.isPresent
|
||||||
|
|
||||||
|
BarLabel {
|
||||||
|
text: battery.ramp[battery.rampIndex]
|
||||||
|
color: battery.rampColors[battery.rampIndex]
|
||||||
|
}
|
||||||
|
|
||||||
|
BarLabel { // label-full
|
||||||
|
text: battery.percentage >= battery.fullAt ? "c:" : ""
|
||||||
|
color: Colors.secondaryGradient[4]
|
||||||
|
}
|
||||||
|
|
||||||
|
BarLabel { // label-low
|
||||||
|
text: battery.discharging && battery.percentage <= battery.lowAt ? "⚠" : ""
|
||||||
|
color: Colors.alert
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
// polybar 'datetime' : Monday October 19, 2026 : 09:29:00-am {15:29-UTC}
|
||||||
|
BarLabel {
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property date utc: new Date(clock.date.getTime() + clock.date.getTimezoneOffset() * 60000)
|
||||||
|
|
||||||
|
text: `${Qt.formatDateTime(clock.date, "dddd MMMM dd, yyyy : hh:mm:ss-ap")} {${Qt.formatDateTime(utc, "HH:mm")}-UTC}`
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
// colors.json is generated by 'scwrypts set theme'; watching it means a theme
|
||||||
|
// change recolors the shell without a restart
|
||||||
|
Singleton {
|
||||||
|
readonly property color background: json.background
|
||||||
|
readonly property color foreground: json.foreground
|
||||||
|
readonly property color backgroundAlt: json.backgroundAlt
|
||||||
|
readonly property color foregroundAlt: json.foregroundAlt
|
||||||
|
readonly property color primary: json.primary
|
||||||
|
readonly property color secondary: json.secondary
|
||||||
|
readonly property color alert: json.alert
|
||||||
|
readonly property color disabled: json.disabled
|
||||||
|
|
||||||
|
readonly property var secondaryGradient: json.secondaryGradient
|
||||||
|
|
||||||
|
readonly property string font: "Monaspace Krypton"
|
||||||
|
readonly property real fontSize: 11
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: Quickshell.shellPath("colors.json")
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
|
||||||
|
JsonAdapter {
|
||||||
|
id: json
|
||||||
|
|
||||||
|
property string background: "#000505"
|
||||||
|
property string foreground: "#d0f0f0"
|
||||||
|
property string backgroundAlt: "#6911aa"
|
||||||
|
property string foregroundAlt: "#d0f0f0"
|
||||||
|
property string primary: "#6911aa"
|
||||||
|
property string secondary: "#11bb98"
|
||||||
|
property string alert: "#c80064"
|
||||||
|
property string disabled: "#424253"
|
||||||
|
|
||||||
|
property var secondaryGradient: ["#006942", "#009949", "#00aa79", "#11bb98", "#22ccba"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// polybar 'internal/cpu'; silent until cpu usage is high
|
||||||
|
BarLabel {
|
||||||
|
id: cpu
|
||||||
|
|
||||||
|
property int warnPercentage: 79
|
||||||
|
|
||||||
|
property real lastIdle: 0
|
||||||
|
property real lastTotal: 0
|
||||||
|
|
||||||
|
color: Colors.alert
|
||||||
|
text: ""
|
||||||
|
|
||||||
|
PollingCommand {
|
||||||
|
interval: 3000
|
||||||
|
command: ["head", "-n1", "/proc/stat"]
|
||||||
|
onOutput: output => {
|
||||||
|
const fields = output.trim().split(/\s+/).slice(1).map(Number)
|
||||||
|
const idle = fields[3] + fields[4] // idle + iowait
|
||||||
|
const total = fields.reduce((sum, value) => sum + value, 0)
|
||||||
|
|
||||||
|
const deltaTotal = total - cpu.lastTotal
|
||||||
|
const used = cpu.lastTotal > 0 && deltaTotal > 0
|
||||||
|
? Math.round((1 - (idle - cpu.lastIdle) / deltaTotal) * 100)
|
||||||
|
: 0
|
||||||
|
|
||||||
|
cpu.lastIdle = idle
|
||||||
|
cpu.lastTotal = total
|
||||||
|
|
||||||
|
cpu.text = used >= cpu.warnPercentage
|
||||||
|
? `CPU${String(used).padStart(2)}%`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// polybar 'internal/fs'; silent until the disk is nearly full
|
||||||
|
BarLabel {
|
||||||
|
id: disk
|
||||||
|
|
||||||
|
property int warnPercentage: 83
|
||||||
|
|
||||||
|
color: Colors.alert
|
||||||
|
text: ""
|
||||||
|
|
||||||
|
PollingCommand {
|
||||||
|
interval: 17000
|
||||||
|
command: ["df", "--human-readable", "--output=pcent,avail", "/"]
|
||||||
|
onOutput: output => {
|
||||||
|
const [percentage, free] = output.trim().split("\n").pop().trim().split(/\s+/)
|
||||||
|
const used = parseInt(percentage)
|
||||||
|
disk.text = used >= disk.warnPercentage
|
||||||
|
? `${free} remaining on disk (${used}% full)`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
// monitor layout picker for $DOTWRYN/config/desktop/hyprland/config.lua.d/02-monitor-layouts.lua;
|
||||||
|
// shown with 'qs ipc call -- displays show' (without '--', 'show' parses as 'qs ipc show')
|
||||||
|
Scope {
|
||||||
|
id: picker
|
||||||
|
|
||||||
|
property bool shown: false
|
||||||
|
property var screen: null
|
||||||
|
|
||||||
|
property var layouts: []
|
||||||
|
property var resolutions: []
|
||||||
|
|
||||||
|
property int selectedLayout: 0
|
||||||
|
property int selectedResolution: -1 // -1 : the modes configured in the layout
|
||||||
|
|
||||||
|
function show(): void {
|
||||||
|
selectedLayout = 0
|
||||||
|
selectedResolution = -1
|
||||||
|
screen = Quickshell.screens.find(screen => screen.name === Hyprland.focusedMonitor?.name) ?? null
|
||||||
|
Quickshell.execDetached(["hyprctl", "eval", "dotwryn_publish_monitor_layouts()"])
|
||||||
|
shown = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveLayout(offset: int): void {
|
||||||
|
if (layouts.length > 0) selectedLayout = (selectedLayout + offset + layouts.length) % layouts.length
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveResolution(offset: int): void {
|
||||||
|
const count = resolutions.length + 1
|
||||||
|
selectedResolution = ((selectedResolution + 1 + offset + count) % count) - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// hyprland 0.56.2 segfaults if a focused layer surface is destroyed by a
|
||||||
|
// monitor change, so the picker must be gone before the layout is applied
|
||||||
|
function applyLayout(): void {
|
||||||
|
if (selectedLayout >= layouts.length) return
|
||||||
|
|
||||||
|
const resolution = selectedResolution < 0 ? "nil" : JSON.stringify(resolutions[selectedResolution])
|
||||||
|
evaluation.command = ["hyprctl", "eval", `dotwryn_set_monitor_layout(${JSON.stringify(layouts[selectedLayout])}, ${resolution})`]
|
||||||
|
|
||||||
|
shown = false
|
||||||
|
applyAfterHidden.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: applyAfterHidden
|
||||||
|
interval: 250
|
||||||
|
onTriggered: evaluation.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: evaluation
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const result = text.trim()
|
||||||
|
if (result !== "ok") Quickshell.execDetached(["notify-send", "displays", result.replace(/^.*:\d+: /, "")])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "displays"
|
||||||
|
|
||||||
|
function show(): void { picker.show() }
|
||||||
|
function hide(): void { picker.shown = false }
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Hyprland
|
||||||
|
|
||||||
|
function onRawEvent(event) {
|
||||||
|
const prefix = "dotwryn-monitor-layouts "
|
||||||
|
if (event.name !== "custom" || !event.data.startsWith(prefix)) return
|
||||||
|
|
||||||
|
const published = JSON.parse(event.data.slice(prefix.length))
|
||||||
|
picker.layouts = published.layouts
|
||||||
|
picker.resolutions = published.resolutions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component PickerText: Text {
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
visible: picker.shown
|
||||||
|
screen: picker.screen
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
implicitWidth: content.implicitWidth + 24
|
||||||
|
implicitHeight: content.implicitHeight + 24
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colors.background
|
||||||
|
border.width: 1
|
||||||
|
border.color: Colors.primary
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_J: case Qt.Key_Down: picker.moveLayout(1); break
|
||||||
|
case Qt.Key_K: case Qt.Key_Up: picker.moveLayout(-1); break
|
||||||
|
case Qt.Key_L: case Qt.Key_Right: picker.moveResolution(1); break
|
||||||
|
case Qt.Key_H: case Qt.Key_Left: picker.moveResolution(-1); break
|
||||||
|
|
||||||
|
case Qt.Key_Return: case Qt.Key_Enter: picker.applyLayout(); break
|
||||||
|
|
||||||
|
case Qt.Key_Escape: case Qt.Key_Q: picker.shown = false; break
|
||||||
|
default: return
|
||||||
|
}
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: content
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
PickerText {
|
||||||
|
text: "monitor layout"
|
||||||
|
font.bold: true
|
||||||
|
color: Colors.secondary
|
||||||
|
}
|
||||||
|
|
||||||
|
PickerText {
|
||||||
|
visible: picker.layouts.length === 0
|
||||||
|
text: "no monitor layouts for this host"
|
||||||
|
color: Colors.disabled
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: picker.layouts
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: layoutRow
|
||||||
|
|
||||||
|
required property int index
|
||||||
|
required property string modelData
|
||||||
|
|
||||||
|
readonly property bool selected: picker.selectedLayout === index
|
||||||
|
|
||||||
|
implicitWidth: Math.max(layoutLabel.implicitWidth + 24, 280)
|
||||||
|
implicitHeight: layoutLabel.implicitHeight + 8
|
||||||
|
color: selected ? Colors.primary : "transparent"
|
||||||
|
|
||||||
|
PickerText {
|
||||||
|
id: layoutLabel
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 12
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: layoutRow.modelData
|
||||||
|
font.bold: layoutRow.selected
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onEntered: picker.selectedLayout = layoutRow.index
|
||||||
|
onClicked: picker.applyLayout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
visible: picker.layouts.length > 0
|
||||||
|
spacing: 8
|
||||||
|
topPadding: 8
|
||||||
|
|
||||||
|
PickerText {
|
||||||
|
text: "resolution"
|
||||||
|
color: Colors.secondary
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ["configured"].concat(picker.resolutions)
|
||||||
|
|
||||||
|
PickerText {
|
||||||
|
required property int index
|
||||||
|
required property string modelData
|
||||||
|
|
||||||
|
readonly property bool selected: picker.selectedResolution === index - 1
|
||||||
|
|
||||||
|
text: selected ? `[${modelData}]` : ` ${modelData} `
|
||||||
|
color: selected ? Colors.foreground : Colors.disabled
|
||||||
|
font.bold: selected
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: picker.selectedResolution = parent.index - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
// i3-nagbar replacement; shown with 'qs ipc call logout show'
|
||||||
|
Scope {
|
||||||
|
id: prompt
|
||||||
|
|
||||||
|
property bool shown: false
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "logout"
|
||||||
|
|
||||||
|
function show(): void { prompt.shown = true }
|
||||||
|
function hide(): void { prompt.shown = false }
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
visible: prompt.shown
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: 32
|
||||||
|
color: Colors.alert
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 12
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "Do you really want to exit Hyprland?"
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 8
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: [
|
||||||
|
{ label: "Yes", action: () => Quickshell.execDetached(["sh", "-c", "notify-send 'system' 'exiting hyprland...' -i face-tired; hyprctl dispatch 'hl.dsp.exit()'"]) },
|
||||||
|
{ label: "X", action: () => prompt.shown = false },
|
||||||
|
]
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
implicitWidth: buttonLabel.implicitWidth + 20
|
||||||
|
implicitHeight: 24
|
||||||
|
color: Colors.background
|
||||||
|
border.width: 1
|
||||||
|
border.color: Colors.foreground
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: buttonLabel
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: parent.modelData.label
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: parent.modelData.action()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// polybar 'internal/memory'; silent until memory usage is high
|
||||||
|
BarLabel {
|
||||||
|
id: memory
|
||||||
|
|
||||||
|
property int warnPercentage: 73
|
||||||
|
|
||||||
|
color: Colors.alert
|
||||||
|
text: ""
|
||||||
|
|
||||||
|
PollingCommand {
|
||||||
|
interval: 2000
|
||||||
|
command: ["cat", "/proc/meminfo"]
|
||||||
|
onOutput: output => {
|
||||||
|
const total = parseInt(output.match(/^MemTotal:\s+(\d+)/m)[1])
|
||||||
|
const available = parseInt(output.match(/^MemAvailable:\s+(\d+)/m)[1])
|
||||||
|
const used = Math.round((total - available) * 100 / total)
|
||||||
|
memory.text = used >= memory.warnPercentage
|
||||||
|
? `RAM${String(used).padStart(2)}%`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
// polybar 'internal/network' (wlan / eth); shows the first physical interface of the given type
|
||||||
|
BarLabel {
|
||||||
|
id: network
|
||||||
|
|
||||||
|
required property string interfaceType // "wireless" | "wired"
|
||||||
|
|
||||||
|
text: ""
|
||||||
|
|
||||||
|
PollingCommand {
|
||||||
|
interval: 31000
|
||||||
|
command: ["sh", "-c", `
|
||||||
|
for path in /sys/class/net/*
|
||||||
|
do
|
||||||
|
[ -e "$path/device" ] || continue
|
||||||
|
[ -d "$path/wireless" ] && type=wireless || type=wired
|
||||||
|
[ "$type" = "${network.interfaceType}" ] || continue
|
||||||
|
|
||||||
|
ifname="$(basename "$path")"
|
||||||
|
ip="$(ip -4 -o addr show dev "$ifname" | awk '{print $4}' | cut -d/ -f1 | head -n1)"
|
||||||
|
echo "$ifname $ip"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
`]
|
||||||
|
onOutput: output => {
|
||||||
|
const [ifname, ip] = output.trim().split(/\s+/)
|
||||||
|
if (!ifname) {
|
||||||
|
network.text = ""
|
||||||
|
} else if (ip) {
|
||||||
|
network.text = `${ifname}/${ip}`
|
||||||
|
network.color = Colors.secondary
|
||||||
|
} else {
|
||||||
|
network.text = `(${ifname}:⊘)`
|
||||||
|
network.color = Colors.disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
|
||||||
|
// notification daemon (replaces xfce4-notifyd for the hyprland session)
|
||||||
|
Scope {
|
||||||
|
id: notifications
|
||||||
|
|
||||||
|
readonly property int defaultTimeout: 5000
|
||||||
|
|
||||||
|
NotificationServer {
|
||||||
|
id: server
|
||||||
|
|
||||||
|
keepOnReload: true
|
||||||
|
bodySupported: true
|
||||||
|
bodyMarkupSupported: true
|
||||||
|
actionsSupported: true
|
||||||
|
imageSupported: true
|
||||||
|
|
||||||
|
onNotification: notification => notification.tracked = true
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
visible: server.trackedNotifications.values.length > 0
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
margins {
|
||||||
|
top: 8
|
||||||
|
right: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
implicitWidth: 380
|
||||||
|
implicitHeight: stack.implicitHeight
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: stack
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: server.trackedNotifications
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: card
|
||||||
|
|
||||||
|
required property Notification modelData
|
||||||
|
readonly property bool critical: modelData.urgency === NotificationUrgency.Critical
|
||||||
|
|
||||||
|
width: stack.width
|
||||||
|
implicitHeight: content.implicitHeight + 20
|
||||||
|
color: Colors.background
|
||||||
|
border.width: 2
|
||||||
|
border.color: critical ? Colors.alert : Colors.secondary
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: !card.critical && card.modelData.expireTimeout !== 0
|
||||||
|
interval: card.modelData.expireTimeout > 0
|
||||||
|
? card.modelData.expireTimeout * 1000
|
||||||
|
: notifications.defaultTimeout
|
||||||
|
onTriggered: card.modelData.expire()
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
margins: 10
|
||||||
|
}
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: card.modelData.summary
|
||||||
|
color: card.critical ? Colors.alert : Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
visible: text !== ""
|
||||||
|
text: card.modelData.body
|
||||||
|
textFormat: Text.StyledText
|
||||||
|
color: Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize - 1
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
maximumLineCount: 6
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
visible: card.modelData.actions.length > 0
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: card.modelData.actions
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
required property NotificationAction modelData
|
||||||
|
|
||||||
|
implicitWidth: actionLabel.implicitWidth + 16
|
||||||
|
implicitHeight: actionLabel.implicitHeight + 8
|
||||||
|
color: Colors.backgroundAlt
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: actionLabel
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: parent.modelData.text
|
||||||
|
color: Colors.foregroundAlt
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: parent.modelData.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea { // click anywhere else on the card to dismiss
|
||||||
|
anchors.fill: parent
|
||||||
|
z: -1
|
||||||
|
onClicked: card.modelData.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
// runs a command every 'interval' ms and emits its stdout (polybar module 'interval')
|
||||||
|
Item {
|
||||||
|
id: polling
|
||||||
|
|
||||||
|
required property var command
|
||||||
|
property int interval: 1000
|
||||||
|
|
||||||
|
signal output(string text)
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: process
|
||||||
|
command: polling.command
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: polling.output(this.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: polling.interval
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: process.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.SystemTray
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
|
// polybar 'internal/tray'
|
||||||
|
Row {
|
||||||
|
id: tray
|
||||||
|
|
||||||
|
required property var window
|
||||||
|
|
||||||
|
spacing: 8
|
||||||
|
leftPadding: 8
|
||||||
|
rightPadding: 8
|
||||||
|
visible: SystemTray.items.values.length > 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: SystemTray.items
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
required property SystemTrayItem modelData
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
implicitSize: 18
|
||||||
|
source: modelData.icon
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
onClicked: mouse => {
|
||||||
|
const item = icon.modelData
|
||||||
|
const showMenu = mouse.button === Qt.RightButton || item.onlyMenu
|
||||||
|
if (showMenu && item.hasMenu) {
|
||||||
|
const position = icon.mapToItem(null, 0, 0)
|
||||||
|
item.display(tray.window, position.x, position.y - 4)
|
||||||
|
} else if (mouse.button === Qt.MiddleButton) {
|
||||||
|
item.secondaryActivate()
|
||||||
|
} else {
|
||||||
|
item.activate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onWheel: wheel => icon.modelData.scroll(wheel.angleDelta.y, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: osd
|
||||||
|
|
||||||
|
readonly property PwNode sink: Pipewire.defaultAudioSink
|
||||||
|
readonly property PwNode source: Pipewire.defaultAudioSource
|
||||||
|
|
||||||
|
property string label: ""
|
||||||
|
property real level: 0
|
||||||
|
property bool muted: false
|
||||||
|
property bool shown: false
|
||||||
|
property string warning: ""
|
||||||
|
|
||||||
|
// going past 100% : at 100%, it takes 'unlockPresses' separate presses of
|
||||||
|
// volume-up (the first shows a warning); above 100% there is no limit
|
||||||
|
readonly property real step: 0.10
|
||||||
|
readonly property int unlockPresses: 3
|
||||||
|
readonly property int repeatGuardMs: 150 // key-repeat events don't count toward unlocking
|
||||||
|
property int pressesAtMax: 0
|
||||||
|
property real lastUpPress: 0
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "volume"
|
||||||
|
function up(): void { osd.volumeUp() }
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: unlockReset
|
||||||
|
interval: 3000
|
||||||
|
onTriggered: osd.pressesAtMax = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function volumeUp(): void {
|
||||||
|
const audio = sink?.audio
|
||||||
|
if (!audio) return
|
||||||
|
|
||||||
|
const now = Date.now()
|
||||||
|
const isRepeat = now - lastUpPress < repeatGuardMs
|
||||||
|
lastUpPress = now
|
||||||
|
|
||||||
|
const percent = Math.round(audio.volume * 100)
|
||||||
|
|
||||||
|
if (percent < 100) { // normal range; stop exactly at 100%
|
||||||
|
pressesAtMax = 0
|
||||||
|
audio.volume = Math.min(1.0, audio.volume + step)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (percent > 100) { // already past 100% : no limit
|
||||||
|
audio.volume = audio.volume + step
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// exactly 100%
|
||||||
|
if (!isRepeat) {
|
||||||
|
pressesAtMax += 1
|
||||||
|
unlockReset.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pressesAtMax >= unlockPresses) {
|
||||||
|
pressesAtMax = 0
|
||||||
|
audio.volume = audio.volume + step
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRepeat && shown) { // holding the key at 100% : just keep the warning up
|
||||||
|
hideTimer.restart()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const remaining = unlockPresses - pressesAtMax
|
||||||
|
show("volume", sink, "volume-max", `press ${remaining} more to go past 100%`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// sound effects : names from $DOTWRYN/config/sfx.map, files in DESKTOP__SFX_PATH
|
||||||
|
property string sfxPath: ""
|
||||||
|
property var sfxFiles: ({})
|
||||||
|
|
||||||
|
// default devices must be tracked for their volume / mute to update
|
||||||
|
PwObjectTracker { objects: [osd.sink, osd.source] }
|
||||||
|
|
||||||
|
Process { // DESKTOP__SFX_PATH lives in the scwrypts environment; read it once
|
||||||
|
running: true
|
||||||
|
command: ["scwrypts", "--group", "scwrypts", "--type", "zsh", "--name", "scwrypts/environment/getenv", "--", "DESKTOP__SFX_PATH"]
|
||||||
|
environment: ({ SCWRYPTS_LOG_LEVEL: "0" })
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: osd.sfxPath = this.text.trim().replace(/^\$HOME|^~/, Quickshell.env("HOME"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: Quickshell.env("DOTWRYN") + "/config/sfx.map"
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
onLoaded: {
|
||||||
|
const files = {}
|
||||||
|
for (const line of text().split("\n")) {
|
||||||
|
const [name, file] = line.trim().split(/\s+/)
|
||||||
|
if (name && file && !name.startsWith("#")) files[name] = file
|
||||||
|
}
|
||||||
|
osd.sfxFiles = files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function playSfx(name: string): void {
|
||||||
|
if (sfxPath === "" || !sfxFiles[name]) return
|
||||||
|
Quickshell.execDetached(["canberra-gtk-play", "-f", `${sfxPath}/${sfxFiles[name]}`])
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(label: string, node: PwNode, sfx: string, warning: string): void {
|
||||||
|
if (!node?.audio) return
|
||||||
|
osd.warning = warning ?? ""
|
||||||
|
osd.label = label
|
||||||
|
osd.level = node.audio.volume
|
||||||
|
osd.muted = node.audio.muted
|
||||||
|
osd.shown = true
|
||||||
|
hideTimer.restart()
|
||||||
|
playSfx(sfx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore the initial values reported while the devices bind at startup
|
||||||
|
property bool armed: false
|
||||||
|
Timer { running: true; interval: 1500; onTriggered: osd.armed = true }
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: osd.sink?.audio ?? null
|
||||||
|
ignoreUnknownSignals: true
|
||||||
|
function onVolumeChanged() { if (osd.armed) osd.show("volume", osd.sink, "volume", "") }
|
||||||
|
function onMutedChanged() { if (osd.armed) osd.show("volume", osd.sink, "mute", "") }
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: osd.source?.audio ?? null
|
||||||
|
ignoreUnknownSignals: true
|
||||||
|
function onVolumeChanged() { if (osd.armed) osd.show("mic", osd.source, "volume", "") }
|
||||||
|
function onMutedChanged() { if (osd.armed) osd.show("mic", osd.source, "mute", "") }
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: hideTimer
|
||||||
|
interval: 1500
|
||||||
|
onTriggered: osd.shown = false
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
visible: osd.shown
|
||||||
|
|
||||||
|
anchors.bottom: true
|
||||||
|
margins.bottom: 120
|
||||||
|
exclusiveZone: 0
|
||||||
|
|
||||||
|
readonly property bool boosted: osd.level > 1.005
|
||||||
|
|
||||||
|
implicitWidth: 400
|
||||||
|
implicitHeight: osd.warning !== "" ? 84 : 56
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colors.background
|
||||||
|
border.width: 2
|
||||||
|
border.color: osd.muted || parent.boosted || osd.warning !== "" ? Colors.alert : Colors.secondary
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: percentSlot
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
text: "1000%"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text { // past-100% warning; sits above the row so the row never moves
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: row.top
|
||||||
|
anchors.bottomMargin: 8
|
||||||
|
visible: osd.warning !== ""
|
||||||
|
text: osd.warning
|
||||||
|
color: Colors.alert
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize - 1
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
// pinned to the bottom edge : the popup is anchored to the screen
|
||||||
|
// bottom, so it grows upward for the warning and the bar stays put
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 18
|
||||||
|
spacing: 14
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 64
|
||||||
|
text: osd.muted ? `${osd.label} \u2298` : osd.label
|
||||||
|
color: osd.muted ? Colors.alert : Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle { // level bar
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 200
|
||||||
|
height: 10
|
||||||
|
color: Colors.disabled
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width * Math.min(osd.level, 1)
|
||||||
|
height: parent.height
|
||||||
|
color: osd.muted || osd.level > 1.005 ? Colors.alert : Colors.secondary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: percentSlot.advanceWidth
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
text: `${Math.round(osd.level * 100)}%`
|
||||||
|
color: osd.level > 1.005 ? Colors.alert : Colors.foreground
|
||||||
|
font.family: Colors.font
|
||||||
|
font.pointSize: Colors.fontSize
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
|
// polybar 'internal/xworkspaces'
|
||||||
|
Row {
|
||||||
|
id: workspaces
|
||||||
|
|
||||||
|
required property HyprlandMonitor monitor
|
||||||
|
|
||||||
|
// numbered workspaces first (🎮 is 100), then named in creation order; specials are hidden
|
||||||
|
readonly property var visibleWorkspaces: Hyprland.workspaces.values
|
||||||
|
.filter(workspace => !workspace.name.startsWith("special"))
|
||||||
|
.sort((a, b) => {
|
||||||
|
if ((a.id > 0) !== (b.id > 0)) return a.id > 0 ? -1 : 1
|
||||||
|
return a.id > 0 ? a.id - b.id : b.id - a.id
|
||||||
|
})
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: workspaces.visibleWorkspaces
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: workspace
|
||||||
|
|
||||||
|
required property HyprlandWorkspace modelData
|
||||||
|
readonly property bool isActive: modelData.id === workspaces.monitor?.activeWorkspace?.id
|
||||||
|
|
||||||
|
height: workspaces.height
|
||||||
|
width: label.implicitWidth + label.font.pixelSize * 1.2
|
||||||
|
color: modelData.urgent ? Colors.alert
|
||||||
|
: isActive ? Colors.backgroundAlt
|
||||||
|
: "transparent"
|
||||||
|
|
||||||
|
BarLabel {
|
||||||
|
id: label
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: workspace.modelData.name
|
||||||
|
color: workspace.isActive ? Colors.foregroundAlt : Colors.foreground
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
// through hyprland.lua so the slide direction matches the keybinds
|
||||||
|
onClicked: Quickshell.execDetached(["hyprctl", "eval", `dotwryn_focus_workspace("${
|
||||||
|
workspace.modelData.id > 0 ? workspace.modelData.id : "name:" + workspace.modelData.name
|
||||||
|
}")`])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"theme" : "winter",
|
||||||
|
"background" : "#000505",
|
||||||
|
"foreground" : "#d0f0f0",
|
||||||
|
"backgroundAlt" : "#007469",
|
||||||
|
"foregroundAlt" : "#000505",
|
||||||
|
"primary" : "#00ffe7",
|
||||||
|
"secondary" : "#906556",
|
||||||
|
"alert" : "#d11455",
|
||||||
|
"disabled" : "#424253",
|
||||||
|
|
||||||
|
"secondaryGradient" : [
|
||||||
|
"#503830",
|
||||||
|
"#704f43",
|
||||||
|
"#906556",
|
||||||
|
"#a97f6f",
|
||||||
|
"#bc9b8f"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//@ pragma UseQApplication
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
// hyprland shell; a port of the polybar / xfce4-notifyd / i3-nagbar setup (+ volume popup)
|
||||||
|
ShellRoot {
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
Bar {
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Notifications {}
|
||||||
|
|
||||||
|
VolumeOsd {}
|
||||||
|
|
||||||
|
LogoutPrompt {}
|
||||||
|
|
||||||
|
DisplayPicker {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=hyprland session
|
||||||
|
BindsTo=graphical-session.target
|
||||||
|
Wants=graphical-session-pre.target
|
||||||
|
After=graphical-session-pre.target
|
||||||
@@ -7,8 +7,11 @@ set -sg repeat-time 0
|
|||||||
|
|
||||||
set-option -g default-shell /bin/zsh
|
set-option -g default-shell /bin/zsh
|
||||||
|
|
||||||
|
set-option -ga update-environment HYPRLAND_INSTANCE_SIGNATURE
|
||||||
|
set-option -ga update-environment WAYLAND_DISPLAY # wl-clipboard through waypipe on reattach
|
||||||
|
|
||||||
# quick reload
|
# quick reload
|
||||||
bind-key r source-file ~/.tmux.conf\; display "TMUX CONFIG RELOADED"
|
bind-key r source-file ~/.config/tmux/tmux.conf\; display "TMUX CONFIG RELOADED"
|
||||||
|
|
||||||
# force color
|
# force color
|
||||||
set -g default-terminal "tmux-256color"
|
set -g default-terminal "tmux-256color"
|
||||||
@@ -98,6 +101,6 @@ bind-key -n C-M-r send-keys M-r
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip'
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'if [ -n "$WAYLAND_DISPLAY" ]; then wl-copy; else xclip -selection clipboard; fi'
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[preferred]
|
||||||
|
default=hyprland;gtk
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
source "$DOTWRYN/config/xinitrc.common"
|
|
||||||
|
|
||||||
export DESKTOP_SESSION=plasma
|
|
||||||
exec startplasma-x11
|
|
||||||
+2
-2
@@ -2,7 +2,7 @@ _COLORSCHEME_FILE__alacritty="${DOTWRYN}/config/user/alacritty/theme.toml"
|
|||||||
|
|
||||||
_GENERATE_THEME__alacritty() {
|
_GENERATE_THEME__alacritty() {
|
||||||
echo "# do not edit; generated by scwrypts
|
echo "# do not edit; generated by scwrypts
|
||||||
# theme : ${THEME_NAME}
|
# theme : ${theme_name}
|
||||||
[colors.cursor]
|
[colors.cursor]
|
||||||
cursor = '0x$(_GET_HEX .alacritty.cursor cursor)'
|
cursor = '0x$(_GET_HEX .alacritty.cursor cursor)'
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ cyan = '0x$(_GET_HEX .ansi.cyan.bright)'
|
|||||||
white = '0x$(_GET_HEX .ansi.gray.bright)'
|
white = '0x$(_GET_HEX .ansi.gray.bright)'
|
||||||
" | sed '$d' > "${_COLORSCHEME_FILE__alacritty}"
|
" | sed '$d' > "${_COLORSCHEME_FILE__alacritty}"
|
||||||
|
|
||||||
local TRANSPARENCY_OVERRIDE=$(cat "${SOURCE_THEME}" | utils.yq -r '.alacritty.transparency' | grep -v '^null$')
|
local TRANSPARENCY_OVERRIDE=$(sed 's/--- *#.*/---/' "${theme_source}" | utils.yq -r '.alacritty.transparency' | grep -v '^null$')
|
||||||
[ ${TRANSPARENCY_OVERRIDE} ] && {
|
[ ${TRANSPARENCY_OVERRIDE} ] && {
|
||||||
printf "[window]\nopacity = ${TRANSPARENCY_OVERRIDE}\n" >> "${_COLORSCHEME_FILE__alacritty}"
|
printf "[window]\nopacity = ${TRANSPARENCY_OVERRIDE}\n" >> "${_COLORSCHEME_FILE__alacritty}"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
use --group dotwryn desktop/colorscheme/apps/alacritty
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/flameshot
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/getty
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/gtk
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/hyprland
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/kitty
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/polybar
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/quickshell
|
||||||
|
use --group dotwryn desktop/colorscheme/apps/rofi
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
_COLORSCHEME_FILE__flameshot="${DOTWRYN}/config/user/flameshot/flameshot.ini"
|
_COLORSCHEME_FILE__flameshot="${DOTWRYN}/config/user/flameshot/flameshot.ini"
|
||||||
|
|
||||||
_GENERATE_THEME__flameshot() {
|
_GENERATE_THEME__flameshot() {
|
||||||
local C1="#$(_GET_HEX .flameshot.color1 .material.primary.200 .ansi.reg.bright )"
|
local C1="#$(_GET_HEX .flameshot.color1 .material.primary.200 .ansi.red.bright )"
|
||||||
local C2="#$(_GET_HEX .flameshot.color2 .material.primary.500 .ansi.red.regular)"
|
local C2="#$(_GET_HEX .flameshot.color2 .material.primary.500 .ansi.red.regular)"
|
||||||
local C3="#$(_GET_HEX .flameshot.color3 .material.primary.800 .ansi.green.bright )"
|
local C3="#$(_GET_HEX .flameshot.color3 .material.primary.800 .ansi.green.bright )"
|
||||||
local C4="#$(_GET_HEX .flameshot.color4 .material.secondary.200 .ansi.green.regular)"
|
local C4="#$(_GET_HEX .flameshot.color4 .material.secondary.200 .ansi.green.regular)"
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
_COLORSCHEME_FILE__getty="${ACTIVE_THEME_PATH}/getty.sh"
|
_COLORSCHEME_FILE__getty="$(dotwryn.config colorscheme.active.path)/getty.sh"
|
||||||
|
|
||||||
_GENERATE_THEME__getty() {
|
_GENERATE_THEME__getty() {
|
||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
# do not edit; generated by scwrypts
|
# do not edit; generated by scwrypts
|
||||||
# theme : ${THEME_NAME}
|
# theme : ${theme_name}
|
||||||
#
|
#
|
||||||
# source this file to apply colorscheme to linux getty
|
# source this file to apply colorscheme to linux getty
|
||||||
#
|
#
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
_COLORSCHEME_FILE__gtk3="${DOTWRYN}/config/user/gtk-3.0/gtk.css"
|
||||||
|
_COLORSCHEME_FILE__gtk4="${DOTWRYN}/config/user/gtk-4.0/gtk.css"
|
||||||
|
|
||||||
|
# recolors libadwaita (GTK4) and the adw-gtk3 theme (GTK3) through their shared
|
||||||
|
# named colors; requires gtk-theme-name=adw-gtk3-dark (config/user/gtk-3.0/settings.ini)
|
||||||
|
#
|
||||||
|
# libadwaita draws text from one surface over another (e.g. notebook pages paint the
|
||||||
|
# view background but inherit the window foreground), so every surface shares the
|
||||||
|
# theme foreground and is the theme background tinted toward a material color; the
|
||||||
|
# only bg/fg pairs are the material ones (accent + status colors)
|
||||||
|
_GENERATE_THEME__gtk() {
|
||||||
|
local css="/* do not edit; generated by scwrypts
|
||||||
|
* theme : ${theme_name}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@define-color view_bg_color #$(_GET_HEX .gtk.view.bg .background);
|
||||||
|
@define-color view_fg_color #$(_GET_HEX .gtk.view.fg .foreground);
|
||||||
|
|
||||||
|
@define-color window_bg_color mix(@view_bg_color, #$(_GET_HEX .gtk.window.tint .material.base.secondary .ansi.green.regular ), 0.10);
|
||||||
|
@define-color window_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color headerbar_bg_color mix(@view_bg_color, #$(_GET_HEX .gtk.headerbar.tint .material.base.primary .ansi.yellow.regular), 0.25);
|
||||||
|
@define-color headerbar_fg_color @view_fg_color;
|
||||||
|
@define-color headerbar_border_color @view_fg_color;
|
||||||
|
@define-color headerbar_backdrop_color @window_bg_color;
|
||||||
|
@define-color headerbar_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color headerbar_darker_shade_color rgba(0, 0, 0, 0.9);
|
||||||
|
|
||||||
|
@define-color sidebar_bg_color mix(@view_bg_color, @window_bg_color, 0.6);
|
||||||
|
@define-color sidebar_fg_color @view_fg_color;
|
||||||
|
@define-color sidebar_backdrop_color @view_bg_color;
|
||||||
|
@define-color sidebar_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
@define-color secondary_sidebar_bg_color @view_bg_color;
|
||||||
|
@define-color secondary_sidebar_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color card_bg_color alpha(@view_fg_color, 0.05);
|
||||||
|
@define-color card_fg_color @view_fg_color;
|
||||||
|
@define-color card_shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
|
||||||
|
@define-color dialog_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color dialog_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color popover_bg_color mix(@view_bg_color, @headerbar_bg_color, 0.6);
|
||||||
|
@define-color popover_fg_color @view_fg_color;
|
||||||
|
@define-color popover_shade_color rgba(0, 0, 0, 0.25);
|
||||||
|
|
||||||
|
@define-color thumbnail_bg_color @window_bg_color;
|
||||||
|
@define-color thumbnail_fg_color @view_fg_color;
|
||||||
|
|
||||||
|
@define-color shade_color rgba(0, 0, 0, 0.36);
|
||||||
|
@define-color scrollbar_outline_color rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
@define-color accent_color #$(_GET_HEX .gtk.accent.color .material.secondary.200 .ansi.green.bright );
|
||||||
|
@define-color accent_bg_color #$(_GET_HEX .gtk.accent.bg .material.base.secondary .ansi.green.regular );
|
||||||
|
@define-color accent_fg_color #$(_GET_HEX .gtk.accent.fg .material.base.foreground.secondary .ansi.gray.white );
|
||||||
|
|
||||||
|
@define-color destructive_color #$(_GET_HEX .gtk.destructive.color .material.error.200 .ansi.red.bright );
|
||||||
|
@define-color destructive_bg_color #$(_GET_HEX .gtk.destructive.bg .material.base.error .ansi.red.regular );
|
||||||
|
@define-color destructive_fg_color #$(_GET_HEX .gtk.destructive.fg .material.base.foreground.error .ansi.gray.white );
|
||||||
|
|
||||||
|
@define-color success_color #$(_GET_HEX .gtk.success.color .material.secondary.200 .ansi.green.bright );
|
||||||
|
@define-color success_bg_color #$(_GET_HEX .gtk.success.bg .material.base.secondary .ansi.green.regular );
|
||||||
|
@define-color success_fg_color #$(_GET_HEX .gtk.success.fg .material.base.foreground.secondary .ansi.gray.white );
|
||||||
|
|
||||||
|
@define-color warning_color #$(_GET_HEX .gtk.warning.color .material.primary.200 .ansi.yellow.bright );
|
||||||
|
@define-color warning_bg_color #$(_GET_HEX .gtk.warning.bg .material.base.primary .ansi.yellow.regular);
|
||||||
|
@define-color warning_fg_color #$(_GET_HEX .gtk.warning.fg .material.base.foreground.primary .ansi.gray.white );
|
||||||
|
|
||||||
|
@define-color error_color #$(_GET_HEX .gtk.error.color .material.error.200 .ansi.red.bright );
|
||||||
|
@define-color error_bg_color #$(_GET_HEX .gtk.error.bg .material.base.error .ansi.red.regular );
|
||||||
|
@define-color error_fg_color #$(_GET_HEX .gtk.error.fg .material.base.foreground.error .ansi.gray.white );"
|
||||||
|
|
||||||
|
# adw-gtk3 pins the GTK4 accent to the system accent-color (libadwaita-tweaks.css)
|
||||||
|
local gtk4_accent="
|
||||||
|
:root {
|
||||||
|
--accent-color: @accent_color;
|
||||||
|
--accent-bg-color: @accent_bg_color;
|
||||||
|
--accent-fg-color: @accent_fg_color;
|
||||||
|
}"
|
||||||
|
|
||||||
|
mkdir -p -- "${_COLORSCHEME_FILE__gtk3:h}" "${_COLORSCHEME_FILE__gtk4:h}"
|
||||||
|
echo "${css}" > "${_COLORSCHEME_FILE__gtk3}"
|
||||||
|
echo "${css}${gtk4_accent}" > "${_COLORSCHEME_FILE__gtk4}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_SET_THEME__gtk() {
|
||||||
|
return 0 # gtk apps load gtk.css on startup
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
_COLORSCHEME_FILE__hyprland_hyprlock="$(dotwryn.config colorscheme.active.path)/hyprlock.conf"
|
||||||
|
_COLORSCHEME_FILE__hyprland_hyprtoolkit="$(dotwryn.config colorscheme.active.path)/hyprtoolkit.conf" # linked to ~/.config/hypr by system/symlinks/get-all
|
||||||
|
|
||||||
|
_GENERATE_THEME__hyprland() {
|
||||||
|
# (hyprland itself reads the colorscheme through colorscheme.lua; see config/desktop/hyprland/config.d/99-dwindle.lua)
|
||||||
|
|
||||||
|
echo "# do not edit; generated by scwrypts
|
||||||
|
# theme : ${theme_name}
|
||||||
|
\$background = rgb($(_GET_HEX .hyprland.hyprlock.background .background))
|
||||||
|
\$foreground = rgb($(_GET_HEX .hyprland.hyprlock.foreground .foreground))
|
||||||
|
\$accent = rgb($(_GET_HEX .hyprland.hyprlock.accent .material.secondary.500 .ansi.green.bright))
|
||||||
|
\$accent_alt = rgb($(_GET_HEX .hyprland.hyprlock.accent-alt .material.primary.700 .ansi.yellow.regular))
|
||||||
|
\$verifying = rgb($(_GET_HEX .hyprland.hyprlock.verifying .material.secondary.200 .ansi.green.bright))
|
||||||
|
\$wrong = rgb($(_GET_HEX .hyprland.hyprlock.wrong .material.error.200 .ansi.red.bright))
|
||||||
|
\$keypress = rgb($(_GET_HEX .hyprland.hyprlock.keypress .material.primary.200 .ansi.yellow.bright))
|
||||||
|
\$clock = rgb($(_GET_HEX .hyprland.hyprlock.clock .ansi.gray.white))
|
||||||
|
\$date = rgb($(_GET_HEX .hyprland.hyprlock.date .ansi.gray.bright))" > "${_COLORSCHEME_FILE__hyprland_hyprlock}"
|
||||||
|
|
||||||
|
# shared theme for hyprland-ecosystem GUI apps (hyprland-guiutils dialogs, hyprpm prompts, ...)
|
||||||
|
echo "# do not edit; generated by scwrypts
|
||||||
|
# theme : ${theme_name}
|
||||||
|
background = rgb($(_GET_HEX .hyprland.hyprtoolkit.background .material.secondary.900 .ansi.gray.black))
|
||||||
|
base = rgb($(_GET_HEX .hyprland.hyprtoolkit.base .material.secondary.900 .ansi.gray.black))
|
||||||
|
alternate_base = rgb($(_GET_HEX .hyprland.hyprtoolkit.alternate-base .background))
|
||||||
|
text = rgb($(_GET_HEX .hyprland.hyprtoolkit.text .material.foreground.secondary.900 .ansi.gray.white))
|
||||||
|
bright_text = rgb($(_GET_HEX .hyprland.hyprtoolkit.bright-text .material.foreground.primary.300 .ansi.gray.black))
|
||||||
|
accent = rgb($(_GET_HEX .hyprland.hyprtoolkit.accent .material.primary.300 .ansi.yellow.bright))
|
||||||
|
accent_secondary = rgb($(_GET_HEX .hyprland.hyprtoolkit.accent-secondary .material.base.primary .ansi.yellow.regular))
|
||||||
|
|
||||||
|
font_family = Monaspace Argon
|
||||||
|
font_family_monospace = Monaspace Argon
|
||||||
|
|
||||||
|
rounding_large = 0
|
||||||
|
rounding_small = 0" > "${_COLORSCHEME_FILE__hyprland_hyprtoolkit}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_SET_THEME__hyprland() {
|
||||||
|
command -v hyprctl &>/dev/null || return 0
|
||||||
|
|
||||||
|
# shells that outlive a hyprland start (e.g. a tmux server started from the TTY)
|
||||||
|
# don't carry its environment; fall back to the most recent running instance
|
||||||
|
local -x HYPRLAND_INSTANCE_SIGNATURE="${HYPRLAND_INSTANCE_SIGNATURE:-$(
|
||||||
|
hyprctl instances -j 2>/dev/null | jq -r 'sort_by(.time) | last | .instance // empty'
|
||||||
|
)}"
|
||||||
|
[[ "${HYPRLAND_INSTANCE_SIGNATURE}" ]] || return 0 # hyprland isn't running
|
||||||
|
|
||||||
|
hyprctl reload &>/dev/null
|
||||||
|
scwrypts --group dotwryn --type zsh --name desktop/wayland/hyprland/set-background -- theme "${theme_name}" &>/dev/null # name.txt is written after this hook
|
||||||
|
return 0
|
||||||
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@ _COLORSCHEME_FILE__kitty="${DOTWRYN}/config/user/kitty/theme.conf"
|
|||||||
|
|
||||||
_GENERATE_THEME__kitty() {
|
_GENERATE_THEME__kitty() {
|
||||||
echo "# do not edit; generated by scwrypts
|
echo "# do not edit; generated by scwrypts
|
||||||
# theme : ${THEME_NAME}
|
# theme : ${theme_name}
|
||||||
color0 #${BLACK}
|
color0 #${BLACK}
|
||||||
color1 #${RED}
|
color1 #${RED}
|
||||||
color2 #${GREEN}
|
color2 #${GREEN}
|
||||||
+1
-1
@@ -2,7 +2,7 @@ _COLORSCHEME_FILE__polybar="${DOTWRYN}/config/user/polybar/theme.ini"
|
|||||||
|
|
||||||
_GENERATE_THEME__polybar() {
|
_GENERATE_THEME__polybar() {
|
||||||
echo "# do not edit; generated by scwrypts
|
echo "# do not edit; generated by scwrypts
|
||||||
# theme : ${THEME_NAME}
|
# theme : ${theme_name}
|
||||||
[colors]
|
[colors]
|
||||||
background = #$(_GET_HEX .polybar.background .background)
|
background = #$(_GET_HEX .polybar.background .background)
|
||||||
foreground = #$(_GET_HEX .polybar.foreground .foreground)
|
foreground = #$(_GET_HEX .polybar.foreground .foreground)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
_COLORSCHEME_FILE__quickshell="${DOTWRYN}/config/user/quickshell/colors.json"
|
||||||
|
|
||||||
|
_GENERATE_THEME__quickshell() {
|
||||||
|
echo "{
|
||||||
|
\"theme\" : \"${theme_name}\",
|
||||||
|
\"background\" : \"#$(_GET_HEX .quickshell.background .background)\",
|
||||||
|
\"foreground\" : \"#$(_GET_HEX .quickshell.foreground .foreground)\",
|
||||||
|
\"backgroundAlt\" : \"#$(_GET_HEX .quickshell.background-alt .selection.background)\",
|
||||||
|
\"foregroundAlt\" : \"#$(_GET_HEX .quickshell.foreground-alt .selection.foreground)\",
|
||||||
|
\"primary\" : \"#$(_GET_HEX .quickshell.primary .material.base.primary .ansi.yellow.regular)\",
|
||||||
|
\"secondary\" : \"#$(_GET_HEX .quickshell.secondary .material.base.secondary .ansi.green.regular)\",
|
||||||
|
\"alert\" : \"#$(_GET_HEX .quickshell.alert .material.base.error .ansi.red.regular)\",
|
||||||
|
\"disabled\" : \"#$(_GET_HEX .quickshell.disabled .ansi.gray.regular)\",
|
||||||
|
|
||||||
|
\"secondaryGradient\" : [
|
||||||
|
\"#$(_GET_HEX .quickshell.secondary-gradient-0 .material.secondary.700 .ansi.green.regular)\",
|
||||||
|
\"#$(_GET_HEX .quickshell.secondary-gradient-1 .material.secondary.600 .ansi.green.regular)\",
|
||||||
|
\"#$(_GET_HEX .quickshell.secondary-gradient-2 .material.secondary.500 .ansi.green.regular)\",
|
||||||
|
\"#$(_GET_HEX .quickshell.secondary-gradient-3 .material.secondary.400 .ansi.green.regular)\",
|
||||||
|
\"#$(_GET_HEX .quickshell.secondary-gradient-4 .material.secondary.300 .ansi.green.regular)\"
|
||||||
|
]
|
||||||
|
}" > "${_COLORSCHEME_FILE__quickshell}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_SET_THEME__quickshell() {
|
||||||
|
return 0 # quickshell watches colors.json and reloads on change
|
||||||
|
}
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
_COLORSCHEME_FILE__rofi="${ACTIVE_THEME_PATH}/rofi.rasi"
|
_COLORSCHEME_FILE__rofi="$(dotwryn.config colorscheme.active.path)/rofi.rasi"
|
||||||
|
|
||||||
_GENERATE_THEME__rofi() {
|
_GENERATE_THEME__rofi() {
|
||||||
echo "/**
|
echo "/**
|
||||||
* do not edit; generated by scwrypts
|
* do not edit; generated by scwrypts
|
||||||
* theme : ${THEME_NAME}
|
* theme : ${theme_name}
|
||||||
**/
|
**/
|
||||||
|
|
||||||
*{
|
*{
|
||||||
@@ -15,7 +15,7 @@ _GENERATE_THEME__rofi() {
|
|||||||
active: #$(_GET_HEX .rofi.active .material.base.primary .ansi.green.regular);
|
active: #$(_GET_HEX .rofi.active .material.base.primary .ansi.green.regular);
|
||||||
urgent: #$(_GET_HEX .rofi.urgent .material.base.error .ansi.red.regular );
|
urgent: #$(_GET_HEX .rofi.urgent .material.base.error .ansi.red.regular );
|
||||||
}
|
}
|
||||||
" | sed '$d' > "$_COLORSCHEME_FILE__rofi"
|
" | sed '$d' > "${_COLORSCHEME_FILE__rofi}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_SET_THEME__rofi() {
|
_SET_THEME__rofi() {
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
-- lua implementation of the dotwryn colorscheme library (scwrypts/dotwryn/desktop/colorscheme)
|
||||||
|
--
|
||||||
|
-- usage:
|
||||||
|
-- local colorscheme = dofile(os.getenv("DOTWRYN") .. "/scwrypts/dotwryn/desktop/colorscheme/colorscheme.lua")
|
||||||
|
-- local theme = colorscheme.load() -- the active theme
|
||||||
|
-- local theme = colorscheme.load("winter") -- a named theme
|
||||||
|
--
|
||||||
|
-- theme.name -- e.g. "halloween"
|
||||||
|
-- theme.values -- the merged (default.yaml + theme) source, references unresolved
|
||||||
|
-- theme.get_hex(".i3.focused.border", ".material.secondary.500", ".ansi.green.bright") --> "#ffc106"
|
||||||
|
--
|
||||||
|
-- theme.get_hex follows 'desktop/colorscheme/get-hex' : an ordered list of lookup terms where
|
||||||
|
-- the first which resolves wins; values which are themselves lookups (".material...") are
|
||||||
|
-- followed recursively; a term is a yq-style path, an ANSI color number (0-15), or one of
|
||||||
|
-- the compatibility terms below; unlike get-hex, colors are returned as "#rrggbb"
|
||||||
|
--
|
||||||
|
-- reads the yaml through 'yq' (dependency of the colorscheme library)
|
||||||
|
|
||||||
|
local DOTWRYN = os.getenv("DOTWRYN")
|
||||||
|
assert(DOTWRYN ~= nil and DOTWRYN ~= "", "DOTWRYN must be set to use the colorscheme library (have you loaded ~/.zshrc?)")
|
||||||
|
|
||||||
|
local COLORSCHEME_DIR = DOTWRYN .. "/config/colorschemes"
|
||||||
|
local ACTIVE_THEME_PATH = COLORSCHEME_DIR .. "/active"
|
||||||
|
local ACTIVE_THEME_SOURCE = ACTIVE_THEME_PATH .. "/source.yaml"
|
||||||
|
local DEFAULT_MATERIAL_REFERENCES = ACTIVE_THEME_PATH .. "/default.yaml"
|
||||||
|
|
||||||
|
local MAX_LOOKUP_RECURSION = 10
|
||||||
|
|
||||||
|
local ANSI_COLOR_LOOKUPS = {
|
||||||
|
[0] = ".ansi.gray.black",
|
||||||
|
[1] = ".ansi.red.regular",
|
||||||
|
[2] = ".ansi.green.regular",
|
||||||
|
[3] = ".ansi.yellow.regular",
|
||||||
|
[4] = ".ansi.blue.regular",
|
||||||
|
[5] = ".ansi.magenta.regular",
|
||||||
|
[6] = ".ansi.cyan.regular",
|
||||||
|
[7] = ".ansi.gray.white",
|
||||||
|
[8] = ".ansi.gray.regular",
|
||||||
|
[9] = ".ansi.red.bright",
|
||||||
|
[10] = ".ansi.green.bright",
|
||||||
|
[11] = ".ansi.yellow.bright",
|
||||||
|
[12] = ".ansi.blue.bright",
|
||||||
|
[13] = ".ansi.magenta.bright",
|
||||||
|
[14] = ".ansi.cyan.bright",
|
||||||
|
[15] = ".ansi.gray.bright",
|
||||||
|
}
|
||||||
|
|
||||||
|
local COMPATIBILITY_LOOKUPS = {
|
||||||
|
foreground = { ".foreground", ".ansi.gray.black" },
|
||||||
|
background = { ".background", ".ansi.gray.white" },
|
||||||
|
cursor = { ".cursor", ".ansi.gray.white" },
|
||||||
|
selection_foreground = { ".selection.foreground", ".background" },
|
||||||
|
selection_background = { ".selection.background", ".foreground" },
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local shell_quote = function(value)
|
||||||
|
return "'" .. value:gsub("'", "'\\''") .. "'"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- (the exit status from pipe:close() is unreliable inside hyprland, which reaps its own
|
||||||
|
-- children; a failed command is detected by its missing output instead)
|
||||||
|
local read_command = function(command)
|
||||||
|
local pipe = io.popen(command)
|
||||||
|
local output = pipe:read("a")
|
||||||
|
pipe:close()
|
||||||
|
if output == nil or output == "" then error("colorscheme : no output from command : " .. command) end
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
local read_yaml = function(...)
|
||||||
|
local files = {}
|
||||||
|
for _, file in ipairs({ ... }) do table.insert(files, shell_quote(file)) end
|
||||||
|
|
||||||
|
local chunk = read_command("yq eval-all '. as $item ireduce ({}; . * $item)' -o lua " .. table.concat(files, " "))
|
||||||
|
return assert(load(chunk, "colorscheme", "t", {}))()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ".material.primary.500" --> values.material.primary[500] (or ["500"])
|
||||||
|
local get_path = function(values, lookup)
|
||||||
|
local value = values
|
||||||
|
for key in lookup:gmatch("[^.]+") do
|
||||||
|
if type(value) ~= "table" then return nil end
|
||||||
|
value = value[tonumber(key)] or value[key]
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
|
local expand_term = function(term, lookups)
|
||||||
|
local ansi_color = term:match("^%d+$") and ANSI_COLOR_LOOKUPS[tonumber(term)]
|
||||||
|
if ansi_color ~= nil then
|
||||||
|
table.insert(lookups, ansi_color)
|
||||||
|
elseif COMPATIBILITY_LOOKUPS[term] ~= nil then
|
||||||
|
for _, lookup in ipairs(COMPATIBILITY_LOOKUPS[term]) do table.insert(lookups, lookup) end
|
||||||
|
else
|
||||||
|
table.insert(lookups, term)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local colorscheme = {}
|
||||||
|
|
||||||
|
colorscheme.load = function(theme_name)
|
||||||
|
local theme_source = ACTIVE_THEME_SOURCE
|
||||||
|
if theme_name ~= nil then
|
||||||
|
theme_source = COLORSCHEME_DIR .. "/" .. theme_name .. ".yaml"
|
||||||
|
if io.open(theme_source, "r") == nil then error("colorscheme : no such theme '" .. theme_name .. "'") end
|
||||||
|
else
|
||||||
|
-- (name.txt is only written after every theme file is generated)
|
||||||
|
theme_name = read_command("readlink -- " .. shell_quote(ACTIVE_THEME_SOURCE)):match("([^/]+)%.yaml%s*$")
|
||||||
|
end
|
||||||
|
|
||||||
|
local theme = {
|
||||||
|
name = theme_name,
|
||||||
|
values = read_yaml(DEFAULT_MATERIAL_REFERENCES, theme_source),
|
||||||
|
}
|
||||||
|
|
||||||
|
theme.get_hex = function(...)
|
||||||
|
local lookups = {}
|
||||||
|
for _, term in ipairs({ ... }) do expand_term(tostring(term), lookups) end
|
||||||
|
if #lookups == 0 then error("colorscheme : must provide at least one color lookup") end
|
||||||
|
|
||||||
|
for _, lookup in ipairs(lookups) do
|
||||||
|
local value = lookup
|
||||||
|
for _ = 1, MAX_LOOKUP_RECURSION do
|
||||||
|
value = get_path(theme.values, value)
|
||||||
|
if type(value) ~= "string" or value:sub(1, 1) ~= "." then break end
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(value) == "string" and value ~= "" and value:sub(1, 1) ~= "." then
|
||||||
|
return "#" .. value:gsub("^#", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
error("colorscheme : color lookup error for '" .. table.concat({ ... }, " ") .. "' in theme '" .. tostring(theme.name) .. "'")
|
||||||
|
end
|
||||||
|
|
||||||
|
return theme
|
||||||
|
end
|
||||||
|
|
||||||
|
return colorscheme
|
||||||
@@ -1,264 +1,6 @@
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
_COLORSCHEME_DIR="${DOTWRYN}/config/colorschemes"
|
use --group dotwryn desktop/colorscheme/get-hex
|
||||||
|
use --group dotwryn desktop/colorscheme/set-theme
|
||||||
ACTIVE_THEME_PATH="${_COLORSCHEME_DIR}/active"
|
|
||||||
ACTIVE_THEME_SOURCE="${ACTIVE_THEME_PATH}/source.yaml"
|
|
||||||
|
|
||||||
use --group dotwryn desktop/colorscheme/alacritty
|
|
||||||
use --group dotwryn desktop/colorscheme/flameshot
|
|
||||||
use --group dotwryn desktop/colorscheme/getty
|
|
||||||
use --group dotwryn desktop/colorscheme/kitty
|
|
||||||
use --group dotwryn desktop/colorscheme/polybar
|
|
||||||
use --group dotwryn desktop/colorscheme/rofi
|
|
||||||
|
|
||||||
COLORSCHEME__SUPPORTED_CONFIG_TYPES=($(typeset -f + | sed -n 's/^_GENERATE_THEME__//p'))
|
|
||||||
|
|
||||||
DEFAULT_MATERIAL_REFERENCES="${ACTIVE_THEME_PATH}/default.yaml"
|
|
||||||
|
|
||||||
DEPENDENCIES+=(sed yq)
|
|
||||||
|
|
||||||
utils.environment.check DESKTOP__WALLPAPER_PATH --optional
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
MAX_LOOKUP_RECURSION=10
|
|
||||||
${scwryptsmodule}.get-hex() {
|
|
||||||
[ ! ${USAGE} ] && USAGE="
|
|
||||||
usage: ...args... [...options...]
|
|
||||||
|
|
||||||
options:
|
|
||||||
-t, --theme get the colorscheme value for the indicated theme source
|
|
||||||
-l, --list-themes show available color themes and exit
|
|
||||||
|
|
||||||
args:
|
|
||||||
An ordered list of colorscheme lookup terms. The first term is preferred, and
|
|
||||||
subsequent lookup terms are used as fallback.
|
|
||||||
|
|
||||||
Some special terms are allowed (typically for compatibility); however,
|
|
||||||
these should be simple yq queries from the 'colorscheme/\$THEME_NAME.yaml'
|
|
||||||
(e.g. '.ansi.red.bright')
|
|
||||||
|
|
||||||
Special terms:
|
|
||||||
[0-15] : lookup by ANSI color number
|
|
||||||
compatibility : foreground | background | cursor | selection_foreground | selection_background
|
|
||||||
"
|
|
||||||
|
|
||||||
local THEME_NAME='current active theme'
|
|
||||||
local THEME_SOURCE="${ACTIVE_THEME_SOURCE}"
|
|
||||||
local ARGS=()
|
|
||||||
local LOOKUPS=()
|
|
||||||
while [[ $# -gt 0 ]]
|
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
-t | --theme )
|
|
||||||
THEME_NAME=$2; shift 1
|
|
||||||
THEME_SOURCE="${_COLORSCHEME_DIR}/${THEME_NAME}.yaml"
|
|
||||||
[ -f "${THEME_SOURCE}" ] \
|
|
||||||
|| echo.error "no such theme '${THEME_NAME}' exists"
|
|
||||||
;;
|
|
||||||
|
|
||||||
-l | --list-themes ) _LIST_THEMES; return 0 ;;
|
|
||||||
|
|
||||||
[0-9] | 1[0-5] ) LOOKUPS+=($(_GET_YAML_LOOKUP_FOR_ANSI_COLOR $1)) ;;
|
|
||||||
|
|
||||||
foreground ) LOOKUPS+=(.foreground .ansi.gray.black) ;;
|
|
||||||
background ) LOOKUPS+=(.background .ansi.gray.white) ;;
|
|
||||||
cursor ) LOOKUPS+=(.cursor .ansi.gray.white) ;;
|
|
||||||
selection_foreground ) LOOKUPS+=(.selection.foreground .background ) ;;
|
|
||||||
selection_background ) LOOKUPS+=(.selection.background .foreground ) ;;
|
|
||||||
|
|
||||||
* ) LOOKUPS+=("$1") ;;
|
|
||||||
esac
|
|
||||||
shift 1
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ ${#LOOKUPS[@]} -gt 0 ]] \
|
|
||||||
|| echo.error 'must provide at least one color lookup'
|
|
||||||
|
|
||||||
utils.check-errors || return 1
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
|
|
||||||
local LOOKUP VALUE
|
|
||||||
local I INIT
|
|
||||||
for LOOKUP in ${LOOKUPS[@]}
|
|
||||||
do
|
|
||||||
I=0 INIT=${LOOKUP}
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
((I+=1))
|
|
||||||
VALUE=$(utils.yq eval-all '. as $item ireduce ({}; . * $item)' "${DEFAULT_MATERIAL_REFERENCES}" "${THEME_SOURCE}" | utils.yq -r ${LOOKUP})
|
|
||||||
case ${VALUE} in
|
|
||||||
.* ) LOOKUP=${VALUE} ;;
|
|
||||||
* ) break ;;
|
|
||||||
esac
|
|
||||||
[[ ${I} -ge ${MAX_LOOKUP_RECURSION} ]] && {
|
|
||||||
VALUE=null
|
|
||||||
WARNING "max recursive depth reached for '${INIT}'"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ ${VALUE} =~ null ]] && continue
|
|
||||||
[[ ${VALUE} =~ ^$ ]] && continue
|
|
||||||
break
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ ${VALUE} =~ null ]] && {
|
|
||||||
echo.error "color lookup error for '${LOOKUPS}'"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo ${VALUE} | sed 's/^#//'
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_THEME() {
|
|
||||||
[ ! ${USAGE} ] && USAGE="
|
|
||||||
usage: [...options...]
|
|
||||||
|
|
||||||
options:
|
|
||||||
-t, --theme one of the available color themes
|
|
||||||
-l, --list-themes show available color themes and exit
|
|
||||||
|
|
||||||
--only only set the theme for a specific terminal/application
|
|
||||||
(${COLORSCHEME__SUPPORTED_CONFIG_TYPES})
|
|
||||||
|
|
||||||
-h, --help show this dialogue and exit
|
|
||||||
|
|
||||||
args:
|
|
||||||
\$1 shorthand for '--theme \$1'
|
|
||||||
|
|
||||||
generate all source-controlled theme files then link them to the
|
|
||||||
appropriate local theme file to immediately update terminal themes
|
|
||||||
|
|
||||||
Note : 'i3wm colorscheme' configuration is supported but must be performed
|
|
||||||
through the 'desktop/xorg/i3 --group dotwryn' module due to
|
|
||||||
some odd complexity
|
|
||||||
"
|
|
||||||
local THEME_NAME CONFIG_TYPE
|
|
||||||
local UPDATE_ACTIVE_THEME=true
|
|
||||||
while [[ $# -gt 0 ]]
|
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
-t | --theme ) THEME_NAME=$2; shift 1 ;;
|
|
||||||
-l | --list-themes ) _LIST_THEMES; return 0 ;;
|
|
||||||
|
|
||||||
--only )
|
|
||||||
UPDATE_ACTIVE_THEME=false
|
|
||||||
CONFIG_TYPE=$2; shift 1
|
|
||||||
command -v _SET_THEME__${CONFIG_TYPE} >/dev/null 2>&1 \
|
|
||||||
|| echo.error "configuration for '${CONFIG_TYPE}' not supported"
|
|
||||||
;;
|
|
||||||
|
|
||||||
-h | --help ) USAGE; return 0 ;;
|
|
||||||
|
|
||||||
* ) [ ! ${THEME_NAME} ] \
|
|
||||||
&& THEME_NAME=$1 \
|
|
||||||
|| echo.error "unknown argument '$1'" \
|
|
||||||
;
|
|
||||||
esac
|
|
||||||
shift 1
|
|
||||||
done
|
|
||||||
|
|
||||||
utils.check-errors --no-fail || return 1
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
|
|
||||||
[ ${THEME_NAME} ] || THEME_NAME=$(_LIST_THEMES | utils.fzf 'select a theme')
|
|
||||||
[ ${THEME_NAME} ] || ABORT
|
|
||||||
|
|
||||||
local SOURCE_THEME="${_COLORSCHEME_DIR}/${THEME_NAME}.yaml"
|
|
||||||
[ -f "${SOURCE_THEME}" ] \
|
|
||||||
|| echo.error "no such theme '${THEME_NAME}'" \
|
|
||||||
|| return 1
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
|
|
||||||
[[ ${UPDATE_ACTIVE_THEME} =~ true ]] && {
|
|
||||||
mkdir -p "${ACTIVE_THEME_PATH}" &>/dev/null
|
|
||||||
echo.status "updating active theme" \
|
|
||||||
&& ( cd -- "${ACTIVE_THEME_PATH}"; ln -sf -- "../$(basename -- "${SOURCE_THEME}")" "./$(basename -- "${ACTIVE_THEME_SOURCE}")"; ) \
|
|
||||||
&& echo.success "active theme set to '${THEME_NAME}'" \
|
|
||||||
|| echo.error "unable to set active theme to '${THEME_NAME}'" \
|
|
||||||
|| return 2
|
|
||||||
}
|
|
||||||
|
|
||||||
local CONFIG_TYPES=()
|
|
||||||
[ ${CONFIG_TYPE} ] \
|
|
||||||
&& CONFIG_TYPES=(${CONFIG_TYPE}) \
|
|
||||||
|| CONFIG_TYPES=(${COLORSCHEME__SUPPORTED_CONFIG_TYPES}) \
|
|
||||||
;
|
|
||||||
|
|
||||||
_GET_HEX() { dotwryn.desktop.colorscheme.get-hex --theme ${THEME_NAME} $@; }
|
|
||||||
# allow simple ANSI-color reference
|
|
||||||
local BLACK=$(_GET_HEX .ansi.gray.black )
|
|
||||||
local BRIGHT_BLACK=$(_GET_HEX .ansi.gray.regular )
|
|
||||||
local RED=$(_GET_HEX .ansi.red.regular )
|
|
||||||
local BRIGHT_RED=$(_GET_HEX .ansi.red.bright )
|
|
||||||
local GREEN=$(_GET_HEX .ansi.green.regular )
|
|
||||||
local BRIGHT_GREEN=$(_GET_HEX .ansi.green.bright )
|
|
||||||
local YELLOW=$(_GET_HEX .ansi.yellow.regular )
|
|
||||||
local BRIGHT_YELLOW=$(_GET_HEX .ansi.yellow.bright )
|
|
||||||
local BLUE=$(_GET_HEX .ansi.blue.regular )
|
|
||||||
local BRIGHT_BLUE=$(_GET_HEX .ansi.blue.bright )
|
|
||||||
local MAGENTA=$(_GET_HEX .ansi.magenta.regular)
|
|
||||||
local BRIGHT_MAGENTA=$(_GET_HEX .ansi.magenta.bright )
|
|
||||||
local CYAN=$(_GET_HEX .ansi.cyan.regular )
|
|
||||||
local BRIGHT_CYAN=$(_GET_HEX .ansi.cyan.bright )
|
|
||||||
local WHITE=$(_GET_HEX .ansi.gray.white )
|
|
||||||
local BRIGHT_WHITE=$(_GET_HEX .ansi.gray.bright )
|
|
||||||
local FOREGROUND=$(_GET_HEX .foreground )
|
|
||||||
local BACKGROUND=$(_GET_HEX .background )
|
|
||||||
local CURSOR=$(_GET_HEX .cursor )
|
|
||||||
|
|
||||||
for CONFIG_TYPE in ${CONFIG_TYPES[@]}
|
|
||||||
do
|
|
||||||
echo.status "updating ${CONFIG_TYPE} theme" \
|
|
||||||
&& _GENERATE_THEME__${CONFIG_TYPE} \
|
|
||||||
&& _SET_THEME__${CONFIG_TYPE} \
|
|
||||||
&& echo.success "emulator ${CONFIG_TYPE} successfully updated to ${THEME_NAME}" \
|
|
||||||
|| echo.error "error setting theme ${THEME_NAME} for ${CONFIG_TYPE}"
|
|
||||||
|
|
||||||
[[ ${CONFIG_TYPE} =~ ^getty$ ]] && [[ ${TERM} =~ ^linux$ ]] && {
|
|
||||||
echo.status 'loading getty theme now' \
|
|
||||||
&& NO_CLEAR=1 source "${ACTIVE_THEME_PATH}/getty.sh" \
|
|
||||||
&& echo.success 'getty theme loaded' \
|
|
||||||
|| echo.error 'getty theme loading error (see above)'
|
|
||||||
}
|
|
||||||
done
|
|
||||||
|
|
||||||
local WALLPAPER="$(find "${DESKTOP__WALLPAPER_PATH}" -type f -name ${THEME_NAME}.\* 2>/dev/null | head -n1)"
|
|
||||||
[ "${WALLPAPER}" ] && command -v feh &>/dev/null \
|
|
||||||
&& feh --no-fehbg --bg-fill "${WALLPAPER}"
|
|
||||||
|
|
||||||
utils.check-errors --no-usage \
|
|
||||||
&& echo "${THEME_NAME}" > "${ACTIVE_THEME_PATH}/name.txt"
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
_LIST_THEMES() {
|
|
||||||
ls "${_COLORSCHEME_DIR}" | sed -n 's/.yaml$//p'
|
|
||||||
}
|
|
||||||
|
|
||||||
_GET_YAML_LOOKUP_FOR_ANSI_COLOR() {
|
|
||||||
echo "
|
|
||||||
0: .ansi.gray.black
|
|
||||||
1: .ansi.red.regular
|
|
||||||
2: .ansi.green.regular
|
|
||||||
3: .ansi.yellow.regular
|
|
||||||
4: .ansi.blue.regular
|
|
||||||
5: .ansi.magenta.regular
|
|
||||||
6: .ansi.cyan.regular
|
|
||||||
7: .ansi.gray.white
|
|
||||||
8: .ansi.gray.regular
|
|
||||||
9: .ansi.red.bright
|
|
||||||
10: .ansi.green.bright
|
|
||||||
11: .ansi.yellow.bright
|
|
||||||
12: .ansi.blue.bright
|
|
||||||
13: .ansi.magenta.bright
|
|
||||||
14: .ansi.cyan.bright
|
|
||||||
15: .ansi.gray.bright
|
|
||||||
" | utils.yq -r ".$1"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
#####################################################################
|
||||||
|
|
||||||
|
${scwryptsmodule}() {
|
||||||
|
local PARSERS=() DESCRIPTION='
|
||||||
|
provides a literal hex code for the target theme based on
|
||||||
|
the provided lookup key(s)
|
||||||
|
'
|
||||||
|
eval "$(utils.parse.autosetup)"
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
theme.yq() { echo "${theme_yaml}" | utils.yq -r "${@}" | grep -v ^null$; }
|
||||||
|
|
||||||
|
local previously_searched_keys=()
|
||||||
|
|
||||||
|
local lookup_key value
|
||||||
|
for lookup_key in "${yaml_lookup_array[@]}"
|
||||||
|
do
|
||||||
|
while [[ "${previously_searched_keys[(Ie)${lookup_key}]}" -le 1 ]]
|
||||||
|
do
|
||||||
|
value="$(theme.yq "${lookup_key}")"
|
||||||
|
case "${value}" in
|
||||||
|
( .* ) # value resembles another key
|
||||||
|
previously_searched_keys+=("${lookup_key}")
|
||||||
|
lookup_key="${value}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
( * ) break ;;
|
||||||
|
esac
|
||||||
|
value=null
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ "${value}" =~ '^#' ]] && break
|
||||||
|
done
|
||||||
|
|
||||||
|
case "${value}" in
|
||||||
|
( #* ) echo "${value/\#/}" ;;
|
||||||
|
( null | '' ) echo.error "color lookup error for ${(q)yaml_lookup_array[@]}" ;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.locals() {
|
||||||
|
local ARGS=()
|
||||||
|
local theme_name='current active theme'
|
||||||
|
local theme_source
|
||||||
|
local theme_yaml
|
||||||
|
local yaml_lookup_array=()
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse() {
|
||||||
|
local parsed=0
|
||||||
|
|
||||||
|
case "${1}" in
|
||||||
|
( -t | --theme ) parsed=2; theme_name="${2}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return "${parsed}"
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.usage() {
|
||||||
|
USAGE__options+='
|
||||||
|
-t, --theme get the colorscheme value for the indicated theme source
|
||||||
|
-l, --list-themes show available color themes and exit
|
||||||
|
'
|
||||||
|
|
||||||
|
USAGE__args+='
|
||||||
|
$1..$N lookup keys for hex color codes
|
||||||
|
An ordered list of colorscheme lookup terms. The first term is preferred, and
|
||||||
|
subsequent lookup terms are used as fallback.
|
||||||
|
|
||||||
|
Some special terms are allowed (typically for compatibility); however, in
|
||||||
|
general, these should be simple jq-style queries to pull values from the
|
||||||
|
associated colorscheme.yaml file
|
||||||
|
(e.g. .ansi.red.bright)
|
||||||
|
|
||||||
|
Special terms:
|
||||||
|
[0-15] : lookup by ANSI color number
|
||||||
|
compatibility : foreground | background | cursor | selection_foreground | selection_background
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.validate() {
|
||||||
|
local _a
|
||||||
|
for _a in "${ARGS[@]}"
|
||||||
|
do
|
||||||
|
case "${_a}" in
|
||||||
|
# --- ANSI color numbers -------------------
|
||||||
|
( 0 ) yaml_lookup_array+=(.ansi.gray.black) ;;
|
||||||
|
( 1 ) yaml_lookup_array+=(.ansi.red.regular) ;;
|
||||||
|
( 2 ) yaml_lookup_array+=(.ansi.green.regular) ;;
|
||||||
|
( 3 ) yaml_lookup_array+=(.ansi.yellow.regular) ;;
|
||||||
|
( 4 ) yaml_lookup_array+=(.ansi.blue.regular) ;;
|
||||||
|
( 5 ) yaml_lookup_array+=(.ansi.magenta.regular) ;;
|
||||||
|
( 6 ) yaml_lookup_array+=(.ansi.cyan.regular) ;;
|
||||||
|
( 7 ) yaml_lookup_array+=(.ansi.gray.white) ;;
|
||||||
|
( 8 ) yaml_lookup_array+=(.ansi.gray.regular) ;;
|
||||||
|
( 9 ) yaml_lookup_array+=(.ansi.red.bright) ;;
|
||||||
|
( 10 ) yaml_lookup_array+=(.ansi.green.bright) ;;
|
||||||
|
( 11 ) yaml_lookup_array+=(.ansi.yellow.bright) ;;
|
||||||
|
( 12 ) yaml_lookup_array+=(.ansi.blue.bright) ;;
|
||||||
|
( 13 ) yaml_lookup_array+=(.ansi.magenta.bright) ;;
|
||||||
|
( 14 ) yaml_lookup_array+=(.ansi.cyan.bright) ;;
|
||||||
|
( 15 ) yaml_lookup_array+=(.ansi.gray.bright) ;;
|
||||||
|
|
||||||
|
# --- special keys -------------------------
|
||||||
|
( foreground ) yaml_lookup_array+=(.foreground .ansi.gray.black) ;;
|
||||||
|
( selection_foreground ) yaml_lookup_array+=(.selection.foreground .background ) ;;
|
||||||
|
|
||||||
|
( background ) yaml_lookup_array+=(.background .ansi.gray.white) ;;
|
||||||
|
( selection_background ) yaml_lookup_array+=(.selection.background .foreground ) ;;
|
||||||
|
|
||||||
|
( cursor ) yaml_lookup_array+=(.cursor .ansi.gray.white) ;;
|
||||||
|
|
||||||
|
( '' ) ;;
|
||||||
|
|
||||||
|
# --- literal lookup keys ------------------
|
||||||
|
( * ) yaml_lookup_array+=("${_a}") ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
unset _a
|
||||||
|
|
||||||
|
[[ "${#yaml_lookup_array[@]}" -gt 0 ]] \
|
||||||
|
|| echo.error "must provide at least one yaml lookup key"
|
||||||
|
|
||||||
|
case "${theme_name}" in
|
||||||
|
( 'current active theme' )
|
||||||
|
theme_source="$(dotwryn.config colorscheme.active.source)"
|
||||||
|
;;
|
||||||
|
|
||||||
|
( * )
|
||||||
|
theme_source="$(dotwryn.config colorscheme.path)/${theme_name}.yaml"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[[ -f "${theme_source}" ]] \
|
||||||
|
|| echo.error "invalid or missing theme '${theme_name}'" -v theme_source
|
||||||
|
|
||||||
|
theme_yaml="$(
|
||||||
|
for yamlfile in \
|
||||||
|
"$(dotwryn.config colorscheme.active.default-material-references)" \
|
||||||
|
"${theme_source}" \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
[[ "$(head -n1 "${yamlfile}")" =~ ^--- ]] || echo '---'
|
||||||
|
sed 's/---\s*#.*$/---/' "${yamlfile}"
|
||||||
|
done | utils.yq.combine-files
|
||||||
|
)"
|
||||||
|
|
||||||
|
[[ "${theme_yaml}" ]] && [[ "$(echo "${theme_yaml}" | utils.yq -r . 2>/dev/null)" ]] \
|
||||||
|
|| echo.error "yaml theme '${theme_name}' produced invalid yaml"
|
||||||
|
}
|
||||||
@@ -9,6 +9,6 @@ USAGE__description+='
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
MAIN() {
|
MAIN() {
|
||||||
cat "${ACTIVE_THEME_PATH}/name.txt" 2>/dev/null \
|
cat "$(dotwryn.config colorscheme.active.path)/name.txt" 2>/dev/null \
|
||||||
|| ERROR 'theme name not available'
|
|| echo.error 'theme name not available'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,14 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
use desktop/colorscheme --group dotwryn
|
|
||||||
use desktop/xorg/i3 --group dotwryn
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
USAGE__options+="
|
use --group dotwryn desktop/colorscheme
|
||||||
-t, --theme one of the available color themes
|
|
||||||
-l, --list-themes show available color themes and exit
|
|
||||||
|
|
||||||
--only only set the theme for a specific terminal/application
|
|
||||||
(${COLORSCHEME__SUPPORTED_CONFIG_TYPES})
|
|
||||||
"
|
|
||||||
|
|
||||||
USAGE__args+='
|
|
||||||
\$1 shorthand for "--theme \$1"
|
|
||||||
'
|
|
||||||
|
|
||||||
USAGE__description+='
|
|
||||||
Generates source-controlled config files for the selected theme.
|
|
||||||
By default, generates all possible config types to provide a
|
|
||||||
consistent, system-wide theme.
|
|
||||||
|
|
||||||
Due to complexities with i3wm colorscheme management, it is not
|
|
||||||
possible to update i3wm colorscheme files when using the "--only"
|
|
||||||
flag.
|
|
||||||
'
|
|
||||||
|
|
||||||
|
dotwryn.desktop.colorscheme.set-theme.parse.usage
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
MAIN() {
|
MAIN() {
|
||||||
local ARGS=() UPDATE_I3_CONFIG=true
|
#dotwryn.config colorscheme.path
|
||||||
|
#dotwryn.config colorscheme.supported-apps
|
||||||
while [[ $# -gt 0 ]]
|
dotwryn.desktop.colorscheme.set-theme "${@}"
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
--only )
|
|
||||||
ARGS+=($1)
|
|
||||||
UPDATE_I3_CONFIG=false
|
|
||||||
;;
|
|
||||||
|
|
||||||
* ) ARGS+=($1) ;;
|
|
||||||
esac
|
|
||||||
shift 1
|
|
||||||
done
|
|
||||||
|
|
||||||
SET_THEME ${ARGS[@]} \
|
|
||||||
|| ERROR 'failed to set theme (see above)' \
|
|
||||||
|| return 1
|
|
||||||
|
|
||||||
[[ ${UPDATE_I3_CONFIG} =~ true ]] || return 0
|
|
||||||
|
|
||||||
dotwryn.desktop.xorg.i3.generate-config \
|
|
||||||
|| ERROR 'failed to update i3 config (see above)' \
|
|
||||||
|| return 1
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
#####################################################################
|
||||||
|
|
||||||
|
use --group dotwryn desktop/colorscheme/get-hex
|
||||||
|
use --group dotwryn desktop/xorg/i3/set-background
|
||||||
|
|
||||||
|
use --group dotwryn desktop/colorscheme/apps
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES=()
|
||||||
|
dotwryn.config colorscheme.supported-apps DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES
|
||||||
|
|
||||||
|
|
||||||
|
${scwryptsmodule}() {
|
||||||
|
local PARSERS=() DESCRIPTION='
|
||||||
|
generate source-controlled theme files and link them to the
|
||||||
|
appropriate applications
|
||||||
|
'
|
||||||
|
|
||||||
|
eval "$(utils.parse.autosetup)"
|
||||||
|
|
||||||
|
local DEBUG_ARGS=(-v theme_name -v theme_source -v config_types)
|
||||||
|
local TRACE_ARGS=("${DEBUG_ARGS[@]}" -v update_active_theme)
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
local colorscheme_active_path="$(dotwryn.config colorscheme.active.path)"
|
||||||
|
local colorscheme_active_source="$(dotwryn.config colorscheme.active.source)"
|
||||||
|
|
||||||
|
echo.trace 'starting colorscheme update'
|
||||||
|
|
||||||
|
case "${update_active_theme}" in
|
||||||
|
( false ) ;;
|
||||||
|
( true )
|
||||||
|
echo.status "updating active theme" \
|
||||||
|
&& (
|
||||||
|
cd -- "${colorscheme_active_path}"
|
||||||
|
ln -sf -- "../$(basename -- "${theme_source}")" "./$(basename -- "$(dotwryn.config colorscheme.active.source)")"
|
||||||
|
) \
|
||||||
|
&& echo.success "active theme set to '${theme_name}'" \
|
||||||
|
|| echo.error "unable to set active theme to '${theme_name}'" \
|
||||||
|
;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_GET_HEX() { dotwryn.desktop.colorscheme.get-hex --theme "${theme_name}" "${@}"; }
|
||||||
|
|
||||||
|
_GET_HEX . | utils.yq >/dev/null \
|
||||||
|
|| echo.error "error loading colorscheme file; aborting" \
|
||||||
|
|| return 1
|
||||||
|
|
||||||
|
# allow simple ANSI-color reference
|
||||||
|
local \
|
||||||
|
BLACK="$( _GET_HEX .ansi.gray.black )" \
|
||||||
|
BRIGHT_BLACK="$( _GET_HEX .ansi.gray.regular )" \
|
||||||
|
RED="$( _GET_HEX .ansi.red.regular )" \
|
||||||
|
BRIGHT_RED="$( _GET_HEX .ansi.red.bright )" \
|
||||||
|
GREEN="$( _GET_HEX .ansi.green.regular )" \
|
||||||
|
BRIGHT_GREEN="$( _GET_HEX .ansi.green.bright )" \
|
||||||
|
YELLOW="$( _GET_HEX .ansi.yellow.regular )" \
|
||||||
|
BRIGHT_YELLOW="$( _GET_HEX .ansi.yellow.bright )" \
|
||||||
|
BLUE="$( _GET_HEX .ansi.blue.regular )" \
|
||||||
|
BRIGHT_BLUE="$( _GET_HEX .ansi.blue.bright )" \
|
||||||
|
MAGENTA="$( _GET_HEX .ansi.magenta.regular )" \
|
||||||
|
BRIGHT_MAGENTA="$( _GET_HEX .ansi.magenta.bright )" \
|
||||||
|
CYAN="$( _GET_HEX .ansi.cyan.regular )" \
|
||||||
|
BRIGHT_CYAN="$( _GET_HEX .ansi.cyan.bright )" \
|
||||||
|
WHITE="$( _GET_HEX .ansi.gray.white )" \
|
||||||
|
BRIGHT_WHITE="$( _GET_HEX .ansi.gray.bright )" \
|
||||||
|
FOREGROUND="$( _GET_HEX .foreground )" \
|
||||||
|
BACKGROUND="$( _GET_HEX .background )" \
|
||||||
|
CURSOR="$( _GET_HEX .cursor )" \
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
for config_type in "${config_types[@]}"
|
||||||
|
do
|
||||||
|
case "${config_type}" in
|
||||||
|
( i3-background )
|
||||||
|
dotwryn.desktop.xorg.i3.set-background "${theme_name}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
( i3 )
|
||||||
|
dotwryn.desktop.xorg.i3.generate-config \
|
||||||
|
;;
|
||||||
|
|
||||||
|
( * )
|
||||||
|
echo.status "updating ${config_type} theme" \
|
||||||
|
&& "_GENERATE_THEME__${config_type}" \
|
||||||
|
&& "_SET_THEME__${config_type}" \
|
||||||
|
&& echo.success "emulator ${config_type} successfully updated to ${theme_name}" \
|
||||||
|
|| echo.error "error setting theme ${theme_name} for ${config_type}" \
|
||||||
|
;;
|
||||||
|
esac || continue
|
||||||
|
|
||||||
|
# handle special
|
||||||
|
case "${config_type}" in
|
||||||
|
( getty )
|
||||||
|
[[ "${TERM}" == linux ]] || continue
|
||||||
|
echo.status 'loading getty theme now' \
|
||||||
|
&& NO_CLEAR=1 source "${colorscheme_active_path}/getty.sh" \
|
||||||
|
&& echo.success 'getty theme loaded' \
|
||||||
|
|| echo.error 'getty theme loading error (see above)' \
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# --only regenerates one config type; the active theme (and its name) is unchanged
|
||||||
|
[[ "${ERRORS}" -eq 0 ]] && [[ "${update_active_theme}" =~ true ]] \
|
||||||
|
&& echo "${theme_name}" > "${colorscheme_active_path}/name.txt"
|
||||||
|
|
||||||
|
return "${ERRORS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.locals() {
|
||||||
|
local ARGS=()
|
||||||
|
local theme_name theme_source
|
||||||
|
local update_active_theme=true
|
||||||
|
local config_type config_types=()
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse() {
|
||||||
|
local parsed=0
|
||||||
|
|
||||||
|
case "${1}" in
|
||||||
|
( -t | --theme ) parsed=2
|
||||||
|
theme_name="${2}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
( -l | --list-themes ) parsed=1
|
||||||
|
dotwryn.config colorscheme.themes
|
||||||
|
EARLY_ESCAPE_CODE=-1
|
||||||
|
;;
|
||||||
|
|
||||||
|
( --only ) parsed=2
|
||||||
|
update_active_theme=false
|
||||||
|
config_type="${2}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return "${parsed}"
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.usage() {
|
||||||
|
[[ "${#DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES[@]}" -eq 0 ]] \
|
||||||
|
|
||||||
|
USAGE__options+="
|
||||||
|
-t, --theme one of the available color themes
|
||||||
|
-l, --list-themes show available color themes and exit
|
||||||
|
|
||||||
|
--only only set the theme for a specific terminal/application
|
||||||
|
(${DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES[@]})
|
||||||
|
"
|
||||||
|
|
||||||
|
USAGE__args+='
|
||||||
|
$1 theme name (can be used instead of -t / --theme)
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
${scwryptsmodule}.parse.validate() {
|
||||||
|
[[ "${theme_name}" ]] && [[ "${ARGS[1]}" ]] \
|
||||||
|
&& echo.error "unknown argument '${ARGS[1]}'"
|
||||||
|
|
||||||
|
[[ "${theme_name}" ]] || theme_name="${ARGS[1]}"
|
||||||
|
[[ "${theme_name}" ]] || theme_name="$(dotwryn.config colorscheme.themes | utils.fzf 'select a theme')"
|
||||||
|
[[ "${theme_name}" ]] \
|
||||||
|
|| echo.error 'must provide theme name'
|
||||||
|
|
||||||
|
theme_source="$(dotwryn.config colorscheme.path)/${theme_name}.yaml"
|
||||||
|
[[ -f "${theme_source}" ]] \
|
||||||
|
|| echo.error "no such theme '${theme_name}'"
|
||||||
|
|
||||||
|
[[ "${#ARGS[@]}" -le 1 ]] \
|
||||||
|
|| echo.error "unknown argument(s) ${(q)ARGS[@]:1}"
|
||||||
|
|
||||||
|
case "${config_type}" in
|
||||||
|
( '' ) config_types=("${DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES[@]}") ;;
|
||||||
|
( * )
|
||||||
|
[[ "$(zsh.is-in-array DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES "${config_type}")" ]] \
|
||||||
|
|| echo.error "invalid config type '${config_type}' (supported: ${(q)DOTWRYN_COLORSCHEME__SUPPORTED_CONFIG_TYPES[@]})"
|
||||||
|
|
||||||
|
config_types=("${config_type}")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user