Sha256: ded10c77eeea55030ad9ebd5af5a8ba9fe034934935fb3af7576949c1e2686c3
Contents?: true
Size: 989 Bytes
Versions: 39
Compression:
Stored size: 989 Bytes
Contents
#This class can be used to send notify-messages through the notify-binary (notify-send or kdialog). class Knj::Notify #Call this method to show notifications. #===Examples # Knj::Notify.send("msg" => "Hello world!", "time" => 5) def self.send(args) begin toolkit = Knj::Os.toolkit rescue toolkit = "" end if toolkit == "kde" cmd = "kdialog --passivepopup #{Knj::Strings.unixsafe(args["msg"])}" if args["title"] cmd << " --title #{Knj::Strings.unixsafe(args["msg"])}" end if args["time"] cmd << " #{Knj::Strings.unixsafe(args["time"])}" end system(cmd) else cmd = "notify-send" if args["time"] raise "Time is not numeric." if !(Float(args["time"]) rescue false) cmd << " -t #{args["time"]}" end cmd << " #{Knj::Strings.unixsafe(args["title"])} #{Knj::Strings.unixsafe(args["msg"])}" system(cmd) end end end
Version data entries
39 entries across 39 versions & 1 rubygems