mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-07-06 16:12:33 +02:00
there is now osd in waybar
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -126,7 +126,7 @@ in {
|
||||
# Quick launch
|
||||
"$mod,RETURN, exec, uwsm app -- ${pkgs.ghostty}/bin/ghostty" # Ghostty (terminal)
|
||||
"$mod,E, exec, uwsm app -- ${pkgs-stable.thunar}/bin/thunar" # Thunar
|
||||
"$mod, SPACE, exec, rofi -show drun" # Launcher
|
||||
"$mod, SPACE, exec, tofi-drun" # Launcher
|
||||
"$mod, N, exec, swaync-client -t" # Notification center
|
||||
|
||||
# Windows
|
||||
@@ -168,8 +168,8 @@ in {
|
||||
|
||||
bindl = [
|
||||
# Brightness
|
||||
", XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
|
||||
", XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
|
||||
", XF86MonBrightnessUp, exec, bright-up"
|
||||
", XF86MonBrightnessDown, exec, bright-down"
|
||||
|
||||
# Media
|
||||
", XF86AudioPlay, exec, playerctl play-pause"
|
||||
@@ -179,10 +179,10 @@ in {
|
||||
", XF86AudioStop, exec, playerctl stop"
|
||||
|
||||
# Sound
|
||||
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
|
||||
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise"
|
||||
", XF86AudioLowerVolume, exec, swayosd-client --output-volume lower"
|
||||
", XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle"
|
||||
", XF86AudioMute, exec, vol-mute"
|
||||
", XF86AudioRaiseVolume, exec, vol-up"
|
||||
", XF86AudioLowerVolume, exec, vol-down"
|
||||
", XF86AudioMicMute, exec, mic-mute"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
{ config, pkgs, ... }: let
|
||||
c = config.lib.stylix.colors;
|
||||
font = config.stylix.fonts.sansSerif.name;
|
||||
fontSize = toString config.stylix.fonts.sizes.applications;
|
||||
gaps = toString config.theme.gaps-out;
|
||||
theme = pkgs.writeText "launcher.rasi" ''
|
||||
configuration {
|
||||
modi: "drun,run";
|
||||
case-sensitive: false;
|
||||
cycle: true;
|
||||
normalize-match: true;
|
||||
show-icons: false;
|
||||
matching: "normal";
|
||||
tokenize: true;
|
||||
kb-cancel: "Escape,MousePrimary";
|
||||
drun-match-fields: "name,exec,generic,comment";
|
||||
drun-display-format: "{name}";
|
||||
drun-url-launcher: "xdg-open";
|
||||
drun-show-actions: false;
|
||||
disable-history: false;
|
||||
sorting-method: "normal";
|
||||
terminal: "ghostty";
|
||||
hover-select: true;
|
||||
me-select-entry: "";
|
||||
me-accept-entry: [ "MousePrimary" ];
|
||||
}
|
||||
|
||||
* {
|
||||
background: transparent;
|
||||
background-alt: #${c.base01}ff;
|
||||
foreground: #${c.base05}ff;
|
||||
active: #${c.base0D}ff;
|
||||
inactive: #${c.base03}ff;
|
||||
selected-fg: #${c.base00}ff;
|
||||
font: "${font}, Bold ${fontSize}";
|
||||
}
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
location: north;
|
||||
anchor: north;
|
||||
padding: ${gaps}px ${gaps}px 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
background-color: transparent;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
orientation: horizontal;
|
||||
spacing: 0;
|
||||
padding: 6px 14px;
|
||||
border-radius: 100px;
|
||||
background-color: @background-alt;
|
||||
children: [ "inputbar", "listview" ];
|
||||
}
|
||||
|
||||
inputbar {
|
||||
expand: false;
|
||||
spacing: 8px;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
color: @foreground;
|
||||
children: [ "prompt", "entry" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
background-color: transparent;
|
||||
color: @active;
|
||||
padding: 0 2px 0 0;
|
||||
vertical-align: 0.5;
|
||||
}
|
||||
|
||||
entry {
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
placeholder-color: @inactive;
|
||||
placeholder: "Search...";
|
||||
vertical-align: 0.5;
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
listview {
|
||||
layout: horizontal;
|
||||
lines: 1;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
spacing: 0;
|
||||
padding: 0 0 0 14px;
|
||||
background-color: transparent;
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0;
|
||||
padding: 2px 10px;
|
||||
border-radius: 100px;
|
||||
background-color: transparent;
|
||||
color: @foreground;
|
||||
cursor: pointer;
|
||||
children: [ "element-text" ];
|
||||
}
|
||||
|
||||
element selected.normal {
|
||||
background-color: @active;
|
||||
color: @selected-fg;
|
||||
}
|
||||
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
vertical-align: 0.5;
|
||||
}
|
||||
|
||||
message {
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border-radius: 100px;
|
||||
background-color: @background-alt;
|
||||
color: @foreground;
|
||||
}
|
||||
'';
|
||||
in {
|
||||
stylix.targets.rofi.enable = false;
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
theme = "${theme}";
|
||||
};
|
||||
}
|
||||
@@ -21,6 +21,9 @@ in {
|
||||
positionY = "top";
|
||||
cssPriority = "user";
|
||||
"control-center-width" = 450;
|
||||
"control-center-margin-top" = 0;
|
||||
"control-center-margin-bottom" = 0;
|
||||
"control-center-margin-right" = 0;
|
||||
"fit-to-screen" = true;
|
||||
"notification-window-width" = 400;
|
||||
"notification-icon-size" = 40;
|
||||
@@ -189,9 +192,9 @@ in {
|
||||
|
||||
.control-center {
|
||||
background: @center-bg;
|
||||
border-radius: var(--border-radius);
|
||||
border: ${toString border-size}px solid @selected;
|
||||
margin: 5px;
|
||||
border-radius: 0 0 0 var(--border-radius);
|
||||
border-left: ${toString border-size}px solid @selected;
|
||||
margin: 0;
|
||||
padding: 5px 5px 0 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
'';
|
||||
in {
|
||||
services.swayosd = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
stylePath = style;
|
||||
topMargin = 0.5;
|
||||
topMargin = 0.06;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
c = config.lib.stylix.colors;
|
||||
font = config.stylix.fonts.serif.name;
|
||||
gaps = config.theme.gaps-out;
|
||||
barHeight = config.theme.bar-height;
|
||||
rounding =
|
||||
if config.theme.rounding > barHeight / 2
|
||||
then barHeight / 2
|
||||
else config.theme.rounding;
|
||||
in {
|
||||
programs.tofi = {
|
||||
enable = true;
|
||||
settings = {
|
||||
anchor = "top";
|
||||
height = barHeight;
|
||||
margin-top = gaps;
|
||||
margin-left = 350;
|
||||
margin-right = 350;
|
||||
|
||||
horizontal = true;
|
||||
num-results = 8;
|
||||
result-spacing = 20;
|
||||
padding-top = 2;
|
||||
padding-bottom = 2;
|
||||
padding-left = 14;
|
||||
padding-right = 14;
|
||||
|
||||
font = lib.mkForce font;
|
||||
prompt-color = lib.mkForce "#${c.base0D}ff";
|
||||
|
||||
outline-width = 0;
|
||||
border-width = 0;
|
||||
corner-radius = rounding;
|
||||
|
||||
prompt-text = " ";
|
||||
placeholder-text = "Search...";
|
||||
|
||||
drun-launch = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -15,6 +15,79 @@
|
||||
done
|
||||
printf '{"text": "", "class": "disconnected", "tooltip": "Disconnected"}\n'
|
||||
'';
|
||||
|
||||
updateOsd = ''
|
||||
[ -f /tmp/waybar-osd-pid ] && kill "$(cat /tmp/waybar-osd-pid)" 2>/dev/null
|
||||
printf '%s' "$OSD_TEXT" > /tmp/waybar-osd
|
||||
pkill -RTMIN+8 waybar 2>/dev/null
|
||||
( sleep 2.5; rm -f /tmp/waybar-osd /tmp/waybar-osd-pid; pkill -RTMIN+8 waybar 2>/dev/null ) &
|
||||
printf '%s' "$!" > /tmp/waybar-osd-pid
|
||||
'';
|
||||
|
||||
volGetText = ''
|
||||
VOL_RAW=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_SINK@)
|
||||
VOL=$(printf '%s' "$VOL_RAW" | awk '{printf "%d", $2*100}')
|
||||
if printf '%s' "$VOL_RAW" | grep -q MUTED; then
|
||||
OSD_TEXT=" $VOL%"
|
||||
elif [ "$VOL" -lt 33 ]; then
|
||||
OSD_TEXT=" $VOL%"
|
||||
elif [ "$VOL" -lt 66 ]; then
|
||||
OSD_TEXT=" $VOL%"
|
||||
else
|
||||
OSD_TEXT=" $VOL%"
|
||||
fi
|
||||
'';
|
||||
|
||||
brightGetText = ''
|
||||
BRIGHT=$(${pkgs.brightnessctl}/bin/brightnessctl -m | awk -F, '{print int($5)}')
|
||||
if [ "$BRIGHT" -lt 33 ]; then
|
||||
OSD_TEXT=" $BRIGHT%"
|
||||
elif [ "$BRIGHT" -lt 66 ]; then
|
||||
OSD_TEXT=" $BRIGHT%"
|
||||
else
|
||||
OSD_TEXT=" $BRIGHT%"
|
||||
fi
|
||||
'';
|
||||
|
||||
vol-up = pkgs.writeShellScriptBin "vol-up" ''
|
||||
${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 5%+ --limit 1.0
|
||||
${volGetText}
|
||||
${updateOsd}
|
||||
'';
|
||||
|
||||
vol-down = pkgs.writeShellScriptBin "vol-down" ''
|
||||
${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 5%-
|
||||
${volGetText}
|
||||
${updateOsd}
|
||||
'';
|
||||
|
||||
vol-mute = pkgs.writeShellScriptBin "vol-mute" ''
|
||||
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_SINK@ toggle
|
||||
${volGetText}
|
||||
${updateOsd}
|
||||
'';
|
||||
|
||||
mic-mute = pkgs.writeShellScriptBin "mic-mute" ''
|
||||
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_SOURCE@ toggle
|
||||
if ${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_SOURCE@ | grep -q MUTED; then
|
||||
OSD_TEXT=" Muted"
|
||||
else
|
||||
OSD_TEXT=" Live"
|
||||
fi
|
||||
${updateOsd}
|
||||
'';
|
||||
|
||||
bright-up = pkgs.writeShellScriptBin "bright-up" ''
|
||||
${pkgs.brightnessctl}/bin/brightnessctl set 5%+
|
||||
${brightGetText}
|
||||
${updateOsd}
|
||||
'';
|
||||
|
||||
bright-down = pkgs.writeShellScriptBin "bright-down" ''
|
||||
${pkgs.brightnessctl}/bin/brightnessctl set 5%-
|
||||
${brightGetText}
|
||||
${updateOsd}
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
./settings.nix
|
||||
@@ -31,7 +104,7 @@ in {
|
||||
pavucontrol
|
||||
blueman
|
||||
iw
|
||||
];
|
||||
] ++ [vol-up vol-down vol-mute mic-mute bright-up bright-down];
|
||||
|
||||
wayland.windowManager.hyprland.settings.exec-once = [
|
||||
"waybar"
|
||||
|
||||
@@ -6,9 +6,9 @@ in {
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 25;
|
||||
height = config.theme.bar-height;
|
||||
margin = "${toString gaps-out} ${toString gaps-out} 0";
|
||||
modules-center = ["clock" "tray" "hyprland/workspaces" "custom/network" "bluetooth" "battery" "group/right-hidden"];
|
||||
modules-center = ["custom/osd" "clock" "tray" "hyprland/workspaces" "custom/network" "bluetooth" "battery" "group/right-hidden"];
|
||||
|
||||
"group/right-hidden" = {
|
||||
orientation = "horizontal";
|
||||
@@ -92,13 +92,21 @@ in {
|
||||
on-click-right = "blueman-manager &";
|
||||
};
|
||||
|
||||
"custom/osd" = {
|
||||
exec = "cat /tmp/waybar-osd";
|
||||
exec-if = "test -f /tmp/waybar-osd";
|
||||
signal = 8;
|
||||
interval = "once";
|
||||
format = "{}";
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon}";
|
||||
format-bluetooth = "{icon}";
|
||||
tooltip-format = "{volume}%";
|
||||
format-muted = "<span size='12pt'></span>";
|
||||
scroll-step = 2;
|
||||
on-click = "swayosd-client --output-volume mute-toggle";
|
||||
on-click = "vol-mute";
|
||||
on-click-right = "pavucontrol -t 4 &";
|
||||
format-icons = {
|
||||
headphone = "";
|
||||
|
||||
@@ -36,7 +36,7 @@ in {
|
||||
background: ${module-bg};
|
||||
border-radius: 100px;
|
||||
padding: 6px 14px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#clock,
|
||||
@@ -201,5 +201,11 @@ in {
|
||||
background-color: ${fg};
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
#custom-osd {
|
||||
padding: 1px 14px;
|
||||
font-weight: 700;
|
||||
color: ${fg};
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
../../home/system/waybar
|
||||
../../home/system/swaync
|
||||
../../home/system/swayosd
|
||||
../../home/system/rofi
|
||||
../../home/system/tofi
|
||||
../../home/system/mime
|
||||
../../home/system/udiskie
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
type = lib.types.attrs;
|
||||
default = {
|
||||
rounding = 20;
|
||||
bar-height = 36;
|
||||
bar-rounding = 20 + 10;
|
||||
bar-thickness = 0;
|
||||
gaps-in = 8;
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
- [ ] Configuration sway-nc
|
||||
- [ ] Configuration sway-osd
|
||||
- [ ] Configuration hyprlock
|
||||
- [ ] Gaming/Focus mode
|
||||
- [x] Gaming/Focus mode
|
||||
- [ ] Configuration Rofi/Drun
|
||||
- [ ] Helium plus rapide ? service/deamon ?
|
||||
- [ ] Ghostty service/deamon ?
|
||||
- [ ] Tofi service/deamon ?
|
||||
- [ ] Clean files
|
||||
- [ ] Check claude: Sécu, mots en français, faute, ...
|
||||
|
||||
Reference in New Issue
Block a user