better workspace indicator styling
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 4.2.0)
|
cmake_minimum_required(VERSION 4.2.0)
|
||||||
project(bar)
|
project(bar)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
@@ -9,6 +9,18 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
|||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
# Some CMake versions may enable C++ modules and add compiler flags
|
||||||
|
# like `-fmodules-ts`. Older or certain `clang`/`clangd` builds may
|
||||||
|
# not accept this flag and will report "Unknown argument: '-fmodules-ts'".
|
||||||
|
# Strip that flag when using Clang to avoid diagnostics from clang/clangd.
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
|
||||||
|
string(REPLACE "-fmodules-ts" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "-fmodules-ts" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
|
string(REPLACE "-fmodules-ts" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
string(REPLACE "-fmodules-ts" "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||||
|
string(REPLACE "-fmodules-ts" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
|
endif()
|
||||||
|
|
||||||
pkg_check_modules(GTKMM REQUIRED gtkmm-4.0)
|
pkg_check_modules(GTKMM REQUIRED gtkmm-4.0)
|
||||||
pkg_check_modules(LAYERSHELL REQUIRED gtk4-layer-shell-0)
|
pkg_check_modules(LAYERSHELL REQUIRED gtk4-layer-shell-0)
|
||||||
|
|
||||||
@@ -34,3 +46,19 @@ include_directories(bar_lib PRIVATE
|
|||||||
add_executable(bar main.cpp)
|
add_executable(bar main.cpp)
|
||||||
|
|
||||||
target_link_libraries(bar bar_lib ${GTKMM_LIBRARIES} ${LAYERSHELL_LIBRARIES})
|
target_link_libraries(bar bar_lib ${GTKMM_LIBRARIES} ${LAYERSHELL_LIBRARIES})
|
||||||
|
|
||||||
|
# Copy `resources/bar.css` into the build directory when it changes
|
||||||
|
set(RES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/bar.css")
|
||||||
|
set(RES_DST "${CMAKE_CURRENT_BINARY_DIR}/resources/bar.css")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${RES_DST}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/resources"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${RES_SRC}" "${RES_DST}"
|
||||||
|
DEPENDS "${RES_SRC}"
|
||||||
|
COMMENT "Copy resources/bar.css to build directory"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(copy_resources ALL DEPENDS ${RES_DST})
|
||||||
|
add_dependencies(bar copy_resources)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.workspace-pill {
|
.workspace-pill {
|
||||||
background-color: rgba(255, 255, 255, 0.12);
|
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@@ -29,11 +28,11 @@ window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.workspace-pill-focused {
|
.workspace-pill-focused {
|
||||||
background-color: rgba(255, 255, 255, 0.18);
|
background-color: rgba(104, 104, 104, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspace-pill-active {
|
.workspace-pill-active {
|
||||||
background-color: rgba(255, 255, 255, 0.25);
|
background-color: rgba(168, 168, 168, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspace-pill-urgent {
|
.workspace-pill-urgent {
|
||||||
@@ -43,7 +42,7 @@ window {
|
|||||||
|
|
||||||
/* Hover effect: slightly brighten background and show pointer */
|
/* Hover effect: slightly brighten background and show pointer */
|
||||||
.workspace-pill:hover {
|
.workspace-pill:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.20);
|
background-color: rgba(255, 255, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tray-icon {
|
.tray-icon {
|
||||||
|
|||||||
@@ -348,30 +348,8 @@ void HyprlandService::switchToWorkspace(int monitorId, int slot)
|
|||||||
auto wsIt = monitor.workspaceStates.find(slot);
|
auto wsIt = monitor.workspaceStates.find(slot);
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
|
|
||||||
if (wsIt != monitor.workspaceStates.end() && wsIt->second.hyprId >= 0)
|
|
||||||
{
|
|
||||||
// Use the Hyprland workspace id if available
|
// Use the Hyprland workspace id if available
|
||||||
cmd = "hyprctl dispatch workspace " + std::to_string(wsIt->second.hyprId);
|
cmd = "hyprctl dispatch workspace " + std::to_string(wsIt->second.hyprId);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Fallback: ask Hyprland to switch/create a workspace on the monitor
|
|
||||||
// by using the slot number and the monitor name. Syntax: "<slot>:<monitor>"
|
|
||||||
// Example: hyprctl dispatch workspace 2:DP-1
|
|
||||||
// This may vary by Hyprland version; if it doesn't work on your system
|
|
||||||
// adjust the command accordingly.
|
|
||||||
std::string monName = monitor.name;
|
|
||||||
if (monName.empty())
|
|
||||||
{
|
|
||||||
// As a last resort, just try the slot number globally
|
|
||||||
cmd = "hyprctl dispatch workspace " + std::to_string(slot);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Quote monitor name in case it contains spaces
|
|
||||||
cmd = "hyprctl dispatch workspace " + std::to_string(slot) + ":\"" + monName + "\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user