Skip to content

Commit 22d0f36

Browse files
committed
Bugfix with moving window
1 parent 4474db6 commit 22d0f36

2 files changed

Lines changed: 114 additions & 148 deletions

File tree

config.h

Lines changed: 113 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,122 @@
11
/*
2-
2+
*
33
██▀███ ▄▄▄ ▄████ ███▄ █ ▄▄▄ ██▀███ █ █░ ███▄ ▄███▓
44
▓██ ▒ ██▒▒████▄ ██▒ ▀█▒ ██ ▀█ █ ▒████▄ ▓██ ▒ ██▒▓█░ █ ░█░▓██▒▀█▀ ██▒
55
▓██ ░▄█ ▒▒██ ▀█▄ ▒██░▄▄▄░▓██ ▀█ ██▒▒██ ▀█▄ ▓██ ░▄█ ▒▒█░ █ ░█ ▓██ ▓██░
6-
▒██▀▀█▄ ░██▄▄▄▄██ ░▓█ ██▓▓██▒ ▐▌██▒░██▄▄▄▄██ ▒██▀▀█▄ ░█░ █ ░█ ▒██ ▒██
6+
▒██▀▀█▄ ░██▄▄▄▄██ ░▓█ ██▓▓██▒ ▐▌██▒░██▄▄▄▄██ ▒██▀▀█▄ ░█░ █ ░█ ▒██ ▒██
77
░██▓ ▒██▒ ▓█ ▓██▒░▒▓███▀▒▒██░ ▓██░ ▓█ ▓██▒░██▓ ▒██▒░░██▒██▓ ▒██▒ ░██▒
88
░ ▒▓ ░▒▓░ ▒▒ ▓▒█░ ░▒ ▒ ░ ▒░ ▒ ▒ ▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ▓░▒ ▒ ░ ▒░ ░ ░
99
░▒ ░ ▒░ ▒ ▒▒ ░ ░ ░ ░ ░░ ░ ▒░ ▒ ▒▒ ░ ░▒ ░ ▒░ ▒ ░ ░ ░ ░ ░
10-
░░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░
11-
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
12-
10+
░░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░
11+
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
12+
1313
_________ _ _______________
1414
/ ___/ __ \/ |/ / __/ _/ ___/
15-
/ /__/ /_/ / / _/_/ // (_ /
16-
\___/\____/_/|_/_/ /___/\___/
15+
/ /__/ /_/ / / _/_/ // (_ /
16+
\___/\____/_/|_/_/ /___/\___/
17+
__
18+
/ /_ __ __ _________ _________ ____________ __
19+
/ __ \/ / / / / ___/ __ \/ ___/ __ \/ ___/ ___/ / / /
20+
/ /_/ / /_/ / / /__/ /_/ / /__/ /_/ / /__/ / / /_/ /
21+
/_.___/\__, / \___/\____/\___/\____/\___/_/ \__, /
22+
/____/ /____/
23+
*
1724
*/
1825
#pragma once
1926
#include "structs.h"
2027

2128
/* Monitors */
2229
// Ordered From left to right (0 is most left)
23-
#define MONITOR_COUNT 2
24-
static const Monitor Monitors[MONITOR_COUNT] = {(Monitor){.width = 1920, .height = 1080}, (Monitor){.width = 2560, .height = 1440}};
30+
#define MONITOR_COUNT 2
31+
static const Monitor Monitors[MONITOR_COUNT] = {(Monitor){.width = 1920, .height = 1080}, (Monitor){.width = 2560, .height = 1440}};
2532

2633
/* Commands */
2734
#define TERMINAL_CMD "alacritty &"
28-
#define WEB_BROWSER_CMD "chromium &"
29-
#define APPLICATION_LAUNCHER_CMD "dmenu_run &"
30-
31-
#define WM_REFRESH_SPEED 1.0 // In seconds
32-
33-
/* Font */
34-
/*
35-
* IMPORTANT:
36-
* Unicode characters often need some tweaking with positioning.
37-
* If you use a unicode character as an icon and it is not correctly centered,
38-
* just add spaces to the back or front of the icon to center it. */
39-
40-
#define FONT "monospace:size=11"
41-
#define FONT_SIZE 11 // Should be same as size of given font
42-
#define FONT_COLOR "#ffffff" // Color for the font of the bar
43-
#define DECORATION_FONT_COLOR "#ffffff" // Color for the font of the window decoration
44-
35+
#define WEB_BROWSER_CMD "brave &"
36+
#define APPLICATION_LAUNCHER_CMD "rofi-app-launcher &"
37+
38+
#define WM_REFRESH_SPEED 1.0f // In seconds
39+
/* Font*/
40+
#define FONT "JetBrains Mono Nerd Font:size=13:style=bold"
41+
#define FONT_SIZE 13
42+
#define FONT_COLOR "#000000"
43+
#define DECORATION_FONT_COLOR "#ffffff"
4544
/* Keybindings */
46-
#define MASTER_KEY Mod4Mask // All WM Keybindings are using the Master-Key as a modifier
45+
#define MASTER_KEY Mod4Mask
4746

48-
/* Application keybinds*/
49-
#define TERMINAL_OPEN_KEY XK_Return
47+
#define TERMINAL_OPEN_KEY XK_Return
5048
#define WEB_BROWSER_OPEN_KEY XK_W
5149
#define APPLICATION_LAUNCHER_OPEN_KEY XK_S
5250

53-
/* WM keybinds */
5451
#define WM_TERMINATE_KEY XK_C
5552

56-
/* Window keybinds */
5753
#define WINDOW_CLOSE_KEY XK_Q
5854
#define WINDOW_FULLSCREEN_KEY XK_F
5955
#define WINDOW_CYCLE_KEY XK_Tab
6056

61-
/* Window-Layout keybinds */
62-
#define WINDOW_ADD_TO_LAYOUT_KEY XK_space
63-
#define WINDOW_LAYOUT_CYCLE_UP_KEY XK_Up
57+
#define WINDOW_ADD_TO_LAYOUT_KEY XK_space
58+
#define WINDOW_LAYOUT_CYCLE_UP_KEY XK_Up
6459
#define WINDOW_LAYOUT_CYCLE_DOWN_KEY XK_Down
6560
#define WINDOW_LAYOUT_INCREASE_MASTER_KEY XK_L
6661
#define WINDOW_LAYOUT_DECREASE_MASTER_KEY XK_H
6762
#define WINDOW_LAYOUT_INCREASE_SLAVE_KEY XK_K
6863
#define WINDOW_LAYOUT_DECREASE_SLAVE_KEY XK_J
64+
#define WINDOW_LAYOUT_SET_MASTER_KEY XK_G
6965
#define WINDOW_LAYOUT_FLOATING_KEY XK_R
70-
#define WINDOW_LAYOUT_TILED_MASTER_KEY XK_T
71-
7266

7367
#define WINDOW_LAYOUT_TILED_MASTER_KEY XK_T
7468
#define WINDOW_LAYOUT_HORIZONTAL_MASTER_KEY XK_V
7569
#define WINDOW_LAYOUT_HORIZONTAL_STRIPES_KEY XK_X
7670
#define WINDOW_LAYOUT_VERTICAL_STRIPES_KEY XK_M
7771

78-
/* Window-Gap keybinds */
7972
#define WINDOW_GAP_INCREASE_KEY XK_plus
8073
#define WINDOW_GAP_DECREASE_KEY XK_minus
8174

82-
/* Bar keybinds*/
83-
#define BAR_TOGGLE_KEY XK_I
75+
#define BAR_TOGGLE_KEY XK_I
8476
#define BAR_CYCLE_MONITOR_UP_KEY XK_N
8577
#define BAR_CYCLE_MONITOR_DOWN_KEY XK_B
8678

87-
/* Decoration keyinds */
8879
#define DECORATION_TOGGLE_KEY XK_U
8980

9081
/* Desktops */
91-
/* In Ragnar, you can specify a unlimeted amount of desktops.
92-
* At the moment, you can only cycle desktops and windows through desktops
93-
* one by one. */
9482
#define DESKTOP_CYCLE_UP_KEY XK_D
9583
#define DESKTOP_CYCLE_DOWN_KEY XK_A
9684
#define DESKTOP_CLIENT_CYCLE_UP_KEY XK_P
9785
#define DESKTOP_CLIENT_CYCLE_DOWN_KEY XK_O
9886
#define DESKTOP_COUNT 6
9987

10088
/* Window properties */
101-
102-
#define WINDOW_BG_COLOR 0x32302f // Background color of the window frame (effectless when WINDOW_TRANSPARENT_FRAME=true)
103-
#define WINDOW_BORDER_WIDTH 3
104-
#define WINDOW_BORDER_COLOR 0x242424 // Color of window border for inactive windows
105-
#define WINDOW_BORDER_COLOR_ACTIVE 0x454545 // Color of window border for active windows
106-
#define WINDOW_MIN_SIZE_LAYOUT_VERTICAL 300 // Minimum height of a window in a layout
107-
#define WINDOW_MIN_SIZE_LAYOUT_HORIZONTAL 100 // Minimum width of a window in a layout
108-
#define WINDOW_MAX_COUNT_LAYOUT 5 // Maximum number of windows in a layout
109-
#define WINDOW_MAX_GAP 400 // Maximum amount of pixel-gap between windows in layout
110-
#define WINDOW_TRANSPARENT_FRAME true // If transparency with a compositer is used, enable this
111-
#define WINDOW_LAYOUT_DEFAULT WINDOW_LAYOUT_TILED_MASTER
89+
#define WINDOW_BG_COLOR 0x32302f
90+
#define WINDOW_BORDER_WIDTH 3 // In pixles
91+
#define WINDOW_BORDER_COLOR 0xa6719a
92+
#define WINDOW_BORDER_COLOR_ACTIVE 0xf2c9e9
93+
#define WINDOW_MAX_COUNT_LAYOUT 5
94+
#define WINDOW_MIN_SIZE_LAYOUT_HORIZONTAL 300
95+
#define WINDOW_MIN_SIZE_LAYOUT_VERTICAL 100 // In pixels
96+
#define WINDOW_MAX_GAP 100 // In pixels
97+
#define WINDOW_TRANSPARENT_FRAME true
98+
#define WINDOW_LAYOUT_DEFAULT WINDOW_LAYOUT_TILED_MASTER
11299

113100
/* Window decoration */
114-
115-
/*
116-
* ======================================
117-
* 1 -> | htop > < [=] X |
118-
* ================================^==^==
119-
* ^ | |
120-
* | 3 4
121-
* 2
122-
* 1: Decoration-title
123-
* This label displays the title of the window.
124-
* 2: Decoration-Titlebar
125-
* The bar that is added to the top of each window
126-
* if decoration is on. Window decorations are drawn
127-
* in the titlebar.
128-
* 3:
129-
* Fullscreen Button/Icon:
130-
* When left-clicked, fullscreen of the window gets toggled.
131-
* 4:
132-
* Close Button/Icon
133-
* When left-clicked, window closes.
134-
*
135-
* */
136-
#define SHOW_DECORATION true
137-
#define DECORATION_TITLEBAR_SIZE 30
138-
#define DECORATION_COLOR 0x2d2d2d // Color of the titlebar
139-
#define DECORATION_TITLE_COLOR 0x212121 // Color of the Decoration-title lable
140-
141-
/* Decoration - Close Icon */
142-
#define DECORATION_SHOW_CLOSE_ICON true
143-
#define DECORATION_CLOSE_ICON "X"
144-
#define DECORATION_CLOSE_ICON_COLOR 0x212121
101+
#define SHOW_DECORATION false
102+
#define DECORATION_TITLEBAR_SIZE 30
103+
#define DECORATION_COLOR 0x131020
104+
#define DECORATION_TITLE_COLOR 0x1a1823
105+
106+
#define DECORATION_SHOW_CLOSE_ICON true
107+
#define DECORATION_CLOSE_ICON ""
108+
#define DECORATION_CLOSE_ICON_COLOR 0x1a1823
145109
#define DECORATION_CLOSE_ICON_SIZE 50
146110

147-
/* Decoration - Maximize Icon */
148111
#define DECORATION_SHOW_MAXIMIZE_ICON true
149-
#define DECORATION_MAXIMIZE_ICON "Max"
150-
#define DECORATION_MAXIMIZE_ICON_COLOR 0x212121
112+
#define DECORATION_MAXIMIZE_ICON ""
113+
#define DECORATION_MAXIMIZE_ICON_COLOR 0x1a1823
151114
#define DECORATION_MAXIMIZE_ICON_SIZE 50
152115

116+
#define DECORATION_DESIGN_WIDTH 20
117+
#define DECORATION_ICONS_LABEL_DESIGN DESIGN_ROUND_LEFT
118+
#define DECORATION_TITLE_LABEL_DESIGN DESIGN_ROUND_RIGHT
119+
153120
/* Bar */
154121

155122
/*
@@ -163,58 +130,24 @@ static const Monitor Monitors[MONITOR_COUNT] = {(Monitor){.width = 1920, .heigh
163130
* the BarCommands about the WM like the current clicked execute Ragnar WM that is running
164131
* monitor or the current program. their given command.
165132
* */
166-
#define SHOW_BAR true
167-
#define BAR_SHOW_INFO_LABEL true
168-
#define BAR_SHOW_VERSION_LABEL true
169-
#define BAR_INSTANT_UPDATE true // Turning this off can save performace, as it only updates the bar if events happen
133+
#define SHOW_BAR true
134+
#define BAR_INSTANT_UPDATE true // Turning this off can save performace
170135

171-
#define BAR_SIZE 30
172-
#define BAR_PADDING_Y 10 // Amount of space left between most left point of the bar-monitor to bar & most right point of the bar-monitor
173-
#define BAR_PADDING_X 10 // Y offset from the uppest point of the bar-monitor to the bar
174-
#define BAR_START_MONITOR 1 // Monitor on which the bar is on. (0 is most left)
175-
#define BAR_COLOR 0x202020
176-
#define BAR_BORDER_COLOR 0x303030
177-
#define BAR_LABEL_PADDING 100 // Space between bar main label and info label
136+
#define BAR_SHOW_INFO_LABEL true
137+
#define BAR_SHOW_VERSION_LABEL true
178138

179-
#define BAR_MAIN_LABEL_COLOR 0x1e404f
180-
#define BAR_INFO_LABEL_COLOR 0x1e404f
181-
#define BAR_INFO_LABEL_SELECTED_COLOR 0x152d38
182-
#define BAR_VERSION_LABEL_COLOR 0x1e404f
139+
#define BAR_SIZE 40 // In pixels
140+
#define BAR_PADDING_Y 20
141+
#define BAR_PADDING_X 20
142+
#define BAR_START_MONITOR 1 // Monitor on which the bar is on startup. (0 is most left)
143+
#define BAR_REFRESH_SPEED 1.0 // In seconds
144+
#define BAR_COLOR 0x131020
145+
#define BAR_BORDER_COLOR 0x24273a
183146

184-
#define BAR_INFO_PROGRAM_ICON "Program: "
185-
#define BAR_INFO_MONITOR_ICON "Monitor: "
186-
#define BAR_INFO_DESKTOP_ICON "Desktop: "
187-
#define BAR_INFO_WINDOW_LAYOUT_ICON "Layout: "
188-
189-
#define BAR_SLICES_COUNT 1 // Amount of commands mapped to the bar
190-
191-
#define BAR_INFO_LABEL_DESKTOP_ICON_SIZE 50
192-
static const char* BarInfoLabelDesktopIcons[DESKTOP_COUNT] = { "1", "2", "3", "4", "5", "6" };
193-
static const uint32_t BarInfoLabelPos[MONITOR_COUNT] = {900, 700};
194-
/* Bar Commands */
195-
static BarCommand BarCommands[BAR_SLICES_COUNT] =
196-
{
197-
(BarCommand){.cmd = "echo \"$(date +%R) \"", .refresh_time = 1.0f},
198-
};
199-
200-
/* Bar buttons */
201-
#define BAR_BUTTON_PADDING 20
202-
#define BAR_BUTTON_COUNT 3 // Count of buttons on the bar-button-label
203-
#define BAR_BUTTON_SIZE 100
204-
static const uint32_t BarButtonLabelPos[MONITOR_COUNT] = { 1350, 1350 };
205-
static BarButton BarButtons[BAR_BUTTON_COUNT] =
206-
{
207-
(BarButton){.cmd = APPLICATION_LAUNCHER_CMD, .icon = "Search", .color = 0x1e404f},
208-
(BarButton){.cmd = TERMINAL_CMD, .icon = "Terminal", .color = 0x1e404f},
209-
(BarButton){.cmd = WEB_BROWSER_CMD, .icon = "Browser", .color = 0x1e404f},
210-
};
211-
212-
/* Designs */
213-
214-
/* --- DESIGNS --- */
147+
/* --- BAR DESIGNS --- */
215148
/* STAIGHT:
216149
* |
217-
* SHARP_LEFT_UP:
150+
* SHARP_LEFT_UP:
218151
* /-|
219152
* / |
220153
* /---|
@@ -230,7 +163,7 @@ static BarButton BarButtons[BAR_BUTTON_COUNT] =
230163
* |---/
231164
* | /
232165
* |-/
233-
* ARROW_LEFT:
166+
* ARROW_LEFT:
234167
* <
235168
* ARROW_RIGHT
236169
* >
@@ -239,22 +172,55 @@ static BarButton BarButtons[BAR_BUTTON_COUNT] =
239172
* ROUND_RIGHT
240173
* |)
241174
*/
175+
#define BAR_LABEL_DESIGN_WIDTH 20
176+
#define BAR_MAIN_LABEL_DESIGN DESIGN_ROUND_RIGHT
177+
#define BAR_INFO_LABEL_DESIGN_FRONT DESIGN_ROUND_LEFT
178+
#define BAR_INFO_LABEL_DESIGN_BACK DESIGN_ROUND_RIGHT
179+
#define BAR_VERSION_LABEL_DESIGN DESIGN_ROUND_LEFT
180+
181+
182+
#define BAR_MAIN_LABEL_COLOR 0xf3bce6
183+
#define BAR_INFO_LABEL_COLOR 0xf3bce6
184+
#define BAR_INFO_LABEL_SELECTED_COLOR 0xc99bbe
185+
#define BAR_VERSION_LABEL_COLOR 0xf3bce6
242186

243-
#define DECORATION_DESIGN_WIDTH 20 // Amount of pixels to the most outer part of the decoration design
244-
#define DECORATION_ICONS_LABEL_DESIGN DESIGN_ARROW_LEFT
245-
#define DECORATION_TITLE_LABEL_DESIGN DESIGN_ARROW_RIGHT
187+
#define BAR_INFO_PROGRAM_ICON ""
188+
#define BAR_INFO_MONITOR_ICON "󰍹"
189+
#define BAR_INFO_DESKTOP_ICON ""
190+
#define BAR_INFO_WINDOW_LAYOUT_ICON ""
191+
192+
#define BAR_SLICES_COUNT 5
193+
194+
#define BAR_INFO_LABEL_DESKTOP_ICON_SIZE 50
195+
static const char* BarInfoLabelDesktopIcons[DESKTOP_COUNT] = { "", "", "", "", "", "" };
196+
static const uint32_t BarInfoLabelPos[MONITOR_COUNT] = {900, 700};
197+
static BarCommand BarCommands[BAR_SLICES_COUNT] =
198+
{
199+
(BarCommand){.cmd = "echo \" 󰣇\"", .refresh_time = 300.0f},
200+
(BarCommand){.cmd = "echo \" $(date +%R) \"", .refresh_time = 1.0f},
201+
(BarCommand){.cmd = "ram-ragbar", .refresh_time = 1.0f,},
202+
(BarCommand){.cmd = "uptime-ragbar", .refresh_time = 1.0f},
203+
(BarCommand){.cmd = "packages-ragbar", .refresh_time = 60.0f},
204+
};
205+
206+
#define BAR_BUTTON_PADDING 20
207+
#define BAR_BUTTON_SIZE 50
208+
#define BAR_BUTTON_COUNT 4
209+
static const uint32_t BarButtonLabelPos[MONITOR_COUNT] = { 1350, 1600 };
210+
static BarButton BarButtons[BAR_BUTTON_COUNT] =
211+
{
212+
(BarButton){.cmd = APPLICATION_LAUNCHER_CMD, .icon = "", .color = 0xf3bce6},
213+
(BarButton){.cmd = TERMINAL_CMD, .icon = "", .color = 0xf3bce6},
214+
(BarButton){.cmd = WEB_BROWSER_CMD, .icon = "", .color = 0xf3bce6},
215+
(BarButton){.cmd = "nitrogen &", .icon = "", .color = 0xf3bce6},
216+
};
246217

247-
#define BAR_LABEL_DESIGN_WIDTH 20 // Amount of pixels to the most outer part of the bar design
248-
#define BAR_MAIN_LABEL_DESIGN DESIGN_ARROW_RIGHT
249-
#define BAR_INFO_LABEL_DESIGN_FRONT DESIGN_ARROW_LEFT
250-
#define BAR_INFO_LABEL_DESIGN_BACK DESIGN_ARROW_RIGHT
251-
#define BAR_VERSION_LABEL_DESIGN DESIGN_ARROW_LEFT
252218

253219
/* Scratchpads */
254-
#define SCRATCH_PAD_COUNT 2
220+
#define SCRATCH_PAD_COUNT 2
255221
static ScratchpadDef ScratchpadDefs[SCRATCH_PAD_COUNT] =
256222
{
257-
(ScratchpadDef){.cmd = "alacritty &", .key = XK_1},
258-
(ScratchpadDef){.cmd = "alacritty -e vim &", .key = XK_2},
223+
(ScratchpadDef){.cmd = "alacritty &", .key = XK_1},
224+
(ScratchpadDef){.cmd = "alacritty -e mocp &", .key = XK_2},
259225
};
260226

ragnar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void xwm_window_frame(Window win) {
199199
win_frame = XCreateSimpleWindow(wm.display, wm.root, win_x, (Monitors[wm.focused_monitor].height / 2) - (attribs.height / 2),
200200
attribs.width, attribs.height, WINDOW_BORDER_WIDTH, WINDOW_BORDER_COLOR, WINDOW_BG_COLOR);
201201
}
202-
XSelectInput(wm.display, win_frame, SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | PointerMotionMask);
202+
XSelectInput(wm.display, win_frame, SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask);
203203
XReparentWindow(wm.display, win, win_frame, 0, ((SHOW_DECORATION && !wm.decoration_hidden && !wm.spawning_scratchpad) ? DECORATION_TITLEBAR_SIZE : 0));
204204
if(!wm.spawning_scratchpad && SHOW_DECORATION && !wm.decoration_hidden) {
205205
XResizeWindow(wm.display, win, attribs.width,attribs.height - DECORATION_TITLEBAR_SIZE);

0 commit comments

Comments
 (0)