Skip to content

Commit

Permalink
refactor: store padding regex in a package-level variable
Browse files Browse the repository at this point in the history
  • Loading branch information
d3cryptofc committed Sep 25, 2024
1 parent 37d3e31 commit 024ba8b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/dbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ const DBUS_XML = `<node name="` + FDN_PATH + `">
</node>`

var (
conn *dbus.Conn
hyprsock HyprConn
ongoing_notifications map[uint32]chan uint32 = make(map[uint32]chan uint32)
current_id uint32 = 0
sound bool
conn *dbus.Conn
hyprsock HyprConn
ongoing_notifications map[uint32]chan uint32 = make(map[uint32]chan uint32)
current_id uint32 = 0
sound bool
notification_padding_regexp *regexp.Regexp = regexp.MustCompile("^\\s*|(\n)\\s*(.)")
)

type DBusNotify string
Expand Down Expand Up @@ -117,8 +118,7 @@ func (n DBusNotify) Notify(
}

// Using RegExp to add padding for all lines
nf.message = regexp.
MustCompile("^\\s*|(\n)\\s*(.)").
nf.message = notification_padding_regexp.
ReplaceAllString(
strings.TrimLeft(nf.message, "\n"),
"$1\u205F $2",
Expand Down

0 comments on commit 024ba8b

Please sign in to comment.