Add mime type module and refactor options

This commit is contained in:
DashieTM 2024-09-09 23:11:36 +02:00
parent 3a2266d44f
commit 69fb898087
25 changed files with 641 additions and 478 deletions

View file

@ -16,7 +16,7 @@
type = lib.types.bool;
description = "Enables anyrun";
};
use_default_config = lib.mkOption {
useDefaultConfig = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
@ -24,7 +24,7 @@
Use preconfigured anyrun config.
'';
};
custom_config = lib.mkOption {
customConfig = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
@ -33,7 +33,7 @@
Will be merged with default configuration if enabled.
'';
};
use_default_css = lib.mkOption {
useDefaultCss = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
@ -41,7 +41,7 @@
Use preconfigured anyrun css.
'';
};
custom_css = lib.mkOption {
customCss = lib.mkOption {
default = '''';
example = ''
#window {
@ -63,7 +63,7 @@
programs.anyrun = {
enable = true;
config =
if config.mods.hyprland.anyrun.use_default_config then
if config.mods.hyprland.anyrun.useDefaultConfig then
{
plugins = [
inputs.anyrun.packages.${pkgs.system}.applications
@ -83,12 +83,12 @@
hidePluginInfo = true;
closeOnClick = true;
}
// config.mods.hyprland.anyrun.custom_config
// config.mods.hyprland.anyrun.customConfig
else
config.mods.hyprland.anyrun.custom_config;
config.mods.hyprland.anyrun.customConfig;
extraCss =
if config.mods.hyprland.anyrun.use_default_css then
if config.mods.hyprland.anyrun.useDefaultCss then
''
#window {
border-radius: 10px;
@ -137,9 +137,9 @@
border-radius: 10px;
}
''
+ config.mods.hyprland.anyrun.custom_css
+ config.mods.hyprland.anyrun.customCss
else
config.mods.hyprland.anyrun.custom_css;
config.mods.hyprland.anyrun.customCss;
};
}
);

View file

@ -37,7 +37,7 @@
The workspace configuration for hyprland.
'';
};
no_atomic = lib.mkOption {
noAtomic = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
@ -45,7 +45,7 @@
Use tearing
'';
};
extra_autostart = lib.mkOption {
extraAutostart = lib.mkOption {
default = [ ];
example = [ "your application" ];
type = lib.types.listOf lib.types.str;
@ -53,7 +53,7 @@
Extra exec_once.
'';
};
use_default_config = lib.mkOption {
useDefaultConfig = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
@ -61,7 +61,7 @@
Use preconfigured Hyprland config.
'';
};
custom_config = lib.mkOption {
customConfig = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
@ -100,7 +100,7 @@
wayland.windowManager.hyprland = {
enable = true;
settings =
if config.mods.hyprland.use_default_config then
if config.mods.hyprland.useDefaultConfig then
{
"$mod" = "SUPER";
@ -131,14 +131,14 @@
"$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate"
# media keys
(lib.mkIf config.mods.scripts.audio-control ",XF86AudioMute,exec, audio-control mute")
(lib.mkIf config.mods.scripts.audio-control ",XF86AudioLowerVolume,exec, audio-control sink -5%")
(lib.mkIf config.mods.scripts.audio-control ",XF86AudioRaiseVolume,exec, audio-control sink +5%")
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audio-control mute")
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audio-control sink -5%")
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audio-control sink +5%")
",XF86AudioPlay,exec, playerctl play-pause"
",XF86AudioNext,exec, playerctl next"
",XF86AudioPrev,exec, playerctl previous"
(lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-")
(lib.mkIf config.mods.scripts.change-brightness ",XF86MonBrightnessUp,exec, change-brightness brightness +10%")
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-")
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, change-brightness brightness +10%")
# hyprland keybinds
# misc
@ -219,7 +219,7 @@
border_size = 3;
"col.active_border" = lib.mkOverride 51 "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg";
# "col.inactive_border" = "0x66333333";
allow_tearing = lib.mkIf config.mods.hyprland.no_atomic true;
allow_tearing = lib.mkIf config.mods.hyprland.noAtomic true;
};
decoration = {
@ -297,7 +297,7 @@
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
"QT_SCALE_FACTOR,1"
''EDITOR,"neovide --novsync --nofork"''
(lib.mkIf config.mods.hyprland.no_atomic "WLR_DRM_NO_ATOMIC,1")
(lib.mkIf config.mods.hyprland.noAtomic "WLR_DRM_NO_ATOMIC,1")
"GTK_USE_PORTAL, 1"
(lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia")
@ -349,7 +349,7 @@
# should be taken care of with the new systemd services
# "nextcloud --background"
"oxinoti"
] ++ config.mods.hyprland.extra_autostart;
] ++ config.mods.hyprland.extraAutostart;
# plugin = {
# hyprspace = {
@ -359,9 +359,9 @@
# };
# };
}
// config.mods.hyprland.custom_config
// config.mods.hyprland.customConfig
else
lib.mkForce config.mods.hyprland.custom_config;
lib.mkForce config.mods.hyprland.customConfig;
plugins = config.mods.hyprland.plugins;
#inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
};

View file

@ -1,7 +1,6 @@
{
lib,
config,
pkgs,
options,
...
}:
@ -17,262 +16,309 @@ in
type = lib.types.bool;
description = "Enables ironbar";
};
useDefaultConfig = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use preconfigured ironbar config.
'';
};
customConfig = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
description = ''
Custom ironbar configuration.
Will be merged with default configuration if enabled.
'';
};
useDefaultCss = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use preconfigured ironbar css.
'';
};
customCss = lib.mkOption {
default = '''';
example = ''
#window {
border-radius: none;
}
'';
type = lib.types.lines;
description = ''
Custom ironbar css.
Will be merged with default css if enabled.
'';
};
};
};
config = lib.mkIf config.mods.hyprland.ironbar.enable (
lib.optionalAttrs (options ? programs.ironbar) {
programs.ironbar = {
enable = true;
style = ''
@import url("/home/${username}/.config/gtk-3.0/gtk.css");
style =
if config.mods.hyprland.ironbar.useDefaultCss then
''
@import url("/home/${username}/.config/gtk-3.0/gtk.css");
* {
color: #71bbe6;
padding: 0px;
margin: 0px;
}
* {
color: #71bbe6;
padding: 0px;
margin: 0px;
}
.background {
background-color: rgba(0, 0, 0, 0);
}
.background {
background-color: rgba(0, 0, 0, 0);
}
.workspaces {
margin: 2px 0px 0px 5px;
border-radius: 10px;
/* background-color: #2b2c3b; */
background-color: #1E1E2E;
padding: 2px 5px 2px 5px;
}
.workspaces {
margin: 2px 0px 0px 5px;
border-radius: 10px;
/* background-color: #2b2c3b; */
background-color: #1E1E2E;
padding: 2px 5px 2px 5px;
}
.workspaces .item {
margin: 0px 3px 0px 3px;
font-size: 13px;
border-radius: 100%;
padding: 0px 2px 0px 3px;
background-color: rgba(0, 0, 0, 0);
}
.workspaces .item {
margin: 0px 3px 0px 3px;
font-size: 13px;
border-radius: 100%;
padding: 0px 2px 0px 3px;
background-color: rgba(0, 0, 0, 0);
}
.workspaces .item:hover {
background-color: #3e4152;
}
.workspaces .item:hover {
background-color: #3e4152;
}
.workspaces .item.focused {
background-color: #3e4152;
}
.workspaces .item.focused {
background-color: #3e4152;
}
.audio-box {
padding: 2em;
background-color: #1E1E2E;
border-radius: 5px;
}
.audio-box {
padding: 2em;
background-color: #1E1E2E;
border-radius: 5px;
}
.audio-slider {
padding: 5px;
margin: 5px;
}
.audio-slider {
padding: 5px;
margin: 5px;
}
.audio-button {
padding: 5px 10px 5px 10px;
margin: 0px 1em 20px 1em;
border-radius: 100%;
font-size: 17px;
}
.audio-button {
padding: 5px 10px 5px 10px;
margin: 0px 1em 20px 1em;
border-radius: 100%;
font-size: 17px;
}
.audio-button-box {
padding: 0px 2.5em 0px 2.5em;
}
.audio-button-box {
padding: 0px 2.5em 0px 2.5em;
}
.focused {
/* margin: 2px 0px 0px 0px; */
padding: 0px 5px 0px 5px;
/* background-color: 1a1b26; */
background-color: #1E1E2E;
font-size: 17px;
border-radius: 10px;
}
.focused {
/* margin: 2px 0px 0px 0px; */
padding: 0px 5px 0px 5px;
/* background-color: 1a1b26; */
background-color: #1E1E2E;
font-size: 17px;
border-radius: 10px;
}
#bar #end {
margin: 0px 5px 0px 0px;
padding: 0px 5px 0px 5px;
background-color: #1E1E2E;
border-radius: 10px;
}
#bar #end {
margin: 0px 5px 0px 0px;
padding: 0px 5px 0px 5px;
background-color: #1E1E2E;
border-radius: 10px;
}
.popup-button {
padding: 0px 5px 0px 3px;
margin: 0em 3px;
border-radius: 100%;
font-size: 13px;
background-color: #1E1E2E;
}
.popup-button {
padding: 0px 5px 0px 3px;
margin: 0em 3px;
border-radius: 100%;
font-size: 13px;
background-color: #1E1E2E;
}
.popup-button-box {
padding: 2px 0px 2px 0px;
}
.popup-button-box {
padding: 2px 0px 2px 0px;
}
.clock {
padding: 0px 5px 0px 5px;
font-size: 17px;
background-color: #1E1E2E;
}
.clock {
padding: 0px 5px 0px 5px;
font-size: 17px;
background-color: #1E1E2E;
}
.clock:hover {
background-color: #3e4152;
}
.clock:hover {
background-color: #3e4152;
}
.custom button {
background-color: #1E1E2E;
}
.custom button {
background-color: #1E1E2E;
}
.custom button:hover {
background-color: #3e4152;
}
.custom button:hover {
background-color: #3e4152;
}
.memory-usage {
font-size: 15px;
margin: 0px 5px 0px 0px;
}
.memory-usage {
font-size: 15px;
margin: 0px 5px 0px 0px;
}
.memory-usage:hover {
background-color: #3e4152;
}
.memory-usage:hover {
background-color: #3e4152;
}
.popup-clock {
background-color: #1E1E2E;
border-radius: 5px;
padding: 2px 8px 10px 8px;
}
.popup-clock {
background-color: #1E1E2E;
border-radius: 5px;
padding: 2px 8px 10px 8px;
}
.popup-clock .calendar-clock {
font-size: 2.5em;
padding-bottom: 0.1em;
}
.popup-clock .calendar-clock {
font-size: 2.5em;
padding-bottom: 0.1em;
}
.popup-clock .calendar {
border-radius: 5px;
font-size: 1.05em;
}
.popup-clock .calendar {
border-radius: 5px;
font-size: 1.05em;
}
.popup-clock .calendar:selected {
background-color: #3e4152;
}
'';
.popup-clock .calendar:selected {
background-color: #3e4152;
}
''
+ config.mods.hyprland.ironbar.customCss
else
config.mods.hyprland.ironbar.customCss;
features = [
#"another_feature"
];
config = {
monitors."${config.conf.defaultMonitor}" = {
end = config.conf.ironbar.modules ++ [
monitors."${config.conf.defaultMonitor}" =
if config.mods.hyprland.ironbar.useDefaultConfig then
{
type = "sys_info";
format = [ " {memory_percent}" ];
interval.memory = 30;
class = "memory-usage";
}
{
type = "custom";
bar = [
end = config.conf.ironbar.modules ++ [
{
type = "button";
class = "popup-button";
label = "";
on_click = "popup:toggle";
type = "sys_info";
format = [ " {memory_percent}" ];
interval.memory = 30;
class = "memory-usage";
}
];
class = "popup-button-box";
popup = [
{
type = "box";
orientation = "vertical";
class = "audio-box";
widgets = [
type = "custom";
bar = [
{
type = "button";
class = "popup-button";
label = "";
on_click = "popup:toggle";
}
];
class = "popup-button-box";
popup = [
{
type = "box";
orientation = "horizontal";
orientation = "vertical";
class = "audio-box";
widgets = [
{
type = "button";
class = "audio-button";
label = "";
on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh bluetooth";
type = "box";
orientation = "horizontal";
widgets = [
{
type = "button";
class = "audio-button";
label = "";
on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh bluetooth";
}
{
type = "button";
class = "audio-button";
label = "󰋋";
on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh internal";
}
];
class = "audio-button-box";
}
{
type = "button";
class = "audio-button";
label = "󰋋";
on_click = "!/home/${username}/.config/eww/scripts/audio_control.sh internal";
type = "label";
label = "Output";
}
{
type = "slider";
class = "audio-slider";
step = 1.0;
length = 200;
value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'";
on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%";
}
{
type = "label";
label = "Input";
}
{
type = "slider";
class = "audio-slider";
step = 1.0;
length = 200;
value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'";
on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%";
}
];
class = "audio-button-box";
}
{
type = "label";
label = "Output";
}
{
type = "slider";
class = "audio-slider";
step = 1.0;
length = 200;
value = "pactl get-sink-volume @DEFAULT_SINK@ | awk -F'/' '{ print $2 }' | tr -d ' %'";
on_change = "!pactl set-sink-volume @DEFAULT_SINK@ $0%";
}
{
type = "label";
label = "Input";
}
{
type = "slider";
class = "audio-slider";
step = 1.0;
length = 200;
value = "pactl get-source-volume @DEFAULT_SOURCE@ | awk -F'/' '{ print $2 }' | tr -d ' %'";
on_change = "!pactl set-source-volume @DEFAULT_SOURCE@ $0%";
}
];
}
];
}
{
type = "custom";
bar = [
{
type = "button";
class = "popup-button";
label = "";
on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css";
type = "custom";
bar = [
{
type = "button";
class = "popup-button";
label = "";
on_click = "!oxidash --css /home/${username}/gits/oxidash/style.css";
}
];
class = "popup-button-box";
}
{
type = "clock";
format = "%I:%M";
format_popup = "%I:%M:%S";
locale = "en_US";
}
{ type = "tray"; }
];
position = "top";
height = 10;
anchor_to_edges = true;
start = [
{
type = "workspaces";
all_monitors = true;
}
];
center = [
{
type = "focused";
show_icon = true;
show_title = true;
icon_size = 20;
truncate = "end";
}
];
class = "popup-button-box";
}
{
type = "clock";
format = "%I:%M";
format_popup = "%I:%M:%S";
locale = "en_US";
}
{ type = "tray"; }
];
position = "top";
height = 10;
anchor_to_edges = true;
start = [
{
type = "workspaces";
all_monitors = true;
}
];
center = [
{
type = "focused";
show_icon = true;
show_title = true;
icon_size = 20;
truncate = "end";
}
];
};
// config.mods.hyprland.ironbar.customConfig
else
config.mods.hyprland.ironbar.customConfig;
};
};
}