Added swaync and some notifications
This commit is contained in:
79
config/grapheio/scripts/volume.sh
Executable file
79
config/grapheio/scripts/volume.sh
Executable file
@@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
# - amixer
|
||||||
|
# - pactl
|
||||||
|
# - jq
|
||||||
|
# - libnotify
|
||||||
|
|
||||||
|
ACTION=$1
|
||||||
|
|
||||||
|
get_volume_info() {
|
||||||
|
amixer sget Master | \
|
||||||
|
grep 'Left:' | \
|
||||||
|
sed -e 's/[^[]*\[\([0-9]*\)%\][^[]\[\(\w*\)\]/{"volume": \1, "muted": \2}/' \
|
||||||
|
-e 's/on/false/' \
|
||||||
|
-e 's/off/true/'
|
||||||
|
}
|
||||||
|
|
||||||
|
notify() {
|
||||||
|
notify-send "$1" "$2" -e -t 1500 -h string:x-canonical-private-synchronous:volume
|
||||||
|
}
|
||||||
|
|
||||||
|
mute() {
|
||||||
|
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||||
|
|
||||||
|
VOLUME_INFO=$(get_volume_info)
|
||||||
|
VOLUME=$(echo $VOLUME_INFO | jq .volume)
|
||||||
|
if [ $(echo $VOLUME_INFO | jq .muted) == "true" ]
|
||||||
|
then
|
||||||
|
AUDIO_ICON=""
|
||||||
|
MUTED_STR="Muted"
|
||||||
|
BODY=""
|
||||||
|
else
|
||||||
|
AUDIO_ICON=""
|
||||||
|
MUTED_STR="Unmuted"
|
||||||
|
BODY=$(echo "$VOLUME%")
|
||||||
|
fi
|
||||||
|
|
||||||
|
TITLE=$(echo "$AUDIO_ICON $MUTED_STR")
|
||||||
|
notify "$TITLE" "$BODY"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_volume() {
|
||||||
|
# Set the volume
|
||||||
|
TARGET=$1
|
||||||
|
pactl set-sink-volume @DEFAULT_SINK@ $TARGET
|
||||||
|
|
||||||
|
# Send a notification
|
||||||
|
VOLUME_INFO=$(get_volume_info)
|
||||||
|
ACTION=$([[ ${TARGET:0:1} == "+" ]] && echo "Volume Up" || echo "Volume Down")
|
||||||
|
VOLUME=$(echo $VOLUME_INFO | jq .volume)
|
||||||
|
|
||||||
|
if [ $(echo $VOLUME_INFO | jq .muted) == "true" ]
|
||||||
|
then
|
||||||
|
AUDIO_ICON=""
|
||||||
|
MUTED_STR="[muted]"
|
||||||
|
else
|
||||||
|
AUDIO_ICON=""
|
||||||
|
MUTED_STR=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
TITLE=$(echo "$AUDIO_ICON $ACTION")
|
||||||
|
BODY=$(echo "$VOLUME% $MUTED_STR")
|
||||||
|
notify "$TITLE" "$BODY"
|
||||||
|
}
|
||||||
|
|
||||||
|
case $ACTION in
|
||||||
|
mute)
|
||||||
|
mute
|
||||||
|
;;
|
||||||
|
set)
|
||||||
|
set_volume $2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown action"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.samfelag.modules.desktop.grapheio;
|
cfg = config.samfelag.modules.desktop.grapheio;
|
||||||
|
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.samfelag.modules.desktop.grapheio = {
|
options.samfelag.modules.desktop.grapheio = {
|
||||||
@@ -14,11 +15,19 @@ in
|
|||||||
# - Packages ---------------------------------
|
# - Packages ---------------------------------
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
# - Tools ----------------------------------
|
||||||
|
jq
|
||||||
# - Appearance -----------------------------
|
# - Appearance -----------------------------
|
||||||
|
rose-pine-gtk-theme
|
||||||
|
rose-pine-icon-theme
|
||||||
# - Cursor
|
# - Cursor
|
||||||
inputs.hyprcursor-rose-pine.packages.${pkgs.system}.default
|
inputs.hyprcursor-rose-pine.packages.${pkgs.system}.default
|
||||||
|
rose-pine-cursor
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# - Data files -------------------------------
|
||||||
|
hm.xdg.configFile."grapheio".source = ../../config/grapheio;
|
||||||
|
|
||||||
# - Cursor -----------------------------------
|
# - Cursor -----------------------------------
|
||||||
hm.home.pointerCursor = {
|
hm.home.pointerCursor = {
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
@@ -29,12 +38,42 @@ in
|
|||||||
|
|
||||||
hm.gtk = {
|
hm.gtk = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
theme = {
|
||||||
|
package = pkgs.rose-pine-gtk-theme;
|
||||||
|
name = "rose-pine-gtk-theme";
|
||||||
|
};
|
||||||
|
iconTheme = {
|
||||||
|
package = pkgs.rose-pine-icon-theme;
|
||||||
|
name = "rose-pine-icons";
|
||||||
|
};
|
||||||
cursorTheme = {
|
cursorTheme = {
|
||||||
package = pkgs.rose-pine-cursor;
|
package = pkgs.rose-pine-cursor;
|
||||||
name = "BreezeX Cursor";
|
name = "BreezeX-RoséPine";
|
||||||
|
size = 24;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# - Hyprland keybindings ---------------------
|
||||||
|
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
|
||||||
|
bind = [
|
||||||
|
# Pulse Audio controls (mute)
|
||||||
|
", XF86AudioMute, exec, $HOME/.config/grapheio/scripts/volume.sh mute"
|
||||||
|
|
||||||
|
# Media player controls
|
||||||
|
", XF86AudioPlay, exec, playerctl play-pause"
|
||||||
|
", XF86AudioPause, exec, playerctl play-pause"
|
||||||
|
", XF86AudioNext, exec, playerctl next"
|
||||||
|
", XF86AudioPrev, exec, playerctl previous"
|
||||||
|
", XF86AudioStop, exec, playerctl stop"
|
||||||
|
];
|
||||||
|
|
||||||
|
binde = [
|
||||||
|
# Pulse Audio controls (volume)
|
||||||
|
", XF86AudioRaiseVolume, exec, $HOME/.config/grapheio/scripts/volume.sh set +5%"
|
||||||
|
", XF86AudioLowerVolume, exec, $HOME/.config/grapheio/scripts/volume.sh set -5%"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# - Modules ----------------------------------
|
# - Modules ----------------------------------
|
||||||
|
|
||||||
samfelag.modules = {
|
samfelag.modules = {
|
||||||
|
|||||||
@@ -19,30 +19,83 @@ in {
|
|||||||
hm.services.swaync = {
|
hm.services.swaync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
widgets = [
|
||||||
|
"title"
|
||||||
|
"dnd"
|
||||||
|
"notifications"
|
||||||
|
];
|
||||||
|
widget-config = {
|
||||||
|
dnd = {
|
||||||
|
text = "Silence";
|
||||||
|
};
|
||||||
|
title = {
|
||||||
|
text = "Notifications";
|
||||||
|
clear-all-button = true;
|
||||||
|
button-text = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
style = ''
|
style = ''
|
||||||
* {
|
* {
|
||||||
font-family: Iosevka;
|
font-family: Iosevka;
|
||||||
|
color: #${config.colorScheme.palette.base05};
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification {
|
.notification {
|
||||||
padding: 4px 4px 0px 4px;
|
border-width: 2px;
|
||||||
|
padding: 2px 4px;
|
||||||
background-color: #${config.colorScheme.palette.base00};
|
background-color: #${config.colorScheme.palette.base00};
|
||||||
color: #${config.colorScheme.palette.base05};
|
color: #${config.colorScheme.palette.base05};
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary {
|
.notification-content {
|
||||||
|
background-color: inherit;
|
||||||
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.critical.notification {
|
||||||
|
background-color: #${config.colorScheme.palette.base0C};
|
||||||
|
}
|
||||||
|
|
||||||
|
.image {
|
||||||
|
margin: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-center {
|
.control-center {
|
||||||
margin: 20px;
|
margin: 30px;
|
||||||
opacity: 0.95;
|
margin-left: 0px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: solid #${config.colorScheme.palette.base05} 1px;
|
||||||
background-color: #${config.colorScheme.palette.base01};
|
background-color: #${config.colorScheme.palette.base01};
|
||||||
color: #${config.colorScheme.palette.base05};
|
color: #${config.colorScheme.palette.base05};
|
||||||
|
opacity: 0.95;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.control-center-clear-all {
|
||||||
|
background: #${config.colorScheme.palette.base02};
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-center-dnd:checked {
|
||||||
|
background: #${config.colorScheme.palette.base08};
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
background: #${config.colorScheme.palette.base08};
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-group-collapse-button {
|
||||||
|
margin: 4px;
|
||||||
|
box-shadow: none;
|
||||||
|
background: #${config.colorScheme.palette.base0A};
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-group-close-all-button {
|
||||||
|
margin: 4px;
|
||||||
|
box-shadow: none;
|
||||||
|
background: #${config.colorScheme.palette.base08};
|
||||||
|
}
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,6 +106,11 @@ in {
|
|||||||
"swaync"
|
"swaync"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
layerrule = [
|
||||||
|
"animation slide top, swaync-control-center"
|
||||||
|
"animation slide top, swaync-notification-window"
|
||||||
|
];
|
||||||
|
|
||||||
bind = [
|
bind = [
|
||||||
# Notification center
|
# Notification center
|
||||||
"${hyprCfg.mod}, n, exec, swaync-client -t -sw"
|
"${hyprCfg.mod}, n, exec, swaync-client -t -sw"
|
||||||
|
|||||||
@@ -19,26 +19,5 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
services.pipewire.enable = true;
|
services.pipewire.enable = true;
|
||||||
|
|
||||||
# - Hyprland keybindings ---------------------
|
|
||||||
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
|
|
||||||
bind = [
|
|
||||||
# Pulse Audio controls (mute)
|
|
||||||
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
|
||||||
|
|
||||||
# Media player controls
|
|
||||||
", XF86AudioPlay, exec, playerctl play-pause"
|
|
||||||
", XF86AudioPause, exec, playerctl play-pause"
|
|
||||||
", XF86AudioNext, exec, playerctl next"
|
|
||||||
", XF86AudioPrev, exec, playerctl previous"
|
|
||||||
", XF86AudioStop, exec, playerctl stop"
|
|
||||||
];
|
|
||||||
|
|
||||||
binde = [
|
|
||||||
# Pulse Audio controls (volume)
|
|
||||||
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
|
|
||||||
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.samfelag.modules.system.bluetooth;
|
cfg = config.samfelag.modules.system.bluetooth;
|
||||||
desktopCfg = config.samfelag.modules.desktop;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.samfelag.modules.system.bluetooth = {
|
options.samfelag.modules.system.bluetooth = {
|
||||||
@@ -11,9 +10,5 @@ in
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
hardware.bluetooth.enable = true;
|
hardware.bluetooth.enable = true;
|
||||||
services.blueman.enable = true;
|
services.blueman.enable = true;
|
||||||
|
|
||||||
samfelag.modules.desktop.wm.i3.extraKeybindings = lib.mkIf desktopCfg.enable {
|
|
||||||
"${desktopCfg.i3.mod}+b" = "exec $HOME/.config/rofi/menus/bluetooth/bluetooth.sh";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user