Personal Nix setup

Update hyprpanel

Changed files
+29 -113
home
desktop
hyprpanel
src
scss
ui
vala
modules
desktop
+5
home/desktop/hyprland.nix
···
bindl = [
", XF86AudioMute, exec, ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle"
+
", XF86AudioMicMute, exec, ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
", XF86AudioPlay, exec, ${playerctl} play-pause"
", XF86AudioPause, exec, ${playerctl} play-pause"
", XF86AudioNext, exec, ${playerctl} next"
···
windowrule = [
"float, class:zen-beta,initialTitle:(Picture-in-Picture)"
+
];
+
+
layerrule = [
+
"blur, hyprpanel"
];
};
};
+13 -8
home/desktop/hyprpanel/src/scss/Bar.scss
···
$bg-color: #{"@theme_bg_color"};
window.Bar {
+
background: transparent;
+
> box {
-
background: $bg-color;
+
min-height: 36px;
+
padding: 2px 18px;
+
background: transparent;
color: $fg-color;
-
font-weight: bold;
+
+
font-family: SF Pro Display;
+
font-weight: medium;
+
font-size: 13px;
}
-
button {
-
min-height: 0;
-
min-width: 0;
-
border-radius: 8px;
-
margin: 4px;
-
padding: 4px 8px;
+
.menubar-item {
+
> * + * {
+
margin-left: 6px;
+
}
}
}
+9 -49
home/desktop/hyprpanel/src/ui/Bar.blp
···
using Astal 4.0;
template $Bar: Astal.Window {
+
default-height: 40;
+
CenterBox centerbox {
start-widget: Box {
-
MenuButton {
-
Label {
-
label: bind template.clock;
-
}
-
-
popover: Popover popover {
-
Calendar calendar {
-
show-day-names: true;
-
show-heading: true;
-
show-week-numbers: true;
-
}
-
};
-
}
};
center-widget: Box {
-
Box {
-
visible: bind template.mpris-visible;
-
-
Image {
-
file: bind template.mpris-art;
-
}
-
-
Label {
-
label: bind template.mpris-label;
-
}
-
}
};
end-widget: Box {
-
spacing: 4;
-
-
Image {
-
visible: bind template.bluetooth-visible;
-
icon-name: "bluetooth-symbolic";
-
}
+
spacing: 14;
Image {
-
icon-name: bind template.power-profile-icon;
-
}
-
-
Image {
+
styles ["menubar-item"]
icon-name: bind template.network-icon;
}
Box {
+
styles ["menubar-item"]
Image {
icon-name: bind template.volume-icon;
}
-
-
Scale {
-
width-request: 100;
-
change-value => $change_volume();
-
-
adjustment: Adjustment {
-
value: bind template.volume;
-
lower: 0;
-
upper: 1;
-
};
-
}
}
Box {
-
Image {
-
icon-name: bind template.battery-icon;
-
}
-
+
styles ["menubar-item"]
Label {
label: bind template.battery-label;
+
}
+
Image {
+
icon-name: bind template.battery-icon;
}
}
};
+1 -56
home/desktop/hyprpanel/src/vala/Bar.vala
···
[GtkTemplate(ui="/ui/Bar.ui")]
class Bar : Astal.Window {
-
public string clock { get; set; }
public string volume_icon { get; set; }
public string battery_visible { get; set; }
public string battery_label { get; set; }
public string battery_icon { get; set; }
-
public double volume { get; set; }
public string network_icon { get; set; }
-
public bool mpris_visible { get; set; }
-
public string mpris_label { get; set; }
-
public string mpris_art { get; set; }
-
public string power_profile_icon { get; set; }
-
public bool bluetooth_visible { get; set; }
-
-
AstalIO.Time timer;
-
AstalMpris.Player player;
-
-
[GtkChild] unowned Gtk.Popover popover;
-
[GtkChild] unowned Gtk.Calendar calendar;
public Bar() {
+
namespace = "hyprpanel";
anchor = TOP | LEFT | RIGHT;
exclusivity = EXCLUSIVE;
add_css_class("Bar");
present();
-
-
// clock
-
timer = AstalIO.Time.interval(1000, null);
-
timer.now.connect(() => {
-
clock = new DateTime.now_local().format("%H:%M:%S");
-
});
-
-
// everytime popover is opened, select current day
-
popover.notify["visible"].connect(() => {
-
if (popover.visible) {
-
calendar.select_day(new DateTime.now_local());
-
}
-
});
// network
var nw = AstalNetwork.get_default();
···
// volume
var speaker = AstalWp.get_default().get_default_speaker();
speaker.bind_property("volume-icon", this, "volume-icon", BindingFlags.SYNC_CREATE);
-
speaker.bind_property("volume", this, "volume", BindingFlags.SYNC_CREATE);
-
-
// mpris
-
player = new AstalMpris.Player("spotify");
-
player.bind_property("available", this, "mpris-visible", BindingFlags.SYNC_CREATE);
-
player.bind_property("cover-art", this, "mpris-art", BindingFlags.SYNC_CREATE);
-
player.bind_property("metadata", this, "mpris-label", BindingFlags.SYNC_CREATE, (_, src, ref target) => {
-
if (player.title == null || player.artist == null) {
-
return false;
-
}
-
target.set_string(@"$(player.artist) - $(player.title)");
-
return true;
-
}, null);
-
-
// powerprofiles
-
var powerprofile = AstalPowerProfiles.get_default();
-
powerprofile.bind_property("icon-name", this, "power-profile-icon", BindingFlags.SYNC_CREATE);
-
-
// bluetooth
-
var bt = AstalBluetooth.get_default();
-
bt.bind_property("is-connected", this, "bluetooth-visible", BindingFlags.SYNC_CREATE);
-
}
-
-
[GtkCallback]
-
bool change_volume(Gtk.Range scale, Gtk.ScrollType type, double value) {
-
AstalWp.get_default().get_default_speaker().set_volume(value);
-
return true;
}
public override void dispose() {
-
timer.cancel();
-
timer.dispose();
-
player.dispose();
base.dispose();
}
}
+1
modules/desktop/session.nix
···
settings.terminal.vt = 1;
};
hypridle.enable = true;
+
upower.enable = true;
logind = {
powerKey = "suspend";
powerKeyLongPress = "poweroff";