├── .gitignore ├── LICENSE ├── PKGBUILD ├── README.md ├── dsystray ├── systray.cpp ├── systray.h ├── trayicon.cpp └── trayicon.h ├── epager ├── pager.cpp └── pager.h ├── etaskbar ├── dactiontaskbar.cpp ├── dactiontaskbar.h ├── dtaskbarwidget.cpp └── dtaskbarwidget.h ├── etc └── xdg │ └── qobbar │ ├── blocks.sh │ └── qobbar.conf ├── ewindow ├── activewindow.cpp └── activewindow.h ├── example ├── blueGree.conf ├── bspwm_bot.conf ├── bspwm_top.conf ├── gento.conf ├── greenbar.conf ├── myconkyrc ├── qobbar1.png ├── qobbar2.jpg ├── qobbar3.jpg ├── qobbar4.png └── qobbar5.jpg ├── main.cpp ├── panel_adaptor.cpp ├── panel_adaptor.h ├── panelapplication.cpp ├── panelapplication.h ├── panelwidget.cpp ├── panelwidget.h ├── panelwidget.ui ├── qobbar.pro ├── status ├── conkystatu.cpp ├── conkystatu.h ├── statuslabel.cpp └── statuslabel.h └── utils ├── defines.cpp ├── defines.h ├── setting.cpp ├── setting.h ├── stylecolors.cpp ├── stylecolors.h ├── x11utills.cpp ├── x11utills.h ├── xdesktoputils.cpp └── xdesktoputils.h /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.dll 10 | *.dylib 11 | 12 | # Qt-es 13 | object_script.*.Release 14 | object_script.*.Debug 15 | *_plugin_import.cpp 16 | /.qmake.cache 17 | /.qmake.stash 18 | *.pro.user 19 | *.pro.user.* 20 | *.qbs.user 21 | *.qbs.user.* 22 | *.moc 23 | moc_*.cpp 24 | moc_*.h 25 | qrc_*.cpp 26 | ui_*.h 27 | *.qmlc 28 | *.jsc 29 | Makefile* 30 | *build-* 31 | 32 | # Qt unit tests 33 | target_wrapper.* 34 | 35 | # QtCreator 36 | *.autosave 37 | 38 | # QtCreator Qml 39 | *.qmlproject.user 40 | *.qmlproject.user.* 41 | 42 | # QtCreator CMake 43 | CMakeLists.txt.user* 44 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # This is an example PKGBUILD file. Use this as a start to creating your own, 2 | # and remove these comments. For more information, see 'man PKGBUILD'. 3 | # NOTE: Please fill out the license field for your package! If it is unknown, 4 | # then please put 'unknown'. 5 | #Maintainer: Abouzakaria 6 | pkgname=qobbar 7 | pkgver=0.2.1 8 | pkgrel=1 9 | epoch= 10 | pkgdesc="" 11 | arch=( 'x86_64') 12 | url="" 13 | license=('GPL') 14 | groups=() 15 | depends=('libx11' 'libxcomposite' 'libxdamage' 'qt5-x11extras' 'qt5-base' ) 16 | makedepends=() 17 | checkdepends=() 18 | optdepends=() 19 | provides=() 20 | conflicts=() 21 | replaces=() 22 | backup=() 23 | options=() 24 | install= 25 | changelog= 26 | source=("https://github.com/zakariakov/qobbar/archive/0.2.1.tar.gz" ) 27 | 28 | noextract=() 29 | md5sums=("SKIP") 30 | validpgpkeys=() 31 | 32 | prepare() { 33 | cd "$pkgname-$pkgver" 34 | 35 | } 36 | 37 | build() { 38 | cd "$srcdir/$pkgname-$pkgver" 39 | qmake "qobbar.pro" \ 40 | PREFIX=/usr \ 41 | QMAKE_CFLAGS_RELEASE="${CFLAGS}"\ 42 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" 43 | make 44 | } 45 | 46 | check() { 47 | cd "$pkgname-$pkgver" 48 | make -k check 49 | } 50 | 51 | package() { 52 | cd "$pkgname-$pkgver" 53 | make DESTDIR="$pkgdir/" install 54 | 55 | 56 | make INSTALL_ROOT="${pkgdir}"/ install || return 1 57 | find "$pkgdir" -type d -print0 | xargs -0 chmod -R 755 58 | find "$pkgdir" -type f -print0 | xargs -0 chmod -R 644 59 | chmod 755 "$pkgdir/usr/bin/qobbar" 60 | 61 | } 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # qobbar 2 | 3 | ![Screenshots](https://github.com/zakariakov/qobbar/blob/master/example/qobbar3.jpg) 4 | 5 | ![Screenshots](https://github.com/zakariakov/qobbar/blob/master/example/qobbar4.png) 6 | 7 | ![Screenshots](https://github.com/zakariakov/qobbar/blob/master/example/qobbar1.png) 8 | 9 | ![Screenshots](https://github.com/zakariakov/screenshots/blob/master/qobbar-gento.png) 10 | 11 | ![Screenshots](https://github.com/zakariakov/qobbar/blob/master/example/qobbar2.jpg) 12 | 13 | ![Screenshots](https://github.com/zakariakov/qobbar/blob/master/example/qobbar5.jpg) 14 | 15 | ### Dependencies 16 | 17 | - libX11 18 | - libXcomposite 19 | - libXdamage 20 | - libQt5X11Extras 21 | - libQt5Widgets 22 | - libQt5Gui 23 | - libQt5Concurrent 24 | - libQt5DBus 25 | - libQt5Core 26 | - libGL 27 | - libpthread 28 | 29 | 30 | ### Building from source 31 | 32 | 33 | ~~~ sh 34 | $ git clone https://github.com/zakariakov/qobbar.git 35 | $ cd qobbar 36 | $ qmake 37 | $ make 38 | $ sudo make install 39 | ~~~ 40 | 41 | ### Configuration 42 | 43 | The configuration uses the NativeFormat CONF file format. 44 | 45 | The default SystemScope paths "/etc/xdg/qobbar/qobbar.conf" 46 | 47 | The default UserScope paths "$HOME/.config/qobbar/qobbar.conf" 48 | 49 | to create user configuration 50 | 51 | ~~~ sh 52 | $ mkdir -p "$HOME/.config/qobbar" 53 | $ cp /etc/xdg/qobbar/qobbar.conf $HOME/.config/qobbar 54 | ~~~ 55 | 56 | or create any configuration file in "$HOME/.config/qobbar" 57 | 58 | the suffix ".conf" is obligatoire ex;"myconf.conf" 59 | 60 | ### Running the app 61 | 62 | ~~~ sh 63 | "Usage: qobbar [OPTION]" 64 | "qobbar v: 0.1 " 65 | "OPTION:" 66 | " -h --help Print this help." 67 | " -c --config config file name." 68 | " ex: create file in $HOME/.config/qobbar/top-bar.conf " 69 | " run \"qobbar -c top-bar\" ." 70 | " -d --debug Print debug in termminal." 71 | " -r --right right-to-left layout direction." 72 | " -s --showhide show or hide bar. ex: qobbar -c top-bar -s" 73 | " -l --list Print list of available modules." 74 | ~~~ 75 | 76 | to run the default configuration just run "qobbar". 77 | 78 | or cp any configuration in the example folder to $HOME/.config/qobbar. 79 | 80 | to run any configuration ex: top-bar.conf run "qobbar -c top-bar". 81 | 82 | ### Available modules 83 | 84 | ~~~ sh 85 | Colors configured using this name 'Colors'. 86 | Panel configured using this name 'Panel'. 87 | Pager configured using this name 'Pager'. 88 | Taskbar configured using this name 'Taskbar'. 89 | Conky configured using this name 'Conky'. 90 | Statu configured using any name ex: 'Cpu' 'Mem'. 91 | ActiveWindow configured using this name 'ActiveWindow'. 92 | ~~~ 93 | 94 | ### Available token 95 | 96 | #### Colors 97 | 98 | ~~~ sh 99 | - Variable color 100 | [Colors] 101 | BgColor=#161925 102 | FgColor=xrdb.color7 103 | - ---------------------- 104 | [Panel] 105 | Background=$BgColor 106 | Foreground=$FgColor 107 | ~~~ 108 | 109 | #### Common 110 | 111 | ~~~ sh 112 | - Background color Hex or xrdb.color 113 | - Foreground color Hex or xrdb.color 114 | - Underline color Hex or xrdb.color 115 | - Overline color Hex or xrdb.color 116 | to get color from Xresource 117 | ex: 'Background=xrdb.background' 118 | ex: 'Overline=xrdb.color5' 119 | 120 | - Border default=0 121 | - BorderRadius default 0 122 | - Alpha 0-to-255 default=255 123 | - FontName default parent fontfamily 124 | - FontSize default parent font size 125 | - FontBold default window fontbold 126 | ~~~ 127 | 128 | #### Panel 129 | 130 | ~~~ sh 131 | - Monitor default 0 132 | - Top panel top or bottom default=true 133 | - BorderColor color Hex or xrdb.color 134 | - BarLeft Ex:statu1,statu2 135 | - BarCenter Ex:Time,Date 136 | - BarRight Ex:Pager 137 | - To repeat the same statu, add ":" and then a number 138 | - Ex: BarLeft=Sep:1,Cpu,Sep:2,Mem,Sep:3,Wifi 139 | - BarLeftSpacing default=0 140 | - BarRightSpacing default=0 141 | - BarCenterSpacing default=0 142 | - MarginLeft default=0 143 | - MarginTop default=0 144 | - MarginRight default=0 145 | - MarginBottom default=0 146 | - Systray default=false 147 | 148 | -----padding has no effect in tilling i3wm ----- 149 | - PaddingBottom default=0 150 | - PaddingLeft default=0 151 | - PaddingRight default=0 152 | - PaddingTop default=0 153 | 154 | ~~~ 155 | 156 | 157 | #### Pager and Taskbar 158 | 159 | ~~~ sh 160 | - ActiveBackground default window highlight 161 | - ActiveAlpha 0-to-255 default=255 162 | - ActiveForeground default window highlightText 163 | - ActiveUnderline color Hex or xrdb.color 164 | - ActiveOverline color Hex or xrdb.color 165 | ~~~ 166 | 167 | #### Pager 168 | 169 | ~~~ sh 170 | - DesktopDesplay "name" "index" "icon" default=index 171 | icon-[0-9] ex: home,office,multimedia, 172 | NOTE: The desktop name needs to match the name configured by the WM 173 | You can get a list of the defined desktops using: 174 | $ xprop -root _NET_DESKTOP_NAMES 175 | 176 | - IconsList list of icon 0 to 9 ex: home,office,multimedia,... 177 | - ActiveIcon if DesktopDesplay==icon default=NULL 178 | ~~~ 179 | 180 | #### Conky 181 | 182 | ~~~ sh 183 | - Command Command to desplay 184 | Ex:Command=conky -c ~/conky/myconkyrc 185 | ~~~ 186 | #### ActiveWindow 187 | 188 | ~~~ sh 189 | -CloseColor color Hex or xrdb.color 190 | -MaxColor color Hex or xrdb.color 191 | -MinColor color Hex or xrdb.color 192 | -CloseText default="x" 193 | -MaxText default="+" 194 | -MinText default="-" 195 | 196 | ~~~ 197 | #### Status 198 | 199 | ~~~ sh 200 | - Command Command to desplay 201 | - Interval second default 1 202 | - MaxSize default 100 203 | - MinSize default 0 204 | - Label default $Command ex:"  $Command " 205 | - ClickLeft Command to exec 206 | - ClickRight Command to exec 207 | - MouseWheelUp Command to exec 208 | - MouseWheelDown Command to exec 209 | ~~~ 210 | 211 | 212 | ### Example 213 | ~~~ sh 214 | [Panel] 215 | BarLeft=Button,Pager 216 | BarCenter=Taskbar 217 | BarRight=Cpu,Time 218 | Top=true 219 | Background=#000000 220 | ;Foreground=xrdb.foreground 221 | Alpha=150 222 | Systray=true 223 | 224 | [Pager] 225 | #ActiveBackground=#ffffff 226 | ActiveForeground=#ffffff 227 | ActiveOverline=#ffff00 228 | DesktopDesplay="icon" 229 | IconsList=,,,,,, 230 | ActiveIcon= 231 | Foreground=#8A8383 232 | Border=1 233 | ActiveAlpha=0 234 | 235 | [Taskbar] 236 | ActiveForeground=#FFFFFF 237 | ActiveOverline=#1E90FF 238 | ActiveBackground=#ffffff 239 | ActiveAlpha=20 240 | Border=1 241 | 242 | [Time] 243 | Interval=12 244 | Command="date +%H:%M\--%d/%m/%y" 245 | Label="" 246 | FontBold=true 247 | ClickLeft="zenity --calendar" 248 | 249 | [Cpu] 250 | ;Command=$HOME/.config/qobbar/blocks.sh 1 251 | Command=$HOME/.config/scripts/cpu_usage 252 | Interval=2 253 | Label= " " 254 | Foreground=#FFFFFF 255 | Overline=#ED163D 256 | Border=1 257 | 258 | [Button] 259 | Label= 260 | ClickLeft= qobmenu 261 | Underline=#FF3A00 262 | ;Overline=#40BF4D 263 | Border=1 264 | Foreground=xrdb.foreground 265 | ~~~ 266 | 267 | ### Conky Example 268 | ~~~ sh 269 | myconkyrc file 270 | 271 | conky.config = { 272 | out_to_x = false, 273 | own_window = false, 274 | out_to_console = true, 275 | background = false, 276 | update_interval = 5.0, 277 | temperature_unit = celsius, 278 | }; 279 | 280 | conky.text = [[ 281 |      ${time %a %d %b %Y}    ${time %H:%M}\ 282 |    ${uptime_short} \ 283 |    ${battery BAT1} \ 284 |    ${acpitemp} \ 285 |    ${memperc}% \ 286 |    ${cpu cpu}% \ 287 |     ${upspeedf wlp2s0}  ${downspeedf wlp2s0} \ 288 | ]]; 289 | 290 | ............... 291 | qobbar.conf 292 | ............... 293 | [Conky] 294 | Command=conky -c $HOME/.config/qobbar/myconkyrc 295 | Background=xrdb.color0 296 | FontName="xos4 Terminus" 297 | .............. 298 | ~~~ 299 | 300 | NOTE : to use this qobmenu [**@zakariakov**](https://github.com/zakariakov/qobmenu) 301 | 302 | or jgmenu (https://github.com/johanmalm/jgmenu) 303 | 304 | 305 | -------------------------------------------------------------------------------- /dsystray/systray.cpp: -------------------------------------------------------------------------------- 1 | 2 | /******************************************************************** 3 | *(c)GPL3+ 4 | Inspired by freedesktops tint2 5 | original code http://razor-qt.org 6 | modified by abou zakaria 7 | *********************************************************************/ 8 | // 9 | 10 | 11 | #include "systray.h" 12 | #include "utils/stylecolors.h" 13 | #include "utils/defines.h" 14 | #include "utils/setting.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "utils/x11utills.h" 23 | #include 24 | 25 | #define SYSTEM_TRAY_REQUEST_DOCK 0 26 | #define SYSTEM_TRAY_BEGIN_MESSAGE 1 27 | #define SYSTEM_TRAY_CANCEL_MESSAGE 2 28 | 29 | #define XEMBED_EMBEDDED_NOTIFY 0 30 | #define XEMBED_MAPPED (1 << 0) 31 | 32 | 33 | QSize getIconSize(QSize size) 34 | { 35 | int mSize=qMin(size.width(), size.height()); 36 | if(mSize<22) 37 | return QSize(16,16); 38 | else if(mSize<32) 39 | return QSize(22,22); 40 | else if(mSize<48) 41 | return QSize(32,32); 42 | 43 | return QSize(16,16); 44 | } 45 | 46 | SysTray::SysTray(QWidget *parent): 47 | QWidget(parent), 48 | // mSetting(s), 49 | mValid(false), 50 | mTrayId(0), 51 | mDamageEvent(0), 52 | mDamageError(0), 53 | mIconSize(TRAY_ICON_SIZE_DEFAULT, TRAY_ICON_SIZE_DEFAULT), 54 | mDisplay(QX11Info::display()) 55 | { 56 | 57 | QFontMetrics fm(parent->font()); 58 | int size=fm.height(); 59 | mIconSize=getIconSize(QSize(size,size)); 60 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__ << "IconSize:\033[0m"<font().pointSize()); 63 | // setFont(font); 64 | setContentsMargins(0,0,0,0); 65 | mWidgetContent=new QWidget; 66 | mWidgetContent->setObjectName("WWidgetContent"); 67 | mWidgetContent->setContentsMargins(0,0,0,0); 68 | mWidgetContent->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); 69 | 70 | QHBoxLayout *Layout = new QHBoxLayout(this); 71 | Layout->setSpacing(0); 72 | Layout->setContentsMargins(0, 0, 0, 0); 73 | Layout->setObjectName(QString::fromUtf8("horizontalLayout")); 74 | Layout->addWidget(mWidgetContent); 75 | 76 | mLayout = new QHBoxLayout(mWidgetContent); 77 | mLayout->setContentsMargins(3,0,3,0); 78 | mLayout->setSpacing(3); 79 | setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); 80 | 81 | _NET_SYSTEM_TRAY_OPCODE = X11UTILLS::atom("_NET_SYSTEM_TRAY_OPCODE"); 82 | 83 | //qApp->installNativeEventFilter(this); 84 | // Init the selection later just to ensure that no signals are sent until 85 | // after construction is done and the creating object has a chance to connect. 86 | // QTimer::singleShot(1500, this, SLOT(startTray())); 87 | startTray(); 88 | loadSettings(); 89 | } 90 | 91 | 92 | /************************************************ 93 | 94 | ************************************************/ 95 | SysTray::~SysTray() 96 | { 97 | stopTray(); 98 | } 99 | 100 | //__________________________________________________________________________________ 101 | void SysTray::loadSettings() 102 | { 103 | //if(mdebug) qDebug()<<" [+] "<<__FILE__<< __LINE__<<"loadSettings()"; 104 | 105 | 106 | //_________________________________________________ Settings 107 | 108 | if(!Setting::instance()->childGroups().contains(MSYSTRAY)) return; 109 | Setting::instance()->beginGroup(MSYSTRAY); 110 | 111 | QString bgColor =Setting::background(); 112 | int alpha =Setting::alpha();// 113 | QString underline =Setting::underline(); 114 | QString overline =Setting::overline(); 115 | int border =Setting::border(); 116 | QString borderColor =Setting::borderColor(); 117 | int radius =Setting::radius(); 118 | int leftTopRadius =Setting::leftTopRadius(); 119 | int rightTopRadius =Setting::rightTopRadius(); 120 | int leftBotRadius =Setting::leftBottomRadius(); 121 | int rightBotRadius =Setting::rightBottomRadius(); 122 | 123 | //_________________________________________________ INIT 124 | Setting::instance()->endGroup(); 125 | 126 | //-------------------------------------------------------STYLESHEET 127 | 128 | int RadiusSize=radius; 129 | RadiusSize=qMax(RadiusSize,leftTopRadius); 130 | RadiusSize=qMax(RadiusSize,rightTopRadius); 131 | RadiusSize=qMax(RadiusSize,leftBotRadius); 132 | RadiusSize=qMax(RadiusSize,rightBotRadius); 133 | 134 | if(RadiusSize>0){ 135 | mWidgetContent->setContentsMargins((RadiusSize/2)+1,0,(RadiusSize/2)+1,0); 136 | } 137 | 138 | // mWidgetContent->setContentsMargins((radius+1),0,(radius+1),0); 139 | 140 | QString mStylebg="QWidget#WWidgetContent{"; 141 | mStylebg+=StyleColors::style(bgColor,QString(),underline,overline,border,alpha,borderColor,radius, 142 | leftTopRadius, 143 | rightTopRadius, 144 | leftBotRadius, 145 | rightBotRadius 146 | )+"\n}"; 147 | setStyleSheet(mStylebg); 148 | 149 | 150 | } 151 | 152 | 153 | /************************************************ 154 | 155 | ************************************************/ 156 | void SysTray::setNativeEventFilter(const QByteArray &eventType, void *message, long *) 157 | { 158 | 159 | 160 | if (eventType != "xcb_generic_event_t") 161 | return ; 162 | 163 | xcb_generic_event_t* event = static_cast(message); 164 | 165 | TrayIcon* icon; 166 | int event_type = event->response_type & ~0x80; 167 | 168 | switch (event_type) 169 | { 170 | case ClientMessage: 171 | clientMessageEvent(event); 172 | break; 173 | 174 | case DestroyNotify: { 175 | unsigned long event_window; 176 | event_window = reinterpret_cast(event)->window; 177 | icon = findIcon(event_window); 178 | if (icon) 179 | { 180 | icon->windowDestroyed(event_window); 181 | mIcons.removeAll(icon); 182 | delete icon; 183 | } 184 | break; 185 | } 186 | default: 187 | if (event_type == mDamageEvent + XDamageNotify) 188 | { 189 | xcb_damage_notify_event_t* dmg = reinterpret_cast(event); 190 | icon = findIcon(dmg->drawable); 191 | if (icon) 192 | icon->update(); 193 | } 194 | break; 195 | } 196 | 197 | // return false; 198 | } 199 | 200 | 201 | 202 | 203 | /************************************************ 204 | 205 | ************************************************/ 206 | void SysTray::clientMessageEvent(xcb_generic_event_t *e) 207 | { 208 | unsigned long opcode; 209 | unsigned long message_type; 210 | Window id; 211 | xcb_client_message_event_t* event = reinterpret_cast(e); 212 | uint32_t* data32 = event->data.data32; 213 | message_type = event->type; 214 | opcode = data32[1]; 215 | if(message_type != _NET_SYSTEM_TRAY_OPCODE) 216 | return; 217 | 218 | switch (opcode) 219 | { 220 | case SYSTEM_TRAY_REQUEST_DOCK: 221 | id = data32[2]; 222 | if (id) 223 | addIcon(id); 224 | break; 225 | 226 | 227 | case SYSTEM_TRAY_BEGIN_MESSAGE: 228 | case SYSTEM_TRAY_CANCEL_MESSAGE: 229 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__ << "we don't show balloon messages.\033[0m"; 230 | break; 231 | 232 | 233 | default: 234 | // if (opcode == xfitMan().atom("_NET_SYSTEM_TRAY_MESSAGE_DATA")) 235 | // qDebug() << "message from dockapp:" << e->data.b; 236 | // else 237 | // qDebug() << "SYSTEM_TRAY : unknown message type" << opcode; 238 | break; 239 | } 240 | } 241 | 242 | /************************************************ 243 | 244 | ************************************************/ 245 | TrayIcon* SysTray::findIcon(Window id) 246 | { 247 | foreach(TrayIcon* icon, mIcons) 248 | { 249 | if (icon->iconId() == id || icon->windowId() == id) 250 | return icon; 251 | } 252 | return nullptr; 253 | } 254 | 255 | 256 | /************************************************ 257 | 258 | ************************************************/ 259 | void SysTray::setIconSize(QSize iconSize) 260 | { 261 | 262 | 263 | mIconSize = getIconSize(iconSize); 264 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__ << "IconSize:\033[0m"<type == PictTypeDirect && 302 | // format->direct.alphaMask) 303 | // { 304 | visualId = xvi[i].visualid; 305 | break; 306 | // } 307 | } 308 | XFree(xvi); 309 | } 310 | 311 | return visualId; 312 | } 313 | 314 | 315 | /************************************************ 316 | freedesktop systray specification 317 | ************************************************/ 318 | void SysTray::startTray() 319 | { 320 | Display* dsp = mDisplay; 321 | Window root = QX11Info::appRootWindow(); 322 | 323 | QString s = QString("_NET_SYSTEM_TRAY_S%1").arg(DefaultScreen(dsp)); 324 | Atom _NET_SYSTEM_TRAY_S = X11UTILLS::atom(s.toLatin1()); 325 | 326 | if (XGetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S) != None) 327 | { 328 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__<< " Another systray is running \033[0m"; 329 | mValid = false; 330 | return; 331 | } 332 | 333 | // init systray protocol 334 | mTrayId = XCreateSimpleWindow(dsp, root, -1, -1, 1, 1, 0, 0, 0); 335 | 336 | XSetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S, mTrayId, CurrentTime); 337 | if (XGetSelectionOwner(dsp, _NET_SYSTEM_TRAY_S) != mTrayId) 338 | { 339 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__ << " Can't get systray manager\033[0m"; 340 | stopTray(); 341 | mValid = false; 342 | return; 343 | } 344 | 345 | int orientation = 0; 346 | XChangeProperty(dsp, 347 | mTrayId, 348 | X11UTILLS::atom("_NET_SYSTEM_TRAY_ORIENTATION"), 349 | XA_CARDINAL, 350 | 32, 351 | PropModeReplace, 352 | (unsigned char *) &orientation, 353 | 1); 354 | 355 | // ** Visual ******************************** 356 | VisualID visualId = getVisual(); 357 | if (visualId) 358 | { 359 | XChangeProperty(mDisplay, 360 | mTrayId, 361 | X11UTILLS::atom("_NET_SYSTEM_TRAY_VISUAL"), 362 | XA_VISUALID, 363 | 32, 364 | PropModeReplace, 365 | (unsigned char*)&visualId, 366 | 1); 367 | } 368 | // ****************************************** 369 | 370 | setIconSize(mIconSize); 371 | 372 | XClientMessageEvent ev; 373 | ev.type = ClientMessage; 374 | ev.window = root; 375 | ev.message_type = X11UTILLS::atom("MANAGER"); 376 | ev.format = 32; 377 | ev.data.l[0] = CurrentTime; 378 | ev.data.l[1] = _NET_SYSTEM_TRAY_S; 379 | ev.data.l[2] = mTrayId; 380 | ev.data.l[3] = 0; 381 | ev.data.l[4] = 0; 382 | XSendEvent(dsp, root, False, StructureNotifyMask, (XEvent*)&ev); 383 | 384 | XDamageQueryExtension(mDisplay, &mDamageEvent, &mDamageError); 385 | 386 | if(Defines::degug()) qDebug()<<"\033[35m [+] Systray :"<< __LINE__ << "Systray started\033[0m"; 387 | mValid = true; 388 | 389 | 390 | 391 | } 392 | 393 | 394 | /************************************************ 395 | 396 | ************************************************/ 397 | void SysTray::stopTray() 398 | { 399 | for (auto & icon : mIcons) 400 | disconnect(icon, &QObject::destroyed, this, &SysTray::onIconDestroyed); 401 | qDeleteAll(mIcons); 402 | if (mTrayId) 403 | { 404 | XDestroyWindow(mDisplay, mTrayId); 405 | mTrayId = 0; 406 | } 407 | mValid = false; 408 | } 409 | 410 | 411 | /************************************************ 412 | 413 | ************************************************/ 414 | void SysTray::onIconDestroyed(QObject * icon) 415 | { 416 | //in the time QOjbect::destroyed is emitted, the child destructor 417 | //is already finished, so the qobject_cast to child will return nullptr in all cases 418 | mIcons.removeAll(static_cast(icon)); 419 | } 420 | 421 | /************************************************ 422 | 423 | ************************************************/ 424 | void SysTray::addIcon(Window winId) 425 | { 426 | 427 | TrayIcon* icon = new TrayIcon(winId, mIconSize, this); 428 | 429 | mIcons.append(icon); 430 | mLayout->addWidget(icon); 431 | connect(icon, &QObject::destroyed, this, &SysTray::onIconDestroyed); 432 | if(Defines::degug()) qDebug()<<"\033[35m [+] "<< __LINE__ << "addIcon\033[0m"<toolTip()< 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "trayicon.h" 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | class SysTray: public QWidget/*, QAbstractNativeEventFilter*/ 35 | { 36 | Q_OBJECT 37 | 38 | 39 | 40 | public: 41 | SysTray(/*Setting *s, */QWidget* parent = nullptr); 42 | ~SysTray(); 43 | 44 | 45 | QSize iconSize() const { return mIconSize; } 46 | void setIconSize(QSize iconSize); 47 | 48 | void setNativeEventFilter(const QByteArray &eventType, void *message, long *); 49 | 50 | void loadSettings(); 51 | 52 | signals: 53 | void iconSizeChanged(int iconSize); 54 | 55 | private slots: 56 | void startTray(); 57 | void stopTray(); 58 | void onIconDestroyed(QObject * icon); 59 | 60 | private: 61 | VisualID getVisual(); 62 | QWidget *mWidgetContent; 63 | void clientMessageEvent(xcb_generic_event_t *e); 64 | 65 | int clientMessage(WId _wid, Atom _msg, 66 | long unsigned int data0, 67 | long unsigned int data1 = 0, 68 | long unsigned int data2 = 0, 69 | long unsigned int data3 = 0, 70 | long unsigned int data4 = 0) const; 71 | 72 | 73 | void addIcon(Window id); 74 | TrayIcon* findIcon(Window trayId); 75 | //Setting *mSetting; 76 | bool mValid; 77 | Window mTrayId; 78 | QList mIcons; 79 | int mDamageEvent; 80 | int mDamageError; 81 | QSize mIconSize; 82 | QHBoxLayout *mLayout; 83 | 84 | Atom _NET_SYSTEM_TRAY_OPCODE; 85 | Display* mDisplay; 86 | }; 87 | 88 | 89 | 90 | 91 | 92 | #endif //SYSTRAY_H 93 | -------------------------------------------------------------------------------- /dsystray/trayicon.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | *(c)GPL3+ 3 | Inspired by freedesktops tint2 4 | original code http://razor-qt.org 5 | modified by abou zakaria 6 | *********************************************************************/ 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "trayicon.h" 17 | #include "utils/defines.h" 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "utils/x11utills.h" 23 | #define XEMBED_EMBEDDED_NOTIFY 0 24 | 25 | 26 | static bool xError; 27 | 28 | /************************************************ 29 | 30 | ************************************************/ 31 | int windowErrorHandler(Display *d, XErrorEvent *e) 32 | { 33 | xError = true; 34 | if (e->error_code != BadWindow) { 35 | char str[1024]; 36 | XGetErrorText(d, e->error_code, str, 1024); 37 | qWarning() << "Error handler" << e->error_code 38 | << str; 39 | } 40 | return 0; 41 | } 42 | 43 | 44 | /************************************************ 45 | 46 | ************************************************/ 47 | TrayIcon::TrayIcon(Window iconId, QSize const & iconSize, QWidget* parent): 48 | QWidget(parent), 49 | mIconId(iconId), 50 | mWindowId(0), 51 | mIconSize(iconSize), 52 | mDamage(0), 53 | mDisplay(QX11Info::display()) 54 | { 55 | // NOTE: 56 | // it's a good idea to save the return value of QX11Info::display(). 57 | // In Qt 5, this API is slower and has some limitations which can trigger crashes. 58 | // The XDisplay value is actally stored in QScreen object of the primary screen rather than 59 | // in a global variable. So when the parimary QScreen is being deleted and becomes invalid, 60 | // QX11Info::display() will fail and cause crash. Storing this value improves the efficiency and 61 | // also prevent potential crashes caused by this bug. 62 | 63 | 64 | setContentsMargins(0,0,0,0); 65 | 66 | setAutoFillBackground(false); 67 | setObjectName("TrayIcon"); 68 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 69 | 70 | 71 | 72 | QTimer::singleShot(200, [this] { init(); update(); }); 73 | } 74 | 75 | 76 | 77 | /************************************************ 78 | 79 | ************************************************/ 80 | void TrayIcon::init() 81 | { 82 | Display* dsp = mDisplay; 83 | 84 | XWindowAttributes attr; 85 | if (! XGetWindowAttributes(dsp, mIconId, &attr)) 86 | { 87 | deleteLater(); 88 | return; 89 | } 90 | if(Defines::degug()){ 91 | 92 | qDebug() << "\033[37m [-] New tray icon ***********************"<<__LINE__<<"\033[0m"; 93 | qDebug() << " [-]\033[0m * window id: " << hex << mIconId; 94 | qDebug() << " [-]\033[0m * window name:" << X11UTILLS::getWindowTitle(mIconId); 95 | qDebug() << " [-]\033[0m * size (WxH): " << attr.width << "x" << attr.height; 96 | 97 | // qDebug() << " * color depth:" << attr.depth; 98 | } 99 | unsigned long mask = 0; 100 | XSetWindowAttributes set_attr; 101 | 102 | Visual* visual = attr.visual; 103 | set_attr.colormap = attr.colormap; 104 | set_attr.background_pixel = 0; 105 | set_attr.border_pixel = 0; 106 | mask = CWColormap|CWBackPixel|CWBorderPixel; 107 | 108 | mWindowId = XCreateWindow(dsp, this->winId(), 0, 0, mIconSize.width() * metric(PdmDevicePixelRatio), mIconSize.height() * metric(PdmDevicePixelRatio), 109 | 0, attr.depth, InputOutput, visual, mask, &set_attr); 110 | 111 | 112 | xError = false; 113 | XErrorHandler old; 114 | old = XSetErrorHandler(windowErrorHandler); 115 | XReparentWindow(dsp, mIconId, mWindowId, 0, 0); 116 | XSync(dsp, false); 117 | XSetErrorHandler(old); 118 | 119 | if (xError) 120 | { 121 | qWarning() << "****************************************"; 122 | qWarning() << "* Not icon_swallow *"; 123 | qWarning() << "****************************************"; 124 | XDestroyWindow(dsp, mWindowId); 125 | mWindowId = 0; 126 | deleteLater(); 127 | return; 128 | } 129 | 130 | 131 | { 132 | Atom acttype; 133 | int actfmt; 134 | unsigned long nbitem, bytes; 135 | unsigned char *data = 0; 136 | int ret; 137 | 138 | ret = XGetWindowProperty(dsp, mIconId, X11UTILLS().atom("_XEMBED_INFO"), 139 | 0, 2, false, X11UTILLS().atom("_XEMBED_INFO"), 140 | &acttype, &actfmt, &nbitem, &bytes, &data); 141 | if (ret == Success) 142 | { 143 | if (data) 144 | XFree(data); 145 | } 146 | else 147 | { 148 | qWarning() << "TrayIcon: xembed error"; 149 | XDestroyWindow(dsp, mWindowId); 150 | deleteLater(); 151 | return; 152 | } 153 | } 154 | 155 | { 156 | XEvent e; 157 | e.xclient.type = ClientMessage; 158 | e.xclient.serial = 0; 159 | e.xclient.send_event = True; 160 | e.xclient.message_type = X11UTILLS().atom("_XEMBED"); 161 | e.xclient.window = mIconId; 162 | e.xclient.format = 32; 163 | e.xclient.data.l[0] = CurrentTime; 164 | e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY; 165 | e.xclient.data.l[2] = 0; 166 | e.xclient.data.l[3] = mWindowId; 167 | e.xclient.data.l[4] = 0; 168 | XSendEvent(dsp, mIconId, false, 0xFFFFFF, &e); 169 | } 170 | 171 | XSelectInput(dsp, mIconId, StructureNotifyMask); 172 | mDamage = XDamageCreate(dsp, mIconId, XDamageReportRawRectangles); 173 | XCompositeRedirectWindow(dsp, mWindowId, CompositeRedirectManual); 174 | 175 | XMapWindow(dsp, mIconId); 176 | XMapRaised(dsp, mWindowId); 177 | 178 | const QSize req_size{mIconSize * metric(PdmDevicePixelRatio)}; 179 | XResizeWindow(dsp, mWindowId, req_size.width(), req_size.height()); 180 | XResizeWindow(dsp, mIconId, req_size.width(), req_size.height()); 181 | } 182 | 183 | 184 | /************************************************ 185 | 186 | ************************************************/ 187 | TrayIcon::~TrayIcon() 188 | { 189 | Display* dsp = mDisplay; 190 | XSelectInput(dsp, mIconId, NoEventMask); 191 | 192 | if (mDamage) 193 | XDamageDestroy(dsp, mDamage); 194 | 195 | // reparent to root 196 | xError = false; 197 | XErrorHandler old = XSetErrorHandler(windowErrorHandler); 198 | 199 | XUnmapWindow(dsp, mIconId); 200 | XReparentWindow(dsp, mIconId, QX11Info::appRootWindow(), 0, 0); 201 | 202 | if (mWindowId) 203 | XDestroyWindow(dsp, mWindowId); 204 | XSync(dsp, False); 205 | XSetErrorHandler(old); 206 | } 207 | 208 | 209 | /************************************************ 210 | 211 | ************************************************/ 212 | QSize TrayIcon::sizeHint() const 213 | { 214 | QMargins margins = contentsMargins(); 215 | return QSize(margins.left() + mIconSize.width() + margins.right(), 216 | margins.top() + mIconSize.height() + margins.bottom() 217 | ); 218 | } 219 | 220 | 221 | /************************************************ 222 | 223 | ************************************************/ 224 | void TrayIcon::setIconSize(QSize iconSize) 225 | { 226 | mIconSize = iconSize; 227 | 228 | const QSize req_size{mIconSize * metric(PdmDevicePixelRatio)}; 229 | if (mWindowId) 230 | X11UTILLS().resizeWindow(mWindowId, req_size.width(), req_size.height()); 231 | 232 | if (mIconId) 233 | X11UTILLS().resizeWindow(mIconId, req_size.width(), req_size.height()); 234 | } 235 | 236 | 237 | /************************************************ 238 | 239 | ************************************************/ 240 | bool TrayIcon::event(QEvent *event) 241 | { 242 | if (mWindowId) 243 | { 244 | switch (event->type()) 245 | { 246 | case QEvent::Paint: 247 | draw(static_cast(event)); 248 | break; 249 | 250 | case QEvent::Move: 251 | case QEvent::Resize: 252 | { 253 | QRect rect = iconGeometry(); 254 | X11UTILLS().moveWindow(mWindowId, rect.left(), rect.top()); 255 | } 256 | break; 257 | 258 | case QEvent::MouseButtonPress: 259 | case QEvent::MouseButtonRelease: 260 | case QEvent::MouseButtonDblClick: 261 | event->accept(); 262 | break; 263 | 264 | default: 265 | break; 266 | } 267 | } 268 | 269 | return QWidget::event(event); 270 | } 271 | 272 | 273 | /************************************************ 274 | 275 | ************************************************/ 276 | QRect TrayIcon::iconGeometry() 277 | { 278 | QRect res = QRect(QPoint(0, 0), mIconSize); 279 | 280 | res.moveCenter(QRect(0, 0, width(), height()).center()); 281 | return res; 282 | } 283 | 284 | 285 | /************************************************ 286 | 287 | ************************************************/ 288 | void TrayIcon::draw(QPaintEvent* /*event*/) 289 | { 290 | Display* dsp = mDisplay; 291 | 292 | XWindowAttributes attr; 293 | if (!XGetWindowAttributes(dsp, mIconId, &attr)) 294 | { 295 | qWarning() << "Paint error"; 296 | return; 297 | } 298 | 299 | QImage image; 300 | XImage* ximage = XGetImage(dsp, mIconId, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap); 301 | if(ximage) 302 | { 303 | image = QImage((const uchar*) ximage->data, ximage->width, ximage->height, ximage->bytes_per_line, QImage::Format_ARGB32_Premultiplied); 304 | } 305 | else 306 | { 307 | qWarning() << " * Error image is NULL"; 308 | 309 | XClearArea(mDisplay, (Window)winId(), 0, 0, attr.width, attr.height, False); 310 | // for some unknown reason, XGetImage failed. try another less efficient method. 311 | // QScreen::grabWindow uses XCopyArea() internally. 312 | image = qApp->primaryScreen()->grabWindow(mIconId).toImage(); 313 | } 314 | 315 | if(Defines::degug()){ 316 | 317 | qDebug() <<"\033[37m [-] Tray icon Paint icon ******************"<<__LINE__<<"\033[0m"; 318 | qDebug() <<" [-] * XComposite: " << isXCompositeAvailable(); 319 | qDebug() <<" [-] * Icon geometry:" << iconGeometry(); 320 | qDebug() <<" [-] Icon"; 321 | qDebug() <<" [-] * window id: " << hex << mIconId; 322 | qDebug() <<" [-] * window name:" << X11UTILLS::getWindowTitle(mIconId); 323 | qDebug() <<" [-] * size (WxH): " << attr.width << "X" << attr.height; 324 | qDebug() <<" [-] * pos (XxY): " << attr.x << attr.y; 325 | qDebug() <<" [-] * color depth:" << attr.depth; 326 | qDebug() <<" [-] XImage"; 327 | qDebug() <<" [-] * size (WxH): " << ximage->width << "X" << ximage->height; 328 | switch (ximage->format) 329 | { 330 | case XYBitmap: qDebug() <<" [-] * format: XYBitmap"; break; 331 | case XYPixmap: qDebug() <<" [-] * format: XYPixmap"; break; 332 | case ZPixmap: qDebug() <<" [-] * format: ZPixmap"; break; 333 | } 334 | qDebug() <<" [-] * color depth: " << ximage->depth; 335 | qDebug() <<" [-] * bits per pixel:" << ximage->bits_per_pixel; 336 | 337 | } 338 | 339 | // Draw QImage ........................... 340 | QPainter painter(this); 341 | QRect iconRect = iconGeometry(); 342 | if (image.size() != iconRect.size()) 343 | { 344 | image = image.scaled(iconRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); 345 | QRect r = image.rect(); 346 | r.moveCenter(iconRect.center()); 347 | iconRect = r; 348 | } 349 | // qDebug() << " Draw rect:" << iconRect; 350 | 351 | painter.drawImage(iconRect, image); 352 | 353 | if(ximage) 354 | XDestroyImage(ximage); 355 | // debug << "End paint icon **********************************"; 356 | } 357 | 358 | 359 | /************************************************ 360 | 361 | ************************************************/ 362 | void TrayIcon::windowDestroyed(Window w) 363 | { 364 | //damage is destroyed if it's parent window was destroyed 365 | if (mIconId == w) 366 | mDamage = 0; 367 | } 368 | 369 | 370 | /************************************************ 371 | 372 | ************************************************/ 373 | bool TrayIcon::isXCompositeAvailable() 374 | { 375 | int eventBase, errorBase; 376 | return XCompositeQueryExtension(QX11Info::display(), &eventBase, &errorBase ); 377 | } 378 | -------------------------------------------------------------------------------- /dsystray/trayicon.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | *(c)GPL3+ 3 | Inspired by freedesktops tint2 4 | original code http://razor-qt.org 5 | modified by abou zakaria 6 | *********************************************************************/ 7 | 8 | #ifndef TRAYICON_H 9 | #define TRAYICON_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #define TRAY_ICON_SIZE_DEFAULT 16 22 | class TrayIcon: public QWidget 23 | { 24 | Q_OBJECT 25 | 26 | 27 | public: 28 | TrayIcon(Window iconId, QSize const & iconSize, QWidget* parent); 29 | virtual ~TrayIcon(); 30 | 31 | Window iconId() { return mIconId; } 32 | Window windowId() { return mWindowId; } 33 | void windowDestroyed(Window w); 34 | 35 | QSize iconSize() const { return mIconSize; } 36 | void setIconSize(QSize iconSize); 37 | 38 | QSize sizeHint() const; 39 | 40 | protected: 41 | bool event(QEvent *event); 42 | void draw(QPaintEvent* event); 43 | 44 | private: 45 | void init(); 46 | QRect iconGeometry(); 47 | Window mIconId; 48 | Window mWindowId; 49 | QSize mIconSize; 50 | Damage mDamage; 51 | Display* mDisplay; 52 | 53 | static bool isXCompositeAvailable(); 54 | 55 | 56 | }; 57 | 58 | 59 | 60 | #endif // TRAYICON_H 61 | -------------------------------------------------------------------------------- /epager/pager.h: -------------------------------------------------------------------------------- 1 | /* BEGIN_COMMON_COPYRIGHT_HEADER 2 | * (c)GPL3+ 3 | * 4 | * elokab - a lightweight, Qt based, desktop toolset 5 | * https://sourceforge.net/project/elokab/ 6 | * 7 | * Copyright: 2013-2014 elokab team 8 | * Authors: 9 | * Abou Zakaria 10 | * 11 | * This program or library is free software; you can redistribute it 12 | * and/or modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 3 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | 21 | * You should have received a copy of the GNU Lesser General 22 | * Public License along with this library; if not, write to the 23 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 | * Boston, MA 02110-1301 USA 25 | * 26 | * END_COMMON_COPYRIGHT_HEADER */ 27 | 28 | #ifndef DESKTOPSWITCH_H 29 | #define DESKTOPSWITCH_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | class QSignalMapper; 38 | class QButtonGroup; 39 | class ToolButton : public QToolButton 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | ToolButton( QWidget *parent ) : 45 | QToolButton(parent) 46 | { 47 | setContentsMargins(0,0,0,0); 48 | 49 | this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); 50 | this->setToolButtonStyle(Qt::ToolButtonIconOnly); 51 | QFont font=parent->font(); 52 | font.setPointSize(parent->font().pointSize()); 53 | setFont(font); 54 | 55 | // QFontMetrics fm(parent->font()); 56 | // int size=fm.height(); 57 | } 58 | 59 | signals: 60 | 61 | void activated(); 62 | public slots: 63 | void setData(QString txt){m_data=txt;} 64 | QString data(){return m_data;} 65 | private: 66 | QString m_data; 67 | }; 68 | /** 69 | * @brief The Pager class التبديل بين اسطح المكتب 70 | */ 71 | class Pager : public QWidget/*,public QAbstractNativeEventFilter*/ 72 | 73 | { 74 | Q_OBJECT 75 | 76 | public: 77 | explicit Pager(QWidget* parent = nullptr); 78 | void setNativeEventFilter(const QByteArray &eventType, void *message, long *); 79 | ~Pager(); 80 | 81 | void setSize(QSize size); 82 | 83 | public slots: 84 | void loadSettings(); 85 | private: 86 | 87 | QSignalMapper *m_pSignalMapper; 88 | int m_DeskCount; 89 | QWidget *mParent; 90 | // Setting *mSetting; 91 | QWidget *widgetContent; 92 | /*!< قائمة بمجموعة ازرار */ 93 | QButtonGroup * m_GroupBtns; 94 | QListlistbtn; 95 | QList listWndDesk; 96 | // QHash *m_GroupBtns; 97 | /*!< قائمة ياسماء اسطح المكتب */ 98 | QStringList m_desktopNames; 99 | /*!< حجم الزر */ 100 | QSize m_size; 101 | 102 | /** 103 | * @brief wheelEvent تحريك مؤشر العجلة 104 | * @param e 105 | */ 106 | void wheelEvent(QWheelEvent* e); 107 | /** 108 | * @brief setupBtns تكوين الازرار 109 | */ 110 | void setupBtns(); 111 | QHBoxLayout * mHBoxLayout ; 112 | QString m_bgColor; 113 | QString m_fgColor; 114 | QString m_activeBgColor; 115 | 116 | enum DesktopType{DESKINDEX,DESKNAME,DESKICON}; 117 | int mDesktopType; 118 | QStringList listIcons; 119 | QString mActiveIcon; 120 | private slots: 121 | /** 122 | * @brief setDesktop الانتقال الى سطح مكتب 123 | * @param desktop رقم سطح المكتب 124 | */ 125 | void setDesktop(int desktop); 126 | void goDesktop(int arg); 127 | void actvateBtnDesktop(); 128 | void rechargeDesktop(); 129 | 130 | void refreshTaskList(); 131 | void refreshTaskButton(); 132 | protected slots: 133 | 134 | 135 | }; 136 | 137 | 138 | 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /etaskbar/dactiontaskbar.h: -------------------------------------------------------------------------------- 1 | #ifndef DACTIONTASKBAR_H 2 | #define DACTIONTASKBAR_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | //#include 9 | class DActionTaskbar : public QToolButton 10 | { 11 | Q_OBJECT 12 | public: 13 | 14 | explicit DActionTaskbar(const Window window, QWidget *parent =nullptr); 15 | void setActiveWin(bool arg); 16 | protected: 17 | virtual void dragEnterEvent(QDragEnterEvent *event); 18 | virtual void dragLeaveEvent(QDragLeaveEvent *); 19 | void mousePressEvent(QMouseEvent *event); 20 | 21 | 22 | protected: 23 | void contextMenuEvent( QContextMenuEvent* event); 24 | private: 25 | Window m_Window; 26 | QAction *m_actParent; 27 | const QMimeData *mimeData; 28 | bool mActive; 29 | private slots: 30 | 31 | QString appName(); 32 | 33 | QString classeName(); 34 | 35 | /**********عمليات النوافذ***************/ 36 | void minimizeWindow(); //تصغير النافذة 37 | void restoreWindow(); //استعادة النافذة من التصغير 38 | void moveWindowToDesktop(); //نقل النافذة الى سطح المكت// 39 | void unMaximizeWindow(); //استعادة النافذة من التكبير 40 | void shadeWindow(); //تحجيم النافذة اي نظليلها 41 | void unShadeWindow(); //استعادة النافذة من التحجيم 42 | void closeApplication(); //غلق النافذة 43 | void maximizeWindow(); //تكبير التافذة 44 | void setApplicationLayer(); //وضع النافذة فوق تحت عادي 45 | 46 | void activateWithDraggable(); 47 | public slots: 48 | 49 | void getIcon(); //ايقونة البرنامج 50 | void getText(); //نص لابرنامج 51 | 52 | void windowPropertyChanged(unsigned long /*atom*/); 53 | }; 54 | 55 | #endif // DACTIONTASKBAR_H 56 | -------------------------------------------------------------------------------- /etaskbar/dtaskbarwidget.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | *(c)GPL3+ 3 | 4 | original code http://razor-qt.org 5 | modified by abou zakaria 6 | *********************************************************************/ 7 | 8 | //#include "taskbarsettingdialog.h" 9 | #include "utils/stylecolors.h" 10 | #include "utils/defines.h" 11 | #include "utils/setting.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "dtaskbarwidget.h" 17 | #include "dactiontaskbar.h" 18 | #include "utils/x11utills.h" 19 | #include "xcb/xcb.h" 20 | 21 | #define TEXTBICON 0 22 | #define ICONONLY 1 23 | 24 | 25 | DtaskbarWidget::DtaskbarWidget(/*Setting *s,*/ QWidget *parent/*, bool debug*/): 26 | QWidget(parent)/*,mSetting(s),mDebug(debug)*/ 27 | { 28 | m_parent=parent; 29 | QFont font=parent->font(); 30 | font.setPointSize(parent->font().pointSize()); 31 | setFont(font); 32 | this->setObjectName("dtaskbar"); 33 | this->setContentsMargins(0,0,0,0); 34 | this->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); 35 | 36 | widgetContent=new QWidget; 37 | widgetContent->setObjectName("WidgetContent"); 38 | widgetContent->setWindowTitle(tr("Desktop Switch")); 39 | widgetContent->setContentsMargins(0,0,0,0); 40 | widgetContent->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); 41 | 42 | QHBoxLayout *Layout = new QHBoxLayout(this); 43 | Layout->setSpacing(0); 44 | Layout->setContentsMargins(0, 0, 0, 0); 45 | Layout->setObjectName(QString::fromUtf8("horizontalLayout")); 46 | 47 | Layout->addWidget(widgetContent); 48 | 49 | m_horizontalLayout = new QHBoxLayout(widgetContent); 50 | m_horizontalLayout->setSpacing(0); 51 | m_horizontalLayout->setContentsMargins(0,0,0,0); 52 | m_horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); 53 | 54 | m_rootWindow = QX11Info::appRootWindow(); 55 | loadSettings(); 56 | 57 | //qApp->installNativeEventFilter(this); 58 | 59 | 60 | } 61 | 62 | //_________________________________________________________________________________________ 63 | void DtaskbarWidget::setNativeEventFilter(const QByteArray &eventType, void *message, long *) 64 | { 65 | 66 | if (eventType == "xcb_generic_event_t") { 67 | xcb_generic_event_t* event = static_cast(message); 68 | 69 | switch (event->response_type & ~0x80) { 70 | 71 | case XCB_PROPERTY_NOTIFY: { 72 | xcb_property_notify_event_t *property = reinterpret_cast(event); 73 | 74 | windowPropertyChanged(property->window, property->atom); 75 | 76 | break; 77 | } 78 | 79 | default: break; 80 | } 81 | 82 | } 83 | 84 | //return false; 85 | } 86 | 87 | //_________________________________________________________________________________________ 88 | void DtaskbarWidget::windowPropertyChanged(unsigned long window, unsigned long atom) 89 | { 90 | if (window ==m_rootWindow) { 91 | 92 | if (atom == X11UTILLS::atom("_NET_CLIENT_LIST")){ 93 | // qDebug()<<"DtaskbarWidget::windowPropertyChanged _NET_CLIENT_LIST"; 94 | refreshTaskList(); 95 | } 96 | 97 | if(atom == X11UTILLS::atom("_NET_ACTIVE_WINDOW")){ 98 | // qDebug()<<"DtaskbarWidget::windowPropertyChanged _NET_ACTIVE_WINDOW"; 99 | 100 | activeWindowChanged(); 101 | } 102 | 103 | return; 104 | } 105 | 106 | } 107 | 108 | //_________________________________________________________________________________________ 109 | void DtaskbarWidget::loadSettings() 110 | { 111 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" loadSettings()"; 112 | 113 | //_________________________________________________ Settings 114 | QString highlight=qApp->palette().highlight().color().name(); 115 | QString highlightTxt=qApp->palette().highlightedText().color().name(); 116 | 117 | Setting::instance()->beginGroup(MTASKBAR); 118 | 119 | QString bgColor =Setting::background(); 120 | QString fgColor =Setting::foreground(m_parent->palette().windowText().color().name()); 121 | QString activebgColor =Setting::activeBackground(highlight); 122 | QString activefgColor =Setting::activeForeground(highlightTxt); 123 | QString borderColor =Setting::borderColor(); 124 | int alpha =Setting::alpha();// 125 | int activeAlpha =Setting::activeAlpha(); 126 | QString underline =Setting::underline(); 127 | QString overline =Setting::overline(); 128 | QString activeunderline =Setting::activeUnderline(); 129 | QString activeoverline =Setting::activeOverline(); 130 | int border =Setting::border(); 131 | int radius =Setting::radius(); 132 | 133 | Setting::instance()->endGroup(); 134 | 135 | // mSetting->beginGroup("Taskbar"); 136 | 137 | // QString bgColor =mSetting->background(); 138 | // QString fgColor =mSetting->foreground(m_parent->palette().windowText().color().name()); 139 | // QString activebgColor =mSetting->activeBackground(highlight); 140 | // QString activefgColor =mSetting->activeForeground(highlightTxt); 141 | // QString borderColor =mSetting->borderColor(); 142 | // int alpha =mSetting->alpha();// 143 | // int activeAlpha =mSetting->activeAlpha(); 144 | // QString underline =mSetting->underline(); 145 | // QString overline =mSetting->overline(); 146 | // QString activeunderline =mSetting->activeUnderline(); 147 | // QString activeoverline =mSetting->activeOverline(); 148 | // int border =mSetting->border(); 149 | // int radius =mSetting->radius(); 150 | 151 | // mSetting->endGroup(); 152 | 153 | //_________________________________________________ INIT 154 | 155 | //-------------------------------------------------------STYLESHEET 156 | widgetContent->setContentsMargins((radius+1),0,(radius+1),0); 157 | QString mStylebg="QWidget#WidgetContent{"; 158 | mStylebg+=StyleColors::style(bgColor,fgColor,QString(),QString(),border,alpha,borderColor,radius)+"\n}"; 159 | 160 | //QtoolButton Normale 161 | QString mStyleSheet="QToolButton{"; 162 | mStyleSheet+=StyleColors::style(bgColor,fgColor,underline,overline,border,alpha,borderColor,0)+"\n}"; 163 | 164 | //QtoolButton Active 165 | QString activeStyleSheet="QToolButton:checked{\n"; 166 | activeStyleSheet+=StyleColors::style(activebgColor,activefgColor,activeunderline,activeoverline,border,activeAlpha,QString(),0)+"\n}"; 167 | setStyleSheet(mStylebg+mStyleSheet+activeStyleSheet); 168 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" loadSettings()\n"<setStyleSheet(mStyleSheet+activeStyleSheet); 171 | } 172 | 173 | refreshTaskList(); 174 | } 175 | 176 | //_________________________________________________________________________تحديث النوافذ 177 | void DtaskbarWidget::refreshTaskList() 178 | { 179 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" refreshTaskList()"; 180 | 181 | 182 | 183 | // قائمة مؤقة بجميع معرفات النوافذ الحاضرة 184 | QList listWindow = X11UTILLS::getClientList(); 185 | 186 | 187 | // حذف جميع الازرار ومعرفاتها السابقة 188 | if(mButtonsHash.count()>0){ 189 | // قائمة بجميع معرفات النولفذ والازرار 190 | QMutableHashIterator i(mButtonsHash); 191 | while (i.hasNext()) 192 | { 193 | 194 | i.next(); 195 | 196 | int r = listWindow.removeAll(i.key()); 197 | 198 | if (!r) 199 | { 200 | delete i.value(); 201 | i.remove(); 202 | } 203 | 204 | } 205 | } 206 | 207 | foreach (unsigned long wnd, listWindow) 208 | { 209 | 210 | 211 | // انشاء زر جديد للنوافذ الحاضرة 212 | DActionTaskbar *btn=new DActionTaskbar(wnd,this); 213 | 214 | //=========================================== 215 | // اضافة ازر للقائمة 216 | mButtonsHash.insert(wnd, btn); 217 | 218 | // اضافة الزر للبنال 219 | m_horizontalLayout->addWidget(btn); 220 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" addWidget()"<text(); 221 | 222 | } 223 | 224 | foreach (DActionTaskbar *btn,mButtonsHash){ 225 | btn->setMaximumWidth(btn->height()); 226 | btn->setMinimumWidth(btn->height()); 227 | int size=btn->height()-6; 228 | if(size<16) size=16; 229 | if(size>48) size=48; 230 | 231 | btn->setIconSize(QSize(size,size)); 232 | } 233 | 234 | activeWindowChanged(); 235 | 236 | } 237 | 238 | 239 | //____________________________________________________________________________النافذة المفعلة 240 | void DtaskbarWidget::activeWindowChanged() 241 | { 242 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" activeWindowChanged()"; 243 | 244 | // البحث عن النافذة المفعلة 245 | unsigned long window =X11UTILLS::getActiveAppWindow(); 246 | 247 | if( ! window) 248 | return; 249 | 250 | 251 | foreach (DActionTaskbar *btn,mButtonsHash){ 252 | 253 | // btn->setText(X11UTILLS::getWindowTitle(mButtonsHash.key(btn))); 254 | btn->setChecked(false); 255 | btn->setActiveWin(false); 256 | btn->getText(); 257 | } 258 | 259 | 260 | // التاكد من وجودها مع الازرا 261 | DActionTaskbar* toolbtn =nullptr; 262 | if (mButtonsHash.contains(window)){ 263 | toolbtn=mButtonsHash.value(window); 264 | m_activeWindow=window; 265 | toolbtn->setActiveWin(true); 266 | // toolbtn->setChecked(true); 267 | 268 | } 269 | 270 | 271 | 272 | } 273 | 274 | //__________________________________________________________________________mouse wheel 275 | void DtaskbarWidget::wheelEvent(QWheelEvent* event) 276 | { 277 | 278 | QList winList = X11UTILLS::getClientList(); 279 | int current = winList.indexOf(X11UTILLS::getActiveAppWindow()); 280 | int delta = event->delta() < 0 ? 1 : -1; 281 | 282 | for (int ix = current + delta; 0 <= ix && ix < winList.size(); ix += delta) 283 | { 284 | unsigned long window = winList.at(ix); 285 | 286 | X11UTILLS::raiseWindow(window); 287 | break; 288 | 289 | } 290 | 291 | } 292 | 293 | 294 | -------------------------------------------------------------------------------- /etaskbar/dtaskbarwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef DTASKBARWIDGET_H 2 | #define DTASKBARWIDGET_H 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | #include "dactiontaskbar.h" 9 | #include "X11/Xlib.h" 10 | #include 11 | #include 12 | 13 | class DtaskbarWidget : public QWidget/*,public QAbstractNativeEventFilter*/ 14 | { 15 | 16 | Q_OBJECT 17 | 18 | public: 19 | // DtaskbarWidget(); 20 | explicit DtaskbarWidget(QWidget *parent = nullptr); 21 | 22 | void setNativeEventFilter(const QByteArray &eventType, void *message, long *); 23 | void windowPropertyChanged(unsigned long window, unsigned long atom); 24 | 25 | protected: 26 | 27 | signals: 28 | 29 | public slots: 30 | 31 | void loadSettings(); 32 | 33 | 34 | private slots: 35 | 36 | 37 | void refreshTaskList(); 38 | void activeWindowChanged(); 39 | void wheelEvent(QWheelEvent* event); 40 | 41 | 42 | private: 43 | QWidget *m_parent; 44 | // Setting *mSetting; 45 | QWidget *widgetContent; 46 | // bool mDebug; 47 | // QMap m_clients; 48 | QHash mButtonsHash; 49 | unsigned long m_rootWindow; 50 | unsigned long m_activeWindow; 51 | QHBoxLayout * m_horizontalLayout ; 52 | 53 | 54 | }; 55 | 56 | #endif // DTASKBARWIDGET_H 57 | -------------------------------------------------------------------------------- /etc/xdg/qobbar/qobbar.conf: -------------------------------------------------------------------------------- 1 | ## -------------------------------------------------------------------------------- 2 | ; You can create your own local variables, for example: 3 | ;color name or Hex or xrdb.color 4 | ;exsample: red 5 | ;exsample:#161925 6 | ;exsample:xrdb.color5 7 | [Colors] 8 | BgColor=#161925 9 | FgColor=#7E8A98 10 | Hgcolor=#2E629B 11 | 12 | ## -------------------------------------------------------------------------------- 13 | [Panel] 14 | ;Monitor default 0 15 | #Monitor=0 16 | 17 | ;Top panel top or bottom default=true 18 | Top=false 19 | 20 | ; panel height default will be calculated automatically 21 | ; depending on the font size margin and border . 22 | ;Height=32 23 | 24 | ;BorderColor border color for this panel if border > O 25 | #BorderColor=#1A1E21 26 | 27 | ; BarLeft display any module in this left of bar 28 | BarLeft=Pager 29 | 30 | ; BarCenter display any module in this center of bar 31 | BarCenter= ActiveWindow 32 | 33 | ; BarRight display any module in right of bar 34 | #BarRight=Disk,Cpu,Mem,Time 35 | BarRight=Time 36 | ;To repeat the same statu, add ":" and then a number 37 | ;Example: 38 | ;[Panel] 39 | ; BarLeft=Sep:1,Cpu,Sep:2,Mem,Sep:3,Wifi 40 | ;[Sep] 41 | ;Label="|" 42 | ;Color=#fff 43 | 44 | ;BarLeftSpacing default=0 45 | ;space between modules on left bar 46 | BarLeftSpacing=0 47 | 48 | ;BarRightSpacing default=0 49 | ;space between modules on right bar 50 | BarRightSpacing=5 51 | 52 | ;BarCenterSpacing default=0 53 | ;space between modules on center bar 54 | BarCenterSpacing=0 55 | 56 | ;MarginLeft default=0 57 | ;Margin between modules and left bar border 58 | MarginLeft=2 59 | 60 | ;MarginTop default=0 61 | ;Margin between modules and top bar border 62 | MarginTop=2 63 | 64 | ;MarginRight default=0 65 | ;Margin between modules and right bar border 66 | MarginRight=2 67 | 68 | ;MarginBottom default=0 69 | ;Margin between modules and bottom bar border 70 | MarginBottom=2 71 | 72 | ;PaddingLeft default=0 73 | ;space between screen left and bar left 74 | PaddingLeft=0 75 | 76 | ;PaddingRight default=0 77 | ;space between screen right and bar right 78 | PaddingRight=0 79 | 80 | ;PaddingTop default=0 81 | ;space between screen top and bar top 82 | PaddingTop=0 83 | 84 | ;PaddingBottom default=0 85 | ;space between screen bottom and bar bottom 86 | PaddingBottom=0 87 | 88 | ;Systray default=false 89 | ;show systemtray 90 | Systray=true 91 | 92 | ## Common properties ---------- 93 | 94 | ;Background color 95 | Background=$BgColor 96 | 97 | ;Foreground color 98 | Foreground=$FgColor 99 | 100 | ;Underline Bottom line color if Border>0 101 | #Underline=#B44B4B 102 | 103 | ;Overline color Top line color if Border>0 104 | ;Underline color if Border > 0 105 | #Overline=xrdb.color4 106 | 107 | ; Border default=0 108 | #Border=2 109 | 110 | ;BorderRadius default 0 111 | #BorderRadius=4 112 | 113 | ;LeftTopRadius left top radius radius 114 | #LeftTopRadius=3 115 | 116 | ;RightTopRadius right top radius radius 117 | #RightTopRadius=3 118 | 119 | ;LeftBottomRadius left bottom radius 120 | #LeftBottomRadius=3 121 | 122 | ;RightBottomRadius right bottom radius 123 | #RightBottomRadius=3 124 | 125 | ;Alpha 0-to-255 default=255 126 | ;0 full transparent 255 opac 127 | #Alpha=255 128 | 129 | ;FontName default parent fontfamily 130 | FontName=Monospace 131 | 132 | ;FontSize default parent font size 133 | FontSize=9 134 | 135 | ;FontBold default window fontbold 136 | FontBold=false 137 | 138 | ## -------------------------------------------------------------------------------- 139 | [Pager] 140 | 141 | ;ActiveBackground default window highlight color 142 | ActiveBackground =$Hgcolor 143 | 144 | ;ActiveAlpha 0-to-255 default=255 145 | ;0 full transparent 255 opac 146 | #ActiveAlpha=255 147 | 148 | ;ActiveForeground 149 | #ActiveForeground= 150 | 151 | ;ActiveUnderline Bottom line color of the active screen if Border>0 152 | #ActiveUnderline=#008000 153 | 154 | ;ActiveOverline Top line color of the active screen if Border>0 155 | #ActiveOverline=#FFFF00 156 | 157 | ;IconsList list of icon 0 to 9 ex: home,office,multimedia,... 158 | ;IconsList==,,,,,, 159 | 160 | ;ActiveIcon if DesktopDesplay==icon 161 | ;default=NULL 162 | ;ActiveIcon= 163 | 164 | ;DesktopDesplay "name", "index", "icon" default=index 165 | ; icon-[0-9] ex: home,office,multimedia, 166 | ; NOTE: The desktop name needs to match the name configured by the WM 167 | ; You can get a list of the defined desktops using: 168 | ; $ xprop -root _NET_DESKTOP_NAMES 169 | DesktopDesplay=index 170 | 171 | ##Common properties ---------------------------------- 172 | 173 | #Background=$BgColor 174 | #Foreground=$FgColor 175 | #Underline=#B44B4B 176 | #Overline=xrdb.color4 177 | #Border=2 178 | #BorderRadius=4 179 | #Alpha=255 180 | #FontName=Monospace 181 | #FontSize=9 182 | #FontBold=false 183 | 184 | 185 | ## -------------------------------------------------------------------------------- 186 | [Taskbar] 187 | 188 | ;ActiveBackground default window highlight color 189 | #ActiveBackground= 190 | 191 | ;ActiveAlpha 0-to-255 default=255 192 | ActiveAlpha=255 193 | 194 | ;ActiveForeground default window highlightText color 195 | ActiveForeground= 196 | 197 | ;ActiveUnderline color Hex or xrdb.color 198 | ActiveUnderline= 199 | 200 | ;ActiveOverline color Hex or xrdb.color 201 | ActiveOverline= 202 | 203 | ##Common properties ---------------------------------- 204 | 205 | #Background=$BgColor 206 | #Foreground=$FgColor 207 | #Underline=#B44B4B 208 | #Overline=xrdb.color4 209 | #Border=2 210 | #BorderRadius=4 211 | #Alpha=255 212 | #FontName=Monospace 213 | #FontSize=9 214 | #FontBold=false 215 | 216 | ## -------------------------------------------------------------------------------- 217 | [ActiveWindow] 218 | 219 | ;ShowButtons show or hide Close,Maximum,Minimum Buttons 220 | ShowButtons=false 221 | 222 | ;CloseColor Close button color 223 | #CloseColor=#CB2E2C 224 | 225 | ;MaxColor Maximum button color 226 | #MaxColor=#1E90FF 227 | 228 | ;MinColor Minimum button color 229 | #MinColor=#FFA500 230 | 231 | ;CloseText default="x" 232 | 233 | ;MaxText default="+" 234 | 235 | ;MinText default="-" 236 | 237 | ;MaxSize=100 238 | ;MinSize=9 239 | 240 | ##Common properties ---------------------------------- 241 | 242 | #Background=$BgColor 243 | #Foreground=$FgColor 244 | #Underline=#B44B4B 245 | #Overline=xrdb.color4 246 | #Border=2 247 | #BorderRadius=4 248 | #Alpha=255 249 | #FontName=Monospace 250 | #FontSize=9 251 | #FontBold=false 252 | MaxSize=100 253 | #MinSize=9 254 | ## --------------------------------------------------------------------------------Disk Statu 255 | [Disk] 256 | 257 | # Show Disk Usage need (df) 258 | Command=/etc/xdg/qobbar/blocks.sh 7 "/" 259 | 260 | ;Interval second default 1 261 | Interval=60 262 | 263 | ;MaxSize maximum width 264 | MaxSize=100 265 | 266 | ;Label default =$Command 267 | Label=" $Command " 268 | 269 | ;ClickLeft exec Command 270 | ClickLeft=$Command 271 | 272 | ;LeftTopRadius left top radius radius 273 | #LeftTopRadius=3 274 | 275 | ;RightTopRadius right top radius radius 276 | #RightTopRadius=3 277 | 278 | ;LeftBottomRadius left bottom radius 279 | #LeftBottomRadius=3 280 | 281 | ;RightBottomRadius right bottom radius 282 | #RightBottomRadius=3 283 | 284 | ;ClickRight exec Command 285 | #ClickRight=$Home/myscript.sh 286 | 287 | ;MouseWheelUp exec Command 288 | #MouseWheelUp=$Home/myscript.sh 289 | 290 | ;MouseWheelDown exec Command 291 | #MouseWheelDown=$Home/myscript.sh 292 | 293 | #MaxSize=100 294 | #MinSize=9 295 | ##Common properties ---------------------------------- 296 | Background=$BgColor 297 | Foreground=#90EE90 298 | #Underline=#B44B4B 299 | #Overline=xrdb.color4 300 | #Border=2 301 | #BorderRadius=4 302 | #Alpha=255 303 | #FontName=Monospace 304 | #FontSize=9 305 | #FontBold=false 306 | #LeftTopRadius=3 307 | #RightTopRadius=3 308 | #LeftBottomRadius=3 309 | #RightBottomRadius=3 310 | ## --------------------------------------------------------------------------------Cpu Statu 311 | [Cpu] 312 | # Show CPU Info need (Mpstat) 313 | Command=/etc/xdg/qobbar/blocks.sh 1 314 | 315 | ;Interval second default 1 316 | Interval=5 317 | 318 | ;MaxSize maximum width 319 | MaxSize=100 320 | 321 | ;Label default =$Command 322 | Label="Cpu: $Command " 323 | 324 | ;ClickLeft exec Command 325 | ClickLeft=xterm-e htop 326 | 327 | ;LeftTopRadius left top radius radius 328 | #LeftTopRadius=3 329 | 330 | ;RightTopRadius right top radius radius 331 | #RightTopRadius=3 332 | 333 | ;LeftBottomRadius left bottom radius 334 | #LeftBottomRadius=3 335 | 336 | ;RightBottomRadius right bottom radius 337 | #RightBottomRadius=3 338 | 339 | ;ClickRight exec Command 340 | #ClickRight=$Home/myscript.sh 341 | 342 | ;MouseWheelUp exec Command 343 | #MouseWheelUp=$Home/myscript.sh 344 | 345 | ;MouseWheelDown exec Command 346 | #MouseWheelDown=$Home/myscript.sh 347 | 348 | ;RampIcons=,,,,, 349 | 350 | ##Common properties ---------------------------------- 351 | Background=$BgColor 352 | Foreground=#EE90A1 353 | #Underline=#B44B4B 354 | #Overline=xrdb.color4 355 | #Border=2 356 | #BorderRadius=4 357 | #Alpha=255 358 | #FontName=Monospace 359 | #FontSize=9 360 | #FontBold=false 361 | #LeftTopRadius=3 362 | #RightTopRadius=3 363 | #LeftBottomRadius=3 364 | #RightBottomRadius=3 365 | #MaxSize=100 366 | #MinSize=9 367 | ## --------------------------------------------------------------------------------Mem Statu 368 | [Mem] 369 | # Show Memory Usage need (Free) 370 | Command=/etc/xdg/qobbar/blocks.sh 3 371 | 372 | ;Interval second default 1 373 | Interval=30 374 | 375 | ;MaxSize maximum width 376 | MaxSize=100 377 | 378 | ;Label default =$Command 379 | Label="Mem: $Command" 380 | 381 | ;ClickLeft exec Command 382 | ClickLeft=$Command 383 | 384 | ;LeftTopRadius left top radius radius 385 | #LeftTopRadius=3 386 | 387 | ;RightTopRadius right top radius radius 388 | #RightTopRadius=3 389 | 390 | ;LeftBottomRadius left bottom radius 391 | #LeftBottomRadius=3 392 | 393 | ;RightBottomRadius right bottom radius 394 | #RightBottomRadius=3 395 | 396 | ;ClickRight exec Command 397 | #ClickRight=$Home/myscript.sh 398 | 399 | ;MouseWheelUp exec Command 400 | #MouseWheelUp=$Home/myscript.sh 401 | 402 | ;MouseWheelDown exec Command 403 | #MouseWheelDown=$Home/myscript.sh 404 | 405 | ##Common properties ---------------------------------- 406 | #Background=$BgColor 407 | Foreground=#90B9EE 408 | #Underline=#B44B4B 409 | #Overline=xrdb.color4 410 | #Border=2 411 | #BorderRadius=4 412 | #Alpha=255 413 | #FontName=Monospace 414 | #FontSize=9 415 | #FontBold=false 416 | #LeftTopRadius=3 417 | #RightTopRadius=3 418 | #LeftBottomRadius=3 419 | #RightBottomRadius=3 420 | #MaxSize=100 421 | #MinSize=9 422 | ## --------------------------------------------------------------------------------Time Statu 423 | [Time] 424 | Interval=30 425 | Command="date +%H:%M-%d/%m/%y" 426 | Label="  " 427 | Background=#18212A 428 | Foreground=#fff 429 | ClickLeft="zenity --calendar" 430 | BorderRadius=3 431 | -------------------------------------------------------------------------------- /ewindow/activewindow.cpp: -------------------------------------------------------------------------------- 1 | #include "activewindow.h" 2 | #include "utils/stylecolors.h" 3 | #include "utils/defines.h" 4 | #include "utils/setting.h" 5 | 6 | 7 | #include 8 | #include 9 | #include "utils/x11utills.h" 10 | #include "xcb/xcb.h" 11 | ActiveWindow::ActiveWindow(QWidget *parent) : QWidget(parent),mParent(parent) 12 | { 13 | QBoxLayout *hLayout = new QHBoxLayout; 14 | QBoxLayout *layout = new QHBoxLayout; 15 | hLayout->setMargin(0); 16 | hLayout->setSpacing(0); 17 | layout->setMargin(0); 18 | layout->setSpacing(0); 19 | 20 | mWidBgr=new QWidget; 21 | mWidBgr->setObjectName("WidgetBgr"); 22 | btnClose=new MToolButton(this); 23 | btnClose->setObjectName("BClose"); 24 | btnMax=new MToolButton(this); 25 | btnMax->setObjectName("BMax"); 26 | 27 | btnMin=new MToolButton(this); 28 | btnMin->setObjectName("BMin"); 29 | labelTitle=new QLabel; 30 | labelTitle->setAlignment(Qt::AlignCenter); 31 | hLayout->addWidget(btnClose); 32 | hLayout->addWidget(btnMax); 33 | hLayout->addWidget(btnMin); 34 | hLayout->addSpacing(5); 35 | hLayout->addWidget(labelTitle); 36 | 37 | mWidBgr->setLayout(hLayout); 38 | 39 | layout->addWidget(mWidBgr); 40 | setLayout(layout); 41 | 42 | mTimer=new QTimer; 43 | connect(btnClose,SIGNAL(clicked()),this,SLOT(closeActiveWindow())); 44 | connect(btnMax,SIGNAL(clicked()),this,SLOT(maxRestoreActiveWindow())); 45 | connect(btnMin,SIGNAL(clicked()),this,SLOT(minRestoreActiveWindow())); 46 | connect(mTimer,SIGNAL(timeout()),this,SLOT(updateTitle())); 47 | 48 | loadSettings(); 49 | 50 | // qApp->installNativeEventFilter(this); 51 | activeWindowChanged(); 52 | 53 | mTimer->start(3000); 54 | } 55 | 56 | //_________________________________________________________________________________________ 57 | void ActiveWindow::setNativeEventFilter(const QByteArray &eventType, void *message, long *) 58 | { 59 | 60 | if (eventType == "xcb_generic_event_t") { 61 | xcb_generic_event_t* event = static_cast(message); 62 | 63 | switch (event->response_type & ~0x80) { 64 | 65 | case XCB_PROPERTY_NOTIFY: { 66 | xcb_property_notify_event_t *property = reinterpret_cast(event); 67 | 68 | if(property->atom == X11UTILLS::atom("_NET_ACTIVE_WINDOW")){ 69 | // qDebug()<<"DtaskbarWidget::windowPropertyChanged _NET_ACTIVE_WINDOW"; 70 | // qDebug()<<"activeWindowChanged->atom"<atom; 71 | activeWindowChanged(); 72 | } 73 | break; 74 | } 75 | 76 | default: break; 77 | } 78 | 79 | } 80 | 81 | // return false; 82 | } 83 | 84 | void ActiveWindow::updateTitle() 85 | { 86 | if( ! m_window)return; 87 | QString result=X11UTILLS::getWindowTitle(m_window); 88 | if(mTitle==result)return; 89 | 90 | if(Defines::hinDonum()) 91 | result=Defines::replaceNum(result); 92 | setTitle( result); 93 | 94 | } 95 | 96 | void ActiveWindow::setTitle(QString result) 97 | { 98 | mTitle=result; 99 | 100 | labelTitle-> setToolTip(QString()); 101 | //qDebug()<<"ActiveWindow::maxSize"<maxSize){ 103 | setToolTip(result); 104 | result.resize(maxSize-1); 105 | result+="…"; 106 | } 107 | if(Defines::hinDonum()) 108 | result=Defines::replaceNum(result); 109 | labelTitle->setText(result ); 110 | } 111 | //____________________________________________________________________________النافذة المفعلة 112 | void ActiveWindow::activeWindowChanged() 113 | { 114 | if(Defines::degug()) qDebug()<<" [-]"<<__FILE__<< __LINE__<<" activeWindowChanged()"; 115 | 116 | // البحث عن النافذة المفعلة 117 | m_window =X11UTILLS::getActiveAppWindow(); 118 | 119 | if( ! m_window){ 120 | btnClose->setVisible(false); 121 | btnMax->setVisible(false); 122 | btnMin->setVisible(false); 123 | labelTitle->clear(); 124 | return; 125 | } 126 | 127 | 128 | wState=X11UTILLS::states(m_window); 129 | wAllow=X11UTILLS::allowed(m_window); 130 | 131 | if(showButtons){ 132 | btnClose->setVisible(true); 133 | btnMin->setVisible(wAllow["Minimize"] /*&& !wState["Hidden"]*/); 134 | btnMax->setVisible(wAllow["MaximizeHoriz"] && wAllow["MaximizeVert"]); 135 | }else{ 136 | btnClose->setVisible(false); 137 | btnMin->setVisible(false); 138 | btnMax->setVisible(false); 139 | } 140 | 141 | QString result=X11UTILLS::getWindowTitle(m_window); 142 | setTitle( result); 143 | 144 | 145 | } 146 | 147 | 148 | void ActiveWindow::closeActiveWindow() 149 | { 150 | // unsigned long window =X11UTILLS::getActiveAppWindow(); 151 | if( ! m_window){ 152 | activeWindowChanged(); 153 | return; 154 | } 155 | X11UTILLS::closeWindow(m_window); 156 | } 157 | 158 | void ActiveWindow::maxRestoreActiveWindow() 159 | { 160 | 161 | // unsigned long window =X11UTILLS::getActiveAppWindow(); 162 | if( ! m_window){ 163 | activeWindowChanged(); 164 | return; 165 | } 166 | 167 | // QHashwState=X11UTILLS::states(m_window); 168 | // QHashwAllow=X11UTILLS::allowed(m_window); 169 | 170 | if((wAllow["MaximizeHoriz"] && wAllow["MaximizeVert"]) && 171 | (!wState["MaximizedHoriz"] || !wState["MaximizedVert"] /*|| wState["Hidden"]*/)){ 172 | X11UTILLS::maximizeWindow(m_window,2); 173 | }else 174 | if(wState["Hidden"] || wState["MaximizedHoriz"] || wState["MaximizedVert"]){ 175 | X11UTILLS::deMaximizeWindow(m_window); 176 | } 177 | 178 | activeWindowChanged(); 179 | X11UTILLS::raiseWindow(m_window); 180 | } 181 | 182 | void ActiveWindow::minRestoreActiveWindow() 183 | { 184 | 185 | // unsigned long window =X11UTILLS::getActiveAppWindow(); 186 | if( ! m_window){ 187 | activeWindowChanged(); 188 | return; 189 | } 190 | 191 | // QHashwState=X11UTILLS::states(m_window); 192 | // QHashwAllow=X11UTILLS::allowed(m_window); 193 | 194 | 195 | if(wAllow["Minimize"] && !wState["Hidden"]){ 196 | X11UTILLS::minimizeWindow(m_window); 197 | } 198 | } 199 | 200 | 201 | //__________________________________________________________________________________ 202 | void ActiveWindow::loadSettings() 203 | { 204 | if(Defines::degug()) qDebug()<<"\033[34m [-]"<<"ActiveWindow:"<< __LINE__<<"loadSettings()\033[0m"; 205 | 206 | 207 | //_________________________________________________ Settings 208 | QString highlight=qApp->palette().highlight().color().name(); 209 | QString highlightTxt=qApp->palette().highlightedText().color().name(); 210 | 211 | Setting::instance()->beginGroup(MWINDOW); 212 | 213 | 214 | QString bgColor =Setting::background(); 215 | QString fgColor =Setting::foreground(mParent->palette().windowText().color().name()); 216 | QString closeColor =Setting::closeColor(mParent->palette().windowText().color().name()); 217 | QString maxColor =Setting::maxColor(mParent->palette().windowText().color().name()); 218 | QString minColor =Setting::minColor(mParent->palette().windowText().color().name()); 219 | QString closeText =Setting::closeText("x"); 220 | QString maxText =Setting::maxText("+"); 221 | QString minText =Setting::minText("-"); 222 | maxSize =Setting::maxSize(); 223 | int alpha =Setting::alpha();// 224 | QString underline =Setting::underline(); 225 | QString overline =Setting::overline(); 226 | 227 | int border =Setting::border(); 228 | QString borderColor =Setting::borderColor(); 229 | int radius =Setting::radius(); 230 | QStringList fontName =Setting::fontName(mParent->font().families()); 231 | int fontSize =Setting::fontSize(mParent->font().pointSize()); 232 | 233 | bool fontBold =Setting::fontBold(mParent->font().bold()); 234 | 235 | showButtons=Setting::showButtons(false); 236 | 237 | if(showButtons){ 238 | btnClose->setVisible(true); 239 | btnMin->setVisible(wAllow["Minimize"] /*&& !wState["Hidden"]*/); 240 | btnMax->setVisible(wAllow["MaximizeHoriz"] && wAllow["MaximizeVert"]); 241 | }else{ 242 | btnClose->setVisible(false); 243 | btnMin->setVisible(false); 244 | btnMax->setVisible(false); 245 | } 246 | //_________________________________________________ INIT 247 | QFont font; 248 | font.setFamilies(fontName); 249 | font.setPointSize(fontSize); 250 | font.setBold(fontBold); 251 | setFont(font); 252 | labelTitle->setFont(font); 253 | btnClose->setFont(font); 254 | btnMax->setFont(font); 255 | btnMin->setFont(font); 256 | 257 | btnClose->setText(closeText); 258 | btnMax->setText(maxText); 259 | btnMin->setText(minText); 260 | labelTitle->setText("title test"); 261 | Setting::instance()->endGroup(); 262 | 263 | QFontMetrics mtr(font); 264 | #if QT_VERSION >= QT_VERSION_CHECK(5,10,0) 265 | int w=mtr.horizontalAdvance(closeText); 266 | #else 267 | int w=mtr.width(closeText); 268 | #endif 269 | btnClose->setMaximumWidth(w+5); 270 | btnMax->setMaximumWidth(w+5); 271 | btnMin->setMaximumWidth(w+5); 272 | //-------------------------------------------------------STYLESHEET 273 | mWidBgr->setContentsMargins((radius+1),1,(radius+1),1); 274 | QString mStylebg="QWidget#WidgetBgr{"; 275 | mStylebg+=StyleColors::style(bgColor,fgColor,underline,overline,border,alpha,borderColor,radius)+"}\n"; 276 | 277 | QString mStyleLab="QLabel{"; 278 | mStyleLab+=StyleColors::style(bgColor,fgColor,QString(),QString(),0,alpha,QString(),0)+"}\n"; 279 | QString mStyleClose="QToolButton{"; 280 | mStyleClose+=StyleColors::style(bgColor,closeColor,QString(),QString(),0,alpha,QString(),0)+"}\n"; 281 | QString mStyleMax="QToolButton{"; 282 | mStyleMax+=StyleColors::style(bgColor,maxColor,QString(),QString(),0,alpha,QString(),0)+"}\n"; 283 | QString mStyleMin="QToolButton{"; 284 | mStyleMin+=StyleColors::style(bgColor,minColor,QString(),QString(),border,alpha,QString(),0)+"}\n"; 285 | 286 | setStyleSheet(mStylebg); 287 | btnClose->setStyleSheet(mStyleClose); 288 | btnMax->setStyleSheet(mStyleMax); 289 | btnMin->setStyleSheet(mStyleMin); 290 | labelTitle->setStyleSheet(mStyleLab); 291 | // qDebug()< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class MToolButton : public QToolButton 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | MToolButton( QWidget *parent ) : 17 | QToolButton(parent) 18 | { 19 | setContentsMargins(0,0,0,0); 20 | 21 | this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); 22 | this->setToolButtonStyle(Qt::ToolButtonIconOnly); 23 | QFont font=parent->font(); 24 | font.setPointSize(parent->font().pointSize()); 25 | setFont(font); 26 | 27 | // QFontMetrics fm(parent->font()); 28 | // int size=fm.height(); 29 | } 30 | 31 | signals: 32 | 33 | // void activated(); 34 | public slots: 35 | // void setData(QString txt){m_data=txt;} 36 | // QString data(){return m_data;} 37 | private: 38 | QString m_data; 39 | }; 40 | 41 | //---------------------------------------------------------------- 42 | class ActiveWindow : public QWidget/*,public QAbstractNativeEventFilter*/ 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit ActiveWindow(QWidget *parent = nullptr); 47 | void setNativeEventFilter(const QByteArray &eventType, void *message, long *); 48 | signals: 49 | 50 | public slots: 51 | void loadSettings(); 52 | private slots: 53 | void activeWindowChanged(); 54 | void closeActiveWindow(); 55 | void maxRestoreActiveWindow(); 56 | void minRestoreActiveWindow(); 57 | void updateTitle(); 58 | void setTitle(QString result); 59 | private: 60 | QWidget *mParent; 61 | QWidget *mWidBgr; 62 | MToolButton *btnClose; 63 | MToolButton *btnMax; 64 | MToolButton *btnMin; 65 | QLabel *labelTitle; 66 | QTimer *mTimer; 67 | unsigned long m_window ; 68 | bool showButtons; 69 | QHashwState; 70 | QHashwAllow; 71 | QString mTitle; 72 | int maxSize; 73 | }; 74 | 75 | #endif // ACTIVEWINDOW_H 76 | -------------------------------------------------------------------------------- /example/blueGree.conf: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # ___ _ _ # 3 | # / _ \ ___ | |__ | |__ __ _ _ __ # 4 | # | | | |/ _ \| '_ \| '_ \ / _` | '__| # 5 | # | |_| | (_) | |_) | |_) | (_| | | # 6 | # \__\_\\___/|_.__/|_.__/ \__,_|_| # 7 | # # 8 | ############################################# 9 | 10 | ;----------------------------------------------------------------------- 11 | ; Available 12 | ;----------------------------------------------------------------------- 13 | 14 | ; ----------------------------- Common --------------------------------- 15 | # 16 | # Background color Hex or xrdb.color 17 | # Foreground color Hex or xrdb.color 18 | # Underline color Hex or xrdb.color 19 | # Overline color Hex or xrdb.color 20 | # BorderColor color Hex or xrdb.color 21 | # to get color from Xresource 22 | # ex: 'Background=xrdb.background' 23 | # ex: 'Overline=xrdb.color5' 24 | # 25 | # Border default=0 26 | # Alpha 0-to-255 default=255 27 | # FontName default parent fontfamily 28 | # FontSize default parent font size 29 | # FontBold default window fontbold 30 | # 31 | ;------------------------------- Panel --------------------------------- 32 | # Monitor default 0 33 | # BorderRadius default 0 34 | # BorderColor 35 | # BarLeft Ex:Systray,statu1,statu2 36 | # BarCenter Ex:Time,Date 37 | # BarRight Ex:Pager 38 | # To repeat the same statu, add ":" and then a number 39 | # Ex: BarLeft=Sep;1,Cpu,Sep:2,Mem,Sep:3,Wifi 40 | # BarLeftSpacing default=0 41 | # BarRightSpacing default=0 42 | # BarCenterSpacing default=0 43 | # 44 | # MarginLeft default=0 45 | # MarginTop default=0 46 | # MarginRight default=0 47 | # MarginBottom default=0 48 | # 49 | # -----padding has no effect in tilling i3wm ----- 50 | # PaddingBottom default=0 51 | # PaddingLeft default=0 52 | # PaddingRight default=0 53 | # PaddingTop default=0 54 | # Systray default=false 55 | # 56 | ; ------------------------------ Pager and Taskbar---------------------- 57 | # 58 | # ActiveBackground default window highlight 59 | # ActiveAlpha 0-to-255 default=255 60 | # ActiveForeground default window highlightText 61 | # ActiveUnderline color Hex or xrdb.color 62 | # ActiveOverline color Hex or xrdb.color 63 | # 64 | ;------------------------------ Pager ---------------------------------- 65 | # 66 | # DesktopDesplay "name" "index" "icon" default=index 67 | # icon-[0-9] ex: home,office,multimedia, 68 | # NOTE: The desktop name needs to match the name configured by the WM 69 | # You can get a list of the defined desktops using: 70 | # $ xprop -root _NET_DESKTOP_NAMES 71 | # 72 | # IconsList list of icon 0 to 9 73 | # ActiveIcon if DesktopDesplay==icon default=NULL 74 | ;------------------------------ Conky --------------------------------- 75 | # 76 | # Command Command to desplay 77 | # 78 | ;------------------------------ Status --------------------------------- 79 | # 80 | # Command Command to desplay 81 | # Interval second default 1 82 | # MaxSize default 100 83 | # BorderRadius default 0 84 | # Label 85 | # Suffix 86 | # Prefix 87 | # ClickLeft Command to exec 88 | # ClickRight Command to exec 89 | # MouseWheelUp Command to exec 90 | # MouseWheelDown Command to exec 91 | # 92 | #-----------------------Powerline icon---------------------------------- 93 | # 94 | #                   r     95 | # 96 | ;----------------------------------------------------------------------- 97 | [Panel] 98 | Monitor=0 99 | #BarRight=Right-sep:1,Temp,Battery,Wifi,Cal,Time,LogoutButton,Left-sep:1,G-play 100 | BarRight=Conky,Left-sep,LogoutButton 101 | BarCenter=WinTitle 102 | ;BarCenter=Taskbar 103 | BarLeft=Button,Right-sep,Pager,Taskbar 104 | Top=true 105 | Background=xrdb.background 106 | Foreground=xrdb.foreground 107 | Alpha=255 108 | Spacing=0 109 | BarLeftSpacing=0 110 | BarRightSpacing=0 111 | BarCenterSpacing=2 112 | Border =2 113 | BorderColor=#385ACC 114 | ;FontName="FontAwesome" 115 | ;FontName="Neuropolitical" 116 | ;FontName="TerminessTTF Nerd Font" 117 | FontName="xos4 Terminus" 118 | FontSize=9 119 | PaddingBottom=0 120 | PaddingLeft=30 121 | PaddingRight=30 122 | PaddingTop=2 123 | MarginLeft=0 124 | MarginTop=0 125 | MarginRight=0 126 | MarginBottom=0 127 | Systray=true 128 | Height=22 129 | 130 | ;-------------------------------------------------------------------------------- 131 | [Taskbar] 132 | 133 | ActiveBackground=#385ACC 134 | ActiveAlpha=100 135 | ActiveUnderline=xrdb.foreground 136 | Border=1 137 | ;Background=xrdb.color0 138 | ;BorderRadius=9 139 | 140 | ;----------------------------------------------------------------------- 141 | [Systray] 142 | Background=#385ACC 143 | ;BorderRadius=9 144 | 145 | ;----------------------------------------------------------------------- 146 | [Pager] 147 | ;Background=xrdb.color0 148 | ActiveBackground=xrdb.background 149 | Foreground=#7A6E52 150 | ActiveForeground=xrdb.foreground 151 | DesktopDesplay="name" 152 | IconsList=➊,➊,➌,➍,➎,➏,➐,➑,➒ 153 | FontName="DejaVu Sans" 154 | ;FontName="Segoe UI" 155 | ;IconsList=,,,,,, 156 | ;ActiveIcon= 157 | ;ActiveIcon=       158 | FontSize=12 159 | ;BorderRadius=9 160 | ;----------------------------------------------------------------------- 161 | [Time] 162 | Interval=1 163 | Command="date +%H:%M%S" 164 | Label="  " 165 | Background=xrdb.color0 166 | FontName="xos4 Terminus" 167 | FontSize=8 168 | ClickLeft="zenity --calendar" 169 | 170 | ;----------------------------------------------------------------------- 171 | [Cal] 172 | Interval=1800 173 | Command="date +%d/%m/%y" 174 | Label="  " 175 | Background=xrdb.color0 176 | ;Foreground=xrdb.color14 177 | ;Underline=#BF4091 178 | ;Border=0 179 | FontName="xos4 Terminus" 180 | FontSize=8 181 | ClickLeft="zenity --calendar" 182 | 183 | ;----------------------------------------------------------------------- 184 | [Disk] 185 | Label="" 186 | Command=$HOME/.config/qobbar/blocks.sh 7 "/" 187 | Interval=180 188 | Background=#385ACC 189 | Foreground=xrdb.color15 190 | ClickLeft=pcmanfm 191 | FontSize=8 192 | BorderRadius=3 193 | 194 | ;----------------------------------------------------------------------- 195 | [Temp] 196 | Command=$HOME/.config/qobbar/blocks.sh 15 197 | Interval=10 198 | FontSize=8 199 | ;Label="  " 200 | Background=xrdb.color0 201 | ClickLeft="elokab-terminal -e htop" 202 | FontName="xos4 Terminus" 203 | ;----------------------------------------------------------------------- 204 | [Cpu] 205 | Command=$HOME/.config/qobbar/blocks.sh 1 206 | ;Command=$HOME/.config/scripts/cpu_usage 207 | Interval=10 208 | Label=" " 209 | FontSize=8 210 | Background=xrdb.color3 211 | Foreground=xrdb.color15 212 | BorderRadius=3 213 | ClickLeft="elokab-terminal -e htop" 214 | 215 | ;----------------------------------------------------------------------- 216 | [Mem] 217 | Command=$HOME/.config/qobbar/blocks.sh 3 218 | Interval=30 219 | Label="" 220 | FontSize=8 221 | Background=xrdb.color1 222 | Foreground=xrdb.color15 223 | BorderRadius=3 224 | ClickLeft="elokab-terminal -e htop" 225 | 226 | ;----------------------------------------------------------------------- 227 | [Battery] 228 | Command=$HOME/.config/qobbar/blocks.sh 6 229 | Interval=5 230 | ;Label=" " 231 | FontSize=8 232 | Background=xrdb.color0 233 | FontName="xos4 Terminus" 234 | ;----------------------------------------------------------------------- 235 | [Backlight] 236 | Command=$HOME/.config/qobbar/blocks.sh 31 237 | Interval=10 238 | MouseWheelUp=xbacklight +5 239 | MouseWheelDown=xbacklight -5 240 | FontSize=8 241 | ;uiLabel=" " 242 | Background=xrdb.color6 243 | Foreground=xrdb.color15 244 | BorderRadius=3 245 | 246 | ;----------------------------------------------------------------------- 247 | [Volume] 248 | Command=$HOME/.config/qobbar/blocks.sh 18 249 | Interval=10 250 | ClickLeft=pavucontrol-qt 251 | MouseWheelUp =amixer -D pulse set Master 5%+ unmute 252 | MouseWheelDown =amixer -D pulse set Master 5%- unmute 253 | ;Label=" " 254 | FontSize=8 255 | Background=xrdb.color10 256 | Foreground=xrdb.background 257 | BorderRadius=3 258 | 259 | ;----------------------------------------------------------------------- 260 | [Wifi] 261 | Command=$HOME/.config/qobbar/blocks.sh 19 262 | ;Command=~/.config/scripts/bandwidth 263 | Interval=5 264 | Background=xrdb.color0 265 | FontSize=8 266 | Label="" 267 | FontName="xos4 Terminus" 268 | 269 | ;----------------------------------------------------------------------- 270 | [WinTitle] 271 | Background=xrdb.color0 272 | Label="  " 273 | ;Command=xdotool getactivewindow getwindowname 274 | Command=$HOME/.config/qobbar/blocks.sh 12 275 | Interval=3 276 | MaxSize=50 277 | FontName="Segoe UI" 278 | ;FontName="DejaVuSansMono Nerd Font" 279 | Foreground=xrdb.foreground 280 | ;ClickLeft="connman-gtk" 281 | BorderRadius=9 282 | 283 | ;----------------------------------------------------------------------- 284 | [Button] 285 | Label="  " 286 | ;FontName="DejaVuSansMono Nerd Font" 287 | ;FontSize=8 288 | ClickLeft= ~/.config/rofi/rofi-sh -r 289 | Foreground=xrdb.color15 290 | Background=#385ACC 291 | 292 | ;----------------------------------------------------------------------- 293 | [LogoutButton] 294 | Label="  " 295 | ClickLeft= ~/.config/rofi/rofi-sh -p 296 | ;Underline=#FF3A00 297 | ;Overline=#40BF4D 298 | ;Border=1 299 | Foreground=xrdb.color15 300 | Background= #385ACC 301 | 302 | ;----------------------------------------------------------------------- 303 | [G-play] 304 | ;Label=" " 305 | # ClickLeft= mpris-ctl play 306 | ;Background=xrdb.color9 307 | ;Foreground=xrdb.background 308 | ClickLeft= playerctl play-pause 309 | ClickRight= goldfinch -togglehide 310 | Command= $HOME/.config/qobbar/blocks.sh 14 311 | Interval=8 312 | 313 | ;----------------------------------------------------------------------- 314 | [Right-sep] 315 | Background= #385ACC 316 | Foreground=xrdb.background 317 | FontName="Hack Nerd Font" 318 | FontSize=14 319 | Label= 320 | 321 | ;----------------------------------------------------------------------- 322 | [Left-sep] 323 | Background= #385ACC 324 | Foreground=xrdb.background 325 | FontSize=14 326 | Label= 327 | FontName="Hack Nerd Font" 328 | ;----------------------------------------------------------------------- 329 | [Conky] 330 | Command=conky -c $HOME/.config/qobbar/myconkyrc 331 | ;Background=xrdb.color0 332 | FontName="TerminessTTF Nerd Font" 333 | . 334 | ;BorderRadius=9 335 | ;FontName="xos4 Terminus" 336 | -------------------------------------------------------------------------------- /example/bspwm_bot.conf: -------------------------------------------------------------------------------- 1 | ;----------------------------------------------------------------------- 2 | ; Available 3 | ;----------------------------------------------------------------------- 4 | 5 | ; ----------------------------- Common --------------------------------- 6 | # 7 | # Background color Hex or xrdb.color 8 | # Foreground color Hex or xrdb.color 9 | # Underline color Hex or xrdb.color 10 | # Overline color Hex or xrdb.color 11 | # BorderColor color Hex or xrdb.color 12 | # to get color from Xresource 13 | # ex: 'Background=xrdb.background' 14 | # ex: 'Overline=xrdb.color5' 15 | # 16 | # Border default=0 17 | # Alpha 0-to-255 default=255 18 | # FontName default parent fontfamily 19 | # FontSize default parent font size 20 | # FontBold default window fontbold 21 | # 22 | ;------------------------------- Panel --------------------------------- 23 | # 24 | # BorderColor 25 | # BarLeft Ex:Systray,statu1,statu2 26 | # BarCenter Ex:Time,Date 27 | # BarRight Ex:Pager 28 | # BarLeftSpacing default=0 29 | # BarRightSpacing default=0 30 | # BarCenterSpacing default=0 31 | # 32 | # -----padding has no effect in tilling wm ----- 33 | # PaddingBottom default=0 34 | # PaddingLeft default=0 35 | # PaddingRight default=0 36 | # PaddingTop default=0 37 | # Systray default=false 38 | 39 | 40 | ; ------------------------------ Pager and Taskbar---------------------- 41 | # 42 | # ActiveBackground default window highlight 43 | # ActiveAlpha 0-to-255 default=255 44 | # ActiveForeground default window highlightText 45 | # ActiveUnderline color Hex or xrdb.color 46 | # ActiveOverline color Hex or xrdb.color 47 | # 48 | ;------------------------------ Pager ---------------------------------- 49 | # 50 | # DesktopDesplay "name" "index" "icon" default=index 51 | # icon-[0-9] ex: home,office,multimedia, 52 | # NOTE: The desktop name needs to match the name configured by the WM 53 | # You can get a list of the defined desktops using: 54 | # $ xprop -root _NET_DESKTOP_NAMES 55 | # 56 | # IconsList list of icon 0 to 9 57 | # 58 | ;------------------------------ Status --------------------------------- 59 | # 60 | # Command Command to desplay 61 | # Interval second default 1 62 | # Label 63 | # Suffix 64 | # Prefix 65 | # ClickLeft Command to exec 66 | # ClickRight Command to exec 67 | # MouseWheelUp Command to exec 68 | # MouseWheelDown Command to exec 69 | # 70 | ;----------------------------------------------------------------------- 71 | 72 | ;------------------------------------------------- 73 | #                74 | ;------------------------------------------------- 75 | 76 | [Panel] 77 | BarLeft=LogoutButton,Taskbar 78 | BarCenter=G-last,G-toggle,G-previous,G-play,G-next,G-title,G-first 79 | BarRight=Uptame,Time 80 | Top=false 81 | Background=xrdb.background 82 | ;Foreground=xrdb.foreground 83 | ;Alpha=0 84 | Overline=xrdb.color4 85 | ;Underline=xrdb.color4 86 | BorderColor=xrdb.background 87 | Spacing=0 88 | BarLeftSpacing=0 89 | BarRightSpacing=0 90 | BarCenterSpacing=0 91 | Border =2 92 | ;FontName="Font Awesome" 93 | FontSize=8 94 | PaddingBottom=0 95 | PaddingLeft=0 96 | PaddingRight=0 97 | PaddingTop=0 98 | Systray=true 99 | 100 | ;----------------------------------------------------------------------- 101 | [Taskbar] 102 | ;ActiveForeground=#7e57c2 103 | ActiveOverline=#ffffff 104 | ;Foreground=#8A8383 105 | ;Background= xrdb.background 106 | ;Alpha=150 107 | ActiveBackground=xrdb.color0 108 | ActiveAlpha=150 109 | ;Alpha=50 110 | ;ActiveUnderline=#ff8c00 111 | 112 | ;----------------------------------------------------------------------- 113 | [Time] 114 | Interval=30 115 | Command="date +%H:%M__%d/%m/%y" 116 | Label="  " 117 | ;Background=xrdb.background 118 | Foreground=#ffffff 119 | ;Underline=#BF4091 120 | ;Border=0 121 | FontName="Neuropolitical" 122 | FontSize=8 123 | ClickLeft="zenity --calendar" 124 | 125 | ;----------------------------------------------------------------------- 126 | [Uptame] 127 | Interval=60 128 | Command=/etc/xdg/qobbar/blocks.sh 10 129 | Foreground=#ffffff 130 | 131 | ;----------------------------------------------------------------------- 132 | [LogoutButton] 133 | Label="  " 134 | ClickLeft= ~/.config/rofi/rofi-sh -p 135 | ;Underline=#FF3A00 136 | ;Overline=#40BF4D 137 | ;Border=1 138 | Foreground=#ffffff 139 | Background= xrdb.color1 140 | 141 | ;----------------------------------------------------------------------- 142 | [G-first] 143 | ;Background= xrdb.background 144 | Foreground=#9FA8DA 145 | FontName="Font Awesome" 146 | FontSize=10 147 | Label= 148 | 149 | ;----------------------------------------------------------------------- 150 | [G-last] 151 | ;Background= xrdb.background 152 | Foreground=#9FA8DA 153 | FontName="Font Awesome" 154 | FontSize=10 155 | Label= 156 | 157 | ;----------------------------------------------------------------------- 158 | [T-first] 159 | Background= xrdb.background 160 | Foreground=#2C2C2C 161 | FontName="Font Awesome" 162 | FontSize=12 163 | Label= 164 | 165 | ;----------------------------------------------------------------------- 166 | [T-last] 167 | Background= xrdb.background 168 | Foreground=#9FA8DA 169 | FontName="Font Awesome" 170 | FontSize=12 171 | Label= 172 | 173 | ;----------------------------------------------------------------------- 174 | [G-toggle] 175 | Label=" ♫ " 176 | ClickLeft= goldfinch -togglehide 177 | Foreground=#2C2C2C 178 | Background= #9FA8DA 179 | 180 | ;----------------------------------------------------------------------- 181 | [G-title] 182 | ;Label="  " 183 | # ClickLeft= mpris-ctl play 184 | Foreground=#2C2C2C 185 | Background= #9FA8DA 186 | Command= playerctl metadata xesam:title 187 | Interval=3 188 | 189 | ;----------------------------------------------------------------------- 190 | [G-play] 191 | ;Label="  " 192 | # ClickLeft= mpris-ctl play 193 | Foreground=#2C2C2C 194 | Background= #9FA8DA 195 | ClickLeft= playerctl play-pause 196 | Command= /etc/xdg/qobbar/blocks.sh 14 197 | Interval=3 198 | 199 | ;----------------------------------------------------------------------- 200 | [G-pause] 201 | Label="  " 202 | ClickLeft= playerctl pause 203 | Foreground=#2C2C2C 204 | Background= #9FA8DA 205 | 206 | ;----------------------------------------------------------------------- 207 | [G-next] 208 | Label=" " 209 | ClickLeft= playerctl previous 210 | Foreground=#2C2C2C 211 | Background= #9FA8DA 212 | 213 | ;----------------------------------------------------------------------- 214 | [G-previous] 215 | Label=" " 216 | ClickLeft= playerctl next 217 | Foreground=#2C2C2C 218 | Background= #9FA8DA 219 | 220 | ;----------------------------------------------------------------------- 221 | -------------------------------------------------------------------------------- /example/bspwm_top.conf: -------------------------------------------------------------------------------- 1 | ;----------------------------------------------------------------------- 2 | ; Available 3 | ;----------------------------------------------------------------------- 4 | 5 | ; ----------------------------- Common --------------------------------- 6 | # 7 | # Background color Hex or xrdb.color 8 | # Foreground color Hex or xrdb.color 9 | # Underline color Hex or xrdb.color 10 | # Overline color Hex or xrdb.color 11 | # BorderColor color Hex or xrdb.color 12 | # to get color from Xresource 13 | # ex: 'Background=xrdb.background' 14 | # ex: 'Overline=xrdb.color5' 15 | # 16 | # Border default=0 17 | # Alpha 0-to-255 default=255 18 | # FontName default parent fontfamily 19 | # FontSize default parent font size 20 | # FontBold default window fontbold 21 | # 22 | ;------------------------------- Panel --------------------------------- 23 | # 24 | # BorderColor 25 | # BarLeft Ex:Systray,statu1,statu2 26 | # BarCenter Ex:Time,Date 27 | # BarRight Ex:Pager 28 | # BarLeftSpacing default=0 29 | # BarRightSpacing default=0 30 | # BarCenterSpacing default=0 31 | # 32 | # -----padding has no effect in tilling wm ----- 33 | # PaddingBottom default=0 34 | # PaddingLeft default=0 35 | # PaddingRight default=0 36 | # PaddingTop default=0 37 | # Systray default=false 38 | # 39 | ; ------------------------------ Pager and Taskbar---------------------- 40 | # 41 | # ActiveBackground default window highlight 42 | # ActiveAlpha 0-to-255 default=255 43 | # ActiveForeground default window highlightText 44 | # ActiveUnderline color Hex or xrdb.color 45 | # ActiveOverline color Hex or xrdb.color 46 | # 47 | ;------------------------------ Pager ---------------------------------- 48 | # 49 | # DesktopDesplay "name" "index" "icon" default=index 50 | # icon-[0-9] ex: home,office,multimedia, 51 | # NOTE: The desktop name needs to match the name configured by the WM 52 | # You can get a list of the defined desktops using: 53 | # $ xprop -root _NET_DESKTOP_NAMES 54 | # 55 | # IconsList list of icon 0 to 9 56 | # 57 | ;------------------------------ Status --------------------------------- 58 | # 59 | # Command Command to desplay 60 | # Interval second default 1 61 | # MaxSize default 100 62 | # Label 63 | # Suffix 64 | # Prefix 65 | # ClickLeft Command to exec 66 | # ClickRight Command to exec 67 | # MouseWheelUp Command to exec 68 | # MouseWheelDown Command to exec 69 | # 70 | #-----------------------Powerline icon---------------------------------- 71 | # 72 | #                   r 73 | # 74 | ;----------------------------------------------------------------------- 75 | [Panel] 76 | BarRight=Disk,Temp,Cpu,Mem,Battery,Backlight,Volume,Wifi 77 | BarCenter=Wm 78 | BarLeft=Button,Pager,G-Last 79 | Top=true 80 | Background=xrdb.background 81 | Foreground=xrdb.foreground 82 | ;Alpha=0 83 | Spacing=0 84 | BarLeftSpacing=0 85 | BarRightSpacing=3 86 | BarCenterSpacing=0 87 | Border =2 88 | ;Underline=xrdb.color4 89 | ;FontName="FontAwesome" 90 | ;FontName="scientifica" 91 | FontSize=8 92 | PaddingBottom=0 93 | PaddingLeft=0 94 | PaddingRight=0 95 | PaddingTop=0 96 | Systray=false 97 | 98 | ;----------------------------------------------------------------------- 99 | [Pager] 100 | Foreground=#2C2C2C 101 | Background= #9FA8DA 102 | ActiveBackground=#3F51B5 103 | ActiveForeground=#ffffff 104 | DesktopDesplay="icon" 105 | IconsList=,,,,,,,,, 106 | ;IconsList=,,,,,, 107 | ;ActiveIcon= 108 | ;FontSize=8 109 | ;Border =1 110 | 111 | ;----------------------------------------------------------------------- 112 | [Disk] 113 | Label="    " 114 | Command=/etc/xdg/qobbar/blocks.sh 7 "/" 115 | Interval=30 116 | Background=#9FA8DA 117 | Foreground=#2C2C2C 118 | ClickLeft=pcmanfm 119 | FontSize=8 120 | BorderRadius=3 121 | 122 | ;----------------------------------------------------------------------- 123 | [Temp] 124 | Command=/etc/xdg/qobbar/blocks.sh 15 125 | Interval=5 126 | FontSize=8 127 | Foreground=#2C2C2C 128 | Label="    " 129 | Background=#9FA8DA 130 | ClickLeft="elokab-terminal -e htop" 131 | BorderRadius=3 132 | 133 | ;----------------------------------------------------------------------- 134 | [Cpu] 135 | Command=/etc/xdg/qobbar/blocks.sh 1 136 | ;Command=$HOME/.config/scripts/cpu_usage 137 | Interval=5 138 | Label="    " 139 | FontSize=8 140 | Background=#9FA8DA 141 | Foreground=#2C2C2C 142 | BorderRadius=3 143 | 144 | ;----------------------------------------------------------------------- 145 | [Mem] 146 | Command=/etc/xdg/qobbar/blocks.sh 3 147 | Interval=5 148 | Label="    " 149 | FontSize=8 150 | Foreground=#2C2C2C 151 | Background=#9FA8DA 152 | BorderRadius=3 153 | 154 | ;----------------------------------------------------------------------- 155 | [Battery] 156 | Command=/etc/xdg/qobbar/blocks.sh 6 157 | Interval=5 158 | Label="    " 159 | FontSize=8 160 | Background=#9FA8DA 161 | Foreground=#2C2C2C 162 | BorderRadius=3 163 | 164 | ;----------------------------------------------------------------------- 165 | [Backlight] 166 | Command=/etc/xdg/qobbar/blocks.sh 31 167 | Interval=3 168 | MouseWheelUp=xbacklight +5 169 | MouseWheelDown=xbacklight -5 170 | FontSize=8 171 | Label="    " 172 | Foreground=#2C2C2C 173 | Background=#9FA8DA 174 | BorderRadius=3 175 | 176 | ;----------------------------------------------------------------------- 177 | [Volume] 178 | Command=/etc/xdg/qobbar/blocks.sh 18 179 | Interval=5 180 | ClickLeft=pavucontrol-qt 181 | MouseWheelUp =amixer -D pulse set Master 5%+ unmute 182 | MouseWheelDown =amixer -D pulse set Master 5%- unmute 183 | Label="    " 184 | FontSize=8 185 | Foreground=#2C2C2C 186 | Background=#9FA8DA 187 | BorderRadius=3 188 | 189 | ;----------------------------------------------------------------------- 190 | [Wifi] 191 | Command=/etc/xdg/qobbar/blocks.sh 19 192 | ;Command=~/.config/scripts/bandwidth 193 | Interval=3 194 | Background=#9FA8DA 195 | Foreground=#2C2C2C 196 | FontSize=8 197 | Label="    " 198 | BorderRadius=3 199 | 200 | ;----------------------------------------------------------------------- 201 | [Wm] 202 | Label="  " 203 | ;Command=xdotool getactivewindow getwindowname 204 | Command=/etc/xdg/qobbar/blocks.sh 12 205 | Interval=3 206 | MaxSize=50 207 | ;FontName="Ubuntu Arabic" 208 | Foreground=#ffffff 209 | ;----------------------------------------------------------------------- 210 | [Mpd] 211 | Command=/etc/xdg/qobbar/blocks.sh 14 212 | Foreground=#AEC5DB 213 | Interval=3 214 | ClickLeft=mpc toggle 215 | 216 | ;----------------------------------------------------------------------- 217 | [Button] 218 | Label= "  " 219 | ;FontName="DejaVuSansMono Nerd Font" 220 | ;FontSize=8 221 | ClickLeft= ~/.config/rofi/rofi-sh -r 222 | Foreground=xrdb.foreground 223 | Background=xrdb.color1 224 | 225 | ;----------------------------------------------------------------------- 226 | [G-Last] 227 | ;Background= xrdb.background 228 | Foreground=#9FA8DA 229 | FontName="Font Awesome" 230 | FontSize=10 231 | Label="" 232 | 233 | ;----------------------------------------------------------------------- 234 | -------------------------------------------------------------------------------- /example/gento.conf: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # ___ _ _ # 3 | # / _ \ ___ | |__ | |__ __ _ _ __ # 4 | # | | | |/ _ \| '_ \| '_ \ / _` | '__| # 5 | # | |_| | (_) | |_) | |_) | (_| | | # 6 | # \__\_\\___/|_.__/|_.__/ \__,_|_| # 7 | # # 8 | ############################################# 9 | 10 | ;----------------------------------------------------------------------- 11 | ; Available 12 | ;----------------------------------------------------------------------- 13 | 14 | ; ----------------------------- Common --------------------------------- 15 | # 16 | # Background color Hex or xrdb.color 17 | # Foreground color Hex or xrdb.color 18 | # Underline color Hex or xrdb.color 19 | # Overline color Hex or xrdb.color 20 | # BorderColor color Hex or xrdb.color 21 | # to get color from Xresource 22 | # ex: 'Background=xrdb.background' 23 | # ex: 'Overline=xrdb.color5' 24 | # 25 | # Border default=0 26 | # Alpha 0-to-255 default=255 27 | # FontName default parent fontfamily 28 | # FontSize default parent font size 29 | # FontBold default window fontbold 30 | # 31 | ;------------------------------- Panel --------------------------------- 32 | # Monitor default 0 33 | # BorderRadius default 0 34 | # BorderColor 35 | # BarLeft Ex:Systray,statu1,statu2 36 | # BarCenter Ex:Time,Date 37 | # BarRight Ex:Pager 38 | # To repeat the same statu, add ":" and then a number 39 | # Ex: BarLeft=Sep;1,Cpu,Sep:2,Mem,Sep:3,Wifi 40 | # BarLeftSpacing default=0 41 | # BarRightSpacing default=0 42 | # BarCenterSpacing default=0 43 | # 44 | # MarginLeft default=0 45 | # MarginTop default=0 46 | # MarginRight default=0 47 | # MarginBottom default=0 48 | # 49 | # -----padding has no effect in tilling i3wm ----- 50 | # PaddingBottom default=0 51 | # PaddingLeft default=0 52 | # PaddingRight default=0 53 | # PaddingTop default=0 54 | # Systray default=false 55 | # 56 | ; ------------------------------ Pager and Taskbar---------------------- 57 | # 58 | # ActiveBackground default window highlight 59 | # ActiveAlpha 0-to-255 default=255 60 | # ActiveForeground default window highlightText 61 | # ActiveUnderline color Hex or xrdb.color 62 | # ActiveOverline color Hex or xrdb.color 63 | # 64 | ;------------------------------ Pager ---------------------------------- 65 | # 66 | # DesktopDesplay "name" "index" "icon" default=index 67 | # icon-[0-9] ex: home,office,multimedia, 68 | # NOTE: The desktop name needs to match the name configured by the WM 69 | # You can get a list of the defined desktops using: 70 | # $ xprop -root _NET_DESKTOP_NAMES 71 | # 72 | # IconsList list of icon 0 to 9 73 | # ActiveIcon if DesktopDesplay==icon default=NULL 74 | ;------------------------------ Conky --------------------------------- 75 | # 76 | # Command Command to desplay 77 | # 78 | ;------------------------------ Status --------------------------------- 79 | # 80 | # Command Command to desplay 81 | # Interval second default 1 82 | # MaxSize default 100 83 | # BorderRadius default 0 84 | # Label 85 | # Suffix 86 | # Prefix 87 | # ClickLeft Command to exec 88 | # ClickRight Command to exec 89 | # MouseWheelUp Command to exec 90 | # MouseWheelDown Command to exec 91 | # 92 | #-----------------------Powerline icon---------------------------------- 93 | # 94 | #                   r     95 | # 96 | ;----------------------------------------------------------------------- 97 | [Panel] 98 | Monitor=0 99 | #BarRight=Right-sep:1,Temp,Battery,Wifi,Cal,Time,LogoutButton,Left-sep:1,G-play 100 | BarRight=Right-sep:1,Conky,LogoutButton,Left-sep:1 101 | BarCenter=Right-sep:2,WinTitle,Left-sep:2 102 | BarLeft=Right-sep:3,Button,Pager,Left-sep:3 103 | Top=true 104 | Background=xrdb.background 105 | Foreground=xrdb.foreground 106 | Alpha=255 107 | BarLeftSpacing=0 108 | BarRightSpacing=0 109 | BarCenterSpacing=0 110 | Border =0 111 | ;FontName="Segoe UI" 112 | ;FontName="Neuropolitical" 113 | FontName="AvantGarde LT Medium" 114 | ;FontName="xos4 Terminus" 115 | FontSize=8 116 | PaddingBottom=0 117 | PaddingLeft=0 118 | PaddingRight=0 119 | PaddingTop=0 120 | MarginLeft=3 121 | MarginTop=2 122 | MarginRight=2 123 | MarginBottom=3 124 | Systray=true 125 | 126 | ;----------------------------------------------------------------------- 127 | [Pager] 128 | Background=xrdb.color0 129 | ActiveBackground=xrdb.color0 130 | Foreground=xrdb.color13 131 | ActiveForeground=xrdb.color6 132 | DesktopDesplay="name" 133 | IconsList=➊,➊,➌,➍,➎,➏,➐,➑,➒ 134 | FontName="DejaVu Sans" 135 | ;FontName="Segoe UI" 136 | ;IconsList=,,,,,, 137 | ;ActiveIcon= 138 | ;ActiveIcon=       139 | FontSize=12 140 | 141 | ;----------------------------------------------------------------------- 142 | [Time] 143 | Interval=30 144 | Command="date +%H:%M" 145 | Label="  " 146 | Background=xrdb.color0 147 | FontName="xos4 Terminus" 148 | FontSize=8 149 | ClickLeft="zenity --calendar" 150 | 151 | ;----------------------------------------------------------------------- 152 | [Cal] 153 | Interval=1800 154 | Command="date +%d/%m/%y" 155 | Label="  " 156 | Background=xrdb.color0 157 | ;Foreground=xrdb.color14 158 | ;Underline=#BF4091 159 | ;Border=0 160 | FontName="xos4 Terminus" 161 | FontSize=8 162 | ClickLeft="zenity --calendar" 163 | 164 | ;----------------------------------------------------------------------- 165 | [Disk] 166 | Label="" 167 | Command=$HOME/.config/qobbar/blocks.sh 7 "/" 168 | Interval=180 169 | Background=xrdb.color4 170 | Foreground=xrdb.color15 171 | ClickLeft=pcmanfm 172 | FontSize=8 173 | BorderRadius=3 174 | 175 | ;----------------------------------------------------------------------- 176 | [Temp] 177 | Command=$HOME/.config/qobbar/blocks.sh 15 178 | Interval=10 179 | FontSize=8 180 | ;Label="  " 181 | Background=xrdb.color0 182 | ClickLeft="elokab-terminal -e htop" 183 | FontName="xos4 Terminus" 184 | ;----------------------------------------------------------------------- 185 | [Cpu] 186 | Command=$HOME/.config/qobbar/blocks.sh 1 187 | ;Command=$HOME/.config/scripts/cpu_usage 188 | Interval=10 189 | Label=" " 190 | FontSize=8 191 | Background=xrdb.color3 192 | Foreground=xrdb.color15 193 | BorderRadius=3 194 | ClickLeft="elokab-terminal -e htop" 195 | 196 | ;----------------------------------------------------------------------- 197 | [Mem] 198 | Command=$HOME/.config/qobbar/blocks.sh 3 199 | Interval=30 200 | Label="" 201 | FontSize=8 202 | Background=xrdb.color1 203 | Foreground=xrdb.color15 204 | BorderRadius=3 205 | ClickLeft="elokab-terminal -e htop" 206 | 207 | ;----------------------------------------------------------------------- 208 | [Battery] 209 | Command=$HOME/.config/qobbar/blocks.sh 6 210 | Interval=5 211 | ;Label=" " 212 | FontSize=8 213 | Background=xrdb.color0 214 | FontName="xos4 Terminus" 215 | ;----------------------------------------------------------------------- 216 | [Backlight] 217 | Command=$HOME/.config/qobbar/blocks.sh 31 218 | Interval=10 219 | MouseWheelUp=xbacklight +5 220 | MouseWheelDown=xbacklight -5 221 | FontSize=8 222 | ;uiLabel=" " 223 | Background=xrdb.color6 224 | Foreground=xrdb.color15 225 | BorderRadius=3 226 | 227 | ;----------------------------------------------------------------------- 228 | [Volume] 229 | Command=$HOME/.config/qobbar/blocks.sh 18 230 | Interval=10 231 | ClickLeft=pavucontrol-qt 232 | MouseWheelUp =amixer -D pulse set Master 5%+ unmute 233 | MouseWheelDown =amixer -D pulse set Master 5%- unmute 234 | ;Label=" " 235 | FontSize=8 236 | Background=xrdb.color10 237 | Foreground=xrdb.background 238 | BorderRadius=3 239 | 240 | ;----------------------------------------------------------------------- 241 | [Wifi] 242 | Command=$HOME/.config/qobbar/blocks.sh 19 243 | ;Command=~/.config/scripts/bandwidth 244 | Interval=5 245 | Background=xrdb.color0 246 | FontSize=8 247 | Label="" 248 | FontName="xos4 Terminus" 249 | ;----------------------------------------------------------------------- 250 | [WinTitle] 251 | Background=xrdb.color0 252 | Label="  " 253 | ;Command=xdotool getactivewindow getwindowname 254 | Command=$HOME/.config/qobbar/blocks.sh 12 255 | Interval=3 256 | MaxSize=50 257 | FontName="Segoe UI" 258 | ;FontName="DejaVuSansMono Nerd Font" 259 | Foreground=xrdb.foreground 260 | ;ClickLeft="connman-gtk" 261 | 262 | ;----------------------------------------------------------------------- 263 | [Button] 264 | Label="  " 265 | ;FontName="DejaVuSansMono Nerd Font" 266 | ;FontSize=8 267 | ClickLeft= ~/.config/rofi/rofi-sh -r 268 | Foreground=xrdb.color15 269 | Background=xrdb.color1 270 | 271 | ;----------------------------------------------------------------------- 272 | [LogoutButton] 273 | Label="  " 274 | ClickLeft= ~/.config/rofi/rofi-sh -p 275 | ;Underline=#FF3A00 276 | ;Overline=#40BF4D 277 | ;Border=1 278 | Foreground=xrdb.color15 279 | Background= xrdb.color1 280 | 281 | ;----------------------------------------------------------------------- 282 | [G-play] 283 | ;Label=" " 284 | # ClickLeft= mpris-ctl play 285 | ;Background=xrdb.color9 286 | ;Foreground=xrdb.background 287 | ClickLeft= playerctl play-pause 288 | ClickRight= goldfinch -togglehide 289 | Command= $HOME/.config/qobbar/blocks.sh 14 290 | Interval=8 291 | 292 | ;----------------------------------------------------------------------- 293 | [Right-sep] 294 | ;Background= xrdb.background 295 | Foreground=xrdb.color0 296 | FontSize=11 297 | Label= 298 | 299 | ;----------------------------------------------------------------------- 300 | [Left-sep] 301 | ;Background= xrdb.background 302 | Foreground=xrdb.color0 303 | FontSize=11 304 | Label= 305 | 306 | [Conky] 307 | Command=conky -c $HOME/.config/qobbar/myconkyrc 308 | Interval=5 309 | Background=xrdb.color0 310 | FontName="xos4 Terminus" 311 | -------------------------------------------------------------------------------- /example/greenbar.conf: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------- 2 | ; Available 3 | ;------------------------------------------------------------------------- 4 | 5 | ; ----------------------------- Common ----------------------------------- 6 | # 7 | # Background color Hex or xrdb.color 8 | # Foreground color Hex or xrdb.color 9 | # Underline color Hex or xrdb.color 10 | # Overline color Hex or xrdb.color 11 | # BorderColor color Hex or xrdb.color 12 | # to get color from Xresource 13 | # ex: 'Background=xrdb.background' 14 | # ex: 'Overline=xrdb.color5' 15 | # 16 | # Border default=0 17 | # Alpha 0-to-255 default=255 18 | # FontName default parent fontfamily 19 | # FontSize default parent font size 20 | # FontBold default window fontbold 21 | # 22 | ;------------------------------- Panel ---------------------------------- 23 | # 24 | # BorderColor 25 | # BarLeft Ex:Systray,statu1,statu2 26 | # BarCenter Ex:Time,Date 27 | # BarRight Ex:Pager 28 | # BarLeftSpacing default=0 29 | # BarRightSpacing default=0 30 | # BarCenterSpacing default=0 31 | # 32 | # -----padding has no effect in tilling wm ----- 33 | # PaddingBottom default=0 34 | # PaddingLeft default=0 35 | # PaddingRight default=0 36 | # PaddingTop default=0 37 | # 38 | ; ----------------------------- Systray-------------------------------------- 39 | # 40 | ; ------------------------------ Pager and Taskbar-------------------------------------- 41 | # 42 | # ActiveBackground default window highlight 43 | # ActiveAlpha 0-to-255 default=255 44 | # ActiveForeground default window highlightText 45 | # ActiveUnderline color Hex or xrdb.color 46 | # ActiveOverline color Hex or xrdb.color 47 | # 48 | ;------------------------------ Pager --------------------------------------- 49 | # 50 | # DesktopDesplay "name" "index" "icon" default=index 51 | # icon-[0-9] ex: home,office,multimedia, 52 | # NOTE: The desktop name needs to match the name configured by the WM 53 | # You can get a list of the defined desktops using: 54 | # $ xprop -root _NET_DESKTOP_NAMES 55 | # 56 | # IconsList list of icon 0 to 9 57 | # 58 | ;------------------------------ Status --------------------------------------- 59 | # 60 | # Command Command to desplay 61 | # Interval second default 1 62 | # Label 63 | # Suffix 64 | # Prefix 65 | # ClickLeft Command to exec 66 | # ClickRight Command to exec 67 | # MouseWheelUp Command to exec 68 | # MouseWheelDown Command to exec 69 | # 70 | 71 | ;------------------------------------------------------------------------------- 72 | [Panel] 73 | BarRight=Time,Calendar,Disk,Temp,Cpu,Mem,Battery,Backlight,Volume,Wifi,LogoutButton 74 | BarCenter=Wm 75 | BarLeft=Button,Pager 76 | Top=true 77 | Background=xrdb.background 78 | ;Foreground=xrdb.foreground 79 | Foreground=#67E320 80 | ;Alpha=120 81 | ;Overline=xrdb.color0 82 | ;Underline=xrdb.color0 83 | ;BorderColor=#171014 84 | ;Spacing=2 85 | BarLeftSpacing=2 86 | BarRightSpacing=2 87 | BarCenterSpacing=0 88 | Border =2 89 | FontName="xos4 Terminus" 90 | FontSize=8 91 | PaddingBottom=0 92 | PaddingLeft=0 93 | PaddingRight=0 94 | PaddingTop=0 95 | Systray=true 96 | ;------------------------------------------------- 97 | [Pager] 98 | #ActiveBackground=#ffffff 99 | ;ActiveForeground=#67E320 100 | ;ActiveUnderline=#ffffff 101 | ;ActiveOverline=#ffff00 102 | DesktopDesplay="icon" 103 | IconsList=,,,,,, 104 | ActiveIcon= 105 | ;Foreground=#67E320 106 | #Background=#171014 107 | ;ActiveBackground=#ffffff 108 | ;Border=1 109 | ActiveAlpha=0 110 | 111 | ;------------------------------------------------- 112 | [Taskbar] 113 | ActiveForeground=#67E320 114 | #ActiveOverline=#ffffff 115 | Foreground=#67E320 116 | ;Background=#171014 117 | ActiveBackground=#ffffff 118 | ActiveAlpha=20 119 | ActiveUnderline=#ffffff 120 | Border=1 121 | 122 | ;------------------------------------------------- 123 | [Calendar] 124 | Interval=60 125 | Command="date +%d/%m/%y" 126 | ;Label="" 127 | Label="" 128 | ;Background=xrdb.background 129 | ;Foreground=#67E320 130 | ;Underline=#BF4091 131 | ;Border=0 132 | ;FontName="scientifica" 133 | ;FontSize=12 134 | ClickLeft="zenity --calendar" 135 | 136 | ;------------------------------------------------- 137 | [Time] 138 | Interval=30 139 | Command="date +%H:%M" 140 | ;Label="" 141 | Label="" 142 | ;Background=xrdb.background 143 | ;Foreground=#67E320 144 | ;Underline=#BF4091 145 | ;Border=0 146 | ;FontName="scientifica" 147 | ;FontSize=12 148 | ClickLeft="zenity --calendar" 149 | 150 | ;------------------------------------------------- 151 | [Disk] 152 | Label="" 153 | 154 | Command=/etc/xdg/qobbar/blocks.sh 7 "/" 155 | Interval=60 156 | ;Foreground=#67E320 157 | #Background=xrdb.color13 158 | ;Suffix="" 159 | ;Background=xrdb.color0 160 | ClickLeft=pcmanfm 161 | 162 | ;------------------------------------------------- 163 | [Temp] 164 | Command=/etc/xdg/qobbar/blocks.sh 15 165 | ;ommand=$HOME/.config/scripts/temperature2 166 | Interval=5 167 | 168 | Foreground=#67E320 169 | ;Foreground=xrdb.foreground 170 | 171 | Label="" 172 | ;Suffix=" " 173 | ;Background=xrdb.color1 174 | ;Underline=xrdb.color5 175 | ClickLeft="elokab-terminal -e htop" 176 | ;------------------------------------------------- 177 | [Cpu] 178 | Command=/etc/xdg/qobbar/blocks.sh 1 179 | ;Command=$HOME/.config/scripts/cpu_usage 180 | Interval=3 181 | Label= "" 182 | ;Suffix=" " 183 | ;Background=xrdb.color2 184 | Foreground=#67E320 185 | ;Underline=#ED163D 186 | ;------------------------------------------------- 187 | [Mem] 188 | Command=/etc/xdg/qobbar/blocks.sh 3 189 | Interval=5 190 | Label= "" 191 | ;Suffix=" " 192 | Foreground=#67E320 193 | ;Background=xrdb.color3 194 | ;------------------------------------------------- 195 | [Battery] 196 | Label="" 197 | Command=/etc/xdg/qobbar/blocks.sh 6 198 | Interval=1 199 | ;Background=xrdb.color12 200 | ;Foreground=#67E320 201 | ;Suffix=" " 202 | ;Background=xrdb.color4 203 | 204 | 205 | ;------------------------------------------------- 206 | [Backlight] 207 | Command=/etc/xdg/qobbar/blocks.sh 31 208 | Interval=3 209 | ;Foreground=#67E320 210 | MouseWheelUp=xbacklight +5 211 | MouseWheelDown=xbacklight -5 212 | ;Background=#5492CE 213 | ;Suffix=" " 214 | Label="" 215 | ;Background=xrdb.color5 216 | Border=1 217 | 218 | ;------------------------------------------------- 219 | [Volume] 220 | Label="" 221 | Command=/etc/xdg/qobbar/blocks.sh 18 222 | Interval=5 223 | ClickLeft=pavucontrol-qt 224 | MouseWheelUp =amixer -D pulse set Master 5%+ unmute 225 | MouseWheelDown =amixer -D pulse set Master 5%- unmute 226 | ;Foreground=#67E320 227 | ;Background=#b44e41 228 | ;Suffix=" " 229 | ;Background=xrdb.color6 230 | Border=1 231 | 232 | ;------------------------------------------------- 233 | 234 | 235 | [Wifi] 236 | Command=/etc/xdg/qobbar/blocks.sh 19 "wlp2s0" 237 | #Command=~/.config/scripts/bandwidth 238 | Label="" 239 | Interval=5 240 | Border=1 241 | ;Background=xrdb.color7 242 | ;Foreground=#67E320 243 | ;Suffix=" " 244 | ;Prefix="" 245 | ;Alpha=50 246 | 247 | ;------------------------------------------------- 248 | [Last] 249 | Background=xrdb.background 250 | Label= 251 | Foreground=#67E320 252 | 253 | ;------------------------------------------------- 254 | [Wm] 255 | Label=" " 256 | ;Command=xdotool getactivewindow getwindowname 257 | Command=/etc/xdg/qobbar/blocks.sh 12 258 | Interval=3 259 | MaxSize=50 260 | 261 | ;------------------------------------------------- 262 | [Mpd] 263 | Command=/etc/xdg/qobbar/blocks.sh 14 264 | Foreground=#67E320 265 | Interval=3 266 | ClickLeft=mpc toggle 267 | 268 | ;------------------------------------------------- 269 | [Button] 270 | Label= "  " 271 | ;ClickLeft=qobmenu 272 | ClickLeft= ~/.config/rofi/rofi-sh -r 273 | ;Underline=#FF3A00 274 | ;Suffix=" | " 275 | 276 | ;Foreground=#67E320 277 | 278 | ;------------------------------------------------- 279 | [LogoutButton] 280 | Label="  " 281 | ClickLeft= ~/.config/rofi/rofi-sh -s 282 | ;Underline=#FF3A00 283 | ;Overline=#40BF4D 284 | 285 | ;Foreground=#67E320 286 | -------------------------------------------------------------------------------- /example/myconkyrc: -------------------------------------------------------------------------------- 1 | background no 2 | out_to_x no 3 | own_window no 4 | out_to_console yes 5 | update_interval 5 6 | #cpu_avg_samples 2 7 | #net_avg_samples 2 8 | #override_utf8_locale yes 9 | #no_buffers yes 10 | temperature_unit celsius 11 | #draw_shades no 12 | #draw_outline no 13 | #draw_borders no 14 | #draw_graph_borders no 15 | #total_run_times 0 16 | # Text settings # 17 | #override_utf8_locale yes 18 | 19 | TEXT 20 | 21 |      ${time %a %d %b %Y}    ${time %H:%M}\ 22 |    ${uptime_short} \ 23 | #---------------------------------------Battery--------------------------------------------------------------------------------------------------------------------------------- 24 | ${if_match ${battery_percent BAT1} < 15}    ${battery BAT1} \ 25 | ${else}${if_match ${battery_percent BAT1} < 30}    ${battery BAT1} \ 26 | ${else}${if_match ${battery_percent BAT1} < 60}    ${battery BAT1} \ 27 | ${else}${if_match ${battery_percent BAT1} < 90}    ${battery BAT1} \ 28 | ${else}    ${battery BAT1} ${endif}${endif}${endif}${endif}\ 29 | #---------------------------------------Temperatur--------------------------------------------------------------------------------------------------------------------------------- 30 | ${if_match ${acpitemp} < 50}    ${acpitemp} \ 31 | ${else}${if_match ${acpitemp} < 60}    ${acpitemp} \ 32 | ${else}${if_match ${acpitemp} < 70}    ${acpitemp} \ 33 | ${else}    ${acpitemp} ${endif}${endif}${endif} \ 34 | #------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 35 |    ${memperc}% \ 36 |    ${cpu cpu}% \ 37 |     ${upspeedf wlp2s0}  ${downspeedf wlp2s0}   \ 38 | 39 | -------------------------------------------------------------------------------- /example/qobbar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakariakov/qobbar/4fbc7368cd33cfd405bc5558dc25da8933b7537d/example/qobbar1.png -------------------------------------------------------------------------------- /example/qobbar2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakariakov/qobbar/4fbc7368cd33cfd405bc5558dc25da8933b7537d/example/qobbar2.jpg -------------------------------------------------------------------------------- /example/qobbar3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakariakov/qobbar/4fbc7368cd33cfd405bc5558dc25da8933b7537d/example/qobbar3.jpg -------------------------------------------------------------------------------- /example/qobbar4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakariakov/qobbar/4fbc7368cd33cfd405bc5558dc25da8933b7537d/example/qobbar4.png -------------------------------------------------------------------------------- /example/qobbar5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakariakov/qobbar/4fbc7368cd33cfd405bc5558dc25da8933b7537d/example/qobbar5.jpg -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "panelwidget.h" 2 | 3 | #include "panelapplication.h" 4 | #include "panel_adaptor.h" 5 | #include "utils/defines.h" 6 | 7 | 8 | //#include 9 | #include 10 | 11 | void help() 12 | { 13 | printf("Usage: qobbar [OPTION]\n"); 14 | puts("qobbar v: 0.2 \n" ); 15 | puts("OPTION:\n"); 16 | puts(" -h --help Print this help."); 17 | puts(" -c --config config file name."); 18 | puts(" Ex: create file in $HOME/.config/qobbar/top-bar.conf "); 19 | puts(" run \"qobbar -c top-bar\" ."); 20 | puts(" -d --debug Print debug in termminal."); 21 | puts(" -r --right right-to-left layout direction."); 22 | puts(" -R --reconfig Reconfigure the bar ex:\"qobbar -R -c top-bar\"."); 23 | puts(" -x --exit close the bar ex:\"qobbar -x -c top-bar\"."); 24 | puts(" -s --showhide show or hide bar. ex: \"qobbar -s -c top-bar\"."); 25 | puts(" -n --hindonum qisplay the hindo number .١٢٣٤٥٦٧٨٩."); 26 | puts(" -l --list Print list of available modules."); 27 | puts(" -b --bypass-wm Bypass the window manager completely."); 28 | puts(" -signal Emit signal has changed ."); 29 | puts(" Ex: qobbar -c top-bar -signal Cpu"); 30 | } 31 | 32 | void mylist() 33 | { 34 | puts("Colors configured using this name 'Colors'."); 35 | puts("Panel configured using this name 'Panel'."); 36 | puts("Pager configured using this name 'Pager'."); 37 | puts("Systray configured using this name 'Systray'."); 38 | puts("Taskbar configured using this name 'Taskbar'."); 39 | puts("Conky configured using this name 'Conky'."); 40 | puts("ActiveWindow configured using this name 'ActiveWindow'."); 41 | puts("Statu configured using any name ex: 'Cpu' 'Mem'."); 42 | 43 | } 44 | 45 | int main(int argc, char *argv[]) 46 | { 47 | PanelApplication a(argc, argv); 48 | 49 | QStringList args = a.arguments(); 50 | bool hide=false; 51 | bool exit=false; 52 | bool reconfig=false; 53 | bool debug=false; 54 | bool bypassWm=false; 55 | bool hindo=false; 56 | QString signal; 57 | if(args.count()>1) 58 | { 59 | for (int i = 0; i < args.count(); ++i) { 60 | QString arg = args.at(i); 61 | 62 | if (arg == "-h" || arg == "--help" ) {help();return 1; } 63 | 64 | else if (arg == "-c" || arg == "--config" ) { 65 | QString conf; 66 | if(i+1>args.count()-1){help();return 1;} 67 | conf=QString(args.at(i+1)); 68 | conf.remove(".conf"); 69 | if(QFile::exists(QDir::homePath()+"/.config/qobbar/"+conf+".conf")){ 70 | a.setApplicationName(conf); 71 | } 72 | } 73 | else if (arg == "-signal" ) { 74 | 75 | if(i+1>args.count()-1){help();return 1;} 76 | signal=QString(args.at(i+1)); 77 | 78 | } 79 | else if (arg == "-d" || arg == "--debug" ) { debug=true;} 80 | else if (arg == "-s" || arg == "--showhide") { hide=true; } 81 | else if (arg == "-x" || arg == "--exit" ) {exit=true; } 82 | else if (arg == "-R" || arg == "--reconfig") {reconfig=true;} 83 | else if (arg == "-r" || arg == "--right" ) { a.setLayoutDirection(Qt::RightToLeft);} 84 | else if (arg == "-l" || arg == "--list" ) { mylist(); return 0;} 85 | else if (arg == "-b" || arg == "--bypass-wm" ) {bypassWm=true;} 86 | else if (arg == "-n" || arg == "--hindonum" ) {hindo=true;} 87 | 88 | }//for 89 | }//if 90 | 91 | QDBusConnection connection = QDBusConnection::sessionBus(); 92 | if (! QDBusConnection::sessionBus().registerService("org.elokab.panel."+a.applicationName())) 93 | { 94 | 95 | printf ("Unable to register 'org.elokab.qobbar' service - is another instance of elokab-qobbar running?\n"); 96 | 97 | QDBusInterface dbus("org.elokab.panel."+a.applicationName(), 98 | "/org/elokab/panel/"+a.applicationName(), 99 | "org.elokab.panel.Interface"); 100 | 101 | if (!dbus.isValid()) { printf ("QDBusInterface is not valid!");return 0; } 102 | if (hide) {dbus.call("showHide"); return 0;} 103 | if (exit) {dbus.call("exit"); return 0;} 104 | if (reconfig) {dbus.call("reconfigure"); return 0;} 105 | if (!signal.isEmpty()) {dbus.call("emitSignal",signal); return 0;} 106 | return 0; 107 | } 108 | 109 | Defines::setDeguging(debug); 110 | Defines::setHindoNum(hindo); 111 | PanelWidget w(bypassWm); 112 | 113 | new panel_adaptor(&w); 114 | connection.registerObject("/org/elokab/panel/"+a.applicationName(), &w); 115 | 116 | w.show(); 117 | a.setPanel(&w); 118 | return a.exec(); 119 | 120 | } 121 | -------------------------------------------------------------------------------- /panel_adaptor.cpp: -------------------------------------------------------------------------------- 1 | #include "panel_adaptor.h" 2 | 3 | 4 | panel_adaptor::panel_adaptor(QObject *parent) 5 | : QDBusAbstractAdaptor(parent) 6 | { 7 | // constructor 8 | setAutoRelaySignals(true); 9 | } 10 | 11 | panel_adaptor::~panel_adaptor() 12 | { 13 | // destructor 14 | 15 | } 16 | 17 | void panel_adaptor::emitSignal(const QString &key) 18 | { 19 | // handle method call org.tawhid.session.org.logout 20 | QMetaObject::invokeMethod(parent(), "emitSignal", Q_ARG(QString, key)); 21 | } 22 | 23 | void panel_adaptor::reconfigure() 24 | { 25 | qDebug()<<"parent dbus"<< parent()->objectName(); 26 | QMetaObject::invokeMethod(parent(), "reconfigure"); 27 | } 28 | 29 | void panel_adaptor::showHide() 30 | { 31 | QMetaObject::invokeMethod(parent(), "showHide"); 32 | } 33 | 34 | void panel_adaptor::exit() 35 | { 36 | QMetaObject::invokeMethod(parent(), "exit"); 37 | } 38 | -------------------------------------------------------------------------------- /panel_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef RUN_ADAPTOR_H 2 | #define RUN_ADAPTOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | QT_BEGIN_NAMESPACE 8 | 9 | class QString; 10 | 11 | QT_END_NAMESPACE 12 | 13 | /* 14 | * Adaptor class for interface org.tawhid.session.org 15 | */ 16 | 17 | class panel_adaptor: public QDBusAbstractAdaptor 18 | { 19 | Q_OBJECT 20 | Q_CLASSINFO("D-Bus Interface", "org.elokab.panel.Interface") 21 | Q_CLASSINFO("D-Bus Introspection", "" 22 | " \n" 23 | " \n" 24 | " " 25 | " " 26 | " \n" 27 | " " 28 | " \n" 29 | " " 30 | " \n" 31 | " " 32 | " \n" 33 | "") 34 | public: 35 | panel_adaptor(QObject *parent); 36 | virtual ~panel_adaptor(); 37 | 38 | 39 | public Q_SLOTS: // METHODS 40 | void emitSignal(const QString &key); 41 | void reconfigure(); 42 | void showHide(); 43 | void exit(); 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /panelapplication.cpp: -------------------------------------------------------------------------------- 1 | #include "panelapplication.h" 2 | #include 3 | PanelApplication::PanelApplication(int& argc, char** argv) 4 | : QApplication(argc, argv), 5 | mPanel(nullptr) 6 | { 7 | setOrganizationName("qobbar"); 8 | setApplicationName("qobbar"); 9 | setApplicationDisplayName("QobBar"); 10 | setLayoutDirection(Qt::LeftToRight); 11 | setApplicationVersion("0.2.1"); 12 | qApp->installNativeEventFilter(this); 13 | } 14 | 15 | bool PanelApplication::nativeEventFilter(const QByteArray &eventType, void *message, long *result) 16 | { 17 | if(mPanel){ 18 | //qDebug()<<"PanelApplication::nativeEventFilter"; 19 | mPanel->setNativeEventFilter(eventType,message,result); 20 | //return true; 21 | } 22 | return false; 23 | } 24 | -------------------------------------------------------------------------------- /panelapplication.h: -------------------------------------------------------------------------------- 1 | #ifndef PANELAPPLICATION_H 2 | #define PANELAPPLICATION_H 3 | 4 | #include "panelwidget.h" 5 | #include 6 | #include 7 | 8 | class PanelApplication : public QApplication,public QAbstractNativeEventFilter 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit PanelApplication(int& argc, char** argv); 13 | //explicit PanelApplication(QObject *parent = nullptr); 14 | void setPanel(PanelWidget* panel){ mPanel = panel;} 15 | bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); 16 | signals: 17 | 18 | public slots: 19 | 20 | private: 21 | 22 | PanelWidget *mPanel; 23 | }; 24 | 25 | #endif // PANELAPPLICATION_H 26 | -------------------------------------------------------------------------------- /panelwidget.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * elokab Copyright (C) 2014 AbouZakaria * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef PANELWIDGET_H 21 | #define PANELWIDGET_H 22 | #include "status/statuslabel.h" 23 | #include "status/conkystatu.h" 24 | 25 | 26 | #include 27 | //#include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | //#include "xcb/xcb.h" 36 | namespace Ui { 37 | class PanelWidget; 38 | } 39 | 40 | #include 41 | #include "etaskbar/dtaskbarwidget.h" 42 | #include "dsystray/systray.h" 43 | #include "ewindow/activewindow.h" 44 | #include "epager/pager.h" 45 | #include 46 | 47 | #include 48 | class PanelWidget : public QWidget 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit PanelWidget(bool bypassWm=false,QWidget *parent = nullptr); 54 | // bool nativeEventFilter(const QByteArray &eventType, void *message, long *); 55 | void setNativeEventFilter(const QByteArray &eventType, void *message, long *result); 56 | ~PanelWidget(); 57 | public slots: 58 | // void reconfigure(); 59 | void exit(){qApp->quit();} 60 | 61 | // void setDock (); 62 | //unsigned int getWindowPID(Window winID) ; 63 | 64 | void showHide(); 65 | void emitSignal(const QString &group); 66 | private: 67 | 68 | Ui::PanelWidget *ui; 69 | // bool mdebug; 70 | SysTray *mSysTray; 71 | Pager *mPager; 72 | conkyStatu *mConky ; 73 | DtaskbarWidget *mTaskbar; 74 | ActiveWindow *mWindow; 75 | 76 | QFileSystemWatcher *mFileSystemWatcher; 77 | QTimer *m_timer; 78 | 79 | enum Pos{LEFT,CENTER,RIGHT}; 80 | void loadSettings(bool charge=false); 81 | void chargeStatus(QStringList listLeft,QStringList listCenter,QStringList listRight); 82 | // QList listWidgets; 83 | QHash listStatus; 84 | QStringList listWidget; 85 | 86 | QStringList m_listLeft; 87 | QStringList m_listCenter; 88 | QStringList m_listRight; 89 | 90 | QRect m_PaddingRect; 91 | QRect m_MarginRect; 92 | 93 | //QWindow *tlwWindow ; 94 | 95 | 96 | 97 | bool m_topPos; 98 | bool m_isCoposite; 99 | 100 | int m_Screen=0; 101 | int m_height=0; 102 | int m_Border=0; 103 | 104 | 105 | 106 | private slots: 107 | void compositorChanged(); 108 | void reconfigure(); 109 | void resizePanel(); 110 | int calculatSize(); 111 | //X11 112 | void moveToAllDesktop(); 113 | void setStrut(int top, int bottom, int topStartX,int topEndX,int bottomStartX, int bottomEndX ); 114 | 115 | void addStatus(QStringList list,int pos); 116 | void addWidget(QWidget *w,int pos); 117 | void loadIconThems(); 118 | QRect desktopRect(); 119 | 120 | // void moveToShow(); 121 | // void moveToHide(); 122 | }; 123 | 124 | #endif // PANELWIDGET_H 125 | -------------------------------------------------------------------------------- /panelwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | PanelWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 516 10 | 16 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | PanelWidget 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 0 37 | 38 | 39 | 0 40 | 41 | 42 | 43 | 44 | 45 | 0 46 | 47 | 48 | 0 49 | 50 | 51 | 0 52 | 53 | 54 | 0 55 | 56 | 57 | 0 58 | 59 | 60 | 61 | 62 | 0 63 | 64 | 65 | QLayout::SetFixedSize 66 | 67 | 68 | 0 69 | 70 | 71 | 0 72 | 73 | 74 | 0 75 | 76 | 77 | 0 78 | 79 | 80 | 81 | 82 | 83 | 84 | Qt::Horizontal 85 | 86 | 87 | 88 | 251 89 | 13 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 0 98 | 99 | 100 | QLayout::SetDefaultConstraint 101 | 102 | 103 | 0 104 | 105 | 106 | 0 107 | 108 | 109 | 110 | 111 | 112 | 113 | Qt::Horizontal 114 | 115 | 116 | 117 | 251 118 | 13 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 0 127 | 128 | 129 | QLayout::SetFixedSize 130 | 131 | 132 | 0 133 | 134 | 135 | 0 136 | 137 | 138 | 0 139 | 140 | 141 | 0 142 | 143 | 144 | 145 | 146 | 147 | 148 | 0 149 | 150 | 151 | QLayout::SetFixedSize 152 | 153 | 154 | 0 155 | 156 | 157 | 0 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /qobbar.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-03-04T09:15:20 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui x11extras concurrent dbus 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TEMPLATE = app 12 | 13 | LIBS += $(SUBLIBS) -L/usr/lib -lX11 -lXcomposite -lXdamage 14 | 15 | # The following define makes your compiler emit warnings if you use 16 | # any feature of Qt which as been marked as deprecated (the exact warnings 17 | # depend on your compiler). Please consult the documentation of the 18 | # deprecated API in order to know how to port your code away from it. 19 | DEFINES += QT_DEPRECATED_WARNINGS 20 | 21 | # You can also make your code fail to compile if you use deprecated APIs. 22 | # In order to do so, uncomment the following line. 23 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 25 | 26 | TARGET = qobbar 27 | DESTDIR = usr/bin 28 | CONFIG += qt \ 29 | release 30 | OBJECTS_DIR = build 31 | MOC_DIR = build 32 | UI_DIR = build 33 | INCLUDEPATH +=build 34 | 35 | SOURCES += main.cpp\ 36 | panelapplication.cpp \ 37 | panelwidget.cpp \ 38 | panel_adaptor.cpp \ 39 | status/conkystatu.cpp \ 40 | status/statuslabel.cpp \ 41 | etaskbar/dtaskbarwidget.cpp \ 42 | etaskbar/dactiontaskbar.cpp \ 43 | utils/defines.cpp \ 44 | utils/x11utills.cpp \ 45 | dsystray/systray.cpp \ 46 | dsystray/trayicon.cpp \ 47 | utils/xdesktoputils.cpp \ 48 | epager/pager.cpp \ 49 | utils/stylecolors.cpp \ 50 | utils/setting.cpp \ 51 | ewindow/activewindow.cpp 52 | 53 | HEADERS += panelwidget.h \ 54 | panel_adaptor.h \ 55 | panelapplication.h \ 56 | status/conkystatu.h \ 57 | status/statuslabel.h \ 58 | utils/defines.h \ 59 | utils/x11utills.h \ 60 | utils/xdesktoputils.h \ 61 | etaskbar/dactiontaskbar.h \ 62 | etaskbar/dtaskbarwidget.h \ 63 | dsystray/systray.h \ 64 | dsystray/trayicon.h \ 65 | epager/pager.h \ 66 | utils/stylecolors.h \ 67 | utils/setting.h \ 68 | ewindow/activewindow.h 69 | 70 | FORMS += panelwidget.ui \ 71 | 72 | 73 | DISTFILES += \ 74 | etc/xdg/qobbar/qobbar.conf \ 75 | etc/xdg/qobbar/blocks.sh \ 76 | README.md 77 | #--------------------------------------------- 78 | # TRANSLATIONS 79 | #--------------------------------------------- 80 | #--------------------------------------------- 81 | # INSTALL 82 | #--------------------------------------------- 83 | MKDIR = mkdir -p /etc/xdg 84 | 85 | target.path = /usr/bin 86 | 87 | xdgConf.files=etc/xdg/qobbar/* 88 | xdgConf.path=/etc/xdg/qobbar/ 89 | 90 | INSTALLS +=target \ 91 | xdgConf 92 | -------------------------------------------------------------------------------- /status/conkystatu.cpp: -------------------------------------------------------------------------------- 1 | #include "conkystatu.h" 2 | #include "utils/stylecolors.h" 3 | #include "utils/defines.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | QString fixFileName(QString cmd) 10 | { 11 | if(cmd.contains("$HOME/") || cmd.contains("~/")){ 12 | cmd.replace("$HOME/",QDir::homePath()+"/"); 13 | cmd.replace("~/",QDir::homePath()+"/"); 14 | // cmd.insert(0,QDir::homePath()); 15 | } 16 | return cmd.trimmed(); 17 | } 18 | conkyStatu::conkyStatu(/*Setting *s,*/ QWidget *parent):m_Parent(parent)/*,m_Setting(s)*/ 19 | { 20 | 21 | m_process=new QProcess; 22 | setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); 23 | setMargin(0); 24 | setContentsMargins(0,0,0,0); 25 | connect(m_process,SIGNAL(readyReadStandardOutput()),this,SLOT(startConky())); 26 | loadSettings(); 27 | } 28 | 29 | 30 | void conkyStatu::loadSettings() 31 | { 32 | 33 | m_process->close(); 34 | 35 | Setting::instance()->beginGroup(MCONKY); 36 | // m_Setting->beginGroup("Conky"); 37 | QString command =Setting::command(); 38 | int border =Setting::border(); 39 | QString bgColor =Setting::background(); 40 | QString fgColor =Setting::foreground(m_Parent->palette().windowText().color().name()); 41 | QString borderColor =Setting::borderColor(); 42 | QString underline =Setting::underline(); 43 | QString overline =Setting::overline(); 44 | int alpha =Setting::alpha(); 45 | QStringList fontName =Setting::fontName(m_Parent->font().families()); 46 | int fontSize =Setting::fontSize(m_Parent->font().pointSize()); 47 | bool fontBold =Setting::fontBold(m_Parent->font().bold()); 48 | int radius =Setting::radius(); 49 | 50 | Setting::instance()->endGroup(); 51 | if(Defines::degug()){ 52 | // m_Setting->beginGroup("Conky"); 53 | qDebug()<<"\033[32m [-] ConkyStatu : "<< __LINE__; 54 | qDebug()<<" [-] ConkyStatu : command :"<start(command); 91 | 92 | startConky(); 93 | 94 | } 95 | 96 | void conkyStatu::startConky() 97 | { 98 | 99 | 100 | QString result=m_process->readAllStandardOutput(); 101 | QString err=m_process->readAllStandardError(); 102 | 103 | if(!err.isEmpty()) 104 | qDebug()<<"\033[31m ConkyStatu Error command:"<0){ 109 | QString out=list.last(); 110 | if(out.contains("xrdb")){ 111 | out= StyleColors::xrdbget(out); 112 | } 113 | 114 | setText(out); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /status/conkystatu.h: -------------------------------------------------------------------------------- 1 | #ifndef CONKYSTATU_H 2 | #define CONKYSTATU_H 3 | #include "utils/setting.h" 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | class conkyStatu : public QLabel 10 | { 11 | Q_OBJECT 12 | public: 13 | conkyStatu(/*Setting *s,*/ QWidget *parent=nullptr); 14 | 15 | 16 | void loadSettings(); 17 | int heightSize(){return m_Height;} 18 | private slots: 19 | void startConky(); 20 | private: 21 | 22 | QWidget *m_Parent; 23 | // Setting *m_Setting; 24 | QProcess *m_process; 25 | int m_Height; 26 | }; 27 | 28 | #endif // CONKYSTATU_H 29 | -------------------------------------------------------------------------------- /status/statuslabel.cpp: -------------------------------------------------------------------------------- 1 | #include "statuslabel.h" 2 | #include "utils/stylecolors.h" 3 | #include "utils/defines.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | QString fixCommand(QString cmd) 12 | { 13 | if(cmd.contains("$HOME/") || cmd.contains("~/")){ 14 | cmd.replace("$HOME/",QDir::homePath()+"/"); 15 | cmd.replace("~/",QDir::homePath()+"/"); 16 | // cmd.insert(0,QDir::homePath()); 17 | } 18 | return cmd.trimmed(); 19 | } 20 | 21 | //________________________________________________________________ Constructor 22 | StatusLabel::StatusLabel(QString group, QWidget *parent):QLabel(parent), 23 | mName(group),mParent(parent) 24 | { 25 | 26 | if(Defines::degug()) qDebug()<<"\033[32m [-] statu : "<stop(); 55 | 56 | QString groupName=mName; 57 | 58 | if(mName.contains(":")){ 59 | groupName=mName.section(":",0,0); 60 | 61 | } 62 | 63 | Setting::instance()->beginGroup(groupName); 64 | 65 | QString mCommand =Setting::command(); 66 | int interval =Setting::interval(); 67 | mLabel =Setting::label(); 68 | mRampList =Setting::ramps(); 69 | // mPrefix =Setting::prefix(); 70 | mMouseLeftCmd =Setting::clickLeft(); 71 | mMouseRightCmd =Setting::clickRight(); 72 | mMouseWheelUpCmd =Setting::mouseWheelUp(); 73 | mMouseWheelDownCmd =Setting::mouseWheelDown(); 74 | maxSize =Setting::maxSize(); 75 | int minSize =Setting::minSize(); 76 | QString bgColor =Setting::background(); 77 | QString fgColor =Setting::foreground(mParent->palette().windowText().color().name()); 78 | QString underline =Setting::underline(); 79 | QString overline =Setting::overline(); 80 | QString borderColor =Setting::borderColor(); 81 | mBoreder =Setting::border(); 82 | int alpha =Setting::alpha(); 83 | QStringList fontName =Setting::fontName(mParent->font().families()); 84 | int fontSize =Setting::fontSize(mParent->font().pointSize()); 85 | bool fontBold =Setting::fontBold(mParent->font().bold()); 86 | int radius =Setting::radius(); 87 | int leftTopRadius =Setting::leftTopRadius(); 88 | int rightTopRadius =Setting::rightTopRadius(); 89 | int leftBotRadius =Setting::leftBottomRadius(); 90 | int rightBotRadius =Setting::rightBottomRadius(); 91 | 92 | Setting::instance()->endGroup(); 93 | 94 | //_________________________________________________ INIT 95 | QFont font; 96 | font.setPointSize(fontSize); 97 | font.setFamilies(fontName); 98 | font.setBold(fontBold); 99 | setFont(font); 100 | QFontMetrics fm(font); 101 | mHeight=fm.height()+(fm.leading()*2)+(mBoreder*2); 102 | int w=fm.horizontalAdvance("x")*minSize; 103 | 104 | setMinimumWidth(w); 105 | 106 | // if(mSuffix.contains("xrdb.")) 107 | // mSuffix=StyleColors::xrdbget(mSuffix); 108 | 109 | // if(mPrefix.contains("xrdb.")) 110 | // mPrefix=StyleColors::xrdbget(mPrefix); 111 | 112 | if(mLabel.contains("xrdb.")) 113 | mLabel=StyleColors::xrdbget(mLabel); 114 | 115 | 116 | 117 | if(interval<1000)interval=(60000*60)*24;//one day 118 | 119 | mMouseLeftCmd =fixCommand(mMouseLeftCmd); 120 | mMouseRightCmd =fixCommand(mMouseRightCmd); 121 | mMouseWheelUpCmd =fixCommand(mMouseWheelUpCmd); 122 | mMouseWheelDownCmd =fixCommand(mMouseWheelDownCmd); 123 | mCommand =fixCommand(mCommand); 124 | 125 | if(Defines::degug()){ 126 | qDebug()<<"\033[32m [-] statu : "<0) 140 | setContentsMargins((RadiusSize/2)+1,0,(RadiusSize/2)+1,0); 141 | 142 | 143 | //_________________________________________________ STYLESHEET 144 | QString mystyle=StyleColors::style(bgColor, 145 | fgColor, 146 | underline, 147 | overline, 148 | mBoreder, 149 | alpha, 150 | borderColor, 151 | radius, 152 | leftTopRadius, 153 | rightTopRadius, 154 | leftBotRadius, 155 | rightBotRadius); 156 | qDebug()<<" [*]"<<__FILE__<<__LINE__<setCommand(mCommand); 162 | startCommand(interval); 163 | }else{ 164 | QString txt=mLabel; 165 | txt.replace("$Command",QString()); 166 | setText(txt); 167 | } 168 | 169 | } 170 | 171 | //_______________________________________________________________ Mouse 172 | void StatusLabel::mouseReleaseEvent(QMouseEvent *ev) 173 | { 174 | 175 | if (ev->button() == Qt::LeftButton){ 176 | if(!mMouseLeftCmd.isEmpty()){ 177 | execCmd(MouseLeft); 178 | } 179 | }else if(ev->button() == Qt::RightButton){ 180 | if(!mMouseRightCmd.isEmpty()){ 181 | execCmd(MouseRight); 182 | } 183 | } 184 | 185 | } 186 | 187 | //_______________________________________________________________ Mouse 188 | void StatusLabel::wheelEvent(QWheelEvent* e) 189 | { 190 | 191 | // int delta = e->delta() < 0 ? 1 : -1; 192 | int delta = e->delta(); 193 | if(delta>20){ 194 | if(!mMouseWheelUpCmd.isEmpty()) 195 | execCmd(MouseWheelUp); 196 | }else if(delta<-20){ 197 | if(!mMouseWheelDownCmd.isEmpty()) 198 | execCmd(MouseWheelDown); 199 | } 200 | 201 | } 202 | 203 | //_______________________________________________________________ Mouse 204 | void StatusLabel::execCmd(int type) 205 | { 206 | QProcess pr; 207 | 208 | QStringList listleft=mMouseLeftCmd.split(" "); 209 | QString cmdLeft=listleft.first(); 210 | listleft.removeFirst(); 211 | 212 | QStringList listRight=mMouseRightCmd.split(" "); 213 | QString cmdRight=listRight.first(); 214 | listRight.removeFirst(); 215 | 216 | QStringList listUp=mMouseWheelUpCmd.split(" "); 217 | QString cmdUp=listUp.first(); 218 | listUp.removeFirst(); 219 | 220 | QStringList listDown=mMouseWheelDownCmd.split(" "); 221 | QString cmdDown=listDown.first(); 222 | listDown.removeFirst(); 223 | 224 | switch (type) { 225 | case MouseLeft: 226 | pr.startDetached(cmdLeft,listleft); 227 | break; 228 | case MouseRight: 229 | pr.startDetached(cmdRight,listRight); 230 | break; 231 | case MouseWheelUp: 232 | pr.startDetached(cmdUp,listUp); 233 | break; 234 | case MouseWheelDown: 235 | pr.startDetached(cmdDown,listDown); 236 | break; 237 | default: 238 | break; 239 | } 240 | 241 | //تطبيق الامر اذا كان موجودا بمجرد النقر او الازاحة للعجلة 242 | if(!mThread->command().isEmpty()) 243 | startRender(); 244 | 245 | } 246 | 247 | //________________________________________________________________ 248 | void StatusLabel::startCommand(int interval) 249 | { 250 | 251 | mTimer->setInterval(interval); 252 | connect(mTimer,SIGNAL(timeout()),this,SLOT(startRender())); 253 | mTimer->start(); 254 | startRender(); 255 | 256 | } 257 | 258 | //________________________________________________________________ 259 | void StatusLabel::startRender() 260 | { 261 | if(mThread->isRunning()){return;} 262 | 263 | mThread->start(); 264 | } 265 | 266 | //________________________________________________________________ 267 | void StatusLabel::cancelRender() 268 | { 269 | if(Defines::degug()) qDebug()<<"\033[32m [-] statu : "<stop(); 272 | //mThread->terminate(); 273 | mThread->blockSignals(true); 274 | } 275 | 276 | 277 | //*********************** THREAD ****************************** 278 | QString StatusLabel::getRampIcon(QString str) 279 | { 280 | 281 | int result=str.remove("%").trimmed().toInt(); 282 | 283 | if(result<0 || result>100) 284 | return QString(); 285 | 286 | 287 | //int percent=100/mRampList.count(); 288 | int ramp=(result*mRampList.count())/100; 289 | 290 | if(ramp<0 ) 291 | ramp=0; 292 | else if(ramp>mRampList.count()-1) 293 | ramp=mRampList.count()-1; 294 | 295 | return mRampList.at(ramp); 296 | 297 | 298 | } 299 | void StatusLabel::updateCmd(QString result) 300 | { 301 | 302 | 303 | 304 | setToolTip(QString()); 305 | if(result.length()>maxSize){ 306 | setToolTip(result); 307 | result.resize(maxSize-1); 308 | result+="…"; 309 | } 310 | 311 | QString txt=mLabel; 312 | 313 | if(txt.contains("$RampIcons") ) 314 | txt=txt.replace("$RampIcons",getRampIcon(result.trimmed())); 315 | 316 | if(txt.contains("$Command")) 317 | txt=txt.replace("$Command",result.trimmed()); 318 | else 319 | txt+=result.trimmed(); 320 | 321 | if(Defines::hinDonum()) 322 | txt=Defines::replaceNum(txt); 323 | 324 | setText(txt); 325 | if(Defines::degug()) qDebug()<<"\033[32m [-] Statu : "<0){ 355 | emit terminated(list.last()); 356 | } 357 | 358 | } 359 | 360 | 361 | -------------------------------------------------------------------------------- /status/statuslabel.h: -------------------------------------------------------------------------------- 1 | #ifndef STATUSLABEL_H 2 | #define STATUSLABEL_H 3 | #include "utils/setting.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | //********************* THREAD ************************** 11 | class Thread : public QThread 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | Thread(){} 17 | void setCommand(const QString &cmd){mCmd=cmd;} 18 | QString command(){return mCmd;} 19 | 20 | signals: 21 | void terminated(const QString &result); 22 | 23 | protected: 24 | void run(); 25 | 26 | private: 27 | QString mCmd; 28 | }; 29 | 30 | //********************* STATU ************************** 31 | class StatusLabel : public QLabel 32 | { 33 | Q_OBJECT 34 | signals: 35 | //----------------------- 36 | void readFiniched(); 37 | void textReady(QString str); 38 | 39 | public slots: 40 | void loadSettings(); 41 | // بداية القراءة 42 | void startRender(); 43 | protected: 44 | void mouseReleaseEvent(QMouseEvent *ev); 45 | void wheelEvent(QWheelEvent* e); 46 | 47 | public: 48 | // البناء 49 | StatusLabel(QString group, QWidget *parent=nullptr); 50 | // انهاء البناء 51 | ~StatusLabel(); 52 | // اعادة حجم النص مع الاطار 53 | int heightSize(){return mHeight;} 54 | // اسم العملية 55 | QString name(){return mName;} 56 | // انهاء الرندر 57 | void cancelRender(); 58 | 59 | private: 60 | enum CmdType { MouseLeft, MouseRight, MouseWheelUp, MouseWheelDown }; 61 | 62 | Thread *mThread; // العملية في الخلفية 63 | //_________________________________ 64 | QStringList mRampList; 65 | QString mLabel; 66 | // QString mSuffix; 67 | // QString mPrefix; 68 | QString mName; // الاسم 69 | int mInterval; // مدة اعادة تنفيذ الامر 70 | int maxSize=100; // الحجم الاقصى للحامل 71 | QTimer *mTimer; // ساعة ضبط التنفيذ 72 | QWidget *mParent; // النافذة الاب لتغيير لمعرفة اعداداتها 73 | QString mMouseLeftCmd; // امر نقر الموس الايسر 74 | QString mMouseRightCmd; // امر عند نقر الموس الايمن 75 | QString mMouseWheelUpCmd; // امر تدوير العجلة للاعلى 76 | QString mMouseWheelDownCmd; //امر تدوير العجللة للاسفل 77 | int mBoreder; // عرض الاطار 78 | int mHeight; // حجم النض مع الاطار 79 | 80 | //________________________________ 81 | // بداية الرندر 82 | void startCommand(int interval); 83 | // تنفيذ الامر عند النقر او سحب الماوس 84 | void execCmd(int type); 85 | 86 | 87 | private slots: 88 | 89 | // تحديث القراءة 90 | void updateCmd(QString result); 91 | 92 | QString getRampIcon(QString str); 93 | }; 94 | 95 | #endif // STATUSLABEL_H 96 | -------------------------------------------------------------------------------- /utils/defines.cpp: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | 3 | 4 | Q_GLOBAL_STATIC(Defines, DefinesInstance) 5 | 6 | Defines *Defines::instance() 7 | { 8 | return DefinesInstance(); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /utils/defines.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFINES_H 2 | #define DEFINES_H 3 | #include 4 | #include 5 | 6 | #define MSYSTRAY "Systray" 7 | #define MPAGER "Pager" 8 | #define MTASKBAR "Taskbar" 9 | #define MCONKY "Conky" 10 | #define MWINDOW "ActiveWindow" 11 | 12 | class Defines 13 | { 14 | 15 | public: 16 | 17 | Defines(){} 18 | 19 | static Defines *instance(); 20 | static bool degug(){return instance()-> m_debug;} 21 | static void setDeguging(bool debug){instance()->m_debug=debug;} 22 | static bool hinDonum(){return instance()-> m_hindoNum;} 23 | static void setHindoNum(bool hindo){instance()->m_hindoNum=hindo;} 24 | 25 | static QString replaceNum(QString str) 26 | { 27 | QStringList list; 28 | list<<"٠"<<"١"<<"٢"<<"٣"<<"٤"<<"٥"<<"٦"<<"٧"<<"٨"<<"٩"; 29 | 30 | for (int i=0;i<10 ;i++ ) { 31 | QString B=list.at(i); 32 | str=str.replace(QString::number(i),B); 33 | } 34 | return str; 35 | } 36 | 37 | private: 38 | bool m_debug; 39 | bool m_hindoNum; 40 | 41 | }; 42 | #endif // DEFINES_H 43 | -------------------------------------------------------------------------------- /utils/setting.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * elokab Copyright (C) 2014 AbouZakaria * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ***************************************************************************/ 19 | 20 | #include "setting.h" 21 | #include 22 | #include 23 | Q_GLOBAL_STATIC(Setting, SettingInstance) 24 | Setting *Setting::instance() 25 | { 26 | return SettingInstance(); 27 | } 28 | 29 | Setting::Setting() 30 | { 31 | setDefaultFormat(QSettings::NativeFormat); 32 | setIniCodec(QTextCodec::codecForName("UTF-8")); 33 | sync(); 34 | } 35 | 36 | 37 | //___________________________________________________ 38 | QString Setting::background(const QString &defaultValue) 39 | { 40 | return instance()->value("Background",defaultValue).toString(); 41 | } 42 | //___________________________________________________ 43 | QString Setting::foreground(const QString &defaultValue) 44 | { 45 | return instance()->value("Foreground",defaultValue).toString(); 46 | } 47 | //___________________________________________________ 48 | QString Setting::underline() 49 | { 50 | return instance()->value("Underline").toString(); 51 | } 52 | //___________________________________________________ 53 | QString Setting::overline() 54 | { 55 | return instance()->value("Overline").toString(); 56 | } 57 | //___________________________________________________ 58 | QString Setting::borderColor() 59 | { 60 | return instance()->value("BorderColor").toString(); 61 | } 62 | //___________________________________________________ 63 | QStringList Setting::fontName(const QStringList &defaultValue) 64 | { 65 | return instance()->value("FontName",defaultValue).toStringList(); 66 | } 67 | //___________________________________________________ 68 | int Setting::fontSize(int defaultValue) 69 | { 70 | return instance()->value("FontSize",defaultValue).toInt(); 71 | } 72 | //___________________________________________________ 73 | int Setting::radius(int defaultValue) 74 | { 75 | return instance()->value("BorderRadius",defaultValue).toInt(); 76 | } 77 | 78 | //___________________________________________________ 79 | int Setting::leftTopRadius(int defaultValue) 80 | { 81 | return instance()->value("LeftTopRadius",defaultValue).toInt(); 82 | } 83 | //___________________________________________________ 84 | int Setting::rightTopRadius(int defaultValue) 85 | { 86 | return instance()->value("RightTopRadius",defaultValue).toInt(); 87 | } 88 | //___________________________________________________ 89 | int Setting::leftBottomRadius(int defaultValue) 90 | { 91 | return instance()->value("LeftBottomRadius",defaultValue).toInt(); 92 | } 93 | //___________________________________________________ 94 | int Setting::rightBottomRadius(int defaultValue) 95 | { 96 | return instance()->value("RightBottomRadius",defaultValue).toInt(); 97 | } 98 | 99 | //___________________________________________________ 100 | bool Setting::fontBold(bool defaultValue) 101 | { 102 | return instance()->value("FontBold",defaultValue).toBool(); 103 | } 104 | //___________________________________________________ 105 | int Setting::border() 106 | { 107 | return instance()->value("Border",0).toInt(); 108 | } 109 | //___________________________________________________ 110 | int Setting::alpha() 111 | { 112 | return instance()->value("Alpha",255).toInt(); 113 | } 114 | 115 | /*---------------------------------------------------* 116 | * Panel * 117 | *---------------------------------------------------*/ 118 | //___________________________________________________ 119 | int Setting::spacing() 120 | { 121 | return instance()->value("Spacing",0).toInt(); 122 | } 123 | //___________________________________________________ 124 | int Setting::barLeftSpacing() 125 | { 126 | return instance()->value("BarLeftSpacing",0).toInt(); 127 | } 128 | //___________________________________________________ 129 | int Setting::barRightSpacing() 130 | { 131 | return instance()->value("BarRightSpacing",0).toInt(); 132 | } 133 | //___________________________________________________ 134 | int Setting::barCenterSpacing() 135 | { 136 | return instance()->value("BarCenterSpacing",0).toInt(); 137 | } 138 | //___________________________________________________ 139 | bool Setting::top() 140 | { 141 | return instance()->value("Top",true).toBool(); 142 | } 143 | //___________________________________________________ 144 | QStringList Setting::barLeft() 145 | { 146 | return instance()->value("BarLeft").toStringList(); 147 | } 148 | //___________________________________________________ 149 | QStringList Setting::barRight() 150 | { 151 | return instance()->value("BarRight").toStringList(); 152 | } 153 | //___________________________________________________ 154 | QStringList Setting::barCenter() 155 | { 156 | return instance()->value("BarCenter").toStringList(); 157 | } 158 | //___________________________________________________ 159 | int Setting::paddingLeft() 160 | { 161 | return instance()->value("PaddingLeft",0).toInt(); 162 | } 163 | //___________________________________________________ 164 | int Setting::paddingTop() 165 | { 166 | return instance()->value("PaddingTop",0).toInt(); 167 | } 168 | //___________________________________________________ 169 | int Setting::paddingRight() 170 | { 171 | return instance()->value("PaddingRight",0).toInt(); 172 | } 173 | //___________________________________________________ 174 | int Setting::paddingBottom() 175 | { 176 | return instance()->value("PaddingBottom",0).toInt(); 177 | } 178 | 179 | //___________________________________________________ 180 | int Setting::marginLeft() 181 | { 182 | return instance()->value("MarginLeft",0).toInt(); 183 | } 184 | //___________________________________________________ 185 | int Setting::marginTop() 186 | { 187 | return instance()->value("MarginTop",0).toInt(); 188 | } 189 | //___________________________________________________ 190 | int Setting::marginRight() 191 | { 192 | return instance()->value("MarginRight",0).toInt(); 193 | } 194 | //___________________________________________________ 195 | int Setting::meginBottom() 196 | { 197 | return instance()->value("MarginBottom",0).toInt(); 198 | } 199 | //___________________________________________________ 200 | int Setting::panelHeight() 201 | { 202 | return instance()->value("Height",0).toInt(); 203 | } 204 | bool Setting::showSystry() 205 | { 206 | return instance()->value("Systray",false).toBool(); 207 | } 208 | //___________________________________________________ 209 | int Setting::screen() 210 | { 211 | return instance()->value("Monitor",0).toInt(); 212 | } 213 | /*---------------------------------------------------* 214 | * Pager * 215 | *---------------------------------------------------*/ 216 | 217 | //___________________________________________________ 218 | int Setting::activeAlpha() 219 | { 220 | return instance()->value("ActiveAlpha",255).toInt(); 221 | } 222 | //___________________________________________________ 223 | QString Setting::activeBackground(const QString &defaultValue) 224 | { 225 | return instance()->value("ActiveBackground",defaultValue).toString(); 226 | } 227 | //___________________________________________________ 228 | QString Setting::activeForeground(const QString &defaultValue) 229 | { 230 | return instance()->value("ActiveForeground",defaultValue).toString(); 231 | } 232 | QString Setting::activeIcon(const QString &defaultValue) 233 | { 234 | return instance()->value("ActiveIcon",defaultValue).toString(); 235 | } 236 | //___________________________________________________ 237 | QString Setting::activeText(const QString &defaultValue) 238 | { 239 | return instance()->value("ActiveText",defaultValue).toString(); 240 | } 241 | 242 | //___________________________________________________ 243 | QString Setting::activeUnderline() 244 | { 245 | return instance()->value("ActiveUnderline").toString(); 246 | } 247 | //___________________________________________________ 248 | QString Setting::activeOverline() 249 | { 250 | return instance()->value("ActiveOverline").toString(); 251 | } 252 | //___________________________________________________ 253 | QString Setting::desktopDesplay() 254 | { 255 | return instance()->value("DesktopDesplay","index").toString(); 256 | } 257 | //___________________________________________________ 258 | QStringList Setting::iconsList() 259 | { 260 | return instance()->value("IconsList").toStringList(); 261 | } 262 | 263 | /*---------------------------------------------------* 264 | * Statu * 265 | *---------------------------------------------------*/ 266 | 267 | //___________________________________________________ 268 | QString Setting::command() 269 | { 270 | return instance()->value("Command").toString(); 271 | } 272 | //___________________________________________________ 273 | int Setting::interval() 274 | { 275 | return instance()->value("Interval",1).toInt()*1000; 276 | } 277 | //___________________________________________________ 278 | int Setting::maxSize() 279 | { 280 | return instance()->value("MaxSize",150).toInt(); 281 | } 282 | //___________________________________________________ 283 | int Setting::minSize() 284 | { 285 | return instance()->value("MinSize",0).toInt(); 286 | } 287 | 288 | //___________________________________________________ 289 | QString Setting::label() 290 | { 291 | return instance()->value("Label","$Command").toString(); 292 | } 293 | ////___________________________________________________ 294 | //QString Setting::suffix() 295 | //{ 296 | // return instance()->value("Suffix").toString(); 297 | //} 298 | ////___________________________________________________ 299 | //QString Setting::prefix() 300 | //{ 301 | // return instance()->value("Prefix").toString(); 302 | //} 303 | //___________________________________________________ 304 | QStringList Setting::format() 305 | { 306 | return instance()->value("Format",QStringList()<<"$Command").toStringList(); 307 | } 308 | //___________________________________________________ 309 | QStringList Setting::ramps() 310 | { 311 | return instance()->value("RampIcons").toStringList(); 312 | } 313 | 314 | //___________________________________________________ 315 | QString Setting::clickLeft() 316 | { 317 | return instance()->value("ClickLeft").toString(); 318 | } 319 | //___________________________________________________ 320 | QString Setting::clickRight() 321 | { 322 | return instance()->value("ClickRight").toString(); 323 | } 324 | //___________________________________________________ 325 | QString Setting::mouseWheelUp() 326 | { 327 | return instance()->value("MouseWheelUp").toString(); 328 | } 329 | //___________________________________________________ 330 | QString Setting::mouseWheelDown() 331 | { 332 | return instance()->value("MouseWheelDown").toString(); 333 | } 334 | /*---------------------------------------------------* 335 | * ACtiveWindow * 336 | *---------------------------------------------------*/ 337 | 338 | //___________________________________________________ 339 | bool Setting::showButtons(bool defaultValue) 340 | { 341 | return instance()->value("ShowButtons",defaultValue).toBool(); 342 | } 343 | //___________________________________________________ 344 | QString Setting::closeColor(const QString &defaultValue) 345 | { 346 | return instance()->value("CloseColor",defaultValue).toString(); 347 | } 348 | //___________________________________________________ 349 | QString Setting::maxColor(const QString &defaultValue) 350 | { 351 | return instance()->value("MaxColor",defaultValue).toString(); 352 | } 353 | //___________________________________________________ 354 | QString Setting::minColor(const QString &defaultValue) 355 | { 356 | return instance()->value("MinColor",defaultValue).toString(); 357 | } 358 | //___________________________________________________ 359 | QString Setting::closeText(const QString &defaultValue) 360 | { 361 | return instance()->value("CloseText",defaultValue).toString(); 362 | } 363 | //___________________________________________________ 364 | QString Setting::maxText(const QString &defaultValue) 365 | { 366 | return instance()->value("MaxText",defaultValue).toString(); 367 | } 368 | //___________________________________________________ 369 | QString Setting::minText(const QString &defaultValue) 370 | { 371 | return instance()->value("MinText",defaultValue).toString(); 372 | } 373 | 374 | /*---------------------------------------------------* 375 | * Variable Colors * 376 | *---------------------------------------------------*/ 377 | 378 | QString Setting::vriableColor(QString key) 379 | { 380 | return instance()->value(key).toString(); 381 | } 382 | -------------------------------------------------------------------------------- /utils/setting.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * elokab Copyright (C) 2014 AbouZakaria * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef SETTING_H 21 | #define SETTING_H 22 | #include 23 | 24 | class Setting : public QSettings 25 | { 26 | public: 27 | Setting(); 28 | static Setting *instance(); 29 | // Commun 30 | static QString background(const QString &defaultValue=QString()); 31 | static QString foreground(const QString &defaultValue=QString()); 32 | 33 | static QStringList fontName(const QStringList &defaultValue); 34 | static QString underline(); 35 | static QString overline(); 36 | static QString borderColor(); 37 | static int fontSize(int defaultValue); 38 | static int radius(int defaultValue=0); 39 | 40 | static int leftTopRadius(int defaultValue=0); 41 | static int rightTopRadius(int defaultValue=0); 42 | static int leftBottomRadius(int defaultValue=0); 43 | static int rightBottomRadius(int defaultValue=0); 44 | 45 | static int screen(); 46 | static int border(); 47 | static bool fontBold(bool defaultValue); 48 | static int alpha(); 49 | 50 | //Panel 51 | static bool top(); 52 | static int spacing(); 53 | static int barLeftSpacing(); 54 | static int barRightSpacing(); 55 | static int barCenterSpacing(); 56 | static QStringList barLeft(); 57 | static QStringList barCenter(); 58 | static QStringList barRight(); 59 | static int paddingLeft(); 60 | static int paddingTop(); 61 | static int paddingRight(); 62 | static int paddingBottom(); 63 | static int marginLeft(); 64 | static int marginTop(); 65 | static int marginRight(); 66 | static int meginBottom(); 67 | static int panelHeight(); 68 | static bool showSystry(); 69 | //Pager 70 | static int activeAlpha(); 71 | static QString activeBackground(const QString &defaultValue=QString()); 72 | static QString activeForeground(const QString &defaultValue=QString()); 73 | static QString activeText(const QString &defaultValue=QString()); 74 | static QString activeIcon(const QString &defaultValue=QString()); 75 | 76 | static QString activeUnderline(); 77 | static QString activeOverline(); 78 | static QString desktopDesplay(); 79 | static QStringList iconsList(); 80 | 81 | //Statu 82 | static QString command(); 83 | static int interval(); 84 | static int maxSize(); 85 | static int minSize(); 86 | static QString label(); 87 | // static QString suffix(); 88 | // static QString prefix(); 89 | static QStringList format(); 90 | static QStringList ramps(); 91 | static QString clickLeft(); 92 | static QString clickRight(); 93 | static QString mouseWheelUp(); 94 | static QString mouseWheelDown(); 95 | 96 | static bool showButtons(bool defaultValue); 97 | static QString closeColor(const QString &defaultValue=QString()); 98 | static QString maxColor(const QString &defaultValue=QString()); 99 | static QString minColor(const QString &defaultValue=QString()); 100 | static QString closeText(const QString &defaultValue=QString()); 101 | static QString maxText(const QString &defaultValue=QString()); 102 | static QString minText(const QString &defaultValue=QString()); 103 | 104 | static QString vriableColor(QString key); 105 | 106 | private: 107 | QString mGroup; 108 | }; 109 | 110 | #endif // SETTING_H 111 | -------------------------------------------------------------------------------- /utils/stylecolors.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * elokab Copyright (C) 2014 AbouZakaria * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ***************************************************************************/ 19 | 20 | #include "stylecolors.h" 21 | #include "utils/defines.h" 22 | #include "utils/setting.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | Q_GLOBAL_STATIC(StyleColors, StyleColorsInstance) 31 | StyleColors *StyleColors::instance() 32 | { 33 | return StyleColorsInstance(); 34 | } 35 | 36 | 37 | 38 | void StyleColors::xrdbquey() 39 | { 40 | QProcess pr; 41 | pr.start("xrdb",QStringList()<<"-query"); 42 | if (!pr.waitForStarted()) 43 | return ; 44 | 45 | if (!pr.waitForFinished()) 46 | return ; 47 | 48 | QString str= pr.readAllStandardOutput(); 49 | //QString str2= pr.readAllStandardError(); 50 | 51 | //qDebug()<<"str2="<colorsMap["background"]=value; 78 | 79 | } 80 | } 81 | // foreground 82 | if(key.trimmed()==("foreground")){ 83 | QString value=s.section(":",1,1).trimmed(); 84 | if(value.startsWith("#")){ 85 | qDebug()<< "foreground"<colorsMap["foreground"]=value; 87 | 88 | } 89 | } 90 | // color[num] 91 | for (int i = 0; i < 16; ++i) { 92 | if(key.trimmed()==("color"+QString::number(i))){ 93 | QString value=s.section(":",1,1).trimmed(); 94 | if(value.startsWith("#")){ 95 | qDebug()<< key<colorsMap["color"+QString::number(i)]=value; 97 | 98 | } 99 | } 100 | 101 | //qDebug()<colorsMap.value(colorName); 114 | if(!colx.isEmpty()){ 115 | return colx; 116 | } 117 | 118 | QString xresourceFile=QDir::homePath()+"/.Xresources"; 119 | if(!QFile::exists(xresourceFile)) 120 | xresourceFile=QDir::homePath()+"/.Xdefaults"; 121 | if(!QFile::exists(xresourceFile)) 122 | return QString(); 123 | 124 | QFile files(xresourceFile); 125 | if(!files.open( QFile::ReadOnly)) 126 | return QString(); 127 | 128 | QTextStream textStream(&files); 129 | textStream.setCodec(QTextCodec::codecForName("UTF-8")); 130 | QString line ;//premier line; 131 | 132 | while (!textStream.atEnd()) { 133 | 134 | line = textStream.readLine().trimmed(); 135 | if(line.startsWith("#"))continue; 136 | 137 | if(line.startsWith("!"))continue; 138 | 139 | if(!line.contains(":")) continue; 140 | 141 | 142 | if(line.startsWith("*"+colorName)||line.startsWith("*."+colorName)){ 143 | 144 | QString key=line.section(":",0,0).trimmed(); 145 | QString value=line.section(":",1,1).trimmed(); 146 | 147 | if (key.isEmpty()) continue; 148 | 149 | if (value.isEmpty()) continue; 150 | 151 | // qDebug()<endGroup(); 202 | 203 | return col; 204 | } 205 | 206 | 207 | QString StyleColors::getColors(QString col) 208 | { 209 | 210 | if(col.startsWith("$")) 211 | col=loadVariableColor(col.remove("$")); 212 | 213 | if(col.startsWith("xrdb")) 214 | col=loadXresourceColor(col.section(".",1)); 215 | 216 | return col; 217 | } 218 | 219 | QString StyleColors::style(QString bgColor, QString fgColor, 220 | QString underline, QString overline, 221 | int border, int alpha, QString borderColor, 222 | int radius, int leftTopRadius, int rightTopRadius, 223 | int leftBotRadius, int rightBotRadius) 224 | { 225 | 226 | bgColor= getColors(bgColor); 227 | fgColor= getColors(fgColor); 228 | underline= getColors(underline); 229 | overline= getColors(overline); 230 | borderColor=getColors(borderColor); 231 | 232 | QColor bg(bgColor); 233 | bg.setAlpha(alpha); 234 | 235 | QString mStyleSheet; 236 | if(bg.isValid())mStyleSheet+=QString("background-color:rgba(%1,%2,%3,%4);\n") 237 | .arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()); 238 | 239 | if(QColor(fgColor).isValid())mStyleSheet+=QString("color:%1;\n") 240 | .arg(fgColor); 241 | 242 | if(QColor(underline).isValid())mStyleSheet+=QString("border-bottom: %1px solid %2;\n") 243 | .arg(qMax(1,border)).arg(underline); 244 | else mStyleSheet+=QString("border-bottom: 0px;\n") ; 245 | 246 | if(QColor(overline).isValid())mStyleSheet+=QString("border-top: %1px solid %2;\n") 247 | .arg(qMax(1,border)).arg(overline); 248 | else mStyleSheet+=QString("border-top: 0px;\n") ; 249 | 250 | if(QColor(borderColor).isValid())mStyleSheet+=QString("border: %1px solid %2;\n") 251 | .arg(qMax(1,border)).arg(borderColor); 252 | // else mStyleSheet+=QString("border-top: 0px;\n") ; 253 | if(radius>0) 254 | mStyleSheet+=QString("border-radius: %1px;\n") .arg(QString::number(radius)); 255 | else{ 256 | if(leftTopRadius>0) mStyleSheet+=QString("border-top-left-radius: %1px;\n").arg(QString::number(leftTopRadius)); 257 | if(rightTopRadius>0) mStyleSheet+=QString("border-top-right-radius: %1px;\n").arg(QString::number(rightTopRadius)); 258 | if(leftBotRadius>0) mStyleSheet+=QString("border-bottom-left-radius: %1px;\n").arg(QString::number(leftBotRadius)); 259 | if(rightBotRadius>0) mStyleSheet+=QString("border-bottom-right-radius: %1px;\n").arg(QString::number(rightBotRadius)); 260 | } 261 | //qDebug()<<" [*]"<<__FILE__<<__LINE__< * 3 | * * 4 | * This program is free software; you can redistribute it and/or modify * 5 | * it under the terms of the GNU General Public License as published by * 6 | * the Free Software Foundation; either version 3 of the License, or * 7 | * (at your option) any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License * 15 | * along with this program; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ***************************************************************************/ 19 | 20 | #ifndef STYLECOLORS_H 21 | #define STYLECOLORS_H 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | class StyleColors 28 | { 29 | 30 | public: 31 | 32 | explicit StyleColors(){} 33 | static StyleColors *instance(); 34 | static QString loadXresourceColor(const QString &colorName); 35 | 36 | static QString style(QString bgColor, QString fgColor, 37 | QString underLine, QString overLine, 38 | int border=1, int alpha=255, 39 | QString borderColor=QString(), int radius=0, 40 | int leftTopRadius=0, int rightTopRadius=0, int leftBotRadius=0, int rightBotRadius=0); 41 | 42 | static QString xrdbget(QString txt); 43 | 44 | static QString loadVariableColor(QString key); 45 | static QString getColors(QString col); 46 | static void xrdbquey(); 47 | signals: 48 | private: 49 | 50 | QMapcolorsMap; 51 | 52 | public slots: 53 | }; 54 | 55 | #endif // STYLECOLORS_H 56 | -------------------------------------------------------------------------------- /utils/x11utills.h: -------------------------------------------------------------------------------- 1 | #ifndef X11SUPPORT_H 2 | #define X11SUPPORT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "X11/Xlib.h" 14 | 15 | 16 | typedef QList WindowList; 17 | typedef QList AtomList; 18 | /** 19 | * @brief The X11UTILLS class فئة التعامل مع مدراء النوافذ 20 | */ 21 | class X11UTILLS: public QObject 22 | { 23 | Q_OBJECT 24 | public: 25 | X11UTILLS(); 26 | ~X11UTILLS(); 27 | static X11UTILLS *instance(); 28 | 29 | // static X11UTILLS *instance(); 30 | /** 31 | * @brief atom 32 | * @param atomName 33 | * @return 34 | */ 35 | static unsigned long atom(const QString& atomName); 36 | /** 37 | * @brief removeWindowProperty 38 | * @param window 39 | * @param name 40 | */ 41 | static void removeWindowProperty(Window window, const QString& name); 42 | /** 43 | * @brief setWindowPropertyCardinalArray 44 | * @param window 45 | * @param name 46 | * @param values 47 | */ 48 | static void setWindowPropertyCardinalArray(Window window, const QString& name, const QVector& values); 49 | /** 50 | * @brief getClientList قائمة بالنوافذ الصالحة لمدير المهام 51 | * @return QList WindowList; 52 | */ 53 | static WindowList getClientList() ; 54 | 55 | /** 56 | * @brief getWindowProperty 57 | * @param window 58 | * @param atom 59 | * @param reqType 60 | * @param resultLen 61 | * @param result 62 | * @return 63 | */ 64 | static bool getWindowProperty(unsigned long window, 65 | Atom atom, // property 66 | Atom reqType, // req_type 67 | unsigned long* resultLen,// nitems_return 68 | unsigned char** result // prop_return 69 | ) ; 70 | /** 71 | * @brief getRootWindowProperty 72 | * @param atom 73 | * @param reqType 74 | * @param resultLen 75 | * @param result 76 | * @return 77 | */ 78 | static bool getRootWindowProperty(Atom atom, // property 79 | Atom reqType, // req_type 80 | unsigned long* resultLen,// nitems_return 81 | unsigned char** result // prop_return 82 | ) ; 83 | /** 84 | * @brief isWindowForTaskbar هل النافذة صالحة لمبدل المهام 85 | * @param window معرف النافذة 86 | * @return نعم او لا 87 | */ 88 | static bool isWindowForTaskbar(Window window) ; 89 | /** 90 | * @brief getWindowType جلب نوع النافذة 91 | * @param window معرف النافذة 92 | * @return 93 | */ 94 | static AtomList getWindowType(Window window) ; 95 | /** 96 | * @brief getActiveAppWindow جلب التطبيق النشط 97 | * @return عنوان النافذة 98 | */ 99 | static Window getActiveAppWindow() ; 100 | /** 101 | * @brief getActiveWindow جلب النافذة النشطة 102 | * @return عنوان النافذة 103 | */ 104 | static Window getActiveWindow() ; 105 | /** 106 | * @brief getClientIcon جلب ايقونة النافذة 107 | * @param _wid معرف النافذة 108 | * @param _pixreturn الضورة التي ستجلب 109 | * @return الصورة 110 | */ 111 | static bool getClientIcon(Window _wid, QPixmap& _pixreturn) ; 112 | /** 113 | * @brief sendWindowMessage اشارة الى مدير النوافذ 114 | * @param _wid معرف النافذة 115 | * @param _msg 116 | * @param data0 117 | * @param data1 118 | * @param data2 119 | * @param data3 120 | * @param data4 121 | * @return 122 | */ 123 | static int sendWindowMessage(Window _wid, Atom _msg, 124 | unsigned long data0, 125 | long unsigned int data1 = 0, 126 | long unsigned int data2 = 0, 127 | long unsigned int data3 = 0, 128 | long unsigned int data4 = 0) ; 129 | /** 130 | * @brief moveWindowToDesktop ارسال النافذة الى سطح مكتب معين 131 | * @param _wid معرف النافذة 132 | * @param _display رقم سطح المكتب 133 | */ 134 | static void moveWindowToDesktop(Window _wid, int _display); 135 | /** 136 | * @brief getNumDesktop جلب عدد اسطح المكتب 137 | * @return 138 | */ 139 | static int getNumDesktop() ; 140 | /** 141 | * @brief getWindowTitleUTF8String جلب عنوان النافذة من نوع اونيكود 142 | * @param window معرف النافذة 143 | * @param name 144 | * @return 145 | */ 146 | static QString getWindowTitleUTF8String(unsigned long window, const QString& name); 147 | /** 148 | * @brief getWindowPropertyLatin1String 149 | * @param window 150 | * @param name 151 | * @return 152 | */ 153 | static QString getWindowTitleLatin1String(unsigned long window, const QString& name); 154 | /** 155 | * @brief getWindowTitle جلب عنوان النافذة 156 | * @param window معرف النافذة 157 | * @return عنوان النافذة 158 | */ 159 | static QString getWindowTitle(unsigned long window); 160 | /** 161 | * @brief getWindowIcon 162 | * @param window 163 | * @return 164 | */ 165 | static QIcon getWindowIcon(unsigned long window); 166 | /** 167 | * @brief getApplicationName 168 | * @param _wid 169 | * @return 170 | */ 171 | static QString getApplicationName(unsigned long _wid) ; 172 | /** 173 | * @brief getApplicationClasseName 174 | * @param _wid 175 | * @return 176 | */ 177 | static QString getApplicationClasseName(unsigned long _wid) ; 178 | /** 179 | * @brief setActiveDesktop 180 | * @param _desktop 181 | */ 182 | static void setActiveDesktop(int _desktop); 183 | /** 184 | * @brief getActiveDesktop 185 | * @return 186 | */ 187 | static int getActiveDesktop() ; 188 | /** 189 | * @brief getWindowDesktop 190 | * @param _wid 191 | * @return 192 | */ 193 | static int getWindowDesktop(unsigned long _wid); 194 | /** 195 | * @brief raiseWindow 196 | * @param _wid 197 | */ 198 | static void raiseWindow(unsigned long _wid) ; 199 | /** 200 | * @brief minimizeWindow 201 | * @param _wid 202 | */ 203 | static void minimizeWindow(unsigned long _wid) ; 204 | /** 205 | * @brief maximizeWindow 206 | * @param _wid 207 | * @param direction 208 | */ 209 | static void maximizeWindow(unsigned long _wid, int direction = 2) ; 210 | /** 211 | * @brief deMaximizeWindow 212 | * @param _wid 213 | */ 214 | static void deMaximizeWindow(unsigned long _wid) ; 215 | /** 216 | * @brief shadeWindow 217 | * @param _wid 218 | * @param shade 219 | */ 220 | static void shadeWindow(unsigned long _wid, bool shade) ; 221 | /** 222 | * @brief resizeWindow 223 | * @param _wid 224 | * @param _width 225 | * @param _height 226 | */ 227 | static void resizeWindow(unsigned long _wid, int _width, int _height) ; 228 | /** 229 | * @brief closeWindow 230 | * @param _wid 231 | */ 232 | static void closeWindow(unsigned long _wid) ; 233 | /** 234 | * @brief setWindowLayer 235 | * @param _wid 236 | * @param layer 237 | */ 238 | static void setWindowLayer(unsigned long _wid, int layer) ; 239 | 240 | /** 241 | * @brief states حالات النافذة مثل فوق ت 242 | * @param window 243 | * @return 244 | */ 245 | static QHash states(unsigned long window); 246 | /** 247 | * @brief allowed 248 | * @param window 249 | * @return 250 | */ 251 | static QHash allowed(unsigned long window) ; 252 | /** 253 | * @brief getwindowGeometry جلب حجم النافذة وموضعها 254 | * @param window معرف النافذة 255 | * @return مربع النافذة 256 | */ 257 | static QRect getwindowGeometry (unsigned long window); 258 | /** 259 | * @brief isWindowManagerActive معرفة هل يوجد مدير نوافذ 260 | * @return نعم لا 261 | */ 262 | static bool isWindowManagerActive() ; 263 | void moveWindow(Window _win, int _x, int _y) const; 264 | static Atom xatom(const char* atomName); 265 | QHashm_cachedAtoms; 266 | }; 267 | 268 | #endif 269 | -------------------------------------------------------------------------------- /utils/xdesktoputils.cpp: -------------------------------------------------------------------------------- 1 | #include "xdesktoputils.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | //#define EXIT_SUCCESS 1 11 | //#define EXIT_FAILURE 0; 12 | XDesktop::XDesktop() 13 | { 14 | 15 | } 16 | //قائمة باسماء اسطح المكتب 17 | QStringList XDesktop::names() 18 | { 19 | QStringList ret; 20 | unsigned long length; 21 | unsigned char *data = nullptr; 22 | 23 | if (rootWindowProperty(atom("_NET_DESKTOP_NAMES"), atom("UTF8_STRING"), &length, &data)) 24 | { 25 | if (data) 26 | { 27 | char* c = (char*)data; 28 | char* end = (char*)data + length; 29 | while (c < end) 30 | { 31 | ret << QString::fromUtf8(c); 32 | c += strlen(c) + 1; // for trailing \0 33 | } 34 | 35 | XFree(data); 36 | } 37 | } 38 | 39 | 40 | return ret; 41 | } 42 | //اسم سطح المكتب الحالي 43 | QString XDesktop::name(int num, const QString &dName) 44 | { 45 | QStringList lnames = names(); 46 | if (num<0 || num>lnames.count()-1) 47 | return dName; 48 | 49 | return lnames.at(num); 50 | } 51 | // عدد اسطح المكتب 52 | int XDesktop::count() 53 | { 54 | unsigned long length, *data; 55 | rootWindowProperty(atom("_NET_NUMBER_OF_DESKTOPS"), XA_CARDINAL, &length, (unsigned char**) &data); 56 | if (data) 57 | { 58 | int res = data[0]; 59 | XFree(data); 60 | return res; 61 | } 62 | return 0; 63 | } 64 | //السطح النشط 65 | int XDesktop::active() 66 | { 67 | int res = -2; 68 | unsigned long length, *data; 69 | if (rootWindowProperty(atom("_NET_CURRENT_DESKTOP"), XA_CARDINAL, &length, (unsigned char**) &data)) 70 | { 71 | if (data) 72 | { 73 | res = data[0]; 74 | XFree(data); 75 | } 76 | } 77 | 78 | return res; 79 | } 80 | //تفعيل سطح مكتب محدد 81 | int XDesktop::setCurrent(int numDesktop) 82 | { 83 | // xSendMessage(QX11Info::appRootWindow(), atom("_NET_CURRENT_DESKTOP"), (unsigned long) numDesktop); 84 | XClientMessageEvent msg; 85 | msg.window = QX11Info::appRootWindow(); 86 | msg.type = 33;//ClientMessage 87 | msg.message_type = atom("_NET_CURRENT_DESKTOP"); 88 | msg.send_event = true; 89 | msg.display = QX11Info::display(); 90 | msg.format = 32; 91 | msg.data.l[0] = (unsigned long) numDesktop; 92 | 93 | if (XSendEvent(QX11Info::display(), QX11Info::appRootWindow(), 0, (SubstructureRedirectMask | SubstructureNotifyMask) , (XEvent *) &msg) == Success) 94 | return EXIT_SUCCESS; 95 | else 96 | return EXIT_FAILURE; 97 | } 98 | //خصائص النافذة الام 99 | bool XDesktop::rootWindowProperty(Atom atom, // property 100 | Atom reqType, // req_type 101 | unsigned long* resultLen,// nitems_return 102 | unsigned char** result // prop_return 103 | ) 104 | { 105 | return windowProperty( QX11Info::appRootWindow(), atom, reqType, resultLen, result); 106 | } 107 | //خصائص النافذة 108 | bool XDesktop::windowProperty(Window window, 109 | Atom atom, // property 110 | Atom reqType, // req_type 111 | unsigned long* resultLen,// nitems_return 112 | unsigned char** result // prop_return 113 | ) 114 | { 115 | int format; 116 | unsigned long type, rest; 117 | 118 | // int XGetWindowProperty( 119 | // Display* /* display */, 120 | // Window /* w */, 121 | // Atom /* property */, 122 | // long /* long_offset */, 123 | // long /* long_length */, 124 | // Bool /* delete */, 125 | // Atom /* req_type */, 126 | // Atom* /* actual_type_return */, 127 | // int* /* actual_format_return */, 128 | // unsigned long* /* nitems_return */, 129 | // unsigned long* /* bytes_after_return */, 130 | // unsigned char** /* prop_return */ 131 | // ) 132 | 133 | return XGetWindowProperty(QX11Info::display(), window, atom, 0, 4096, false, 134 | reqType, &type, &format, resultLen, &rest, 135 | result) == Success; 136 | 137 | } 138 | 139 | 140 | Atom XDesktop::atom(const char* atomName) 141 | { 142 | static QHash hash; 143 | 144 | if (hash.contains(atomName)) 145 | return hash.value(atomName); 146 | 147 | Atom atom = XInternAtom(QX11Info::display(), atomName, false); 148 | hash[atomName] = atom; 149 | return atom; 150 | } 151 | //رسالة الى خادزم اكس 152 | -------------------------------------------------------------------------------- /utils/xdesktoputils.h: -------------------------------------------------------------------------------- 1 | #ifndef XWINUTILS_H 2 | #define XWINUTILS_H 3 | #include 4 | #include 5 | 6 | 7 | class XDesktop 8 | { 9 | public: 10 | XDesktop(); 11 | /** 12 | * @brief desktopNames جلب قائمة باسماء اسطح المكتب 13 | * rootWindowProperty() سيجلب اولا خصائص النافذة الام 14 | * @return قائمة باسماء اسطح المكتب 15 | */ 16 | static QStringList names() ; 17 | /** 18 | * @brief desktopName اسم سطح المكتب الحالي 19 | * @param num معرف سطح المكتب الحالي 20 | * @param name الاسم الحالي 21 | * @return اسم سطح المكتب 22 | */ 23 | static QString name(int num, const QString &dName) ; 24 | 25 | /** 26 | * @brief desktopCount جلب عدد اسطح المكتب 27 | * @return العدد 28 | */ 29 | static int count() ; 30 | 31 | /** 32 | * @brief desktopCurrent سطح المكتب الحالي 33 | * @return معرف سطح المكتب الحالي 34 | */ 35 | static int active() ; 36 | 37 | /** 38 | * @brief setdesktopCurrent تفعيل سطح مكتب محدد 39 | * @param numDesktop معرف سكح المكتب 40 | */ 41 | static int setCurrent(int numDesktop) ; 42 | 43 | /** 44 | * @brief rootWindowProperty جلب خصائص النافذة الام 45 | * @return windowProperty() 46 | */ 47 | static bool rootWindowProperty(Atom atom, // property 48 | Atom reqType, // req_type 49 | unsigned long* resultLen,// nitems_return 50 | unsigned char** result // prop_return 51 | ) ; 52 | 53 | /** 54 | * @brief windowProperty جلب خصائص النافذة 55 | * @param window معرف النافذة 56 | * @return XGetWindowProperty() 57 | */ 58 | static bool windowProperty(Window window, 59 | Atom atom, // property 60 | Atom reqType, // req_type 61 | unsigned long* resultLen,// nitems_return 62 | unsigned char** result // prop_return 63 | ); 64 | 65 | 66 | /** 67 | * @brief atom typedef unsigned long Atom * Also in Xdefs.h * 68 | * @param atomName الاسم 69 | * @return atom 70 | */ 71 | static Atom atom(const char* atomName); 72 | 73 | }; 74 | 75 | #endif // XWINUTILS_H 76 | --------------------------------------------------------------------------------