Skip to content

Commit

Permalink
feat: add flag --font-size to set a fixed font size
Browse files Browse the repository at this point in the history
  • Loading branch information
d3cryptofc committed Sep 27, 2024
1 parent d472297 commit d5f625f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/hyprnotify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func main() {
CmdFlags := Cmd.Flags()

CmdFlags.BoolVarP(&disableSound, "no-sound", "s", false, "disable sound, silent mode")
CmdFlags.Uint8VarP(&internal.DefaultFontSize, "font-size", "f", 0, "set a fixed font size (1-255)")

Cmd.Execute()
}
10 changes: 8 additions & 2 deletions internal/dbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ var (
current_id uint32 = 0
notification_padding_regexp *regexp.Regexp = regexp.MustCompile("^\\s*|(\n)\\s*(.)")
sound bool

DefaultFontSize uint8
)

type DBusNotify string
Expand Down Expand Up @@ -104,6 +106,10 @@ func (n DBusNotify) Notify(

parse_hints(&nf, hints)

if DefaultFontSize > 0 {
nf.font_size = fontSize{value: DefaultFontSize}
}

// Setting min-width, left alignment
summary = fmt.Sprintf("%-60s", summary)
if nf.icon.value == nf.icon.NOICON {
Expand Down Expand Up @@ -189,12 +195,12 @@ func parse_hints(nf *Notification, hints map[string]dbus.Variant) {
if ok {
nf.font_size.value = uint8(font_size)
}

hint_icon, ok := hints["x-hyprnotify-icon"].Value().(int32)
if ok {
nf.icon.value = hint_icon
nf.icon.padding = ""
nf.color.value = nf.color.DEFAULT
nf.color.value = nf.color.DEFAULT
}

hint_color, ok := hints["x-hyprnotify-color"].Value().(string)
Expand Down

0 comments on commit d5f625f

Please sign in to comment.