File tree 6 files changed +80
-9
lines changed
6 files changed +80
-9
lines changed Original file line number Diff line number Diff line change 98
98
99
99
## Styling
100
100
101
- | Selector | Description |
102
- | -------------------------------- | --------------------------------------|
103
- | ` .workspaces ` | Workspaces widget box |
104
- | ` .workspaces .item ` | Workspace button |
105
- | ` .workspaces .item.focused ` | Workspace button (workspace focused) |
101
+ | Selector | Description |
102
+ | ------------------------------ | -- ----------------------------------------------------- |
103
+ | ` .workspaces ` | Workspaces widget box |
104
+ | ` .workspaces .item ` | Workspace button |
105
+ | ` .workspaces .item.focused ` | Workspace button (workspace focused) |
106
106
| ` .workspaces .item.visible ` | Workspace button (workspace visible, including focused) |
107
- | ` .workspaces .item.inactive ` | Workspace button (favourite, not currently open)
108
- | ` .workspaces .item .icon ` | Workspace button icon (any type) |
109
- | ` .workspaces .item .text-icon ` | Workspace button icon (textual only) |
110
- | ` .workspaces .item .image ` | Workspace button icon (image only) |
107
+ | ` .workspaces .item.urgent ` | Workspace button (workspace contains urgent window) |
108
+ | ` .workspaces .item.inactive ` | Workspace button (favourite, not currently open) |
109
+ | ` .workspaces .item .icon ` | Workspace button icon (any type) |
110
+ | ` .workspaces .item .text-icon ` | Workspace button icon (textual only) |
111
+ | ` .workspaces .item .image ` | Workspace button icon (image only) |
111
112
112
113
For more information on styling, please see the [ styling guide] ( styling-guide ) .
Original file line number Diff line number Diff line change @@ -201,6 +201,10 @@ scale trough {
201
201
background-color: @color_bg_dark ;
202
202
}
203
203
204
+ .workspaces .item .urgent {
205
+ background-color: @color_urgent ;
206
+ }
207
+
204
208
.workspaces .item : hover {
205
209
box-shadow : inset 0 -3px ;
206
210
}
Original file line number Diff line number Diff line change @@ -166,13 +166,45 @@ impl Client {
166
166
}
167
167
168
168
{
169
+ let tx = tx. clone ( ) ;
170
+ let lock = lock. clone ( ) ;
171
+
169
172
event_listener. add_workspace_destroy_handler ( move |data| {
170
173
let _lock = lock ! ( lock) ;
171
174
debug ! ( "Received workspace destroy: {data:?}" ) ;
172
175
send ! ( tx, WorkspaceUpdate :: Remove ( data. workspace_id as i64 ) ) ;
173
176
} ) ;
174
177
}
175
178
179
+ {
180
+ event_listener. add_urgent_state_handler ( move |address| {
181
+ let _lock = lock ! ( lock) ;
182
+ debug ! ( "Received urgent state: {address:?}" ) ;
183
+
184
+ let clients = match hyprland:: data:: Clients :: get ( ) {
185
+ Ok ( clients) => clients,
186
+ Err ( err) => {
187
+ error ! ( "Failed to get clients: {err}" ) ;
188
+ return ;
189
+ }
190
+ } ;
191
+ clients. iter ( ) . find ( |c| c. address == address) . map_or_else (
192
+ || {
193
+ error ! ( "Unable to locate client" ) ;
194
+ } ,
195
+ |c| {
196
+ send ! (
197
+ tx,
198
+ WorkspaceUpdate :: Urgent {
199
+ id: c. workspace. id as i64 ,
200
+ urgent: true ,
201
+ }
202
+ ) ;
203
+ } ,
204
+ ) ;
205
+ } ) ;
206
+ }
207
+
176
208
event_listener
177
209
. start_listener ( )
178
210
. expect ( "Failed to start listener" ) ;
@@ -194,6 +226,14 @@ impl Client {
194
226
}
195
227
) ;
196
228
229
+ send ! (
230
+ tx,
231
+ WorkspaceUpdate :: Urgent {
232
+ id: workspace. id,
233
+ urgent: false ,
234
+ }
235
+ ) ;
236
+
197
237
prev_workspace. replace ( workspace) ;
198
238
}
199
239
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ pub enum WorkspaceUpdate {
135
135
name : String ,
136
136
} ,
137
137
138
+ /// The urgent state of a node changed.
139
+ Urgent {
140
+ id : i64 ,
141
+ urgent : bool ,
142
+ } ,
143
+
138
144
/// An update was triggered by the compositor but this was not mapped by Ironbar.
139
145
///
140
146
/// This is purely used for ergonomics within the compositor clients
Original file line number Diff line number Diff line change @@ -109,6 +109,16 @@ impl From<WorkspaceEvent> for WorkspaceUpdate {
109
109
WorkspaceChange :: Move => {
110
110
Self :: Move ( event. current . expect ( "Missing current workspace" ) . into ( ) )
111
111
}
112
+ WorkspaceChange :: Urgent => {
113
+ if let Some ( node) = event. current {
114
+ Self :: Urgent {
115
+ id : node. id ,
116
+ urgent : node. urgent ,
117
+ }
118
+ } else {
119
+ Self :: Unknown
120
+ }
121
+ }
112
122
_ => Self :: Unknown ,
113
123
}
114
124
}
Original file line number Diff line number Diff line change @@ -416,6 +416,16 @@ impl Module<gtk::Box> for WorkspacesModule {
416
416
}
417
417
}
418
418
}
419
+ WorkspaceUpdate :: Urgent { id, urgent } => {
420
+ let button = button_map. get( & id) ;
421
+ if let Some ( item) = button {
422
+ if urgent {
423
+ item. add_class( "urgent" ) ;
424
+ } else {
425
+ item. style_context( ) . remove_class( "urgent" ) ;
426
+ }
427
+ }
428
+ }
419
429
WorkspaceUpdate :: Unknown => warn!( "Received unknown type workspace event" )
420
430
} ;
421
431
} ) ;
You can’t perform that action at this time.
0 commit comments