在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):phuhl/linux_notification_center开源软件地址(OpenSource Url):https://github.com/phuhl/linux_notification_center开源编程语言(OpenSource Language):Haskell 90.3%开源软件介绍(OpenSource Introduction):Linux Notification CenterA haskell-written notification center for users that like a desktop with style… Take part in the discussion on our new discussion board! FeaturesThe notification center receives notifications via DBUS (like any notification daemon) and shows them in the upper right corner of the screen. The notification (if not specified in the notification otherwise) will also be shown in the notification center even after the notification disappeared by itself. The notifications can be clicked to make them disappear. Notifications can be replaced by the use of the The notification center can (optionally) show user-specified buttons in the bottom that can be in two states (highlighted/not highlighted) and that can run customizable shell commands. ScreenshotsSome applications, notification: Link, Markup, Progressbar, and Action support: UsageTo start it: > deadd-notification-center Toggle between hidden and shown state of the notification center: kill -s USR1 $(pidof deadd-notification-center) Set the state of a user defined button (in this example the first
button, which has # turn highlighting on
notify-send.py a --hint boolean:deadd-notification-center:true \
int:id:0 boolean:state:true type:string:buttons
# turn highlighting off
notify-send.py a --hint boolean:deadd-notification-center:true \
int:id:0 boolean:state:false type:string:buttons This snippet uses notify-send.py, an improved version of libnotify (notify-send). Clear all notifications # within the notification center
notify-send.py a --hint boolean:deadd-notification-center:true \
string:type:clearInCenter
# popups
notify-send.py a --hint boolean:deadd-notification-center:true \
string:type:clearPopups Pause/Unpause popup notifications # pause popup notifications
notify-send.py a --hint boolean:deadd-notification-center:true \
string:type:pausePopups
# unpause popup notifications
notify-send.py a --hint boolean:deadd-notification-center:true \
string:type:unpausePopups Reload CSS Styling file notify-send.py a --hint boolean:deadd-notification-center:true \
string:type:reloadStyle Send notifications that only show up in the notification center but do not produce a popup: notify-send.py "Does not pop up" -t 1 Supported hints and featuresAction buttons with gtk icons notify-send.py "And buttons" "Do you like buttons?" \
--hint boolean:action-icons:true \
--action yes:face-cool no:face-sick Notification images by gtk icon notify-send.py "Icons are" "COOL" \
--hint string:image-path:face-cool Notification images by file notify-send.py "Images are" "COOL" \
--hint string:image-path:file://path/to/image/from/root.png Notification with progress bar notify-send.py "This notification has a progressbar" "33%" \
--hint int:has-percentage:33)
#or
notify-send.py "This notification has a progressbar" "33%" \
--hint int:value:33) Notification with slider notify-send.py "This notification has a slider" "33%" \
--hint int:has-percentage:33
--action changeValue:abc) Example: Brightness indicatorThis snippet can be used to produce a brightness-indicator. It requires the notify-send.py script. #!/bin/bash
if [ "$1" == "inc" ]; then
xbacklight -inc 5
fi
if [ "$1" == "dec" ]; then
xbacklight -lower 5
fi
BRIGHTNESS=$(xbacklight -get)
NOTI_ID=$(notify-send.py "Bildschirmhelligkeit" "$BRIGHTNESS/100" \
--hint string:image-path:video-display boolean:transient:true \
int:has-percentage:$BRIGHTNESS \
--replaces-process "brightness-popup") Example: Volume indicatorThis snippet can be used to produce a volume-indicator. It requires the notify-send.py script. #!/bin/bash
if [ "$1" == "inc" ]; then
amixer -q sset Master 5%+
fi
if [ "$1" == "dec" ]; then
amixer -q sset Master 5%-
fi
if [ "$1" == "mute" ]; then
amixer -q sset Master toggle
fi
AMIXER=$(amixer sget Master)
VOLUME=$(echo $AMIXER | grep 'Right:' | awk -F'[][]' '{ print $2 }' | tr -d "%")
MUTE=$(echo $AMIXER | grep -o '\[off\]' | tail -n 1)
if [ "$VOLUME" -le 20 ]; then
ICON=audio-volume-low
else if [ "$VOLUME" -le 60 ]; then
ICON=audio-volume-medium
else
ICON=audio-volume-high
fi
fi
if [ "$MUTE" == "[off]" ]; then
ICON=audio-volume-muted
fi
NOTI_ID=$(notify-send.py "Lautstärke" "$VOLUME/100" \
--hint string:image-path:$ICON boolean:transient:true \
int:has-percentage:$VOLUME \
--replaces-process "volume-popup") InstallInstall from the AUR for Arch: deadd-notification-center. OR If you want to spare yourself the hassle of the build time there is a binary package available: deadd-notification-center-bin. OR If you don’t want to wait for me to publish the next stable release: Use the new AUR git-package. deadd-notification-center-git. OR On Ubuntu, Debian, everything… Replace 1.7.2 with the current-most release from the release section. Manually install the dependencies (exact names might differ in your distribution):
tar -xvzf linux_notification_center-1.7.2.tar.gz
cd linux_notification_center-1.7.2
wget https://github.com/phuhl/linux_notification_center/releases/download/1.7.2/deadd-notification-center
mkdir -p .out
mv deadd-notification-center .out
sudo make install OR Dependencies:
make
sudo make install ConfigurationNOTE: Some styling config has moved. More infos in this file: updateyourconfig2021.org No configuration is necessary, the notification center comes with sensible defaults™. All colors and sizes are customizable, as well as the default timeout
for notifications and the optional buttons in the notification
center. Below are possible configurable options shown. The
configuration file must be located at Additionally, a [notification-center]
# Hide the notification center when the mouse leaves the window
hideOnMouseLeave = True
# Margin at the top of the notification center in pixels. This can be
# used to avoid overlap between the notification center and bars such
# as polybar or i3blocks.
marginTop = 0
# Margin at the bottom of the notification center in pixels.
marginBottom = 0
# Margin to the right of the notification center in pixels.
marginRight = 0
# Width of the notification center in pixels.
width = 500
# Monitor on which the notification center will be printed.
monitor = 0
# If true, the notification center will open on the screen, on which the
# mouse is
followMouse = false
# (Optional) Command to run at startup. This can be used to setup
# button states.
# startupCommand = "deadd-notification-center-startup"
# If newFirst is set to true, newest notifications appear on the top
# of the notification center. Else, notifications stack, from top to
# bottom.
newFirst = true
# If useActionIcons is set to true, Action Buttons can show Icon
useActionIcons = true
# If true, the transient field in notifications will be ignored and
# the notification will be persisted in the notification center anyways
ignoreTransient = false
# If true, markup (<u>, <i>, <b>, <a>) will be displayed properly
useMarkup = true
# If true, html entities (& for &, % for %, etc) will be parsed
# properly. This is useful for chromium-based apps, which tend to send
# these in notifications.
parseHtmlEntities = true
# If set to true, the parameter noClosedMsg can be set on
# notifications. If noClosedMsg is set to true on a notification,
# DBUS NotificationClosed messages will not be send for this
# notification.
configSendNotiClosedDbusMessage = false
# If set to true: If no icon is passed by the app_icon parameter
# and no application "desktop-entry"-hint is present, the notification
# center will try to guess the icon from the application name (if present).
# Default is true.
guessIconFromAppname = true
# See section "Notification based scripting" for an explanation
#match = "title=Abc;body=abc":"app=notify-send"
#modify = "transient=false"
#run = "":"killall notify-send"
[notification-center-notification-popup]
# Default timeout used for notifications in milli-seconds. This can
# be overwritten with the "-t" option (or "--expire-time") of the
# notify-send command.
notiDefaultTimeout = 10000
# Margin above notifications (in pixels). This can be used to avoid
# overlap between notifications and a bar such as polybar or i3blocks.
distanceTop = 50
# Margin on the right of the notification (in pixels).
distanceRight = 50
# Vertical distance between 2 notifications (in pixels).
distanceBetween = 20
# Width of the notifications.
width = 300
# Monitor on which the notification will be printed.
monitor = 0
# If true, the notifications will open on the screen, on which the
# mouse is
followMouse = false
# The display size of the application icons in the notification
# pop-ups and in the notification center
iconSize = 20
# The maximal display size of images that are part of notifications
# for notification pop-ups and in the notification center
maxImageSize = 100
# The margin around the top, bottom, left, and right of notification
# images. Applies to popup notifications and in-center notifications.
imageMarginTop = 15
imageMarginBottom = 15
imageMarginLeft = 15
imageMarginRight = 0
# Truncates notification bodies with '...' at the specified number of
# lines. If -1 is specified, the body text will not be truncated.
# Applies only to popup notifications
shortenBody = 5
# The mouse button for closing a popup. Must be either "mouse1",
# "mouse2", "mouse3", "mouse4", or "mouse5"
dismissButton = mouse1
# The mouse button for opening a popup with the default action.
# Must be either "mouse1", "mouse2", "mouse3", "mouse4", or "mouse5"
defaultActionButton = mouse3
[buttons]
### This section describes the configurable buttons within the
### notification center and NOT the buttons that appear in the
### notifications
# Note: If you want your buttons in the notification center to be
# squares you should verify that the following equality holds:
# [notification-center]::width
# == [buttons]::buttonsPerRow * [buttons]::buttonHeight
# + ([buttons]::buttonsPerRow + 1) * [buttons]::buttonMargin
# Numbers of buttons that can be drawn on a row of the notification
# center.
buttonsPerRow = 5
# Height of buttons in the notification center (in pixels).
buttonHeight = 60
# Horizontal and vertical margin between each button in the
# notification center (in pixels).
buttonMargin = 2
# Labels written on the buttons in the notification center. Labels
# should be written between quotes and separated by a colon. For
# example:
# labels = "VPN":"Bluetooth":"Wifi":"Screensaver"
# Each label is represented as a clickable button in the notification
# center. The commands variable below define the commands that should
# be launched when the user clicks on the associated button. There
# should be the same number of entries in `commands` and in `labels`
# commands = "sudo vpnToggle":"bluetoothToggle":"wifiToggle":"screensaverToggle" CSS stylingIn the file The following class-names for labels are defined:
Examples: image.deadd-noti-center.notification.icon,
label.deadd-noti-center.notification.appname,
image.deadd-noti-center.in-center.icon,
label.deadd-noti-center.in-center.appname {
opacity: 0
} .deadd-noti-center {
font-family: monospace;
} Notification-based scriptingYou can modify notifications if they match certain criteria. Matching: The criteria you can specify are equality for the following parameters:
You can test a parameter like this: Modifying: You can set the following parameters:
If you want to set more than one parameter you can concatenate them
with Running Commands: Not implemented, yet. [notification-center]
match = "title=Abc;body=abc":"app=notify-send"
modify = "transient=false"
run = "":"killall notify-send" Issues and goalsSee here: Log of issues ContributeFirst of all: Contribution is obviously 100% optional. If you do want to contribute, feel free to send me an email (for the address, see on my profile). If you do not want to contribute with your time, you can buy me a beer ;). Someone mentioned, she would be willing to donate, so here is my PayPal link: https://paypal.me/phuhl. Should you consider to donate, please be aware that this does not buy you the right to demand anything. This is a hobby. And will be. But if you just want to give me some motivation by showing me that someone appreciates my work, feel free to do so. See alsoAlso take a look at my notify-send.py which imitates notify-send (libnotify) but also is able to replace notifications. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论