mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 13:25:42 +03:00
default workspace option
This commit is contained in:
parent
50370e4216
commit
2e18fa268a
@ -4,6 +4,7 @@
|
||||
# Refer to the wiki for more information.
|
||||
|
||||
monitor=,1280x720@60,0x0,0.5,1
|
||||
workspace=DP-1,1
|
||||
|
||||
general {
|
||||
max_fps=240
|
||||
@ -16,3 +17,7 @@ general {
|
||||
col.active_border=0x66ee1111
|
||||
col.inactive_border=0x66333333
|
||||
}
|
||||
|
||||
bind=SUPER,T,exec,xterm
|
||||
bind=SUPER,Q,killactive,
|
||||
bind=SUPERSHIFT,Q,exec,pkill Hyprland
|
@ -156,6 +156,19 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
|
||||
g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND});
|
||||
}
|
||||
|
||||
void CConfigManager::handleDefaultWorkspace(const std::string& command, const std::string& value) {
|
||||
|
||||
const auto DISPLAY = value.substr(0, value.find_first_of(','));
|
||||
const auto WORKSPACEID = stoi(value.substr(value.find_first_of(',') + 1));
|
||||
|
||||
for (auto& mr : m_dMonitorRules) {
|
||||
if (mr.name == DISPLAY) {
|
||||
mr.defaultWorkspaceID = WORKSPACEID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConfigManager::parseLine(std::string& line) {
|
||||
// first check if its not a comment
|
||||
const auto COMMENTSTART = line.find_first_of('#');
|
||||
@ -207,9 +220,11 @@ void CConfigManager::parseLine(std::string& line) {
|
||||
} else if (COMMAND == "bind") {
|
||||
handleBind(COMMAND, VALUE);
|
||||
return;
|
||||
} else if (COMMAND == "workspace") {
|
||||
handleDefaultWorkspace(COMMAND, VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ struct SMonitorRule {
|
||||
float mfact = 0.5;
|
||||
float scale = 1;
|
||||
float refreshRate = 60;
|
||||
int defaultWorkspaceID = -1;
|
||||
};
|
||||
|
||||
class CConfigManager {
|
||||
@ -55,6 +56,7 @@ private:
|
||||
void handleRawExec(const std::string&, const std::string&);
|
||||
void handleMonitor(const std::string&, const std::string&);
|
||||
void handleBind(const std::string&, const std::string&);
|
||||
void handleDefaultWorkspace(const std::string&, const std::string&);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CConfigManager> g_pConfigManager;
|
@ -72,7 +72,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
||||
g_pCompositor->m_lWorkspaces.push_back(SWorkspace());
|
||||
const auto PNEWWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
||||
|
||||
PNEWWORKSPACE->ID = g_pCompositor->m_lWorkspaces.size();
|
||||
PNEWWORKSPACE->ID = monitorRule.defaultWorkspaceID == -1 ? g_pCompositor->m_lWorkspaces.size() : monitorRule.defaultWorkspaceID;
|
||||
PNEWWORKSPACE->monitorID = newMonitor.ID;
|
||||
|
||||
newMonitor.activeWorkspace = PNEWWORKSPACE->ID;
|
||||
|
Loading…
Reference in New Issue
Block a user