Merge branch 'master' into fmt

pull/439/head
Alex 2019-08-29 11:29:48 +02:00 committed by GitHub
commit f592e3d38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1858 additions and 16 deletions

View File

@ -1,3 +1,3 @@
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-protocols mesa-dev libxkbcommon-dev eudev-dev pixman-dev gtkmm3-dev jsoncpp-dev libnl3-dev pulseaudio-dev libmpdclient-dev RUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-protocols mesa-dev libxkbcommon-dev eudev-dev pixman-dev gtkmm3-dev jsoncpp-dev libnl3-dev pulseaudio-dev libmpdclient-dev scdoc

View File

@ -1,4 +1,4 @@
FROM archlinux/base:latest FROM archlinux/base:latest
RUN pacman -Syu --noconfirm && \ RUN pacman -Syu --noconfirm && \
pacman -S git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp --noconfirm pacman -S git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp scdoc --noconfirm

View File

@ -1,5 +1,5 @@
FROM debian:sid FROM debian:sid
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y build-essential meson ninja-build git pkg-config libinput10 libinput-dev wayland-protocols libwayland-client0 libwayland-cursor0 libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libxkbcommon-dev libudev-dev libpixman-1-dev libgtkmm-3.0-dev libjsoncpp-dev && \ apt-get install -y build-essential meson ninja-build git pkg-config libinput10 libinput-dev wayland-protocols libwayland-client0 libwayland-cursor0 libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libxkbcommon-dev libudev-dev libpixman-1-dev libgtkmm-3.0-dev libjsoncpp-dev scdoc && \
apt-get clean apt-get clean

View File

@ -1,5 +1,5 @@
FROM fedora:30 FROM fedora:30
RUN dnf install sway meson git libinput-devel wayland-devel wayland-protocols-devel egl-wayland-devel mesa-libEGL-devel mesa-libGLES-devel mesa-libgbm-devel libxkbcommon-devel libudev-devel pixman-devel gtkmm30-devel jsoncpp-devel -y && \ RUN dnf install sway meson git libinput-devel wayland-devel wayland-protocols-devel egl-wayland-devel mesa-libEGL-devel mesa-libGLES-devel mesa-libgbm-devel libxkbcommon-devel libudev-devel pixman-devel gtkmm30-devel jsoncpp-devel scdoc -y && \
dnf group install "C Development Tools and Libraries" -y && \ dnf group install "C Development Tools and Libraries" -y && \
dnf clean all -y dnf clean all -y

View File

@ -2,4 +2,4 @@ FROM opensuse/tumbleweed:latest
RUN zypper -n up && \ RUN zypper -n up && \
zypper -n install -t pattern devel_C_C++ && \ zypper -n install -t pattern devel_C_C++ && \
zypper -n install git meson clang libinput10 libinput-devel libwayland-client0 libwayland-cursor0 wayland-protocols-devel wayland-devel Mesa-libEGL-devel Mesa-libGLESv2-devel libgbm-devel libxkbcommon-devel libudev-devel libpixman-1-0-devel gtkmm3-devel jsoncpp-devel zypper -n install git meson clang libinput10 libinput-devel libwayland-client0 libwayland-cursor0 wayland-protocols-devel wayland-devel Mesa-libEGL-devel Mesa-libGLESv2-devel libgbm-devel libxkbcommon-devel libudev-devel libpixman-1-0-devel gtkmm3-devel jsoncpp-devel scdoc

View File

@ -46,7 +46,12 @@ class Item : public sigc::trackable {
std::string menu; std::string menu;
DbusmenuGtkMenu* dbus_menu = nullptr; DbusmenuGtkMenu* dbus_menu = nullptr;
Gtk::Menu* gtk_menu = nullptr; Gtk::Menu* gtk_menu = nullptr;
bool item_is_menu = false; /**
* ItemIsMenu flag means that the item only supports the context menu.
* Default value is true because libappindicator supports neither ItemIsMenu nor Activate method
* while compliant SNI implementation would always reset the flag to desired value.
*/
bool item_is_menu = true;
private: private:
void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result); void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result);
@ -60,7 +65,7 @@ class Item : public sigc::trackable {
Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant* variant); Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant* variant);
Glib::RefPtr<Gdk::Pixbuf> getIconByName(const std::string& name, int size); Glib::RefPtr<Gdk::Pixbuf> getIconByName(const std::string& name, int size);
static void onMenuDestroyed(Item* self, GObject* old_menu_pointer); static void onMenuDestroyed(Item* self, GObject* old_menu_pointer);
void makeMenu(GdkEventButton* const& ev); void makeMenu();
bool handleClick(GdkEventButton* const& /*ev*/); bool handleClick(GdkEventButton* const& /*ev*/);
Glib::RefPtr<Gio::DBus::Proxy> proxy_; Glib::RefPtr<Gio::DBus::Proxy> proxy_;

View File

@ -0,0 +1,67 @@
waybar-backlight(5)
# NAME
waybar - backlight module
# DESCRIPTION
The *backlight* module displays the current backlight level.
# CONFIGURATION
*interval* ++
typeof: integer ++
default: 2 ++
The interval in which information gets polled.
*format* ++
typeof: string ++
default: {percent}% ++
The format, how information should be displayed. On {} data gets inserted.
*max-length* ++
typeof: integer ++
The maximum length in characters the module should display.
*rotate* ++
typeof: integer ++
Positive value to rotate the text label.
*states* ++
typeof: array ++
A number of backlight states which get activated on certain brightness levels.
*on-click* ++
typeof: string ++
Command to execute when the module is clicked.
*on-click-right* ++
typeof: string ++
Command to execute when the module is right clicked.
*on-scroll-up* ++
typeof: string ++
Command to execute when performing a scroll up on the module.
*on-scroll-down* ++
typeof: string
Command to execute when performing a scroll down on the module.
*smooth-scrolling-threshold* ++
typeof: double
Threshold to be used when scrolling.
# EXAMPLE:
```
"backlight": {
"device": "intel_backlight",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
}
```
# STYLE
- *#backlight*

View File

@ -0,0 +1,123 @@
waybar-battery(5)
# NAME
waybar - battery module
# DESCRIPTION
The *battery* module displays the current capacity and state (eg. charging) of your battery.
# CONFIGURATION
*bat* ++
typeof: string ++
The battery to monitor, as in /sys/class/power_supply/ instead of auto detect.
*adapter* ++
typeof: string ++
The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect.
*interval* ++
typeof: integer ++
default: 60 ++
The interval in which the information gets polled.
*states* ++
typeof: array ++
A number of battery states which get activated on certain capacity levels. See *waybar-states(5)*.
*format* ++
typeof: string ++
default: {capacity}% ++
The format, how the time should be displayed.
*format-icons*
typeof: array/object
Based on the current capacity, the corresponding icon gets selected. ++
The order is *low* to *high*. Or by the state if it is an object.
*max-length* ++
typeof: integer++
The maximum length in character the module should display.
*rotate* ++
typeof: integer++
Positive value to rotate the text label.
*on-click* ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right* ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up* ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down* ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold* ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip* ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{capacity}*: Capacity in percentage
*{icon}*: Icon, as defined in *format-icons*.
*{time}*: Estimate of time until full or empty. Note that this is based on the power draw at the last refresh time, not an average.
# CUSTOM FORMATS
The *battery* module allows to define custom formats based on up to two factors. The best fitting format will be selected.
*format-<state>*: With *states*, a custom format can be set depending on the capacity of your battery.
*format-<status>*: With the status, a custom format can be set depending on the status in /sys/class/power_supply/<bat>/status (in lowercase).
*format-<status>-<state>*: You can also set a custom format depending on both values.
# STATES
- Every entry (*state*) consists of a *<name>* (typeof: *string*) and a *<value>* (typeof: *integer*).
- The state can be addressed as a CSS class in the *style.css*. The name of the CSS class is the *<name>* of the state. Each class gets activated when the current capacity is equal or below the configured *<value>*.
- Also each state can have its own *format*. Those con be configured via *format-<name>*. Or if you want to differentiate a bit more even as *format-<status>-<state>*. For more information see *custom-formats*.
# EXAMPLES
```
"battery": {
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
}
```
# STYLE
- *#battery*
- *#battery.<status>*
- *<status>* is the value of /sys/class/power_supply/<bat>/status in lowercase.
- *#battery.<state>*
- *<state>* can be defined in the *config*. For more information see *states*.
- *#battery.<status>.<state>*
- Combination of both *<status>* and *<state>*.

View File

@ -0,0 +1,65 @@
waybar-clock(5)
# NAME
waybar - clock module
# DESCRIPTION
The *clock* module displays the current date and time.
# CONFIGURATION
*interval*: ++
typeof: integer ++
default: 60 ++
The interval in which the information gets polled.
*format*: ++
typeof: string ++
default: {:%H:%M} ++
The format, how the date and time should be displayed.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
View all valid format options in *strftime(3)*.
# EXAMPLES
```
"clock": {
"interval": 60,
"format": "{:%H:%M}",
"max-length": 25
}
```
# STYLE
- *#clock*

View File

@ -0,0 +1,78 @@
waybar-cpu(5)
# NAME
waybar - cpu module
# DESCRIPTION
The *cpu* module displays the current cpu utilization.
# CONFIGURATION
*interval*: ++
typeof: integer ++
default: 10 ++
The interval in which the information gets polled.
*format*: ++
typeof: string ++
default: {usage}% ++
The format, how information should be displayed. On {} data gets inserted.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*states*: ++
typeof: array ++
A number of cpu usage states which get activated on certain usage levels. See *waybar-states(5)*.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{load}*: Current cpu load.
*{usage}*: Current cpu usage.
# EXAMPLE
```
"cpu": {
"interval": 10,
"format": "{}% ",
"max-length": 10
}
```
# STYLE
- *#cpu*

View File

@ -0,0 +1,190 @@
waybar-custom(5)
# NAME
waybar - custom module
# DESCRIPTION
The *custom* module displays either the output of a script or static text.
To display static text, specify only the *format* field.
# CONFIGURATION
Addressed by *custom/<name>*
*exec*: ++
typeof: string ++
The path to the script, which should be executed.
*exec-if*: ++
typeof: string ++
The path to a script, which determines if the script in *exec* should be executed.
*exec* will be executed if the exit code of *exec-if* equals 0.
*return-type*: ++
typeof: string ++
See *return-type*
*interval*: ++
typeof: integer ++
The interval (in seconds) in which the information gets polled.
Use *once* if you want to execute the module only on startup.
You can update it manually with a signal. If no *interval* is defined,
it is assumed that the out script loops it self.
*signal*: ++
typeof: integer ++
The signal number used to update the module.
The number is valid between 1 and N, where *SIGRTMIN+N* = *SIGRTMAX*.
*format*: ++
typeof: string ++
default: {} ++
The format, how information should be displayed. On {} data gets inserted.
*format-icons*: ++
typeof: array ++
Based on the set percentage, the corresponding icon gets selected. The order is *low* to *high*.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
*escape*: ++
typeof: bool ++
default: false ++
Option to enable escaping of script output.
# RETURN-TYPE
When *return-type* is set to *json*, Waybar expects the *exec*-script to output its data in JSON format.
This should look like this:
```
{"text": "$text", "tooltip": "$tooltip", "class": "$class", "percentage": $percentage }
```
The *class* parameter also accepts an array of strings.
If nothing or an invalid option is specified, Waybar expects i3blocks style output. Values are *newline* separated.
This should look like this:
```
$text\\n$tooltip\\n$class*
```
*class* is a CSS class, to apply different styles in *style.css*
# FORMAT REPLACEMENTS
*{}*: Output of the script.
*{percentage}* Percentage which can be set via a json return-type.
*{icon}*: An icon from 'format-icons' according to percentage.
# EXAMPLES
## Spotify:
```
"custom/spotify": {
"format": " {}",
"max-length": 40,
"interval": 30, // Remove this if your script is endless and write in loop
"exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder
"exec-if": "pgrep spotify"
}
```
## mpd:
```
"custom/mpd": {
"format": "♪ {}",
//"max-length": 15,
"interval": 10,
"exec": "mpc current",
"exec-if": "pgrep mpd",
"on-click": "mpc toggle",
"on-click-right": "sonata"
}
```
## cmus:
```
"custom/cmus": {
"format": "♪ {}",
//"max-length": 15,
"interval": 10,
"exec": "cmus-remote -C \"format_print '%a - %t'\"", // artist - title
"exec-if": "pgrep cmus",
"on-click": "cmus-remote -u", //toggle pause
"escape": true //handle markup entities
}
```
## Pacman
```
"custom/pacman": {
"format": "{} ",
"interval": "once",
"exec": "pacman_packages",
"on-click": "update-system",
"signal": 8
}
```
## Alternate Pacman
```
"custom/pacman": {
"format": "{} ",
"interval": 3600, // every hour
"exec": "checkupdates | wc -l", // # of updates
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "termite -e 'sudo pacman -Syu'; pkill -SIGRTMIN+8 waybar", // update system
"signal": 8
}
```
You can use the signal and update the number of available packages with *pkill -RTMIN+8 waybar*.
# STYLE
- *#custom-<name>*
- *#custom-<name>.<class>*
- *<class>* can be set by the script. For more information see *return-type*

View File

@ -0,0 +1,71 @@
waybar-idle-inhibitor(5)
# NAME
waybar - idle_inhibitor module
# DESCRIPTION
The *idle_inhibitor* module can inhibiting the idle behavior such as screen blanking, locking, and
screensaving, also known as "presentation mode".
# CONFIGURATION
*format*: ++
typeof: string ++
The format, how the state should be displayed.
*format-icons*: ++
typeof: array ++
Based on the current state, the corresponding icon gets selected.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module. A click also toggles the state
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{status}*: status (*activated* or *deactivated*)
*{icon}*: Icon, as defined in *format-icons*
# EXAMPLES
```
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
}
```

View File

@ -0,0 +1,93 @@
waybar-memory(5)
# NAME
waybar - memory module
# DESCRIPTION
The *memory* module displays the current date and time.
# CONFIGURATION
Addressed by *memory*
*interval*: ++
typeof: integer++
default: 30 ++
The interval in which the information gets polled.
*format*: ++
typeof: string ++
default: {percentage}% ++
The format, how information should be displayed.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*states*: ++
typeof: array ++
A number of memory utilization states which get activated on certain percentage thresholds. See *waybar-states(5)*.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{percentage}*: Percentage of memory in use.
*{total}*: Amount of total memory available in GiB.
*{used}*: Amount of used memory in GiB.
*{avail}*: Amount of available memory in GiB.
# EXAMPLES
```
"memory": {
"interval": 30,
"format": "{}% ",
"max-length": 10
}
```
## FORMATTED MEMORY VALUES
```
"memory": {
"interval": 30,
"format": "{used:0.1f}G/{total:0.1f}G "
}
```
# STYLE
- *#memory*

View File

@ -0,0 +1,200 @@
waybar-mpd(5)
# NAME
waybar - mpd module
# DESCRIPTION
The *mpd* module displays information about a running "Music Player Daemon" instance.
# CONFIGURATION
Addressed by *mpd*
*server*: ++
typeof: string ++
The network address or Unix socket path of the MPD server. If empty, connect to the default host.
*port*: ++
typeof: integer ++
The port MPD listens to. If empty, use the default port.
*interval*: ++
typeof: integer++
default: 5 ++
The interval in which the connection to the MPD server is retried
*timeout*: ++
typeof: integer++
default: 30 ++
The timeout for the connection. Change this if your MPD server has a low `connection_timeout` setting
*unknown-tag*: ++
typeof: string ++
default: "N/A" ++
The text to display when a tag is not present in the current song, but used in `format`
*format*: ++
typeof: string ++
default: "{album} - {artist} - {title}" ++
Information displayed when a song is playing or paused
*format-stopped*: ++
typeof: string ++
default: "stopped" ++
Information displayed when the player is stopped.
*format-disconnected*: ++
typeof: string ++
default: "disconnected" ++
Information displayed when the MPD server can't be reached.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
*tooltip-format*: ++
typeof: string ++
default: "MPD (connected)" ++
Tooltip information displayed when connected to MPD.
*tooltip-format-disconnected*: ++
typeof: string ++
default: "MPD (disconnected)" ++
Tooltip information displayed when the MPD server can't be reached.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*state-icons*: ++
typeof: object ++
default: {} ++
Icon to show depending on the play/pause state of the player (*{ "playing": "...", "paused": "..." }*)
*consume-icons*: ++
typeof: object ++
default: {} ++
Icon to show depending on the "consume" option (*{ "on": "...", "off": "..." }*)
*random-icons*: ++
typeof: object ++
default: {} ++
Icon to show depending on the "random" option (*{ "on": "...", "off": "..." }*)
*repeat-icons*: ++
typeof: object ++
default: {} ++
Icon to show depending on the "repeat" option (*{ "on": "...", "off": "..." }*)
*single-icons*: ++
typeof: object ++
default: {} ++
Icon to show depending on the "single" option (*{ "on": "...", "off": "..." }*)
# FORMAT REPLACEMENTS
## WHEN PLAYING/PAUSED
*{artist}*: The artist of the current song
*{albumArtist}*: The artist of the current album
*{album}*: The album of the current song
*{title}*: The title of the current song
*{date}*: The date of the current song
*{elapsedTime}*: The current position of the current song. To format as a date/time (see example configuration)
*{totalTime}*: The length of the current song. To format as a date/time (see example configuration)
*{stateIcon}*: The icon corresponding the playing or paused status of the player (see *state-icons* option)
*{consumeIcon}*: The icon corresponding the "consume" option (see *consume-icons* option)
*{randomIcon}*: The icon corresponding the "random" option (see *random-icons* option)
*{repeatIcon}*: The icon corresponding the "repeat" option (see *repeat-icons* option)
*{singleIcon}*: The icon corresponding the "single" option (see *single-icons* option)
## WHEN STOPPED
*{consumeIcon}*: The icon corresponding the "consume" option (see *consume-icons* option)
*{randomIcon}*: The icon corresponding the "random" option (see *random-icons* option)
*{repeatIcon}*: The icon corresponding the "repeat" option (see *repeat-icons* option)
*{singleIcon}*: The icon corresponding the "single" option (see *single-icons* option)
## WHEN DISCONNECTED
Currently, no format replacements when disconnected.
# EXAMPLES
```
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"interval": 2,
"consume-icons": {
"on": " " // Icon shows only when "consume" is on
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ", // Icon grayed out when "random" is off
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
}
```
# STYLE
- *#mpd*
- *#mpd.disconnected*
- *#mpd.stopped*
- *#mpd.playing*
- *#mpd.paused*

View File

@ -0,0 +1,143 @@
waybar-network(5)
# NAME
waybar - network module
# DESCRIPTION
The *network* module displays information about the current network connections.
# CONFIGURATION
Addressed by *network*
*interface*: ++
typeof: string ++
Use the defined interface instead of auto detection. Accepts wildcard.
*interval*: ++
typeof: integer ++
default: 60 ++
The interval in which the network information gets polled (e.g. signal strength).
*format*: ++
typeof: string ++
default: *{ifname}* ++
The format, how information should be displayed. This format is used when other formats aren't specified.
*format-ethernet*: ++
typeof: string ++
This format is used when a ethernet interface is displayed.
*format-wifi*: ++
typeof: string ++
This format is used when a wireless interface is displayed.
*format-linked*: ++
typeof: string ++
This format is used when a linked interface with no ip address is displayed.
*format-disconnected*: ++
typeof: string ++
This format is used when the displayed interface is disconnected.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: *true* ++
Option to disable tooltip on hover.
*tooltip-format*: ++
typeof: string ++
The format, how information should be displayed in the tooltip. This format is used when other formats aren't specified.
*tooltip-format-ethernet*: ++
typeof: string ++
This format is used when a ethernet interface is displayed.
*tooltip-format-wifi*: ++
typeof: string ++
This format is used when a wireless interface is displayed.
*tooltip-format-disconnected*: ++
typeof: string ++
This format is used when the displayed interface is disconnected.
# FORMAT REPLACEMENTS
*{ifname}*: Name of the network interface.
*{ipaddr}*: The first IP of the interface.
*{netmask}*: The subnetmask corresponding to the IP.
*{cidr}*: The subnetmask corresponding to the IP in CIDR notation.
*{essid}*: Name (SSID) of the wireless network.
*{signalStrength}*: Signal strength of the wireless network.
*{signaldBm}*: Signal strength of the wireless network in dBm.
*{frequency}*: Frequency of the wireless network in MHz.
*{bandwidthUpBits}*: Instant up speed in bits/seconds.
*{bandwidthDownBits}*: Instant down speed in bits/seconds.
*{bandwidthUpOctets}*: Instant up speed in octets/seconds.
*{bandwidthDownOctets}*: Instant down speed in octets/seconds.
# EXAMPLES
```
"network": {
"interface": "wlp2s0",
"format": "{ifname}",
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname} ",
"format-disconnected": "", //An empty format will hide the module.
"tooltip-format": "{ifname}",
"tooltip-format-wifi": "{essid} ({signalStrength}%) ",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
"max-length": 50
}
```
# STYLE
- *#network*
- *#network.disconnected*
- *#network.linked*
- *#network.ethernet*
- *#network.wifi*

View File

@ -0,0 +1,132 @@
waybar-pulseaudio(5)
# NAME
waybar - pulseaudio module
# DESCRIPTION
The *pulseaudio* module displays the current volume reported by PulseAudio.
Additionally you can control the volume by scrolling *up* or *down* while the cursor is over the module.
# CONFIGURATION
*format*: ++
typeof: string ++
default: {volume}% ++
The format, how information should be displayed. This format is used when other formats aren't specified.
*format-bluetooth*: ++
typeof: string ++
This format is used when using bluetooth speakers.
*format-muted*: ++
typeof: string ++
This format is used when the sound is muted.
*format-source*: ++
typeof: string ++
default: {volume}% ++
This format used for the source.
*format-source-muted*: ++
typeof: string ++
This format is used when the source is muted.
*format-icons*: ++
typeof: array ++
Based on the current port-name and volume, the corresponding icon gets selected. The order is *low* to *high*. See [`Icons`](#module-pulseaudio-config-icons)
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*states*: ++
typeof: array ++
A number of volume states which get activated on certain volume levels. See *waybar-states(5)*
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*scroll-step*: ++
typeof: float ++
default: 1.0 ++
The speed in which to change the volume when scrolling.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module. This replaces the default behaviour of volume control.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module. This replaces the default behaviour of volume control.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{volume}*: Volume in percentage.
*{icon}*: Icon, as defined in `format-icons`.
*{format_source}*: Source format, `format-source`, `format-source-muted`.
# ICONS:
The following strings for `format-icons` are supported.
If they are found in the current PulseAudio port name, the corresponding icons will be selected.
- *default* (Shown, when no other port is found)
- *headphones*
- *speaker*
- *hdmi*
- *headset*
- *handsfree*
- *portable*
- *car*
- *hifi*
- *phone*
# EXAMPLES
```
"pulseaudio": {
"format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"scroll-step": 1,
"on-click": "pavucontrol"
}
```
# STYLE
- *#pulseaudio*
- *#pulseaudio.bluetooth*
- *#pulseaudio.muted*

View File

@ -0,0 +1,43 @@
waybar-states(5)
# OVERVIEW
Some modules support 'states' which allows percentage values to be used as styling triggers to
apply a class when the value matches the declared state value.
# STATES
- Every entry (*state*) consits of a *<name>* (typeof: *string*) and a *<value>* (typeof: *integer*).
- The state can be addressed as a CSS class in the *style.css*. The name of the CSS class is the *<name>* of the state.
Each class gets activated when the current capacity is equal or below the configured *<value>*.
- Also each state can have its own *format*.
Those con be configured via *format-<name>*.
Or if you want to differentiate a bit more even as *format-<status>-<state>*.
# EXAMPLE
```
"battery": {
"bat": "BAT2",
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""],
"max-length": 25
}
```
# STYLING STATES
- *#battery.<state>*
- *<state>* can be defined in the *config*.
# EXAMPLE:
- *#battery.warning: { background: orange; }*
- *#battery.critical: { background: red; }*

View File

@ -0,0 +1,64 @@
waybar-sway-mode(5)
# NAME
waybar - sway mode module
# DESCRIPTION
The *mode* module displays the current binding mode of Sway
# CONFIGURATION
Addressed by *sway/mode*
*format*: ++
typeof: string ++
default: {} ++
The format, how information should be displayed. On {} data gets inserted.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# EXAMPLES
```
"sway/window": {
"format": " {}",
"max-length": 50
}
```
# STYLE
- *#mode*

View File

@ -0,0 +1,67 @@
waybar-sway-window(5)
# NAME
waybar - sway window module
# DESCRIPTION
The *window* module displays the title of the currently focused window in Sway
# CONFIGURATION
Addressed by *sway/window*
*format*: ++
typeof: string ++
default: {} ++
The format, how information should be displayed. On {} data gets inserted.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# EXAMPLES
```
"sway/window": {
"format": "{}",
"max-length": 50
}
```
# STYLE
- *#window*
- *window#waybar.empty* When no windows is in the workspace
- *window#waybar.solo* When one window is in the workspace
- *window#waybar.<app_id>* Where *app_id* is the app_id or *instance* name like (*chromium*) of the only window in the workspace

View File

@ -0,0 +1,123 @@
waybar-sway-workspaces(5)
# NAME
waybar - sway workspaces module
# DESCRIPTION
The *workspaces* module displays the currently used workspaces in Sway.
# CONFIGURATION
Addressed by *sway/workspaces*
*all-outputs*: ++
typeof: bool ++
default: false ++
If set to false, workspaces will only be shown on the output they are on. If set to true all workspaces will be shown on every output.
*format*: ++
typeof: string ++
default: {name} ++
The format, how information should be displayed.
*format-icons*: ++
typeof: array ++
Based on the workspace name and state, the corresponding icon gets selected. See *icons*.
*disable-scroll*: ++
typeof: bool ++
default: false ++
If set to false, you can scroll to cycle through workspaces. If set to true this behaviour is disabled.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*disable-scroll-wraparound*: ++
typeof: bool ++
default: false ++
If set to false, scrolling on the workspace indicator will wrap around to the first workspace when reading the end, and vice versa. If set to true this behavior is disabled.
*enable-bar-scroll*: ++
typeof: bool ++
default: false ++
If set to false, you can't scroll to cycle throughout workspaces from the entire bar. If set to true this behaviour is enabled.
*disable-markup*: ++
typeof: bool ++
default: false ++
If set to true, button label will escape pango markup.
*current-only*: ++
typeof: bool ++
default: false ++
If set to true. Only focused workspaces will be shown.
*persistent_workspaces*: ++
typeof: json (see below) ++
default: empty ++
Lists workspaces that should always be shown, even when non existent
# FORMAT REPLACEMENTS
*{name}*: Name of the workspace, as defined by sway.
*{icon}*: Icon, as defined in *format-icons*.
*{index}*: Index of the workspace.
# ICONS
Additional to workspace name matching, the following *format-icons* can be set.
- *default*: Will be shown, when no string matches is found.
- *urgent*: Will be shown, when workspace is flagged as urgent
- *focused*: Will be shown, when workspace is focused
# PERSISTANT WORKSPACES
Each entry of *persistant_workspace* names a workspace that should always be shown.
Associated with that value is a list of outputs indicating *where* the workspace should be shown,
an empty list denoting all outputs.
```
"sway/workspaces": {
"persistant_workspaces": {
"3": [], // Always show a workspace with name '3', on all outputs if it does not exists
"4": ["eDP-1"], // Always show a workspace with name '4', on output 'eDP-1' if it does not exists
"5": ["eDP-1", "DP-2"] // Always show a workspace with name '5', on outputs 'eDP-1' and 'DP-2' if it does not exists
}
}
```
n.b.: the list of outputs can be obtained from command line using *swaymsg -t get_outputs*
# EXAMPLES
```
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{name}: {icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"urgent": "",
"focused": "",
"default": ""
}
}
```
# Style
- *#workspaces button*
- *#workspaces button.visible*
- *#workspaces button.focused*
- *#workspaces button.urgent*
- *#workspaces button.persistant*

View File

@ -0,0 +1,99 @@
waybar-temperature(5)
# NAME
waybar - temperature module
# DESCRIPTION
The *temperature* module displays the current temperature from a thermal zone.
# CONFIGURATION
Addressed by *temperature*
*thermal-zone*: ++
typeof: integer ++
The thermal zone, as in */sys/class/thermal/*.
*hwmon-path*: ++
typeof: string ++
The temperature path to use, e.g. */sys/class/hwmon/hwmon2/temp1_input* instead of one in */sys/class/thermal/*.
*critical-threshold*: ++
typeof: integer ++
The threshold before it is considered critical (Celcius).
*interval*: ++
typeof: integer ++
default: 10 ++
The interval in which the information gets polled.
*format-critical*: ++
typeof: string ++
The format to use when temperature is considered critical
*format*: ++
typeof: string ++
default: {temperatureC}°C ++
The format (Celcius/Farenheit) in which the temperature should be displayed.
*format-icons*: ++
typeof: array ++
Based on the current temperature (Celcius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in characters the module should display.
*on-click*: ++
typeof: string ++
Command to execute when you clicked on the module.
*on-click-right*: ++
typeof: string ++
Command to execute when you right clicked on the module.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
# FORMAT REPLACEMENTS
*{temperatureC}*: Temperature in Celcius.
*{temperatureF}*: Temperature in Fahrenheit.
# EXAMPLES
```
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
// "critical-threshold": 80,
// "format-critical": "{temperatureC}°C ",
"format": "{temperatureC}°C "
}
```
# STYLE
- *#temperature*
- *#temperature.critical*

View File

@ -0,0 +1,35 @@
waybar-tray(5)
# NAME
waybar - tray module
# DESCRIPTION
_WARNING_ *tray* is still in beta. There may me bugs. Breaking changes may occur.
# CONFIGURATION
Addressed by *tray*
*icon-size*: ++
typeof: integer ++
Defines the size of the tray icons.
*spacing*: ++
typeof: integer ++
Defines the spacing between the tray icons.
# EXAMPLES
```
"tray": {
"icon-size": 21,
"spacing": 10
}
```
# STYLE
- *#tray*

193
man/waybar.5.scd 100644
View File

@ -0,0 +1,193 @@
waybar(5)
# NAME
waybar - configuration file
# DESCRIPTION
The configuration uses the JSON file format and is named *config*.
Valid locations for this file are:
- *$XDG_CONFIG_HOME/waybar/config*
- *~/.config/waybar/config*
- *~/waybar/config*
- */etc/xdg/waybar/config*
A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config.
Also a minimal example configuration can be found on the at the bottom of this man page.
# BAR CONFIGURATION
*layer* ++
typeof: string ++
default: bottom ++
Decide if the bar is displayed in front of the windows or behind them.
*output* ++
typeof: string|array ++
Specifies on which screen this bar will be displayed.
*position* ++
typeof: string ++
default: top ++
Bar position, can be *top*, *bottom*, *left*, *right*.
*height* ++
typeof: integer ++
Height to be used by the bar if possible. Leave blank for a dynamic value.
*width* ++
typeof: integer ++
Width to be used by the bar if possible. Leave blank for a dynamic value.
*modules-left* ++
typeof: array ++
Modules that will be displayed on the left.
*modules-center* ++
typeof: array ++
Modules that will be displayed in the center.
*modules-right* ++
typeof: array
Modules that will be displayed on the right.
*margin* ++
typeof: string ++
Margins value using the CSS format without units.
*margin-<top\|left\|bottom\|right>* ++
typeof: integer ++
Margins value without units.
*name* ++
typeof: string ++
Optional name added as a CSS class, for styling multiple waybars.
# MODULE FORMAT
You can use PangoMarkupFormat (See https://developer.gnome.org/pango/stable/PangoMarkupFormat.html#PangoMarkupFormat).
e.g.
```
"format": "<span style=\"italic\">{}</span>"
```
# MULTIPLE INSTANCES OF A MODULE
If you want to have a second instance of a module, you can suffix it by a '#' and a custom name.
For example if you want a second battery module, you can add *"battery#bat2"* to your modules.
To configure the newly added module, you then also add a module configuration with the same name.
This could then look something like this *(this is an incomplete example)*:
```
"modules-right": ["battery", "battery#bat2"],
"battery": {
"bat": "BAT1"
},
"battery#bat2": {
"bat": "BAT2"
}
```
# MINIMAL CONFIGURATION
A minimal *config* file could look like this:
```
{
"layer": "top",
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": ["sway/window"],
"modules-right": ["battery", "clock"],
"sway/window": {
"max-length": 50
},
"battery": {
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""]
},
"clock": {
"format-alt": "{:%a, %d. %b %H:%M}"
}
}
```
# MULTI OUTPUT CONFIGURATION
## Limit a configuration to some outputs
```
{
"layer": "top",
"output": "eDP-1",
"modules-left": ["sway/workspaces", "sway/mode"],
...
}
```
```
{
"layer": "top",
"output": ["eDP-1", "VGA"],
"modules-left": ["sway/workspaces", "sway/mode"],
...
}
```
## Configuration of multiple outputs
Don't specify an output to create multiple bars on the same screen.
```
[{
"layer": "top",
"output": "eDP-1",
"modules-left": ["sway/workspaces", "sway/mode"],
...
}, {
"layer": "top",
"output": "VGA",
"modules-right": ["clock"],
...
}]
```
## Rotating modules
When positioning Waybar on the left or right side of the screen, sometimes it's useful to be able to rotate the contents of a module so the text runs vertically. This can be done using the "rotate" property of the module. Example:
```
{
"clock": {
"rotate": 90
}
}
```
Valid options for the "rotate" property are: 0, 90, 180 and 270.
# SUPPORTED MODULES
- *waybar-backlight(5)*
- *waybar-battery(5)*
- *waybar-clock(5)*
- *waybar-cpu(5)*
- *waybar-custom(5)*
- *waybar-idle-inhibitor(5)*
- *waybar-memory(5)*
- *waybar-mdp(5)*
- *waybar-network(5)*
- *waybar-pulseaudio(5)*
- *waybar-sway-mode(5)*
- *waybar-sway-window(5)*
- *waybar-sway-workspaces(5)*
- *waybar-temperature(5)*
- *waybar-tray(5)*

View File

@ -72,7 +72,7 @@ src_files = files(
'src/modules/clock.cpp', 'src/modules/clock.cpp',
'src/modules/custom.cpp', 'src/modules/custom.cpp',
'src/modules/cpu.cpp', 'src/modules/cpu.cpp',
'src/modules/idle_inhibitor.cpp', 'src/modules/idle_inhibitor.cpp',
'src/modules/temperature.cpp', 'src/modules/temperature.cpp',
'src/main.cpp', 'src/main.cpp',
'src/bar.cpp', 'src/bar.cpp',
@ -153,6 +153,50 @@ install_data(
install_dir: join_paths(get_option('out'), 'etc/xdg/waybar') install_dir: join_paths(get_option('out'), 'etc/xdg/waybar')
) )
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: false)
if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
man_files = [
'waybar.5.scd',
'waybar-backlight.5.scd',
'waybar-battery.5.scd',
'waybar-clock.5.scd',
'waybar-cpu.5.scd',
'waybar-custom.5.scd',
'waybar-idle-inhibitor.5.scd',
'waybar-memory.5.scd',
'waybar-mpd.5.scd',
'waybar-network.5.scd',
'waybar-pulseaudio.5.scd',
'waybar-sway-mode.5.scd',
'waybar-sway-window.5.scd',
'waybar-sway-workspaces.5.scd',
'waybar-temperature.5.scd',
'waybar-tray.5.scd',
'waybar-states.5.scd',
]
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: 'man/@0@'.format(filename),
output: output,
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
clangtidy = find_program('clang-tidy', required: false) clangtidy = find_program('clang-tidy', required: false)
if clangtidy.found() if clangtidy.found()

View File

@ -201,8 +201,9 @@ void waybar::modules::Network::worker() {
} }
thread_timer_.sleep_for(interval_); thread_timer_.sleep_for(interval_);
}; };
std::array<struct epoll_event, EPOLL_MAX> events{}; thread_ = [this] {
thread_ = [this, &events] { std::array<struct epoll_event, EPOLL_MAX> events{};
int ec = epoll_wait(efd_, events.data(), EPOLL_MAX, -1); int ec = epoll_wait(efd_, events.data(), EPOLL_MAX, -1);
if (ec > 0) { if (ec > 0) {
for (auto i = 0; i < ec; i++) { for (auto i = 0; i < ec; i++) {

View File

@ -130,7 +130,8 @@ std::tuple<std::string, std::string> Host::getBusNameAndObjectPath(const std::st
} }
void Host::addRegisteredItem(std::string service) { void Host::addRegisteredItem(std::string service) {
auto [bus_name, object_path] = getBusNameAndObjectPath(service); std::string bus_name, object_path;
std::tie(bus_name, object_path) = getBusNameAndObjectPath(service);
auto it = std::find_if(items_.begin(), items_.end(), [&bus_name, &object_path](const auto& item) { auto it = std::find_if(items_.begin(), items_.end(), [&bus_name, &object_path](const auto& item) {
return bus_name == item->bus_name && object_path == item->object_path; return bus_name == item->bus_name && object_path == item->object_path;
}); });

View File

@ -128,6 +128,7 @@ void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
} }
} else if (name == "Menu") { } else if (name == "Menu") {
menu = get_variant<std::string>(value); menu = get_variant<std::string>(value);
makeMenu();
} else if (name == "ItemIsMenu") { } else if (name == "ItemIsMenu") {
item_is_menu = get_variant<bool>(value); item_is_menu = get_variant<bool>(value);
} }
@ -319,7 +320,7 @@ void Item::onMenuDestroyed(Item* self, GObject* old_menu_pointer) {
} }
} }
void Item::makeMenu(GdkEventButton* const& ev) { void Item::makeMenu() {
if (gtk_menu == nullptr && !menu.empty()) { if (gtk_menu == nullptr && !menu.empty()) {
dbus_menu = dbusmenu_gtkmenu_new(bus_name.data(), menu.data()); dbus_menu = dbusmenu_gtkmenu_new(bus_name.data(), menu.data());
if (dbus_menu != nullptr) { if (dbus_menu != nullptr) {
@ -334,8 +335,8 @@ void Item::makeMenu(GdkEventButton* const& ev) {
bool Item::handleClick(GdkEventButton* const& ev) { bool Item::handleClick(GdkEventButton* const& ev) {
auto parameters = Glib::VariantContainerBase::create_tuple( auto parameters = Glib::VariantContainerBase::create_tuple(
{Glib::Variant<int>::create(ev->x), Glib::Variant<int>::create(ev->y)}); {Glib::Variant<int>::create(ev->x), Glib::Variant<int>::create(ev->y)});
if ((ev->button == 1 && (item_is_menu || !menu.empty())) || ev->button == 3) { if ((ev->button == 1 && item_is_menu) || ev->button == 3) {
makeMenu(ev); makeMenu();
if (gtk_menu != nullptr) { if (gtk_menu != nullptr) {
#if GTK_CHECK_VERSION(3, 22, 0) #if GTK_CHECK_VERSION(3, 22, 0)
gtk_menu->popup_at_pointer(reinterpret_cast<GdkEvent*>(ev)); gtk_menu->popup_at_pointer(reinterpret_cast<GdkEvent*>(ev));

View File

@ -17,7 +17,11 @@ void Mode::onEvent(const struct Ipc::ipc_response& res) {
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
auto payload = parser_.parse(res.payload); auto payload = parser_.parse(res.payload);
if (payload["change"] != "default") { if (payload["change"] != "default") {
mode_ = Glib::Markup::escape_text(payload["change"].asString()); if (payload["pango_markup"].asBool()) {
mode_ = payload["change"].asString();
} else {
mode_ = Glib::Markup::escape_text(payload["change"].asString());
}
} else { } else {
mode_.clear(); mode_.clear();
} }